ENH: add primitiveMesh cellBb()

- the boundBox for a given cell, using the cheapest calculation:

  - cellPoints if already available, since this will involve the
    fewest number of min/max comparisions.

  - otherwise walk the cell faces: via the cell box() method
    to avoid creating demand-driven cellPoints etc.
This commit is contained in:
Mark Olesen
2022-11-01 12:15:08 +01:00
committed by Andrew Heather
parent 27c2cdc040
commit 0ba458fdbc
12 changed files with 68 additions and 141 deletions

View File

@ -150,13 +150,7 @@ bool Foam::functionObjects::energySpectrum::read(const dictionary& dict)
const boundBox meshBb(mesh_.bounds());
// Assume all cells are the same size...
const cell& c = mesh_.cells()[0];
boundBox cellBb(boundBox::invertedBox);
forAll(c, facei)
{
const face& f = mesh_.faces()[c[facei]];
cellBb.add(mesh_.points(), f);
}
boundBox cellBb(mesh_.cellBb(0));
const vector L(meshBb.max() - meshBb.min());
const vector nCellXYZ(cmptDivide(L, cellBb.max() - cellBb.min()));