mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use simpler boundBox handling
- use default initialize boundBox instead of invertedBox - reset() instead of assigning from invertedBox - extend (three parameter version) and grow method - inflate(Random) instead of extend + re-assigning
This commit is contained in:
committed by
Andrew Heather
parent
1339c3357b
commit
e5006a62d7
@ -53,20 +53,17 @@ int main(int argc, char *argv[])
|
||||
const polyMesh::cellDecomposition decompMode = polyMesh::CELL_TETS;
|
||||
|
||||
treeBoundBox meshBb(mesh.bounds());
|
||||
treeBoundBox shiftedBb(meshBb);
|
||||
|
||||
// Calculate typical cell related size to shift bb by.
|
||||
scalar typDim = meshBb.avgDim()/(2.0*Foam::cbrt(scalar(mesh.nCells())));
|
||||
|
||||
treeBoundBox shiftedBb
|
||||
(
|
||||
meshBb.min(),
|
||||
meshBb.max() + vector(typDim, typDim, typDim)
|
||||
);
|
||||
shiftedBb.max() += vector::uniform(typDim);
|
||||
|
||||
Info<< "Mesh" << endl;
|
||||
Info<< " bounding box : " << meshBb << endl;
|
||||
Info<< " bounding box (shifted) : " << shiftedBb << endl;
|
||||
Info<< " typical dimension : " << shiftedBb.typDim() << endl;
|
||||
Info<< " typical dimension : " << shiftedBb.avgDim() << endl;
|
||||
|
||||
Info<< "Initialised mesh in "
|
||||
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||
|
||||
@ -890,11 +890,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
const boundBox& bb = mesh.bounds();
|
||||
const vector span = bb.span();
|
||||
const scalar mergeDim = mergeTol * bb.minDim();
|
||||
|
||||
Info<< "Mesh bounding box : " << bb << nl
|
||||
<< " with span : " << span << nl
|
||||
<< " with span : " << bb.span() << nl
|
||||
<< "Merge distance : " << mergeDim << nl
|
||||
<< endl;
|
||||
|
||||
|
||||
@ -577,7 +577,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
|
||||
// // weightEstimate += sampleVol/pow3(s);
|
||||
// }
|
||||
//
|
||||
// if (sqr(spanScale_)*sqr(minCellSize) < magSqr(cellBb.span()))
|
||||
// if (sqr(spanScale_)*sqr(minCellSize) < cellBb.magSqr())
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
@ -695,7 +695,7 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
|
||||
Pstream::allGatherList(allBackgroundMeshBounds_);
|
||||
|
||||
// find global bounding box
|
||||
globalBackgroundBounds_ = treeBoundBox(boundBox::invertedBox);
|
||||
globalBackgroundBounds_.reset();
|
||||
forAll(allBackgroundMeshBounds_, proci)
|
||||
{
|
||||
globalBackgroundBounds_.add(allBackgroundMeshBounds_[proci]);
|
||||
|
||||
@ -1965,12 +1965,9 @@ void Foam::conformalVoronoiMesh::buildEdgeLocationTree
|
||||
{
|
||||
treeBoundBox overallBb
|
||||
(
|
||||
geometryToConformTo_.globalBounds().extend(rndGen_, 1e-4)
|
||||
geometryToConformTo_.globalBounds().extend(rndGen_, 1e-4, ROOTVSMALL)
|
||||
);
|
||||
|
||||
overallBb.min() -= Foam::point::uniform(ROOTVSMALL);
|
||||
overallBb.max() += Foam::point::uniform(ROOTVSMALL);
|
||||
|
||||
edgeLocationTreePtr_.reset
|
||||
(
|
||||
new dynamicIndexedOctree<dynamicTreeDataPoint>
|
||||
@ -1992,12 +1989,9 @@ void Foam::conformalVoronoiMesh::buildSurfacePtLocationTree
|
||||
{
|
||||
treeBoundBox overallBb
|
||||
(
|
||||
geometryToConformTo_.globalBounds().extend(rndGen_, 1e-4)
|
||||
geometryToConformTo_.globalBounds().extend(rndGen_, 1e-4, ROOTVSMALL)
|
||||
);
|
||||
|
||||
overallBb.min() -= Foam::point::uniform(ROOTVSMALL);
|
||||
overallBb.max() += Foam::point::uniform(ROOTVSMALL);
|
||||
|
||||
surfacePtLocationTreePtr_.reset
|
||||
(
|
||||
new dynamicIndexedOctree<dynamicTreeDataPoint>
|
||||
|
||||
@ -564,12 +564,9 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
|
||||
// Extend the global bounds to stop the bound box sitting on the surfaces
|
||||
// to be conformed to
|
||||
//globalBounds_ = globalBounds_.extend(rndGen, 1e-4);
|
||||
//globalBounds_.inflate(rndGen, 1e-4);
|
||||
|
||||
vector newSpan = 1e-4*globalBounds_.span();
|
||||
|
||||
globalBounds_.min() -= newSpan;
|
||||
globalBounds_.max() += newSpan;
|
||||
globalBounds_.grow(1e-4*globalBounds_.span());
|
||||
|
||||
// Look at all surfaces at determine whether the locationInMesh point is
|
||||
// inside or outside each, to establish a signature for the domain to be
|
||||
|
||||
@ -122,11 +122,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Extend
|
||||
treeBoundBox bb = geometryToConformTo.globalBounds();
|
||||
{
|
||||
const vector smallVec = 0.1*bb.span();
|
||||
bb.min() -= smallVec;
|
||||
bb.max() += smallVec;
|
||||
}
|
||||
bb.grow(0.1*bb.span());
|
||||
|
||||
Info<< "Meshing to bounding box " << bb << nl << endl;
|
||||
|
||||
|
||||
@ -871,17 +871,16 @@ Foam::label Foam::checkTopology
|
||||
Info<< " "
|
||||
<< setw(20) << "PointZone"
|
||||
<< setw(8) << "Points"
|
||||
<< "BoundingBox" << endl;
|
||||
<< "BoundingBox" << nl;
|
||||
|
||||
for (const auto& zone : pointZones)
|
||||
{
|
||||
boundBox bb;
|
||||
for (const label pointi : zone)
|
||||
{
|
||||
bb.add(mesh.points()[pointi]);
|
||||
}
|
||||
|
||||
bb.reduce(); // Global min/max
|
||||
boundBox bb
|
||||
(
|
||||
mesh.points(),
|
||||
static_cast<const labelUList&>(zone),
|
||||
true // Reduce (global min/max)
|
||||
);
|
||||
|
||||
Info<< " "
|
||||
<< setw(20) << zone.name()
|
||||
|
||||
@ -4,10 +4,7 @@ Random rndGen(653213);
|
||||
List<treeBoundBox> meshBb
|
||||
(
|
||||
1,
|
||||
treeBoundBox
|
||||
(
|
||||
boundBox(coarseMesh.points(), false)
|
||||
).extend(rndGen, 1e-3)
|
||||
treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3)
|
||||
);
|
||||
|
||||
// Dummy bounds dictionary
|
||||
|
||||
@ -4,10 +4,7 @@ Random rndGen(653213);
|
||||
List<treeBoundBox> meshBb
|
||||
(
|
||||
1,
|
||||
treeBoundBox
|
||||
(
|
||||
boundBox(coarseMesh.points(), false)
|
||||
).extend(rndGen, 1e-3)
|
||||
treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3)
|
||||
);
|
||||
|
||||
// Dummy bounds dictionary
|
||||
|
||||
@ -178,12 +178,9 @@ void createBoundaryEdgeTrees
|
||||
// geometry there are less face/edge aligned items.
|
||||
treeBoundBox bb
|
||||
(
|
||||
treeBoundBox(UList<point>(surf.localPoints())).extend(rndGen, 1e-4)
|
||||
treeBoundBox(surf.localPoints()).extend(rndGen, 1e-4, ROOTVSMALL)
|
||||
);
|
||||
|
||||
bb.min() -= point::uniform(ROOTVSMALL);
|
||||
bb.max() += point::uniform(ROOTVSMALL);
|
||||
|
||||
bEdgeTrees.set
|
||||
(
|
||||
surfI,
|
||||
|
||||
@ -193,10 +193,7 @@ int main(int argc, char *argv[])
|
||||
meshBb[Pstream::myProcNo()] = List<treeBoundBox>
|
||||
(
|
||||
1,
|
||||
treeBoundBox
|
||||
(
|
||||
boundBox(mesh.points(), false)
|
||||
).extend(rndGen, 1e-3)
|
||||
treeBoundBox(mesh.points()).extend(rndGen, 1e-3)
|
||||
);
|
||||
Pstream::allGatherList(meshBb);
|
||||
}
|
||||
@ -243,7 +240,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
bbs = List<treeBoundBox>(1, treeBoundBox(boundBox::invertedBox));
|
||||
bbs = List<treeBoundBox>(1, treeBoundBox::null());
|
||||
}
|
||||
|
||||
dictionary dict;
|
||||
|
||||
Reference in New Issue
Block a user