mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -67,7 +67,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
pointField newPoints(mesh.points());
|
pointField newPoints(mesh.points());
|
||||||
|
|
||||||
const point half = meshBb.midpoint();
|
const point half = meshBb.centre();
|
||||||
|
|
||||||
forAll(newPoints, pointi)
|
forAll(newPoints, pointi)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -177,7 +177,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
|||||||
{
|
{
|
||||||
volumeStatus[celli] = volumeType::MIXED;
|
volumeStatus[celli] = volumeType::MIXED;
|
||||||
}
|
}
|
||||||
else if (geometry.inside(cellBb.midpoint()))
|
else if (geometry.inside(cellBb.centre()))
|
||||||
{
|
{
|
||||||
volumeStatus[celli] = volumeType::INSIDE;
|
volumeStatus[celli] = volumeType::INSIDE;
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
|||||||
{
|
{
|
||||||
volumeStatus[celli] = volumeType::MIXED;
|
volumeStatus[celli] = volumeType::MIXED;
|
||||||
}
|
}
|
||||||
else if (geometry.inside(cellBb.midpoint()))
|
else if (geometry.inside(cellBb.centre()))
|
||||||
{
|
{
|
||||||
volumeStatus[celli] = volumeType::INSIDE;
|
volumeStatus[celli] = volumeType::INSIDE;
|
||||||
}
|
}
|
||||||
@ -578,7 +578,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
|
|||||||
// hitInfo[i].hitPoint()
|
// hitInfo[i].hitPoint()
|
||||||
// );
|
// );
|
||||||
//
|
//
|
||||||
// // Info<< "cellBb.midpoint() " << cellBb.midpoint() << nl
|
// // Info<< "cellBb.centre() " << cellBb.centre() << nl
|
||||||
// // << samplePoints[i] << nl
|
// // << samplePoints[i] << nl
|
||||||
// // << hitInfo[i] << nl
|
// // << hitInfo[i] << nl
|
||||||
// // << "cellBb.span() " << cellBb.span() << nl
|
// // << "cellBb.span() " << cellBb.span() << nl
|
||||||
@ -603,10 +603,9 @@ bool Foam::backgroundMeshDecomposition::refineCell
|
|||||||
else if (volType == volumeType::INSIDE)
|
else if (volType == volumeType::INSIDE)
|
||||||
{
|
{
|
||||||
// scalar s =
|
// 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
|
// Estimate number of points in cell by the size at the cell centre
|
||||||
// midpoint
|
|
||||||
// weightEstimate = cellBb.volume()/pow3(s);
|
// weightEstimate = cellBb.volume()/pow3(s);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -41,6 +41,7 @@ addToRunTimeSelectionTable
|
|||||||
dictionary
|
dictionary
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::autoDensity::writeOBJ
|
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)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -322,14 +323,14 @@ bool Foam::autoDensity::fillBox
|
|||||||
// Check the nearest point on the surface to the box, if it is far
|
// 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.
|
// 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
|
// 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;
|
pointIndexHit surfHit;
|
||||||
label hitSurface;
|
label hitSurface;
|
||||||
|
|
||||||
geometry.findSurfaceNearest
|
geometry.findSurfaceNearest
|
||||||
(
|
(
|
||||||
bb.midpoint(),
|
bb.centre(),
|
||||||
2.25*magSqr(span),
|
2.25*magSqr(span),
|
||||||
surfHit,
|
surfHit,
|
||||||
hitSurface
|
hitSurface
|
||||||
|
|||||||
@ -199,7 +199,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
////- Surface intersects bb (but not using intersection test)
|
////- Surface intersects bb (but not using intersection test)
|
||||||
//scalar ccDist = signedDistance(bb.midpoint());
|
//scalar ccDist = signedDistance(bb.centre());
|
||||||
//scalar ccVal = ccDist - _iso_val;
|
//scalar ccVal = ccDist - _iso_val;
|
||||||
//if (mag(ccVal) < SMALL)
|
//if (mag(ccVal) < SMALL)
|
||||||
//{
|
//{
|
||||||
|
|||||||
@ -357,7 +357,7 @@ Foam::volumeType Foam::dynamicIndexedOctree<Type>::calcVolumeType
|
|||||||
|
|
||||||
subType = volumeType
|
subType = volumeType
|
||||||
(
|
(
|
||||||
shapes_.getVolumeType(*this, subBb.midpoint())
|
shapes_.getVolumeType(*this, subBb.centre())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -376,7 +376,7 @@ Foam::volumeType Foam::indexedOctree<Type>::calcVolumeType
|
|||||||
// of its bounding box.
|
// of its bounding box.
|
||||||
const treeBoundBox subBb = nod.bb_.subBbox(octant);
|
const treeBoundBox subBb = nod.bb_.subBbox(octant);
|
||||||
|
|
||||||
subType = shapes_.getVolumeType(*this, subBb.midpoint());
|
subType = shapes_.getVolumeType(*this, subBb.centre());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store octant type
|
// Store octant type
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -146,7 +146,7 @@ Foam::tmp<Foam::pointField> Foam::boundBox::faceCentres() const
|
|||||||
|
|
||||||
Foam::point Foam::boundBox::faceCentre(const direction facei) const
|
Foam::point Foam::boundBox::faceCentre(const direction facei) const
|
||||||
{
|
{
|
||||||
point pt = boundBox::midpoint();
|
point pt = boundBox::centre();
|
||||||
|
|
||||||
if (facei > 5)
|
if (facei > 5)
|
||||||
{
|
{
|
||||||
@ -190,7 +190,7 @@ bool Foam::boundBox::intersect(const boundBox& bb)
|
|||||||
min_ = ::Foam::max(min_, bb.min_);
|
min_ = ::Foam::max(min_, bb.min_);
|
||||||
max_ = ::Foam::min(max_, bb.max_);
|
max_ = ::Foam::min(max_, bb.max_);
|
||||||
|
|
||||||
return !empty();
|
return valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,7 +25,7 @@ Class
|
|||||||
Foam::boundBox
|
Foam::boundBox
|
||||||
|
|
||||||
Description
|
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
|
Note
|
||||||
When a bounding box is created without any points, it creates an inverted
|
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.
|
//- Bounding box is inverted, contains no points.
|
||||||
inline bool empty() const;
|
inline bool empty() const;
|
||||||
|
|
||||||
//- Clear bounding box of all points - make it an inverted box
|
//- Bounding box is non-inverted.
|
||||||
inline void clear();
|
inline bool valid() const;
|
||||||
|
|
||||||
//- Minimum describing the bounding box
|
//- Minimum describing the bounding box
|
||||||
inline const point& min() const;
|
inline const point& min() const;
|
||||||
@ -148,7 +148,10 @@ public:
|
|||||||
//- Maximum describing the bounding box, non-const access
|
//- Maximum describing the bounding box, non-const access
|
||||||
inline point& max();
|
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;
|
inline point midpoint() const;
|
||||||
|
|
||||||
//- The bounding box span (from minimum to maximum)
|
//- The bounding box span (from minimum to maximum)
|
||||||
@ -189,6 +192,9 @@ public:
|
|||||||
|
|
||||||
// Manipulate
|
// Manipulate
|
||||||
|
|
||||||
|
//- Clear bounding box and make it an inverted box
|
||||||
|
inline void clear();
|
||||||
|
|
||||||
//- Extend to include the second box.
|
//- Extend to include the second box.
|
||||||
inline void add(const boundBox& bb);
|
inline void add(const boundBox& bb);
|
||||||
|
|
||||||
@ -231,6 +237,7 @@ public:
|
|||||||
//- Parallel reduction of min/max values
|
//- Parallel reduction of min/max values
|
||||||
void reduce();
|
void reduce();
|
||||||
|
|
||||||
|
|
||||||
// Query
|
// Query
|
||||||
|
|
||||||
//- Intersection (union) with the second box.
|
//- Intersection (union) with the second box.
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
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();
|
// Check each component for max < min
|
||||||
max_ = invertedBox.max();
|
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
|
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)
|
inline void Foam::boundBox::add(const boundBox& bb)
|
||||||
{
|
{
|
||||||
min_ = ::Foam::min(min_, bb.min_);
|
min_ = ::Foam::min(min_, bb.min_);
|
||||||
@ -248,9 +269,9 @@ inline bool Foam::boundBox::contains(const point& pt) const
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
pt.x() >= min_.x() && pt.x() <= max_.x()
|
min_.x() <= pt.x() && pt.x() <= max_.x()
|
||||||
&& pt.y() >= min_.y() && pt.y() <= max_.y()
|
&& min_.y() <= pt.y() && pt.y() <= max_.y()
|
||||||
&& pt.z() >= min_.z() && pt.z() <= max_.z()
|
&& min_.z() <= pt.z() && pt.z() <= max_.z()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,9 +286,9 @@ inline bool Foam::boundBox::containsInside(const point& pt) const
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
pt.x() > min_.x() && pt.x() < max_.x()
|
min_.x() < pt.x() && pt.x() < max_.x()
|
||||||
&& pt.y() > min_.y() && pt.y() < max_.y()
|
&& min_.y() < pt.y() && pt.y() < max_.y()
|
||||||
&& pt.z() > min_.z() && pt.z() < max_.z()
|
&& min_.z() < pt.z() && pt.z() < max_.z()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -72,8 +72,11 @@ void Foam::boundBox::add
|
|||||||
const label len = points.size();
|
const label len = points.size();
|
||||||
|
|
||||||
// Skip if points is empty
|
// Skip if points is empty
|
||||||
if (len)
|
if (!len)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (const label pointi : indices)
|
for (const label pointi : indices)
|
||||||
{
|
{
|
||||||
if (pointi >= 0 && pointi < len)
|
if (pointi >= 0 && pointi < len)
|
||||||
@ -81,7 +84,6 @@ void Foam::boundBox::add
|
|||||||
add(points[pointi]);
|
add(points[pointi]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -95,8 +97,11 @@ void Foam::boundBox::add
|
|||||||
const label len = points.size();
|
const label len = points.size();
|
||||||
|
|
||||||
// Skip if points is empty
|
// Skip if points is empty
|
||||||
if (len)
|
if (!len)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (const label pointi : indices)
|
for (const label pointi : indices)
|
||||||
{
|
{
|
||||||
if (pointi >= 0 && pointi < len)
|
if (pointi >= 0 && pointi < len)
|
||||||
@ -104,7 +109,6 @@ void Foam::boundBox::add
|
|||||||
add(points[pointi]);
|
add(points[pointi]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -63,10 +63,7 @@ Foam::treeBoundBox::treeBoundBox(const UList<point>& points)
|
|||||||
if (points.empty())
|
if (points.empty())
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "cannot find bounding box for zero-sized pointField, "
|
<< "No bounding box for zero-sized pointField" << nl;
|
||||||
<< "returning zero" << endl;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,10 +79,7 @@ Foam::treeBoundBox::treeBoundBox
|
|||||||
if (points.empty() || indices.empty())
|
if (points.empty() || indices.empty())
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "cannot find bounding box for zero-sized pointField, "
|
<< "No bounding box for zero-sized pointField" << nl;
|
||||||
<< "returning zero" << endl;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +102,7 @@ Foam::tmp<Foam::pointField> Foam::treeBoundBox::points() const
|
|||||||
|
|
||||||
Foam::treeBoundBox Foam::treeBoundBox::subBbox(const direction octant) const
|
Foam::treeBoundBox Foam::treeBoundBox::subBbox(const direction octant) const
|
||||||
{
|
{
|
||||||
return subBbox(midpoint(), octant);
|
return subBbox(centre(), octant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ Class
|
|||||||
Foam::treeBoundBox
|
Foam::treeBoundBox
|
||||||
|
|
||||||
Description
|
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.
|
Numbering of corner points is according to octant numbering.
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null setting points to zero
|
//- Construct without any points - an inverted bounding box
|
||||||
inline treeBoundBox();
|
inline treeBoundBox();
|
||||||
|
|
||||||
//- Construct from a boundBox
|
//- Construct from a boundBox
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
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.
|
// Returns octant in which point resides. Reverse of subBbox.
|
||||||
inline Foam::direction Foam::treeBoundBox::subOctant(const point& pt) const
|
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
|
bool& onEdge
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return subOctant(midpoint(), pt, onEdge);
|
return subOctant(centre(), pt, onEdge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ inline void Foam::treeBoundBox::searchOrder
|
|||||||
FixedList<direction,8>& octantOrder
|
FixedList<direction,8>& octantOrder
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
vector dist = midpoint() - pt;
|
vector dist = centre() - pt;
|
||||||
|
|
||||||
direction octant = 0;
|
direction octant = 0;
|
||||||
|
|
||||||
|
|||||||
@ -41,10 +41,7 @@ Foam::treeBoundBox::treeBoundBox
|
|||||||
if (points.empty())
|
if (points.empty())
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "cannot find bounding box for zero-sized pointField, "
|
<< "No bounding box for zero-sized pointField" << nl;
|
||||||
<< "returning zero" << endl;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -351,7 +351,7 @@ void Foam::lumpedPointMovement::setBoundBox
|
|||||||
|
|
||||||
if (autoCentre_)
|
if (autoCentre_)
|
||||||
{
|
{
|
||||||
centre_ = boundBox_.midpoint();
|
centre_ = boundBox_.centre();
|
||||||
centre_ -= (centre_ & axis_) * axis_;
|
centre_ -= (centre_ & axis_) * axis_;
|
||||||
if (lumpedPointIOMovement::debug)
|
if (lumpedPointIOMovement::debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -183,11 +183,12 @@ Foam::searchableBox::searchableBox
|
|||||||
searchableSurface(io),
|
searchableSurface(io),
|
||||||
treeBoundBox(bb)
|
treeBoundBox(bb)
|
||||||
{
|
{
|
||||||
if (!contains(midpoint()))
|
if (!treeBoundBox::valid())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Illegal bounding box specification : "
|
<< "Illegal bounding box specification : "
|
||||||
<< static_cast<const treeBoundBox>(*this) << exit(FatalError);
|
<< static_cast<const treeBoundBox>(*this) << nl
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
bounds() = static_cast<boundBox>(*this);
|
bounds() = static_cast<boundBox>(*this);
|
||||||
@ -203,11 +204,12 @@ Foam::searchableBox::searchableBox
|
|||||||
searchableSurface(io),
|
searchableSurface(io),
|
||||||
treeBoundBox(dict.get<point>("min"), dict.get<point>("max"))
|
treeBoundBox(dict.get<point>("min"), dict.get<point>("max"))
|
||||||
{
|
{
|
||||||
if (!contains(midpoint()))
|
if (!treeBoundBox::valid())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Illegal bounding box specification : "
|
<< "Illegal bounding box specification : "
|
||||||
<< static_cast<const treeBoundBox>(*this) << exit(FatalError);
|
<< static_cast<const treeBoundBox>(*this) << nl
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
bounds() = static_cast<boundBox>(*this);
|
bounds() = static_cast<boundBox>(*this);
|
||||||
@ -291,7 +293,7 @@ Foam::pointIndexHit Foam::searchableBox::findNearest
|
|||||||
const scalar nearestDistSqr
|
const scalar nearestDistSqr
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return findNearest(midpoint(), sample, nearestDistSqr);
|
return findNearest(centre(), sample, nearestDistSqr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -301,7 +303,7 @@ Foam::pointIndexHit Foam::searchableBox::findNearestOnEdge
|
|||||||
const scalar nearestDistSqr
|
const scalar nearestDistSqr
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const point bbMid(midpoint());
|
const point bbMid(centre());
|
||||||
|
|
||||||
// Outside point projected onto cube. Assume faces 0..5.
|
// Outside point projected onto cube. Assume faces 0..5.
|
||||||
pointIndexHit info(true, sample, -1);
|
pointIndexHit info(true, sample, -1);
|
||||||
@ -459,7 +461,7 @@ void Foam::searchableBox::findNearest
|
|||||||
{
|
{
|
||||||
info.setSize(samples.size());
|
info.setSize(samples.size());
|
||||||
|
|
||||||
const point bbMid(midpoint());
|
const point bbMid(centre());
|
||||||
|
|
||||||
forAll(samples, i)
|
forAll(samples, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -87,7 +87,7 @@ Foam::searchableExtrudedCircle::searchableExtrudedCircle
|
|||||||
bounds() = boundBox(points, false);
|
bounds() = boundBox(points, false);
|
||||||
|
|
||||||
vector halfSpan(0.5*bounds().span());
|
vector halfSpan(0.5*bounds().span());
|
||||||
point ctr(bounds().midpoint());
|
point ctr(bounds().centre());
|
||||||
|
|
||||||
bounds().min() = ctr - mag(halfSpan) * vector::one;
|
bounds().min() = ctr - mag(halfSpan) * vector::one;
|
||||||
bounds().max() = ctr + mag(halfSpan) * vector::one;
|
bounds().max() = ctr + mag(halfSpan) * vector::one;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -195,7 +195,7 @@ void Foam::pointToPointPlanarInterpolation::calcWeights
|
|||||||
auto& localVertices = tlocalVertices.ref();
|
auto& localVertices = tlocalVertices.ref();
|
||||||
|
|
||||||
const boundBox bb(localVertices, true);
|
const boundBox bb(localVertices, true);
|
||||||
const point bbMid(bb.midpoint());
|
const point bbMid(bb.centre());
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -1985,7 +1985,7 @@ Foam::triSurface Foam::distributedTriSurfaceMesh::overlappingSurface
|
|||||||
const scalar eps = 1.0e-4;
|
const scalar eps = 1.0e-4;
|
||||||
forAll(bbs, i)
|
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);
|
const vector halfSpan = (1.0+eps)*(bbs[i].max() - mid);
|
||||||
|
|
||||||
bbsX[i].min() = mid - halfSpan;
|
bbsX[i].min() = mid - halfSpan;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -53,7 +53,7 @@ void Foam::sampledCuttingPlane::checkBoundsIntersection
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Verify specified bounding box
|
// Verify specified bounding box
|
||||||
if (!bounds_.empty())
|
if (bounds_.valid())
|
||||||
{
|
{
|
||||||
// Bounding box does not overlap with (global) mesh!
|
// Bounding box does not overlap with (global) mesh!
|
||||||
if (!bounds_.overlaps(meshBb))
|
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
|
// If we will use a fvMeshSubset so can apply bounds as well to make
|
||||||
// the initial selection smaller.
|
// the initial selection smaller.
|
||||||
if (!bounds_.empty() && cellsToSelect.any())
|
if (bounds_.valid() && cellsToSelect.any())
|
||||||
{
|
{
|
||||||
const auto& cellCentres = fvm.C();
|
const auto& cellCentres = fvm.C();
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -147,7 +147,7 @@ Foam::sampledPlane::sampledPlane
|
|||||||
<< " origin:" << origin()
|
<< " origin:" << origin()
|
||||||
<< " normal:" << normal();
|
<< " normal:" << normal();
|
||||||
|
|
||||||
if (!bounds_.empty())
|
if (bounds_.valid())
|
||||||
{
|
{
|
||||||
Info<< " bounds:" << bounds_;
|
Info<< " bounds:" << bounds_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -146,7 +146,7 @@ Foam::surfMeshSamplePlane::surfMeshSamplePlane
|
|||||||
<< " origin:" << origin()
|
<< " origin:" << origin()
|
||||||
<< " normal:" << normal();
|
<< " normal:" << normal();
|
||||||
|
|
||||||
if (!bounds_.empty())
|
if (bounds_.valid())
|
||||||
{
|
{
|
||||||
Info<< " bounds:" << bounds_;
|
Info<< " bounds:" << bounds_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -40,7 +40,7 @@ void Foam::cuttingPlane::checkOverlap
|
|||||||
const plane& pln = *this;
|
const plane& pln = *this;
|
||||||
|
|
||||||
// Plane does not intersect the user bounding box
|
// Plane does not intersect the user bounding box
|
||||||
if (!userBounds.empty() && !userBounds.intersects(pln))
|
if (userBounds.valid() && !userBounds.intersects(pln))
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< nl << callerName
|
<< nl << callerName
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -36,7 +36,7 @@ void Foam::cuttingSurfaceBase::checkOverlap
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// User bounding-box does not overlap with (global) mesh!
|
// User bounding-box does not overlap with (global) mesh!
|
||||||
if (!userBounds.empty() && !userBounds.overlaps(meshBounds))
|
if (userBounds.valid() && !userBounds.overlaps(meshBounds))
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< nl << callerName
|
<< nl << callerName
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -1641,7 +1641,7 @@ Foam::isoSurface::isoSurface
|
|||||||
DynamicList<label> trimTriMap;
|
DynamicList<label> trimTriMap;
|
||||||
// Trimmed to original point
|
// Trimmed to original point
|
||||||
labelList trimTriPointMap;
|
labelList trimTriPointMap;
|
||||||
if (!bounds_.empty())
|
if (bounds_.valid())
|
||||||
{
|
{
|
||||||
trimToBox
|
trimToBox
|
||||||
(
|
(
|
||||||
@ -1674,7 +1674,7 @@ Foam::isoSurface::isoSurface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!bounds_.empty())
|
if (bounds_.valid())
|
||||||
{
|
{
|
||||||
// Adjust interpolatedPoints_
|
// Adjust interpolatedPoints_
|
||||||
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);
|
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -1460,7 +1460,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
|
|||||||
DynamicList<label> trimTriMap;
|
DynamicList<label> trimTriMap;
|
||||||
// Trimmed to original point
|
// Trimmed to original point
|
||||||
labelList trimTriPointMap;
|
labelList trimTriPointMap;
|
||||||
if (!bounds_.empty())
|
if (bounds_.valid())
|
||||||
{
|
{
|
||||||
isoSurface::trimToBox
|
isoSurface::trimToBox
|
||||||
(
|
(
|
||||||
@ -1492,7 +1492,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
|
|||||||
<< " merged triangles." << endl;
|
<< " merged triangles." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bounds_.empty())
|
if (bounds_.valid())
|
||||||
{
|
{
|
||||||
// Adjust interpolatedPoints_
|
// Adjust interpolatedPoints_
|
||||||
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);
|
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);
|
||||||
|
|||||||
Reference in New Issue
Block a user