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) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -177,14 +177,13 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
||||
const cell& c = cells[celli];
|
||||
|
||||
// determine bounding box of tgt cell
|
||||
boundBox cellBb(point::max, point::min);
|
||||
boundBox cellBb(boundBox::invertedBox);
|
||||
forAll(c, facei)
|
||||
{
|
||||
const face& f = faces[c[facei]];
|
||||
forAll(f, fp)
|
||||
{
|
||||
cellBb.min() = min(cellBb.min(), points[f[fp]]);
|
||||
cellBb.max() = max(cellBb.max(), points[f[fp]]);
|
||||
cellBb.add(points, f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -79,12 +79,9 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
|
||||
{
|
||||
bndFaces[nFaces++] = pp.start()+i;
|
||||
const face& f = pp[i];
|
||||
forAll(f, fp)
|
||||
{
|
||||
const point& pt = pp.points()[f[fp]];
|
||||
overallBb.min() = min(overallBb.min(), pt);
|
||||
overallBb.max() = max(overallBb.max(), pt);
|
||||
}
|
||||
|
||||
// Without reduction.
|
||||
overallBb.add(pp.points(), f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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.
|
||||
@ -74,7 +74,7 @@ void Foam::patchCloudSet::calcSamples
|
||||
|
||||
labelList patchFaces(sz);
|
||||
sz = 0;
|
||||
treeBoundBox bb(point::max, point::min);
|
||||
treeBoundBox bb(treeBoundBox::invertedBox);
|
||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||
{
|
||||
const polyPatch& pp = mesh().boundaryMesh()[iter.key()];
|
||||
@ -84,11 +84,8 @@ void Foam::patchCloudSet::calcSamples
|
||||
patchFaces[sz++] = pp.start()+i;
|
||||
}
|
||||
|
||||
// Do not do reduction.
|
||||
const boundBox patchBb(pp.points(), pp.meshPoints(), false);
|
||||
|
||||
bb.min() = min(bb.min(), patchBb.min());
|
||||
bb.max() = max(bb.max(), patchBb.max());
|
||||
// Without reduction.
|
||||
bb.add(pp.points(), pp.meshPoints());
|
||||
}
|
||||
|
||||
// Not very random
|
||||
@ -97,8 +94,8 @@ void Foam::patchCloudSet::calcSamples
|
||||
bb = bb.extend(rndGen, 1e-4);
|
||||
|
||||
// Make sure bb is 3D.
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.min() -= point::uniform(ROOTVSMALL);
|
||||
bb.max() += point::uniform(ROOTVSMALL);
|
||||
|
||||
|
||||
indexedOctree<treeDataFace> patchTree
|
||||
|
||||
@ -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) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -778,8 +778,8 @@ bool Foam::sampledTriSurfaceMesh::update()
|
||||
surface_.triSurface::points(),
|
||||
surface_.triSurface::meshPoints()
|
||||
);
|
||||
bb.min() = max(bb.min(), mesh().bounds().min());
|
||||
bb.max() = min(bb.max(), mesh().bounds().max());
|
||||
|
||||
bb.intersect(mesh().bounds());
|
||||
|
||||
// Extend a bit
|
||||
const vector span(bb.span());
|
||||
|
||||
Reference in New Issue
Block a user