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) 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<point>& 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::pointField> Foam::treeBoundBox::points() const
Foam::treeBoundBox Foam::treeBoundBox::subBbox(const direction octant) const
{
return subBbox(midpoint(), octant);
return subBbox(centre(), octant);
}

View File

@ -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

View File

@ -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<direction,8>& octantOrder
) const
{
vector dist = midpoint() - pt;
vector dist = centre() - pt;
direction octant = 0;

View File

@ -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;
}
}