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

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,7 +53,7 @@ void Foam::sampledCuttingPlane::checkBoundsIntersection
) const
{
// Verify specified bounding box
if (!bounds_.empty())
if (bounds_.valid())
{
// Bounding box does not overlap with (global) mesh!
if (!bounds_.overlaps(meshBb))
@ -132,7 +132,7 @@ void Foam::sampledCuttingPlane::createGeometry()
// If we will use a fvMeshSubset so can apply bounds as well to make
// the initial selection smaller.
if (!bounds_.empty() && cellsToSelect.any())
if (bounds_.valid() && cellsToSelect.any())
{
const auto& cellCentres = fvm.C();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -147,7 +147,7 @@ Foam::sampledPlane::sampledPlane
<< " origin:" << origin()
<< " normal:" << normal();
if (!bounds_.empty())
if (bounds_.valid())
{
Info<< " bounds:" << bounds_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -146,7 +146,7 @@ Foam::surfMeshSamplePlane::surfMeshSamplePlane
<< " origin:" << origin()
<< " normal:" << normal();
if (!bounds_.empty())
if (bounds_.valid())
{
Info<< " bounds:" << bounds_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ void Foam::cuttingPlane::checkOverlap
const plane& pln = *this;
// Plane does not intersect the user bounding box
if (!userBounds.empty() && !userBounds.intersects(pln))
if (userBounds.valid() && !userBounds.intersects(pln))
{
WarningInFunction
<< nl << callerName

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,7 @@ void Foam::cuttingSurfaceBase::checkOverlap
)
{
// User bounding-box does not overlap with (global) mesh!
if (!userBounds.empty() && !userBounds.overlaps(meshBounds))
if (userBounds.valid() && !userBounds.overlaps(meshBounds))
{
WarningInFunction
<< nl << callerName

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1641,7 +1641,7 @@ Foam::isoSurface::isoSurface
DynamicList<label> trimTriMap;
// Trimmed to original point
labelList trimTriPointMap;
if (!bounds_.empty())
if (bounds_.valid())
{
trimToBox
(
@ -1674,7 +1674,7 @@ Foam::isoSurface::isoSurface
}
if (!bounds_.empty())
if (bounds_.valid())
{
// Adjust interpolatedPoints_
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1460,7 +1460,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
DynamicList<label> trimTriMap;
// Trimmed to original point
labelList trimTriPointMap;
if (!bounds_.empty())
if (bounds_.valid())
{
isoSurface::trimToBox
(
@ -1492,7 +1492,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
<< " merged triangles." << endl;
}
if (!bounds_.empty())
if (bounds_.valid())
{
// Adjust interpolatedPoints_
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);