diff --git a/applications/test/wallDist/Test-wallDist.C b/applications/test/wallDist/Test-wallDist.C index 01cadb89ce..34ccbaf40b 100644 --- a/applications/test/wallDist/Test-wallDist.C +++ b/applications/test/wallDist/Test-wallDist.C @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) pointField newPoints(mesh.points()); - const point half = meshBb.midpoint(); + const point half = meshBb.centre(); forAll(newPoints, pointi) { diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C index d957c699c9..49f24def45 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C @@ -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; diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C index 3024190c2c..ef66a633b0 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C @@ -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 diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C index 94f7b4879f..3b9fc7c89f 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C @@ -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) //{ diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C index 9dca228407..10589ed333 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C @@ -357,7 +357,7 @@ Foam::volumeType Foam::dynamicIndexedOctree::calcVolumeType subType = volumeType ( - shapes_.getVolumeType(*this, subBb.midpoint()) + shapes_.getVolumeType(*this, subBb.centre()) ); } diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C index ca2bd12fb7..f5012f4885 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C @@ -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. @@ -376,7 +376,7 @@ Foam::volumeType Foam::indexedOctree::calcVolumeType // of its bounding box. const treeBoundBox subBb = nod.bb_.subBbox(octant); - subType = shapes_.getVolumeType(*this, subBb.midpoint()); + subType = shapes_.getVolumeType(*this, subBb.centre()); } // Store octant type diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.C b/src/OpenFOAM/meshes/boundBox/boundBox.C index 0ce92a29cb..0ad8cf6d28 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.C +++ b/src/OpenFOAM/meshes/boundBox/boundBox.C @@ -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. @@ -146,7 +146,7 @@ Foam::tmp Foam::boundBox::faceCentres() const Foam::point Foam::boundBox::faceCentre(const direction facei) const { - point pt = boundBox::midpoint(); + point pt = boundBox::centre(); if (facei > 5) { @@ -190,7 +190,7 @@ bool Foam::boundBox::intersect(const boundBox& bb) min_ = ::Foam::max(min_, bb.min_); max_ = ::Foam::min(max_, bb.max_); - return !empty(); + return valid(); } diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.H b/src/OpenFOAM/meshes/boundBox/boundBox.H index 30c6e1dd63..8fbd5f0321 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.H +++ b/src/OpenFOAM/meshes/boundBox/boundBox.H @@ -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. @@ -25,7 +25,7 @@ Class Foam::boundBox Description - A bounding box defined in terms of the points at its extremities. + A bounding box defined in terms of min/max extrema points. Note When a bounding box is created without any points, it creates an inverted @@ -133,8 +133,8 @@ public: //- Bounding box is inverted, contains no points. inline bool empty() const; - //- Clear bounding box of all points - make it an inverted box - inline void clear(); + //- Bounding box is non-inverted. + inline bool valid() const; //- Minimum describing the bounding box inline const point& min() const; @@ -148,7 +148,10 @@ public: //- Maximum describing the bounding box, non-const access inline point& max(); - //- The midpoint of the bounding box + //- The centre (midpoint) of the bounding box + inline point centre() const; + + //- The midpoint (centre) of the bounding box. Identical to centre() inline point midpoint() const; //- The bounding box span (from minimum to maximum) @@ -189,6 +192,9 @@ public: // Manipulate + //- Clear bounding box and make it an inverted box + inline void clear(); + //- Extend to include the second box. inline void add(const boundBox& bb); @@ -231,6 +237,7 @@ public: //- Parallel reduction of min/max values void reduce(); + // Query //- Intersection (union) with the second box. diff --git a/src/OpenFOAM/meshes/boundBox/boundBoxI.H b/src/OpenFOAM/meshes/boundBox/boundBoxI.H index aa95e05411..1a1cc1b0b5 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBoxI.H +++ b/src/OpenFOAM/meshes/boundBox/boundBoxI.H @@ -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. @@ -70,10 +70,18 @@ inline bool Foam::boundBox::empty() const } -inline void Foam::boundBox::clear() +inline bool Foam::boundBox::valid() const { - min_ = invertedBox.min(); - max_ = invertedBox.max(); + // Check each component for max < min + for (direction dir = 0; dir < vector::nComponents; ++dir) + { + if (max_[dir] < min_[dir]) + { + return false; + } + } + + return true; } @@ -101,9 +109,15 @@ inline Foam::point& Foam::boundBox::max() } +inline Foam::point Foam::boundBox::centre() const +{ + return 0.5 * (min_ + max_); +} + + inline Foam::point Foam::boundBox::midpoint() const { - return 0.5 * (max_ + min_); + return this->centre(); } @@ -164,6 +178,13 @@ Foam::label Foam::boundBox::nDim() const } +inline void Foam::boundBox::clear() +{ + min_ = invertedBox.min(); + max_ = invertedBox.max(); +} + + inline void Foam::boundBox::add(const boundBox& bb) { min_ = ::Foam::min(min_, bb.min_); @@ -248,9 +269,9 @@ inline bool Foam::boundBox::contains(const point& pt) const { return ( - pt.x() >= min_.x() && pt.x() <= max_.x() - && pt.y() >= min_.y() && pt.y() <= max_.y() - && pt.z() >= min_.z() && pt.z() <= max_.z() + min_.x() <= pt.x() && pt.x() <= max_.x() + && min_.y() <= pt.y() && pt.y() <= max_.y() + && min_.z() <= pt.z() && pt.z() <= max_.z() ); } @@ -265,9 +286,9 @@ inline bool Foam::boundBox::containsInside(const point& pt) const { return ( - pt.x() > min_.x() && pt.x() < max_.x() - && pt.y() > min_.y() && pt.y() < max_.y() - && pt.z() > min_.z() && pt.z() < max_.z() + min_.x() < pt.x() && pt.x() < max_.x() + && min_.y() < pt.y() && pt.y() < max_.y() + && min_.z() < pt.z() && pt.z() < max_.z() ); } diff --git a/src/OpenFOAM/meshes/boundBox/boundBoxTemplates.C b/src/OpenFOAM/meshes/boundBox/boundBoxTemplates.C index 80a0fe3c5f..207e8856c8 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBoxTemplates.C +++ b/src/OpenFOAM/meshes/boundBox/boundBoxTemplates.C @@ -72,14 +72,16 @@ void Foam::boundBox::add const label len = points.size(); // Skip if points is empty - if (len) + if (!len) { - for (const label pointi : indices) + return; + } + + for (const label pointi : indices) + { + if (pointi >= 0 && pointi < len) { - if (pointi >= 0 && pointi < len) - { - add(points[pointi]); - } + add(points[pointi]); } } } @@ -95,14 +97,16 @@ void Foam::boundBox::add const label len = points.size(); // Skip if points is empty - if (len) + if (!len) { - for (const label pointi : indices) + return; + } + + for (const label pointi : indices) + { + if (pointi >= 0 && pointi < len) { - if (pointi >= 0 && pointi < len) - { - add(points[pointi]); - } + add(points[pointi]); } } } diff --git a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C index ffc6856d80..f9d272e7aa 100644 --- a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C +++ b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C @@ -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 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,10 +63,7 @@ Foam::treeBoundBox::treeBoundBox(const UList& points) if (points.empty()) { WarningInFunction - << "cannot find bounding box for zero-sized pointField, " - << "returning zero" << endl; - - return; + << "No bounding box for zero-sized pointField" << nl; } } @@ -82,10 +79,7 @@ Foam::treeBoundBox::treeBoundBox if (points.empty() || indices.empty()) { WarningInFunction - << "cannot find bounding box for zero-sized pointField, " - << "returning zero" << endl; - - return; + << "No bounding box for zero-sized pointField" << nl; } } @@ -108,7 +102,7 @@ Foam::tmp Foam::treeBoundBox::points() const Foam::treeBoundBox Foam::treeBoundBox::subBbox(const direction octant) const { - return subBbox(midpoint(), octant); + return subBbox(centre(), octant); } diff --git a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H index ba7a57dc2c..e5a9a57ef8 100644 --- a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H +++ b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H @@ -25,7 +25,7 @@ Class Foam::treeBoundBox Description - Standard boundBox + extra functionality for use in octree. + Standard boundBox with extra functionality for use in octree. Numbering of corner points is according to octant numbering. @@ -153,7 +153,7 @@ public: // Constructors - //- Construct null setting points to zero + //- Construct without any points - an inverted bounding box inline treeBoundBox(); //- Construct from a boundBox diff --git a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBoxI.H b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBoxI.H index ea6cc3328a..f9d99149cc 100644 --- a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBoxI.H +++ b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBoxI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -80,7 +80,7 @@ inline Foam::point Foam::treeBoundBox::corner(const direction octant) const // Returns octant in which point resides. Reverse of subBbox. inline Foam::direction Foam::treeBoundBox::subOctant(const point& pt) const { - return subOctant(midpoint(), pt); + return subOctant(centre(), pt); } @@ -121,7 +121,7 @@ inline Foam::direction Foam::treeBoundBox::subOctant bool& onEdge ) const { - return subOctant(midpoint(), pt, onEdge); + return subOctant(centre(), pt, onEdge); } @@ -234,7 +234,7 @@ inline void Foam::treeBoundBox::searchOrder FixedList& octantOrder ) const { - vector dist = midpoint() - pt; + vector dist = centre() - pt; direction octant = 0; diff --git a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBoxTemplates.C b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBoxTemplates.C index b96ba178e0..77cdab6736 100644 --- a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBoxTemplates.C +++ b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBoxTemplates.C @@ -41,10 +41,7 @@ Foam::treeBoundBox::treeBoundBox if (points.empty()) { WarningInFunction - << "cannot find bounding box for zero-sized pointField, " - << "returning zero" << endl; - - return; + << "No bounding box for zero-sized pointField" << nl; } } diff --git a/src/lumpedPointMotion/lumpedPointMovement.C b/src/lumpedPointMotion/lumpedPointMovement.C index a04cd7b142..fd0d671b1b 100644 --- a/src/lumpedPointMotion/lumpedPointMovement.C +++ b/src/lumpedPointMotion/lumpedPointMovement.C @@ -351,7 +351,7 @@ void Foam::lumpedPointMovement::setBoundBox if (autoCentre_) { - centre_ = boundBox_.midpoint(); + centre_ = boundBox_.centre(); centre_ -= (centre_ & axis_) * axis_; if (lumpedPointIOMovement::debug) { diff --git a/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C b/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C index d3daaa1852..5b01679047 100644 --- a/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C +++ b/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C @@ -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) 2018 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -183,11 +183,12 @@ Foam::searchableBox::searchableBox searchableSurface(io), treeBoundBox(bb) { - if (!contains(midpoint())) + if (!treeBoundBox::valid()) { FatalErrorInFunction << "Illegal bounding box specification : " - << static_cast(*this) << exit(FatalError); + << static_cast(*this) << nl + << exit(FatalError); } bounds() = static_cast(*this); @@ -203,11 +204,12 @@ Foam::searchableBox::searchableBox searchableSurface(io), treeBoundBox(dict.get("min"), dict.get("max")) { - if (!contains(midpoint())) + if (!treeBoundBox::valid()) { FatalErrorInFunction << "Illegal bounding box specification : " - << static_cast(*this) << exit(FatalError); + << static_cast(*this) << nl + << exit(FatalError); } bounds() = static_cast(*this); @@ -291,7 +293,7 @@ Foam::pointIndexHit Foam::searchableBox::findNearest const scalar nearestDistSqr ) const { - return findNearest(midpoint(), sample, nearestDistSqr); + return findNearest(centre(), sample, nearestDistSqr); } @@ -301,7 +303,7 @@ Foam::pointIndexHit Foam::searchableBox::findNearestOnEdge const scalar nearestDistSqr ) const { - const point bbMid(midpoint()); + const point bbMid(centre()); // Outside point projected onto cube. Assume faces 0..5. pointIndexHit info(true, sample, -1); @@ -459,7 +461,7 @@ void Foam::searchableBox::findNearest { info.setSize(samples.size()); - const point bbMid(midpoint()); + const point bbMid(centre()); forAll(samples, i) { diff --git a/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.C b/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.C index 226c782d49..75c040e810 100644 --- a/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.C +++ b/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -87,7 +87,7 @@ Foam::searchableExtrudedCircle::searchableExtrudedCircle bounds() = boundBox(points, false); vector halfSpan(0.5*bounds().span()); - point ctr(bounds().midpoint()); + point ctr(bounds().centre()); bounds().min() = ctr - mag(halfSpan) * vector::one; bounds().max() = ctr + mag(halfSpan) * vector::one; diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C index 6c16efd3eb..0526b677bd 100644 --- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C +++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -195,7 +195,7 @@ void Foam::pointToPointPlanarInterpolation::calcWeights auto& localVertices = tlocalVertices.ref(); const boundBox bb(localVertices, true); - const point bbMid(bb.midpoint()); + const point bbMid(bb.centre()); if (debug) { diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C index 57fe3e803e..8f048ca538 100644 --- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C +++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C @@ -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) 2015-2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1985,7 +1985,7 @@ Foam::triSurface Foam::distributedTriSurfaceMesh::overlappingSurface const scalar eps = 1.0e-4; forAll(bbs, i) { - const point mid = bbs[i].midpoint(); + const point mid = bbs[i].centre(); const vector halfSpan = (1.0+eps)*(bbs[i].max() - mid); bbsX[i].min() = mid - halfSpan; diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C index 661dc7b31f..80b8e5f382 100644 --- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C +++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C @@ -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(); diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C index 32720169cf..1e2b6a7007 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C @@ -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_; } diff --git a/src/sampling/surfMeshSample/plane/surfMeshSamplePlane.C b/src/sampling/surfMeshSample/plane/surfMeshSamplePlane.C index 59eb7d33b9..9a907c5fc4 100644 --- a/src/sampling/surfMeshSample/plane/surfMeshSamplePlane.C +++ b/src/sampling/surfMeshSample/plane/surfMeshSamplePlane.C @@ -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_; } diff --git a/src/sampling/surface/cutting/cuttingPlaneSelection.C b/src/sampling/surface/cutting/cuttingPlaneSelection.C index 5daf6099d1..4e4819e0ec 100644 --- a/src/sampling/surface/cutting/cuttingPlaneSelection.C +++ b/src/sampling/surface/cutting/cuttingPlaneSelection.C @@ -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 diff --git a/src/sampling/surface/cutting/cuttingSurfaceBaseSelection.C b/src/sampling/surface/cutting/cuttingSurfaceBaseSelection.C index 3e4829a688..f423b8d740 100644 --- a/src/sampling/surface/cutting/cuttingSurfaceBaseSelection.C +++ b/src/sampling/surface/cutting/cuttingSurfaceBaseSelection.C @@ -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 diff --git a/src/sampling/surface/isoSurface/isoSurface.C b/src/sampling/surface/isoSurface/isoSurface.C index 1efeaec9c1..2d84fa7411 100644 --- a/src/sampling/surface/isoSurface/isoSurface.C +++ b/src/sampling/surface/isoSurface/isoSurface.C @@ -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