mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
boundBox, octree cleanup
- added boundBox(const tmp<pointField>&) constructor for use with
coordinate systems
- moved some methods from treeBoundBox to boundBox and use VectorSpace ops
This commit is contained in:
@ -26,9 +26,12 @@ License
|
||||
|
||||
#include "boundBox.H"
|
||||
#include "PstreamReduceOps.H"
|
||||
#include "tmp.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::scalar Foam::boundBox::great(VGREAT);
|
||||
|
||||
const Foam::boundBox Foam::boundBox::greatBox
|
||||
(
|
||||
point(-VGREAT, -VGREAT, -VGREAT),
|
||||
@ -43,16 +46,16 @@ const Foam::boundBox Foam::boundBox::invertedBox
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::boundBox::boundBox(const pointField& points, const bool doReduce)
|
||||
:
|
||||
min_(point::zero),
|
||||
max_(point::zero)
|
||||
void Foam::boundBox::calculate(const pointField& points, const bool doReduce)
|
||||
{
|
||||
if (points.size() == 0)
|
||||
{
|
||||
if (Pstream::parRun() && doReduce)
|
||||
min_ = point::zero;
|
||||
max_ = point::zero;
|
||||
|
||||
if (doReduce && Pstream::parRun())
|
||||
{
|
||||
// Use values that get overwritten by reduce minOp, maxOp below
|
||||
min_ = point(VGREAT, VGREAT, VGREAT);
|
||||
@ -64,22 +67,43 @@ Foam::boundBox::boundBox(const pointField& points, const bool doReduce)
|
||||
min_ = points[0];
|
||||
max_ = points[0];
|
||||
|
||||
forAll(points, i)
|
||||
for (label i = 1; i < points.size(); i++)
|
||||
{
|
||||
min_ = ::Foam::min(min_, points[i]);
|
||||
max_ = ::Foam::max(max_, points[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Reduce parallel information
|
||||
if (doReduce)
|
||||
{
|
||||
// Reduce parallel information
|
||||
reduce(min_, minOp<point>());
|
||||
reduce(max_, maxOp<point>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::boundBox::boundBox(const pointField& points, const bool doReduce)
|
||||
:
|
||||
min_(point::zero),
|
||||
max_(point::zero)
|
||||
{
|
||||
calculate(points, doReduce);
|
||||
}
|
||||
|
||||
|
||||
Foam::boundBox::boundBox(const tmp<pointField>& points, const bool doReduce)
|
||||
:
|
||||
min_(point::zero),
|
||||
max_(point::zero)
|
||||
{
|
||||
calculate(points(), doReduce);
|
||||
points.clear();
|
||||
}
|
||||
|
||||
|
||||
Foam::boundBox::boundBox(Istream& is)
|
||||
{
|
||||
operator>>(is, *this);
|
||||
|
||||
Reference in New Issue
Block a user