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:
@ -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<const treeBoundBox>(*this) << exit(FatalError);
|
||||
<< static_cast<const treeBoundBox>(*this) << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
bounds() = static_cast<boundBox>(*this);
|
||||
@ -203,11 +204,12 @@ Foam::searchableBox::searchableBox
|
||||
searchableSurface(io),
|
||||
treeBoundBox(dict.get<point>("min"), dict.get<point>("max"))
|
||||
{
|
||||
if (!contains(midpoint()))
|
||||
if (!treeBoundBox::valid())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal bounding box specification : "
|
||||
<< static_cast<const treeBoundBox>(*this) << exit(FatalError);
|
||||
<< static_cast<const treeBoundBox>(*this) << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
bounds() = static_cast<boundBox>(*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)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user