Skip to content
Snippets Groups Projects
Commit e76a9624 authored by mattijs's avatar mattijs
Browse files

distributed surfaces

parent 9559aac4
No related branches found
No related tags found
No related merge requests found
...@@ -121,6 +121,12 @@ public: ...@@ -121,6 +121,12 @@ public:
return true; return true;
} }
//- Range of local indices that can be returned.
virtual label size() const
{
return 6;
}
// Single point queries. // Single point queries.
......
...@@ -36,8 +36,8 @@ SourceFiles ...@@ -36,8 +36,8 @@ SourceFiles
#ifndef searchableSphere_H #ifndef searchableSphere_H
#define searchableSphere_H #define searchableSphere_H
#include "searchableSurface.H"
#include "treeBoundBox.H" #include "treeBoundBox.H"
#include "searchableSurface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...@@ -127,6 +127,12 @@ public: ...@@ -127,6 +127,12 @@ public:
return true; return true;
} }
//- Range of local indices that can be returned.
virtual label size() const
{
return 1;
}
// Multiple point queries. // Multiple point queries.
......
...@@ -56,6 +56,7 @@ namespace Foam ...@@ -56,6 +56,7 @@ namespace Foam
// Forward declaration of classes // Forward declaration of classes
class objectRegistry; class objectRegistry;
class mapDistribute;
class treeBoundBox; class treeBoundBox;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
...@@ -180,6 +181,15 @@ public: ...@@ -180,6 +181,15 @@ public:
//- Whether supports volume type below. //- Whether supports volume type below.
virtual bool hasVolumeType() const = 0; virtual bool hasVolumeType() const = 0;
//- Range of local indices that can be returned.
virtual label size() const = 0;
//- Range of global indices that can be returned.
virtual label globalSize() const
{
return size();
}
// Single point queries. // Single point queries.
...@@ -296,16 +306,18 @@ public: ...@@ -296,16 +306,18 @@ public:
// Other // Other
////- Get bounding box. //- Set bounds of surface. Bounds currently set as list of
//const boundBox& bounds() const = 0; // bounding boxes. The bounds are hints to the surface as for
// the range of queries it can expect. faceMap/pointMap can be
////- Set bounding box. // set if the surface has done any redistribution.
//void setBounds virtual void distribute
//( (
// const boundBox&, const List<treeBoundBox>&,
// autoPtr<mapDistribute>& faceMap, const bool keepNonLocal,
// autoPtr<mapDistribute>& pointMap autoPtr<mapDistribute>& faceMap,
//) = 0; autoPtr<mapDistribute>& pointMap
)
{}
}; };
......
...@@ -149,7 +149,7 @@ public: ...@@ -149,7 +149,7 @@ public:
const pointField& start, const pointField& start,
const pointField& end, const pointField& end,
labelListList& surfaces, labelListList& surfaces,
List<List<pointIndexHit> >& surfaceHits List<List<pointIndexHit> >&
) const; ) const;
//- Find nearest. Return -1 (and a miss()) or surface and nearest //- Find nearest. Return -1 (and a miss()) or surface and nearest
......
...@@ -28,6 +28,8 @@ License ...@@ -28,6 +28,8 @@ License
#include "Random.H" #include "Random.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "EdgeMap.H" #include "EdgeMap.H"
#include "triSurfaceFields.H"
#include "Time.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
...@@ -299,57 +301,6 @@ const Foam::wordList& Foam::triSurfaceMesh::regions() const ...@@ -299,57 +301,6 @@ const Foam::wordList& Foam::triSurfaceMesh::regions() const
} }
//Foam::pointIndexHit Foam::triSurfaceMesh::findNearest
//(
// const point& sample,
// const scalar nearestDistSqr
//) const
//{
// return tree().findNearest(sample, nearestDistSqr);
//}
//
//
//Foam::pointIndexHit Foam::triSurfaceMesh::findNearestOnEdge
//(
// const point& sample,
// const scalar nearestDistSqr
//) const
//{
// return = edgeTree().findNearest(sample, nearestDistSqr);
//}
//
//
//Foam::pointIndexHit Foam::triSurfaceMesh::findNearest
//(
// const linePointRef& ln,
// treeBoundBox& tightest,
// point& linePoint
//) const
//{
// return tree().findNearest(ln, tightest, linePoint);
//}
//
//
//Foam::pointIndexHit Foam::triSurfaceMesh::findLine
//(
// const point& start,
// const point& end
//) const
//{
// return tree().findLine(start, end);
//}
//
//
//Foam::pointIndexHit Foam::triSurfaceMesh::findLineAny
//(
// const point& start,
// const point& end
//) const
//{
// return tree().findLineAny(start, end);
//}
// Find out if surface is closed. // Find out if surface is closed.
bool Foam::triSurfaceMesh::hasVolumeType() const bool Foam::triSurfaceMesh::hasVolumeType() const
{ {
...@@ -545,6 +496,29 @@ void Foam::triSurfaceMesh::getNormal ...@@ -545,6 +496,29 @@ void Foam::triSurfaceMesh::getNormal
} }
void Foam::triSurfaceMesh::getField
(
const word& fieldName,
const List<pointIndexHit>& info,
labelList& values
) const
{
const triSurfaceLabelField& fld = lookupObject<triSurfaceLabelField>
(
fieldName
);
values.setSize(info.size());
forAll(info, i)
{
if (info[i].hit())
{
values[i] = fld[info[i].index()];
}
}
}
void Foam::triSurfaceMesh::getVolumeType void Foam::triSurfaceMesh::getVolumeType
( (
const pointField& points, const pointField& points,
...@@ -564,4 +538,31 @@ void Foam::triSurfaceMesh::getVolumeType ...@@ -564,4 +538,31 @@ void Foam::triSurfaceMesh::getVolumeType
} }
//- Write using given format, version and compression
bool Foam::triSurfaceMesh::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
) const
{
fileName fullPath(searchableSurface::objectPath());
if (!mkDir(fullPath.path()))
{
return false;
}
triSurface::write(fullPath);
if (!file(fullPath))
{
return false;
}
//return objectRegistry::writeObject(fmt, ver, cmp);
return true;
}
// ************************************************************************* // // ************************************************************************* //
...@@ -36,6 +36,7 @@ SourceFiles ...@@ -36,6 +36,7 @@ SourceFiles
#ifndef triSurfaceMesh_H #ifndef triSurfaceMesh_H
#define triSurfaceMesh_H #define triSurfaceMesh_H
#include "treeBoundBox.H"
#include "searchableSurface.H" #include "searchableSurface.H"
#include "objectRegistry.H" #include "objectRegistry.H"
#include "indexedOctree.H" #include "indexedOctree.H"
...@@ -142,8 +143,11 @@ public: ...@@ -142,8 +143,11 @@ public:
//- Whether supports volume type below. I.e. whether is closed. //- Whether supports volume type below. I.e. whether is closed.
virtual bool hasVolumeType() const; virtual bool hasVolumeType() const;
//- Range of local indices that can be returned.
// Multiple point queries. virtual label size() const
{
return triSurface::size();
}
virtual void findNearest virtual void findNearest
( (
...@@ -196,6 +200,30 @@ public: ...@@ -196,6 +200,30 @@ public:
List<volumeType>& List<volumeType>&
) const; ) const;
//- Set bounds of surface. Bounds currently set as list of
// bounding boxes. The bounds are hints to the surface as for
// the range of queries it can expect. faceMap/pointMap can be
// set if the surface has done any redistribution.
virtual void distribute
(
const List<treeBoundBox>&,
const bool keepNonLocal,
autoPtr<mapDistribute>& faceMap,
autoPtr<mapDistribute>& pointMap
)
{}
// Other
//- Specific to triSurfaceMesh: from a set of hits (points and
// indices) get the specified field. Misses do not get set.
virtual void getField
(
const word& fieldName,
const List<pointIndexHit>&,
labelList& values
) const;
// regIOobject implementation // regIOobject implementation
...@@ -205,6 +233,14 @@ public: ...@@ -205,6 +233,14 @@ public:
return false; return false;
} }
//- Write using given format, version and compression
virtual bool writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
) const;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment