ENH: minor consistency improvements for bounding box

- a valid() method (same as !empty() call) for consistency with other
  containers and data types

- a centre() method (same as midpoint() method) for consistency with
  other OpenFOAM geometric entities
This commit is contained in:
Mark Olesen
2019-01-09 09:32:23 +01:00
parent a0a7da2edd
commit 2067014079
26 changed files with 123 additions and 98 deletions

View File

@ -177,7 +177,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
{
volumeStatus[celli] = volumeType::MIXED;
}
else if (geometry.inside(cellBb.midpoint()))
else if (geometry.inside(cellBb.centre()))
{
volumeStatus[celli] = volumeType::INSIDE;
}
@ -296,7 +296,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
{
volumeStatus[celli] = volumeType::MIXED;
}
else if (geometry.inside(cellBb.midpoint()))
else if (geometry.inside(cellBb.centre()))
{
volumeStatus[celli] = volumeType::INSIDE;
}
@ -578,7 +578,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
// hitInfo[i].hitPoint()
// );
//
// // Info<< "cellBb.midpoint() " << cellBb.midpoint() << nl
// // Info<< "cellBb.centre() " << cellBb.centre() << nl
// // << samplePoints[i] << nl
// // << hitInfo[i] << nl
// // << "cellBb.span() " << cellBb.span() << nl
@ -603,10 +603,9 @@ bool Foam::backgroundMeshDecomposition::refineCell
else if (volType == volumeType::INSIDE)
{
// scalar s =
// foamyHexMesh_.cellShapeControl_.cellSize(cellBb.midpoint());
// foamyHexMesh_.cellShapeControl_.cellSize(cellBb.centre());
// Estimate the number of points in the cell by the size at the cell
// midpoint
// Estimate number of points in cell by the size at the cell centre
// weightEstimate = cellBb.volume()/pow3(s);
return false;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,6 +41,7 @@ addToRunTimeSelectionTable
dictionary
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::autoDensity::writeOBJ
@ -242,7 +243,7 @@ Foam::label Foam::autoDensity::recurseAndFill
}
}
}
else if (combinedInside(subBB.midpoint()))
else if (combinedInside(subBB.centre()))
{
if (debug)
{
@ -322,14 +323,14 @@ bool Foam::autoDensity::fillBox
// Check the nearest point on the surface to the box, if it is far
// enough away, then the surface sampling of the box can be skipped.
// Checking if the nearest piece of surface is at least 1.5*bb.span away
// from the bb.midpoint.
// from the bb.centre()
pointIndexHit surfHit;
label hitSurface;
geometry.findSurfaceNearest
(
bb.midpoint(),
bb.centre(),
2.25*magSqr(span),
surfHit,
hitSurface

View File

@ -199,7 +199,7 @@ public:
////- Surface intersects bb (but not using intersection test)
//scalar ccDist = signedDistance(bb.midpoint());
//scalar ccDist = signedDistance(bb.centre());
//scalar ccVal = ccDist - _iso_val;
//if (mag(ccVal) < SMALL)
//{