treeBoundBox: Removed unecessary randomisation
Tree bound boxes are expanded asymmetrically to reduce the liklihood of octree faces aliging with mesh faces and edges. The asymmetry is now generated using hard-coded irrational numbers, rather than using a random generator. The asymmetry was effectively already hard coded. The random numbers are only pseudo random, so the same numbers were being applied to the bound boxes every time. This change simply removes the overhead of creating the generator, and also gets rid of some duplicated code.
This commit is contained in:
@ -692,8 +692,6 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
|
|||||||
// Overall bb
|
// Overall bb
|
||||||
treeBoundBox overallBb(boundaryFacesPtr_().localPoints());
|
treeBoundBox overallBb(boundaryFacesPtr_().localPoints());
|
||||||
|
|
||||||
Random& rnd = rndGen_;
|
|
||||||
|
|
||||||
bFTreePtr_.reset
|
bFTreePtr_.reset
|
||||||
(
|
(
|
||||||
new indexedOctree<treeDataBPatch>
|
new indexedOctree<treeDataBPatch>
|
||||||
@ -704,7 +702,7 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
|
|||||||
boundaryFacesPtr_(),
|
boundaryFacesPtr_(),
|
||||||
indexedOctree<treeDataBPatch>::perturbTol()
|
indexedOctree<treeDataBPatch>::perturbTol()
|
||||||
),
|
),
|
||||||
overallBb.extend(rnd, 1e-4),
|
overallBb.extend(1e-4),
|
||||||
10, // maxLevel
|
10, // maxLevel
|
||||||
10, // leafSize
|
10, // leafSize
|
||||||
3.0 // duplicity
|
3.0 // duplicity
|
||||||
|
|||||||
@ -1978,12 +1978,9 @@ void Foam::conformalVoronoiMesh::buildEdgeLocationTree
|
|||||||
{
|
{
|
||||||
treeBoundBox overallBb
|
treeBoundBox overallBb
|
||||||
(
|
(
|
||||||
geometryToConformTo_.globalBounds().extend(rndGen_, 1e-4)
|
geometryToConformTo_.globalBounds().extend(1e-4)
|
||||||
);
|
);
|
||||||
|
|
||||||
overallBb.min() -= Foam::point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
overallBb.max() += Foam::point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
edgeLocationTreePtr_.reset
|
edgeLocationTreePtr_.reset
|
||||||
(
|
(
|
||||||
new dynamicIndexedOctree<dynamicTreeDataPoint>
|
new dynamicIndexedOctree<dynamicTreeDataPoint>
|
||||||
@ -2005,12 +2002,9 @@ void Foam::conformalVoronoiMesh::buildSurfacePtLocationTree
|
|||||||
{
|
{
|
||||||
treeBoundBox overallBb
|
treeBoundBox overallBb
|
||||||
(
|
(
|
||||||
geometryToConformTo_.globalBounds().extend(rndGen_, 1e-4)
|
geometryToConformTo_.globalBounds().extend(1e-4)
|
||||||
);
|
);
|
||||||
|
|
||||||
overallBb.min() -= Foam::point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
overallBb.max() += Foam::point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
surfacePtLocationTreePtr_.reset
|
surfacePtLocationTreePtr_.reset
|
||||||
(
|
(
|
||||||
new dynamicIndexedOctree<dynamicTreeDataPoint>
|
new dynamicIndexedOctree<dynamicTreeDataPoint>
|
||||||
|
|||||||
@ -558,10 +558,7 @@ Foam::conformationSurfaces::conformationSurfaces
|
|||||||
|
|
||||||
// Extend the global bounds to stop the bound box sitting on the surfaces
|
// Extend the global bounds to stop the bound box sitting on the surfaces
|
||||||
// to be conformed to
|
// to be conformed to
|
||||||
// globalBounds_ = globalBounds_.extend(rndGen_, 1e-4);
|
|
||||||
|
|
||||||
vector newSpan = 1e-4*globalBounds_.span();
|
vector newSpan = 1e-4*globalBounds_.span();
|
||||||
|
|
||||||
globalBounds_.min() -= newSpan;
|
globalBounds_.min() -= newSpan;
|
||||||
globalBounds_.max() += newSpan;
|
globalBounds_.max() += newSpan;
|
||||||
|
|
||||||
|
|||||||
@ -919,11 +919,7 @@ List<Vb::Point> autoDensity::initialPoints() const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Extend the global box to move it off large plane surfaces
|
// Extend the global box to move it off large plane surfaces
|
||||||
hierBB = geometryToConformTo().globalBounds().extend
|
hierBB = geometryToConformTo().globalBounds().extend(1e-6);
|
||||||
(
|
|
||||||
rndGen(),
|
|
||||||
1e-6
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicList<Vb::Point> initialPoints;
|
DynamicList<Vb::Point> initialPoints;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ List<treeBoundBox> meshBb
|
|||||||
treeBoundBox
|
treeBoundBox
|
||||||
(
|
(
|
||||||
boundBox(coarseMesh.points(), false)
|
boundBox(coarseMesh.points(), false)
|
||||||
).extend(rndGen, 1e-3)
|
).extend(1e-3)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Dummy bounds dictionary
|
// Dummy bounds dictionary
|
||||||
|
|||||||
@ -174,12 +174,9 @@ void createBoundaryEdgeTrees
|
|||||||
// geometry there are less face/edge aligned items.
|
// geometry there are less face/edge aligned items.
|
||||||
treeBoundBox bb
|
treeBoundBox bb
|
||||||
(
|
(
|
||||||
treeBoundBox(UList<point>(surf.localPoints())).extend(rndGen, 1e-4)
|
treeBoundBox(UList<point>(surf.localPoints())).extend(1e-4)
|
||||||
);
|
);
|
||||||
|
|
||||||
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
bEdgeTrees.set
|
bEdgeTrees.set
|
||||||
(
|
(
|
||||||
surfI,
|
surfI,
|
||||||
|
|||||||
@ -144,18 +144,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "createPolyMesh.H"
|
#include "createPolyMesh.H"
|
||||||
|
|
||||||
Random rndGen(653213);
|
|
||||||
|
|
||||||
// Determine mesh bounding boxes:
|
// Determine mesh bounding boxes:
|
||||||
List<List<treeBoundBox>> meshBb(Pstream::nProcs());
|
List<List<treeBoundBox>> meshBb(Pstream::nProcs());
|
||||||
{
|
{
|
||||||
meshBb[Pstream::myProcNo()] = List<treeBoundBox>
|
meshBb[Pstream::myProcNo()] = List<treeBoundBox>
|
||||||
(
|
(
|
||||||
1,
|
1,
|
||||||
treeBoundBox
|
treeBoundBox(boundBox(mesh.points(), false)).extend(1e-3)
|
||||||
(
|
|
||||||
boundBox(mesh.points(), false)
|
|
||||||
).extend(rndGen, 1e-3)
|
|
||||||
);
|
);
|
||||||
Pstream::gatherList(meshBb);
|
Pstream::gatherList(meshBb);
|
||||||
Pstream::scatterList(meshBb);
|
Pstream::scatterList(meshBb);
|
||||||
|
|||||||
@ -876,14 +876,6 @@ Foam::polyMesh::cellTree() const
|
|||||||
{
|
{
|
||||||
if (cellTreePtr_.empty())
|
if (cellTreePtr_.empty())
|
||||||
{
|
{
|
||||||
treeBoundBox overallBb(points());
|
|
||||||
|
|
||||||
static Random rndGen(261782);
|
|
||||||
|
|
||||||
overallBb = overallBb.extend(rndGen, 1e-4);
|
|
||||||
overallBb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
overallBb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
cellTreePtr_.reset
|
cellTreePtr_.reset
|
||||||
(
|
(
|
||||||
new indexedOctree<treeDataCell>
|
new indexedOctree<treeDataCell>
|
||||||
@ -894,7 +886,7 @@ Foam::polyMesh::cellTree() const
|
|||||||
*this,
|
*this,
|
||||||
CELL_TETS // use tet-decomposition for any inside test
|
CELL_TETS // use tet-decomposition for any inside test
|
||||||
),
|
),
|
||||||
overallBb,
|
treeBoundBox(points()).extend(1e-4),
|
||||||
8, // maxLevel
|
8, // maxLevel
|
||||||
10, // leafsize
|
10, // leafsize
|
||||||
5.0 // duplicity
|
5.0 // duplicity
|
||||||
|
|||||||
@ -344,10 +344,9 @@ public:
|
|||||||
// 0 : none of the above.
|
// 0 : none of the above.
|
||||||
label distanceCmp(const point&, const treeBoundBox& other) const;
|
label distanceCmp(const point&, const treeBoundBox& other) const;
|
||||||
|
|
||||||
//- Return slightly wider bounding box
|
//- Return asymetrically extended bounding box, with guaranteed
|
||||||
// Extends all dimensions with s*span*Random::scalar01()
|
// minimum width of s*mag(span) in any direction
|
||||||
// and guarantees in any direction s*mag(span) minimum width
|
inline treeBoundBox extend(const scalar s) const;
|
||||||
inline treeBoundBox extend(Random&, const scalar s) const;
|
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -312,27 +312,18 @@ inline void Foam::treeBoundBox::searchOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return slightly wider bounding box
|
inline Foam::treeBoundBox Foam::treeBoundBox::extend(const scalar s) const
|
||||||
inline Foam::treeBoundBox Foam::treeBoundBox::extend
|
|
||||||
(
|
|
||||||
Random& rndGen,
|
|
||||||
const scalar s
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
|
// Numbers that don't approximate rational fractions with which to make the
|
||||||
|
// box asymmetric. These are between one and two.
|
||||||
|
static const vector a = vector::uniform(sqrt(1.25) + 0.5);
|
||||||
|
static const vector b = vector::uniform(sqrt(2.0));
|
||||||
|
|
||||||
treeBoundBox bb(*this);
|
treeBoundBox bb(*this);
|
||||||
|
|
||||||
vector newSpan = bb.span();
|
const scalar delta = s*Foam::mag(bb.span());
|
||||||
|
bb.min() -= Foam::max(delta*a, vector::uniform(rootVSmall));
|
||||||
// Make 3D
|
bb.max() += Foam::max(delta*b, vector::uniform(rootVSmall));
|
||||||
scalar minSpan = s * Foam::mag(newSpan);
|
|
||||||
|
|
||||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
|
||||||
{
|
|
||||||
newSpan[dir] = Foam::max(newSpan[dir], minSpan);
|
|
||||||
}
|
|
||||||
|
|
||||||
bb.min() -= cmptMultiply(s * rndGen.vector01(), newSpan);
|
|
||||||
bb.max() += cmptMultiply(s * rndGen.vector01(), newSpan);
|
|
||||||
|
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -980,8 +980,6 @@ void Foam::faceCoupleInfo::findSlavesCoveringMaster
|
|||||||
|
|
||||||
treeBoundBox overallBb(mesh0.points());
|
treeBoundBox overallBb(mesh0.points());
|
||||||
|
|
||||||
Random rndGen(123456);
|
|
||||||
|
|
||||||
indexedOctree<treeDataFace> tree
|
indexedOctree<treeDataFace> tree
|
||||||
(
|
(
|
||||||
treeDataFace // all information needed to search faces
|
treeDataFace // all information needed to search faces
|
||||||
@ -990,7 +988,7 @@ void Foam::faceCoupleInfo::findSlavesCoveringMaster
|
|||||||
mesh0,
|
mesh0,
|
||||||
bndFaces // boundary faces only
|
bndFaces // boundary faces only
|
||||||
),
|
),
|
||||||
overallBb.extend(rndGen, 1e-4), // overall search domain
|
overallBb.extend(1e-4), // overall search domain
|
||||||
8, // maxLevel
|
8, // maxLevel
|
||||||
10, // leafsize
|
10, // leafsize
|
||||||
3.0 // duplicity
|
3.0 // duplicity
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -39,8 +39,6 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
|
|||||||
Info<< "Building InteractionLists with interaction distance "
|
Info<< "Building InteractionLists with interaction distance "
|
||||||
<< maxDistance_ << endl;
|
<< maxDistance_ << endl;
|
||||||
|
|
||||||
Random rndGen(419715);
|
|
||||||
|
|
||||||
const vector interactionVec = maxDistance_*vector::one;
|
const vector interactionVec = maxDistance_*vector::one;
|
||||||
|
|
||||||
treeBoundBox procBb(treeBoundBox(mesh_.points()));
|
treeBoundBox procBb(treeBoundBox(mesh_.points()));
|
||||||
@ -158,7 +156,7 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
|
|||||||
|
|
||||||
treeBoundBox procBbRndExt
|
treeBoundBox procBbRndExt
|
||||||
(
|
(
|
||||||
treeBoundBox(mesh_.points()).extend(rndGen, 1e-4)
|
treeBoundBox(mesh_.points()).extend(1e-4)
|
||||||
);
|
);
|
||||||
|
|
||||||
indexedOctree<treeDataCell> coupledPatchRangeTree
|
indexedOctree<treeDataCell> coupledPatchRangeTree
|
||||||
|
|||||||
@ -2402,13 +2402,10 @@ void Foam::meshRefinement::distribute(const mapDistributePolyMesh& map)
|
|||||||
|
|
||||||
// Redistribute surface and any fields on it.
|
// Redistribute surface and any fields on it.
|
||||||
{
|
{
|
||||||
Random rndGen(653213);
|
|
||||||
|
|
||||||
// Get local mesh bounding box. Single box for now.
|
// Get local mesh bounding box. Single box for now.
|
||||||
List<treeBoundBox> meshBb(1);
|
List<treeBoundBox> meshBb(1);
|
||||||
treeBoundBox& bb = meshBb[0];
|
treeBoundBox& bb = meshBb[0];
|
||||||
bb = treeBoundBox(mesh_.points());
|
bb = treeBoundBox(mesh_.points()).extend(1e-4);
|
||||||
bb = bb.extend(rndGen, 1e-4);
|
|
||||||
|
|
||||||
// Distribute all geometry (so refinementSurfaces and shellSurfaces)
|
// Distribute all geometry (so refinementSurfaces and shellSurfaces)
|
||||||
searchableSurfaces& geometry =
|
searchableSurfaces& geometry =
|
||||||
|
|||||||
@ -253,14 +253,9 @@ void Foam::refinementFeatures::buildTrees(const label featI)
|
|||||||
// Calculate bb of all points
|
// Calculate bb of all points
|
||||||
treeBoundBox bb(points);
|
treeBoundBox bb(points);
|
||||||
|
|
||||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
|
||||||
Random rndGen(65431);
|
|
||||||
|
|
||||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||||
// geometry there are less face/edge aligned items.
|
// geometry there are less face/edge aligned items.
|
||||||
bb = bb.extend(rndGen, 1e-4);
|
bb = bb.extend(1e-4);
|
||||||
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
edgeTrees_.set
|
edgeTrees_.set
|
||||||
(
|
(
|
||||||
@ -394,14 +389,9 @@ Foam::refinementFeatures::regionEdgeTrees() const
|
|||||||
// Calculate bb of all points
|
// Calculate bb of all points
|
||||||
treeBoundBox bb(points);
|
treeBoundBox bb(points);
|
||||||
|
|
||||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
|
||||||
Random rndGen(65431);
|
|
||||||
|
|
||||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||||
// geometry there are less face/edge aligned items.
|
// geometry there are less face/edge aligned items.
|
||||||
bb = bb.extend(rndGen, 1e-4);
|
bb = bb.extend(1e-4);
|
||||||
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
trees.set
|
trees.set
|
||||||
(
|
(
|
||||||
|
|||||||
@ -2466,16 +2466,7 @@ void Foam::snappySnapDriver::reverseAttractMeshPoints
|
|||||||
|
|
||||||
// Get search domain and extend it a bit
|
// Get search domain and extend it a bit
|
||||||
treeBoundBox bb(pp.localPoints());
|
treeBoundBox bb(pp.localPoints());
|
||||||
{
|
bb = bb.extend(1e-4);
|
||||||
// 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.
|
|
||||||
bb = bb.extend(rndGen, 1e-4);
|
|
||||||
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect candidate points for attraction
|
// Collect candidate points for attraction
|
||||||
DynamicList<label> attractPoints(pp.nPoints());
|
DynamicList<label> attractPoints(pp.nPoints());
|
||||||
|
|||||||
@ -826,17 +826,9 @@ Foam::extendedEdgeMesh::pointTree() const
|
|||||||
{
|
{
|
||||||
if (pointTree_.empty())
|
if (pointTree_.empty())
|
||||||
{
|
{
|
||||||
Random rndGen(17301893);
|
|
||||||
|
|
||||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||||
// geometry there are less face/edge aligned items.
|
// geometry there are less face/edge aligned items.
|
||||||
treeBoundBox bb
|
treeBoundBox bb(treeBoundBox(points()).extend(1e-4));
|
||||||
(
|
|
||||||
treeBoundBox(points()).extend(rndGen, 1e-4)
|
|
||||||
);
|
|
||||||
|
|
||||||
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
const labelList featurePointLabels = identity(nonFeatureStart_);
|
const labelList featurePointLabels = identity(nonFeatureStart_);
|
||||||
|
|
||||||
@ -866,17 +858,9 @@ Foam::extendedEdgeMesh::edgeTree() const
|
|||||||
{
|
{
|
||||||
if (edgeTree_.empty())
|
if (edgeTree_.empty())
|
||||||
{
|
{
|
||||||
Random rndGen(17301893);
|
|
||||||
|
|
||||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||||
// geometry there are less face/edge aligned items.
|
// geometry there are less face/edge aligned items.
|
||||||
treeBoundBox bb
|
treeBoundBox bb(treeBoundBox(points()).extend(1e-4));
|
||||||
(
|
|
||||||
treeBoundBox(points()).extend(rndGen, 1e-4)
|
|
||||||
);
|
|
||||||
|
|
||||||
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
labelList allEdges(identity(edges().size()));
|
labelList allEdges(identity(edges().size()));
|
||||||
|
|
||||||
@ -910,17 +894,9 @@ Foam::extendedEdgeMesh::edgeTreesByType() const
|
|||||||
{
|
{
|
||||||
edgeTreesByType_.setSize(nEdgeTypes);
|
edgeTreesByType_.setSize(nEdgeTypes);
|
||||||
|
|
||||||
Random rndGen(872141);
|
|
||||||
|
|
||||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||||
// geometry there are less face/edge aligned items.
|
// geometry there are less face/edge aligned items.
|
||||||
treeBoundBox bb
|
treeBoundBox bb(treeBoundBox(points()).extend(1e-4));
|
||||||
(
|
|
||||||
treeBoundBox(points()).extend(rndGen, 1e-4)
|
|
||||||
);
|
|
||||||
|
|
||||||
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
labelListList sliceEdges(nEdgeTypes);
|
labelListList sliceEdges(nEdgeTypes);
|
||||||
|
|
||||||
|
|||||||
@ -273,8 +273,6 @@ void Foam::mappedPatchBase::findSamples
|
|||||||
|
|
||||||
case NEARESTPATCHFACE:
|
case NEARESTPATCHFACE:
|
||||||
{
|
{
|
||||||
Random rndGen(123456);
|
|
||||||
|
|
||||||
const polyPatch& pp = samplePolyPatch();
|
const polyPatch& pp = samplePolyPatch();
|
||||||
|
|
||||||
if (pp.empty())
|
if (pp.empty())
|
||||||
@ -292,14 +290,8 @@ void Foam::mappedPatchBase::findSamples
|
|||||||
|
|
||||||
treeBoundBox patchBb
|
treeBoundBox patchBb
|
||||||
(
|
(
|
||||||
treeBoundBox(pp.points(), pp.meshPoints()).extend
|
treeBoundBox(pp.points(), pp.meshPoints()).extend(1e-4)
|
||||||
(
|
|
||||||
rndGen,
|
|
||||||
1e-4
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
patchBb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
patchBb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
indexedOctree<treeDataFace> boundaryTree
|
indexedOctree<treeDataFace> boundaryTree
|
||||||
(
|
(
|
||||||
@ -347,8 +339,6 @@ void Foam::mappedPatchBase::findSamples
|
|||||||
|
|
||||||
case NEARESTPATCHPOINT:
|
case NEARESTPATCHPOINT:
|
||||||
{
|
{
|
||||||
Random rndGen(123456);
|
|
||||||
|
|
||||||
const polyPatch& pp = samplePolyPatch();
|
const polyPatch& pp = samplePolyPatch();
|
||||||
|
|
||||||
if (pp.empty())
|
if (pp.empty())
|
||||||
@ -364,14 +354,8 @@ void Foam::mappedPatchBase::findSamples
|
|||||||
// patch (local) points
|
// patch (local) points
|
||||||
treeBoundBox patchBb
|
treeBoundBox patchBb
|
||||||
(
|
(
|
||||||
treeBoundBox(pp.points(), pp.meshPoints()).extend
|
treeBoundBox(pp.points(), pp.meshPoints()).extend(1e-4)
|
||||||
(
|
|
||||||
rndGen,
|
|
||||||
1e-4
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
patchBb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
patchBb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
indexedOctree<treeDataPoint> boundaryTree
|
indexedOctree<treeDataPoint> boundaryTree
|
||||||
(
|
(
|
||||||
|
|||||||
@ -552,17 +552,15 @@ Foam::meshSearch::boundaryTree() const
|
|||||||
|
|
||||||
if (!overallBbPtr_.valid())
|
if (!overallBbPtr_.valid())
|
||||||
{
|
{
|
||||||
Random rndGen(261782);
|
|
||||||
overallBbPtr_.reset
|
overallBbPtr_.reset
|
||||||
(
|
(
|
||||||
new treeBoundBox(mesh_.points())
|
new treeBoundBox(mesh_.points())
|
||||||
);
|
);
|
||||||
|
|
||||||
treeBoundBox& overallBb = overallBbPtr_();
|
treeBoundBox& overallBb = overallBbPtr_();
|
||||||
|
|
||||||
// Extend slightly and make 3D
|
// Extend slightly and make 3D
|
||||||
overallBb = overallBb.extend(rndGen, 1e-4);
|
overallBb = overallBb.extend(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)
|
||||||
@ -605,17 +603,15 @@ Foam::meshSearch::cellTree() const
|
|||||||
|
|
||||||
if (!overallBbPtr_.valid())
|
if (!overallBbPtr_.valid())
|
||||||
{
|
{
|
||||||
Random rndGen(261782);
|
|
||||||
overallBbPtr_.reset
|
overallBbPtr_.reset
|
||||||
(
|
(
|
||||||
new treeBoundBox(mesh_.points())
|
new treeBoundBox(mesh_.points())
|
||||||
);
|
);
|
||||||
|
|
||||||
treeBoundBox& overallBb = overallBbPtr_();
|
treeBoundBox& overallBb = overallBbPtr_();
|
||||||
|
|
||||||
// Extend slightly and make 3D
|
// Extend slightly and make 3D
|
||||||
overallBb = overallBb.extend(rndGen, 1e-4);
|
overallBb = overallBb.extend(1e-4);
|
||||||
overallBb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
overallBb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cellTreePtr_.reset
|
cellTreePtr_.reset
|
||||||
|
|||||||
@ -565,15 +565,9 @@ Foam::triSurfaceMesh::edgeTree() const
|
|||||||
nPoints
|
nPoints
|
||||||
);
|
);
|
||||||
|
|
||||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
|
||||||
Random rndGen(65431);
|
|
||||||
|
|
||||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||||
// geometry there are less face/edge aligned items.
|
// geometry there are less face/edge aligned items.
|
||||||
|
bb = bb.extend(1e-4);
|
||||||
bb = bb.extend(rndGen, 1e-4);
|
|
||||||
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar oldTol = indexedOctree<treeDataEdge>::perturbTol();
|
scalar oldTol = indexedOctree<treeDataEdge>::perturbTol();
|
||||||
|
|||||||
@ -144,16 +144,10 @@ Foam::triSurfaceRegionSearch::treeByRegion() const
|
|||||||
// << endl;
|
// << endl;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Random number generator. Bit dodgy since not exactly
|
|
||||||
// random ;-)
|
|
||||||
Random rndGen(65431);
|
|
||||||
|
|
||||||
// Slightly extended bb. Slightly off-centred just so
|
// Slightly extended bb. Slightly off-centred just so
|
||||||
// on symmetric geometry there are fewer face/edge
|
// on symmetric geometry there are fewer face/edge
|
||||||
// aligned items.
|
// aligned items.
|
||||||
bb = bb.extend(rndGen, 1e-4);
|
bb = bb.extend(1e-4);
|
||||||
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
treeByRegion_.set
|
treeByRegion_.set
|
||||||
|
|||||||
@ -217,14 +217,9 @@ Foam::triSurfaceSearch::tree() const
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
|
||||||
Random rndGen(65431);
|
|
||||||
|
|
||||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||||
// geometry there are less face/edge aligned items.
|
// geometry there are less face/edge aligned items.
|
||||||
bb = bb.extend(rndGen, 1e-4);
|
bb = bb.extend(1e-4);
|
||||||
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||||
|
|||||||
@ -78,10 +78,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
treeBoundBox overallBb(pp.points());
|
treeBoundBox overallBb(pp.points());
|
||||||
Random rndGen(123456);
|
overallBb = overallBb.extend(1e-4);
|
||||||
overallBb = overallBb.extend(rndGen, 1e-4);
|
|
||||||
overallBb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
overallBb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
const indexedOctree<treeDataFace> boundaryTree
|
const indexedOctree<treeDataFace> boundaryTree
|
||||||
(
|
(
|
||||||
|
|||||||
@ -90,16 +90,7 @@ void Foam::patchCloudSet::calcSamples
|
|||||||
bb.min() = min(bb.min(), patchBb.min());
|
bb.min() = min(bb.min(), patchBb.min());
|
||||||
bb.max() = max(bb.max(), patchBb.max());
|
bb.max() = max(bb.max(), patchBb.max());
|
||||||
}
|
}
|
||||||
|
bb = bb.extend(1e-4);
|
||||||
// Not very random
|
|
||||||
Random rndGen(123456);
|
|
||||||
// Make bb asymetric just to avoid problems on symmetric meshes
|
|
||||||
bb = bb.extend(rndGen, 1e-4);
|
|
||||||
|
|
||||||
// Make sure bb is 3D.
|
|
||||||
bb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
bb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
|
|
||||||
indexedOctree<treeDataFace> patchTree
|
indexedOctree<treeDataFace> patchTree
|
||||||
(
|
(
|
||||||
|
|||||||
@ -109,10 +109,7 @@ Foam::sampledTriSurfaceMesh::nonCoupledboundaryTree() const
|
|||||||
|
|
||||||
|
|
||||||
treeBoundBox overallBb(mesh().points());
|
treeBoundBox overallBb(mesh().points());
|
||||||
Random rndGen(123456);
|
overallBb = overallBb.extend(1e-4);
|
||||||
overallBb = overallBb.extend(rndGen, 1e-4);
|
|
||||||
overallBb.min() -= point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
overallBb.max() += point(rootVSmall, rootVSmall, rootVSmall);
|
|
||||||
|
|
||||||
boundaryTreePtr_.reset
|
boundaryTreePtr_.reset
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user