ENH: cvMesh: Add quick rejection tests to octree and buildParallelInterface

This commit is contained in:
laurence
2012-03-01 17:21:13 +00:00
parent 369d4967d2
commit fd953175e0
5 changed files with 309 additions and 5 deletions

View File

@ -724,6 +724,8 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
globalBackgroundBounds_ = treeBoundBox(bbMin, bbMax);
octreeNearestDistances_ = bFTreePtr_().calcNearestDistance();
if (cvMesh_.cvMeshControls().objOutput())
{
OFstream fStr
@ -795,6 +797,7 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
),
boundaryFacesPtr_(),
bFTreePtr_(),
octreeNearestDistances_(),
allBackgroundMeshBounds_(Pstream::nProcs()),
globalBackgroundBounds_(),
decomposeDict_
@ -1150,6 +1153,8 @@ bool Foam::backgroundMeshDecomposition::positionOnThisProcessor
const point& pt
) const
{
// return bFTreePtr_().findAnyOverlap(pt, 0.0);
return
bFTreePtr_().getVolumeType(pt)
== indexedOctree<treeDataBPatch>::INSIDE;
@ -1176,6 +1181,7 @@ bool Foam::backgroundMeshDecomposition::overlapsThisProcessor
const treeBoundBox& box
) const
{
// return !procBounds().contains(box);
return !bFTreePtr_().findBox(box).empty();
}
@ -1183,9 +1189,11 @@ bool Foam::backgroundMeshDecomposition::overlapsThisProcessor
bool Foam::backgroundMeshDecomposition::overlapsThisProcessor
(
const point& centre,
scalar radiusSqr
const scalar radiusSqr
) const
{
//return bFTreePtr_().findAnyOverlap(centre, radiusSqr);
return bFTreePtr_().findNearest(centre, radiusSqr).hit();
}
@ -1645,6 +1653,7 @@ Foam::labelListList Foam::backgroundMeshDecomposition::overlapsProcessors
// If the sphere finds a nearest element of the patch, then it overlaps
sphereOverlapsCandidate[sI] = bFTreePtr_().findNearest(c, rSqr).hit();
//sphereOverlapsCandidate[sI] = bFTreePtr_().findAnyOverlap(c, rSqr);
}
map().reverseDistribute

View File

@ -111,6 +111,8 @@ class backgroundMeshDecomposition
//- Search tree for the boundaryFaces_ patch
autoPtr<indexedOctree<treeDataBPatch> > bFTreePtr_;
List<scalar> octreeNearestDistances_;
//- The bounds of all background meshes on all processors
treeBoundBoxList allBackgroundMeshBounds_;
@ -225,16 +227,16 @@ public:
//- Are the given positions inside the domain of this decomposition
boolList positionOnThisProcessor(const List<point>& pts) const;
//- Does the given box overlap the faces of the bounday of this
//- Does the given box overlap the faces of the boundary of this
// processor
bool overlapsThisProcessor(const treeBoundBox& box) const;
//- Does the given sphere overlap the faces of the bounday of this
//- Does the given sphere overlap the faces of the boundary of this
// processor
bool overlapsThisProcessor
(
const point& centre,
scalar radiusSqr
const scalar radiusSqr
) const;
//- Find nearest intersection of line between start and end, (exposing
@ -289,6 +291,12 @@ public:
//- Return access to the underlying mesh
inline const fvMesh& mesh() const;
//- Return access to the underlying tree
inline const indexedOctree<treeDataBPatch>& tree() const;
//- Return access to the nearest distance of the octree nodes
inline const List<scalar>& octreeNearestDistances() const;
//- Return the boundBox of this processor
inline const treeBoundBox& procBounds() const;
};

View File

@ -30,6 +30,18 @@ const Foam::fvMesh& Foam::backgroundMeshDecomposition::mesh() const
return mesh_;
}
const Foam::indexedOctree<Foam::treeDataBPatch>&
Foam::backgroundMeshDecomposition::tree() const
{
return bFTreePtr_();
}
const Foam::List<Foam::scalar>&
Foam::backgroundMeshDecomposition::octreeNearestDistances() const
{
return octreeNearestDistances_;
}
const Foam::treeBoundBox& Foam::backgroundMeshDecomposition::procBounds() const
{