mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
bb tolerances
This commit is contained in:
@ -209,7 +209,7 @@ void Foam::directMappedPolyPatch::findSamples
|
||||
// patch faces
|
||||
const labelList patchFaces(identity(pp.size()) + pp.start());
|
||||
|
||||
const treeBoundBox patchBb
|
||||
treeBoundBox patchBb
|
||||
(
|
||||
treeBoundBox(pp.points(), pp.meshPoints()).extend
|
||||
(
|
||||
@ -217,6 +217,8 @@ void Foam::directMappedPolyPatch::findSamples
|
||||
1E-4
|
||||
)
|
||||
);
|
||||
patchBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
patchBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
autoPtr<indexedOctree<treeDataFace> > boundaryTree
|
||||
(
|
||||
|
||||
@ -26,7 +26,6 @@ License
|
||||
|
||||
#include "indexedOctree.H"
|
||||
#include "linePointRef.H"
|
||||
// #include "triSurface.H"
|
||||
#include "meshTools.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
|
||||
@ -460,8 +460,10 @@ const Foam::indexedOctree<Foam::treeDataFace>& Foam::meshSearch::boundaryTree()
|
||||
}
|
||||
|
||||
treeBoundBox overallBb(mesh_.points());
|
||||
|
||||
Random rndGen(123456);
|
||||
overallBb.extend(rndGen, 1E-4);
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
boundaryTreePtr_ = new indexedOctree<treeDataFace>
|
||||
(
|
||||
@ -471,7 +473,7 @@ const Foam::indexedOctree<Foam::treeDataFace>& Foam::meshSearch::boundaryTree()
|
||||
mesh_,
|
||||
bndFaces // boundary faces only
|
||||
),
|
||||
overallBb.extend(rndGen, 1E-3), // overall search domain
|
||||
overallBb, // overall search domain
|
||||
8, // maxLevel
|
||||
10, // leafsize
|
||||
3.0 // duplicity
|
||||
@ -492,6 +494,10 @@ const Foam::indexedOctree<Foam::treeDataCell>& Foam::meshSearch::cellTree()
|
||||
//
|
||||
|
||||
treeBoundBox overallBb(mesh_.points());
|
||||
Random rndGen(123456);
|
||||
overallBb.extend(rndGen, 1E-4);
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
cellTreePtr_ = new indexedOctree<treeDataCell>
|
||||
(
|
||||
@ -522,6 +528,10 @@ const Foam::indexedOctree<Foam::treeDataPoint>&
|
||||
//
|
||||
|
||||
treeBoundBox overallBb(mesh_.cellCentres());
|
||||
Random rndGen(123456);
|
||||
overallBb.extend(rndGen, 1E-4);
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
cellCentreTreePtr_ = new indexedOctree<treeDataPoint>
|
||||
(
|
||||
|
||||
@ -352,17 +352,24 @@ const Foam::indexedOctree<Foam::treeDataTriSurface>&
|
||||
{
|
||||
if (tree_.empty())
|
||||
{
|
||||
treeBoundBox bb(points(), meshPoints());
|
||||
|
||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
||||
Random rndGen(65431);
|
||||
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are less face/edge aligned items.
|
||||
treeBoundBox bb
|
||||
(
|
||||
treeBoundBox(points(), meshPoints()).extend(rndGen, 1E-4)
|
||||
);
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
tree_.reset
|
||||
(
|
||||
new indexedOctree<treeDataTriSurface>
|
||||
(
|
||||
treeDataTriSurface(*this),
|
||||
bb.extend(rndGen, 1E-4), // slightly randomize bb
|
||||
bb,
|
||||
10, // maxLevel
|
||||
10, // leafsize
|
||||
3.0 // duplicity
|
||||
@ -379,8 +386,6 @@ const Foam::indexedOctree<Foam::treeDataEdge>&
|
||||
{
|
||||
if (edgeTree_.empty())
|
||||
{
|
||||
treeBoundBox bb(localPoints());
|
||||
|
||||
// Boundary edges
|
||||
labelList bEdges
|
||||
(
|
||||
@ -395,6 +400,15 @@ const Foam::indexedOctree<Foam::treeDataEdge>&
|
||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
||||
Random rndGen(65431);
|
||||
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are less face/edge aligned items.
|
||||
treeBoundBox bb
|
||||
(
|
||||
treeBoundBox(points(), meshPoints()).extend(rndGen, 1E-4)
|
||||
);
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
edgeTree_.reset
|
||||
(
|
||||
new indexedOctree<treeDataEdge>
|
||||
@ -406,7 +420,7 @@ const Foam::indexedOctree<Foam::treeDataEdge>&
|
||||
localPoints(), // points
|
||||
bEdges // selected edges
|
||||
),
|
||||
bb.extend(rndGen, 1E-4), // slightly randomize bb
|
||||
bb, // bb
|
||||
8, // maxLevel
|
||||
10, // leafsize
|
||||
3.0 // duplicity
|
||||
@ -463,8 +477,11 @@ void Foam::triSurfaceMesh::findNearest
|
||||
|
||||
forAll(samples, i)
|
||||
{
|
||||
static_cast<pointIndexHit&>(info[i]) =
|
||||
octree.findNearest(samples[i], nearestDistSqr[i]);
|
||||
static_cast<pointIndexHit&>(info[i]) = octree.findNearest
|
||||
(
|
||||
samples[i],
|
||||
nearestDistSqr[i]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,8 +521,11 @@ void Foam::triSurfaceMesh::findLineAny
|
||||
|
||||
forAll(start, i)
|
||||
{
|
||||
static_cast<pointIndexHit&>(info[i]) =
|
||||
octree.findLineAny(start[i], end[i]);
|
||||
static_cast<pointIndexHit&>(info[i]) = octree.findLineAny
|
||||
(
|
||||
start[i],
|
||||
end[i]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,19 +50,21 @@ triSurfaceSearch::triSurfaceSearch(const triSurface& surface)
|
||||
surface_(surface),
|
||||
treePtr_(NULL)
|
||||
{
|
||||
treeBoundBox treeBb(surface_.points(), surface_.meshPoints());
|
||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
||||
Random rndGen(65431);
|
||||
|
||||
scalar tol = 1E-6 * treeBb.avgDim();
|
||||
|
||||
point& bbMin = treeBb.min();
|
||||
bbMin.x() -= tol;
|
||||
bbMin.y() -= tol;
|
||||
bbMin.z() -= tol;
|
||||
|
||||
point& bbMax = treeBb.max();
|
||||
bbMax.x() += 2*tol;
|
||||
bbMax.y() += 2*tol;
|
||||
bbMax.z() += 2*tol;
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are less face/edge aligned items.
|
||||
treeBoundBox treeBb
|
||||
(
|
||||
treeBoundBox(surface_.points(), surface_.meshPoints()).extend
|
||||
(
|
||||
rndGen,
|
||||
1E-4
|
||||
)
|
||||
);
|
||||
treeBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
treeBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
treePtr_.reset
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user