mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: additional methods/operators for boundBox (related to #196)
- Constructor for bounding box of a single point.
- add(boundBox), add(point) ...
-> Extend box to enclose the second box or point(s).
Eg,
bb.add(pt);
vs.
bb.min() = Foam::min(bb.min(), pt);
bb.max() = Foam::max(bb.max(), pt);
Also works with other bounding boxes.
Eg,
bb.add(bb2);
// OR
bb += bb2;
vs.
bb.min() = Foam::min(bb.min(), bb2.min());
bb.max() = Foam::max(bb.max(), bb2.max());
'+=' operator allows the reduction to be used in parallel
gather/scatter operations.
A global '+' operator is not currently needed.
Note: may be useful in the future to have a 'clear()' method
that resets to a zero-sized (inverted) box.
STYLE: make many bounding box constructors explicit
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 |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,20 +41,7 @@ namespace Foam
|
||||
|
||||
Foam::treeBoundBox Foam::treeDataFace::calcBb(const label facei) const
|
||||
{
|
||||
const pointField& points = mesh_.points();
|
||||
|
||||
const face& f = mesh_.faces()[facei];
|
||||
|
||||
treeBoundBox bb(points[f[0]], points[f[0]]);
|
||||
|
||||
for (label fp = 1; fp < f.size(); fp++)
|
||||
{
|
||||
const point& p = points[f[fp]];
|
||||
|
||||
bb.min() = min(bb.min(), p);
|
||||
bb.max() = max(bb.max(), p);
|
||||
}
|
||||
return bb;
|
||||
return treeBoundBox(mesh_.points(), mesh_.faces()[facei]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user