ENH: treeDataCell: increase duplicity

This commit is contained in:
mattijs 2011-08-18 12:28:44 +01:00
parent 9f7fcc686c
commit 24a82f2d03
5 changed files with 69 additions and 21 deletions

View File

@ -375,7 +375,7 @@ Foam::primitiveMesh::cellTree() const
overallBb, overallBb,
8, // maxLevel 8, // maxLevel
10, // leafsize 10, // leafsize
3.0 // duplicity 5.0 // duplicity
); );
} }

View File

@ -167,7 +167,7 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
procBbRndExt, procBbRndExt,
8, // maxLevel, 8, // maxLevel,
10, // leafSize, 10, // leafSize,
100.0 100.0 // duplicity
); );
ril_.setSize(cellBbsToExchange.size()); ril_.setSize(cellBbsToExchange.size());
@ -386,7 +386,7 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
procBbRndExt, procBbRndExt,
8, // maxLevel, 8, // maxLevel,
10, // leafSize, 10, // leafSize,
100.0 100.0 // duplicity
); );
rwfil_.setSize(wallFaceBbsToExchange.size()); rwfil_.setSize(wallFaceBbsToExchange.size());

View File

@ -30,7 +30,6 @@ License
#include "demandDrivenData.H" #include "demandDrivenData.H"
#include "treeDataCell.H" #include "treeDataCell.H"
#include "treeDataFace.H" #include "treeDataFace.H"
#include "treeDataPoint.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -508,6 +507,21 @@ Foam::meshSearch::meshSearch(const polyMesh& mesh, const bool faceDecomp)
{} {}
// Construct with a custom bounding box
Foam::meshSearch::meshSearch
(
const polyMesh& mesh,
const treeBoundBox& bb,
const bool faceDecomp
)
:
mesh_(mesh),
faceDecomp_(faceDecomp)
{
overallBbPtr_.reset(new treeBoundBox(bb));
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::meshSearch::~meshSearch() Foam::meshSearch::~meshSearch()
@ -527,6 +541,21 @@ const Foam::indexedOctree<Foam::treeDataFace>& Foam::meshSearch::boundaryTree()
// Construct tree // Construct tree
// //
if (!overallBbPtr_.valid())
{
Random rndGen(261782);
overallBbPtr_.reset
(
new treeBoundBox(mesh_.points())
);
treeBoundBox& overallBb = overallBbPtr_();
// Extend slightly and make 3D
overallBb = overallBb.extend(rndGen, 1E-4);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
}
// all boundary faces (not just walls) // all boundary faces (not just walls)
labelList bndFaces(mesh_.nFaces()-mesh_.nInternalFaces()); labelList bndFaces(mesh_.nFaces()-mesh_.nInternalFaces());
forAll(bndFaces, i) forAll(bndFaces, i)
@ -534,12 +563,6 @@ const Foam::indexedOctree<Foam::treeDataFace>& Foam::meshSearch::boundaryTree()
bndFaces[i] = mesh_.nInternalFaces() + i; bndFaces[i] = mesh_.nInternalFaces() + i;
} }
treeBoundBox overallBb(mesh_.points());
Random rndGen(123456);
overallBb = overallBb.extend(rndGen, 1E-4);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
boundaryTreePtr_.reset boundaryTreePtr_.reset
( (
new indexedOctree<treeDataFace> new indexedOctree<treeDataFace>
@ -550,7 +573,7 @@ const Foam::indexedOctree<Foam::treeDataFace>& Foam::meshSearch::boundaryTree()
mesh_, mesh_,
bndFaces // boundary faces only bndFaces // boundary faces only
), ),
overallBb, // overall search domain overallBbPtr_(), // overall search domain
8, // maxLevel 8, // maxLevel
10, // leafsize 10, // leafsize
3.0 // duplicity 3.0 // duplicity
@ -567,13 +590,24 @@ const
{ {
if (!cellTreePtr_.valid()) if (!cellTreePtr_.valid())
{ {
treeBoundBox overallBb(mesh_.points()); //
// Construct tree
//
if (!overallBbPtr_.valid())
{
Random rndGen(261782); Random rndGen(261782);
overallBbPtr_.reset
(
new treeBoundBox(mesh_.points())
);
treeBoundBox& overallBb = overallBbPtr_();
// Extend slightly and make 3D
overallBb = overallBb.extend(rndGen, 1E-4); overallBb = overallBb.extend(rndGen, 1E-4);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL); overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL); overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
}
cellTreePtr_.reset cellTreePtr_.reset
( (
@ -584,10 +618,10 @@ const
false, // not cache bb false, // not cache bb
mesh_ mesh_
), ),
overallBb, overallBbPtr_(),
8, // maxLevel 8, // maxLevel
10, // leafsize 10, // leafsize
3.0 // duplicity 6.0 // duplicity
) )
); );
} }
@ -904,6 +938,7 @@ void Foam::meshSearch::clearOut()
{ {
boundaryTreePtr_.clear(); boundaryTreePtr_.clear();
cellTreePtr_.clear(); cellTreePtr_.clear();
overallBbPtr_.clear();
} }

View File

@ -49,6 +49,7 @@ class polyMesh;
class treeDataCell; class treeDataCell;
class treeDataFace; class treeDataFace;
template<class Type> class indexedOctree; template<class Type> class indexedOctree;
class treeBoundBox;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class meshSearch Declaration Class meshSearch Declaration
@ -64,8 +65,10 @@ class meshSearch
//- Whether to use face decomposition for all geometric tests //- Whether to use face decomposition for all geometric tests
const bool faceDecomp_; const bool faceDecomp_;
//- demand driven octrees //- data bounding box
mutable autoPtr<treeBoundBox> overallBbPtr_;
//- demand driven octrees
mutable autoPtr<indexedOctree<treeDataFace> > boundaryTreePtr_; mutable autoPtr<indexedOctree<treeDataFace> > boundaryTreePtr_;
mutable autoPtr<indexedOctree<treeDataCell> > cellTreePtr_; mutable autoPtr<indexedOctree<treeDataCell> > cellTreePtr_;
@ -163,9 +166,19 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components. Constructs bb slightly bigger than
// mesh points bb.
meshSearch(const polyMesh& mesh, const bool faceDecomp = true); meshSearch(const polyMesh& mesh, const bool faceDecomp = true);
//- Construct with a custom bounding box. Any mesh element outside
// bb will not be found. Up to user to make sure bb
// extends slightly beyond wanted elements.
meshSearch
(
const polyMesh& mesh,
const treeBoundBox& bb,
const bool faceDecomp = true
);
//- Destructor //- Destructor
~meshSearch(); ~meshSearch();

View File

@ -106,7 +106,7 @@ void Foam::meshToMesh::calcAddressing()
shiftedBb, // overall bounding box shiftedBb, // overall bounding box
8, // maxLevel 8, // maxLevel
10, // leafsize 10, // leafsize
3.0 // duplicity 6.0 // duplicity
); );
if (debug) if (debug)