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:
Mark Olesen
2022-11-01 12:15:08 +01:00
committed by Andrew Heather
parent 1339c3357b
commit e5006a62d7
60 changed files with 189 additions and 353 deletions

View File

@ -950,7 +950,7 @@ Foam::distributedTriSurfaceMesh::findBestProcs
// Minimum search distance to find the triangle
point near, far;
bbs[bbi].calcExtremities(centre, near, far);
minDistSqr = min(minDistSqr, magSqr(centre-far));
minDistSqr = min(minDistSqr, centre.distSqr(far));
}
}
}
@ -977,11 +977,11 @@ Foam::distributedTriSurfaceMesh::findBestProcs
point near, far;
bbs[bbi].calcExtremities(centre, near, far);
scalar d2 = magSqr(centre-near);
scalar d2 = centre.distSqr(near);
if (d2 < minDistSqr)
{
minDistSqr = d2;
maxDistSqr = min(radiusSqr, magSqr(centre-far));
maxDistSqr = min(radiusSqr, centre.distSqr(far));
minProci = proci;
}
}
@ -1748,12 +1748,11 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
// Initialise to inverted box
List<List<treeBoundBox>> bbs(Pstream::nProcs());
forAll(bbs, proci)
{
bbs[proci].setSize(1, treeBoundBox(boundBox::invertedBox));
}
List<List<treeBoundBox>> bbs
(
Pstream::nProcs(),
List<treeBoundBox>(1, treeBoundBox::null())
);
const globalIndex& triIndexer = globalTris();
@ -3735,7 +3734,7 @@ void Foam::distributedTriSurfaceMesh::findLineAll
const vectorField smallVec
(
ROOTSMALL*dirVec
+ vector(ROOTVSMALL,ROOTVSMALL,ROOTVSMALL)
+ vector::uniform(ROOTVSMALL)
);
// Copy to input and compact any hits

View File

@ -52,13 +52,13 @@ Foam::patchDistMethods::exact::patchSurface() const
Random rndGen(0);
boundBox localBb(mesh_.points(), false);
treeBoundBox localBb(mesh_.points());
// Determine mesh bounding boxes:
List<treeBoundBox> meshBb
(
1,
treeBoundBox(localBb).extend(rndGen, 1E-3)
localBb.extend(rndGen, 1E-3)
);
// Dummy bounds dictionary