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

@ -64,7 +64,7 @@ void Foam::functionObjects::fieldExtents::calcFieldExtents
auto extents = [this](const scalarField& mask, const vectorField& C)
{
boundBox extents(boundBox::invertedBox);
boundBox extents;
forAll(mask, i)
{
if (mask[i] > 0.5)
@ -77,7 +77,7 @@ void Foam::functionObjects::fieldExtents::calcFieldExtents
if (extents.empty())
{
extents.add(point::zero);
extents.reset(point::zero);
}
return extents;
@ -97,7 +97,7 @@ void Foam::functionObjects::fieldExtents::calcFieldExtents
Log << " internal field: " << bb << nl;
file() << bb;
this->setResult(fieldName + "_internal_min" , bb.min());
this->setResult(fieldName + "_internal_min", bb.min());
this->setResult(fieldName + "_internal_max", bb.max());
}

View File

@ -927,7 +927,7 @@ bool Foam::functionObjects::streamLineBase::read(const dictionary& dict)
}
bounds_ = boundBox::invertedBox;
bounds_.reset();
if (dict.readIfPresent("bounds", bounds_) && !bounds_.empty())
{
Info<< " clipping all segments to " << bounds_ << nl << endl;

View File

@ -152,8 +152,8 @@ bool Foam::functionObjects::energySpectrum::read(const dictionary& dict)
// Assume all cells are the same size...
boundBox cellBb(mesh_.cellBb(0));
const vector L(meshBb.max() - meshBb.min());
const vector nCellXYZ(cmptDivide(L, cellBb.max() - cellBb.min()));
const vector L(meshBb.span());
const vector nCellXYZ(cmptDivide(L, cellBb.span()));
N_ = Vector<int>
(
@ -163,7 +163,7 @@ bool Foam::functionObjects::energySpectrum::read(const dictionary& dict)
);
// Check that the mesh is a structured box
vector cellDx(cellBb.max() - cellBb.min());
vector cellDx(cellBb.span());
vector expectedMax(N_.x()*cellDx.x(), N_.y()*cellDx.y(), N_.z()*cellDx.z());
vector relativeSize(cmptDivide(L, expectedMax));
for (direction i = 0; i < 3; ++i)
@ -183,8 +183,8 @@ bool Foam::functionObjects::energySpectrum::read(const dictionary& dict)
// Map into i-j-k co-ordinates
const vectorField& C = mesh_.C();
c0_ = returnReduce(min(C), minOp<vector>());
const vector cMax = returnReduce(max(C), maxOp<vector>());
deltaC_ = cMax - c0_;
deltaC_ = returnReduce(max(C), maxOp<vector>());
deltaC_ -= c0_;
forAll(C, celli)
{