mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-bbox-improvements' into 'develop'
Feature bbox improvements See merge request !92
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -40,8 +40,8 @@ boundBox cube(scalar start, scalar width)
|
|||||||
{
|
{
|
||||||
return boundBox
|
return boundBox
|
||||||
(
|
(
|
||||||
point(start, start, start),
|
point::uniform(start),
|
||||||
point(start + width, start + width, start + width)
|
point::uniform(start + width)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +59,69 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<<"boundBox faces: " << boundBox::faces << endl;
|
Info<<"boundBox faces: " << boundBox::faces << endl;
|
||||||
Info<<"hex faces: " << hex.modelFaces() << endl;
|
Info<<"hex faces: " << hex.modelFaces() << endl;
|
||||||
|
Info<<"tree-bb faces: " << treeBoundBox::faces << endl;
|
||||||
|
Info<<"tree-bb edges: " << treeBoundBox::edges << endl;
|
||||||
|
|
||||||
|
boundBox bb = boundBox::greatBox;
|
||||||
|
Info<<"great box: " << bb << endl;
|
||||||
|
|
||||||
|
// bb.clear();
|
||||||
|
// Info<<"zero box: " << bb << endl;
|
||||||
|
|
||||||
|
bb = boundBox::invertedBox;
|
||||||
|
Info<<"invalid box: " << bb << endl;
|
||||||
|
Info<< nl << endl;
|
||||||
|
|
||||||
|
if (Pstream::parRun())
|
||||||
|
{
|
||||||
|
bb = cube(Pstream::myProcNo(), 1.1);
|
||||||
|
Pout<<"box: " << bb << endl;
|
||||||
|
|
||||||
|
bb.reduce();
|
||||||
|
Pout<<"reduced: " << bb << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bb = cube(0, 1);
|
||||||
|
Info<<"starting box: " << bb << endl;
|
||||||
|
|
||||||
|
point pt(Zero);
|
||||||
|
bb.add(pt);
|
||||||
|
Info<<"enclose point " << pt << " -> " << bb << endl;
|
||||||
|
|
||||||
|
pt = point(0,1.5,0.5);
|
||||||
|
bb.add(pt);
|
||||||
|
Info<<"enclose point " << pt << " -> " << bb << endl;
|
||||||
|
|
||||||
|
pt = point(5,2,-2);
|
||||||
|
bb.add(pt);
|
||||||
|
Info<<"enclose point " << pt << " -> " << bb << endl;
|
||||||
|
|
||||||
|
// restart with same points
|
||||||
|
bb = boundBox::invertedBox;
|
||||||
|
bb.add(point(1,1,1));
|
||||||
|
bb.add(point::zero);
|
||||||
|
bb.add(point(0,1.5,0.5));
|
||||||
|
bb.add(point(5,2,-2));
|
||||||
|
|
||||||
|
Info<<"repeated " << bb << endl;
|
||||||
|
|
||||||
|
boundBox box1 = cube(0, 1);
|
||||||
|
boundBox box2 = cube(0, 0.75);
|
||||||
|
boundBox box3 = cube(0.5, 1);
|
||||||
|
boundBox box4 = cube(-1, 0.5);
|
||||||
|
|
||||||
|
Info<<"union of " << box1 << " and " << box2 << " => ";
|
||||||
|
|
||||||
|
box1.add(box2);
|
||||||
|
Info<< box1 << endl;
|
||||||
|
|
||||||
|
box1.add(box3);
|
||||||
|
Info<<"union with " << box3 << " => " << box1 << endl;
|
||||||
|
|
||||||
|
box1.add(box4);
|
||||||
|
Info<<"union with " << box4 << " => " << box1 << endl;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,14 +66,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
pointField newPoints(mesh.points());
|
pointField newPoints(mesh.points());
|
||||||
|
|
||||||
const point half(0.5*(meshBb.min() + meshBb.max()));
|
const point half = meshBb.midpoint();
|
||||||
|
|
||||||
forAll(newPoints, pointi)
|
forAll(newPoints, pointi)
|
||||||
{
|
{
|
||||||
point& pt = newPoints[pointi];
|
point& pt = newPoints[pointi];
|
||||||
|
|
||||||
// expand around half
|
// expand around half
|
||||||
pt.y() += pt.y() - half.y();
|
pt.y() += pt.y() - half.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh.movePoints(newPoints);
|
mesh.movePoints(newPoints);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -719,17 +719,13 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
|
|||||||
Pstream::gatherList(allBackgroundMeshBounds_);
|
Pstream::gatherList(allBackgroundMeshBounds_);
|
||||||
Pstream::scatterList(allBackgroundMeshBounds_);
|
Pstream::scatterList(allBackgroundMeshBounds_);
|
||||||
|
|
||||||
point bbMin(GREAT, GREAT, GREAT);
|
// find global bounding box
|
||||||
point bbMax(-GREAT, -GREAT, -GREAT);
|
globalBackgroundBounds_ = treeBoundBox(boundBox::invertedBox);
|
||||||
|
|
||||||
forAll(allBackgroundMeshBounds_, proci)
|
forAll(allBackgroundMeshBounds_, proci)
|
||||||
{
|
{
|
||||||
bbMin = min(bbMin, allBackgroundMeshBounds_[proci].min());
|
globalBackgroundBounds_.add(allBackgroundMeshBounds_[proci]);
|
||||||
bbMax = max(bbMax, allBackgroundMeshBounds_[proci].max());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
globalBackgroundBounds_ = treeBoundBox(bbMin, bbMax);
|
|
||||||
|
|
||||||
if (false)
|
if (false)
|
||||||
{
|
{
|
||||||
OFstream fStr
|
OFstream fStr
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -558,19 +558,11 @@ Foam::label Foam::checkTopology
|
|||||||
|
|
||||||
if (allGeometry)
|
if (allGeometry)
|
||||||
{
|
{
|
||||||
const pointField& pts = pp.points();
|
|
||||||
const labelList& mp = pp.meshPoints();
|
const labelList& mp = pp.meshPoints();
|
||||||
|
|
||||||
if (returnReduce(mp.size(), sumOp<label>()) > 0)
|
if (returnReduce(mp.size(), sumOp<label>()) > 0)
|
||||||
{
|
{
|
||||||
boundBox bb(point::max, point::min);
|
boundBox bb(pp.points(), mp, true); // reduce
|
||||||
forAll(mp, i)
|
|
||||||
{
|
|
||||||
bb.min() = min(bb.min(), pts[mp[i]]);
|
|
||||||
bb.max() = max(bb.max(), pts[mp[i]]);
|
|
||||||
}
|
|
||||||
reduce(bb.min(), minOp<vector>());
|
|
||||||
reduce(bb.max(), maxOp<vector>());
|
|
||||||
Info<< ' ' << bb;
|
Info<< ' ' << bb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -336,10 +336,7 @@ boundBox procBounds
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
boundBox domainBb(points, false);
|
bb.add(points);
|
||||||
|
|
||||||
bb.min() = min(bb.min(), domainBb.min());
|
|
||||||
bb.max() = max(bb.max(), domainBb.max());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bb;
|
return bb;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,105 +24,62 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "ListOps.H"
|
|
||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
#include "tmp.H"
|
#include "tmp.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::scalar Foam::boundBox::great(VGREAT);
|
|
||||||
|
|
||||||
const Foam::boundBox Foam::boundBox::greatBox
|
const Foam::boundBox Foam::boundBox::greatBox
|
||||||
(
|
(
|
||||||
point(-VGREAT, -VGREAT, -VGREAT),
|
point::uniform(-ROOTVGREAT),
|
||||||
point(VGREAT, VGREAT, VGREAT)
|
point::uniform(ROOTVGREAT)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
const Foam::boundBox Foam::boundBox::invertedBox
|
const Foam::boundBox Foam::boundBox::invertedBox
|
||||||
(
|
(
|
||||||
point(VGREAT, VGREAT, VGREAT),
|
point::uniform(ROOTVGREAT),
|
||||||
point(-VGREAT, -VGREAT, -VGREAT)
|
point::uniform(-ROOTVGREAT)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//! \cond ignoreDocumentation
|
|
||||||
//- Skip documentation : local scope only
|
|
||||||
const Foam::label facesArray[6][4] =
|
|
||||||
{
|
|
||||||
// point and face order as per hex cellmodel
|
|
||||||
{0, 4, 7, 3}, // x-min
|
|
||||||
{1, 2, 6, 5}, // x-max
|
|
||||||
{0, 1, 5, 4}, // y-min
|
|
||||||
{3, 7, 6, 2}, // y-max
|
|
||||||
{0, 3, 2, 1}, // z-min
|
|
||||||
{4, 5, 6, 7} // z-max
|
|
||||||
};
|
|
||||||
//! \endcond
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::faceList Foam::boundBox::faces
|
const Foam::faceList Foam::boundBox::faces
|
||||||
(
|
({
|
||||||
initListList<face, label, 6, 4>(facesArray)
|
// Point and face order as per hex cellmodel
|
||||||
);
|
face{0, 4, 7, 3}, // x-min
|
||||||
|
face{1, 2, 6, 5}, // x-max
|
||||||
|
face{0, 1, 5, 4}, // y-min
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
face{3, 7, 6, 2}, // y-max
|
||||||
|
face{0, 3, 2, 1}, // z-min
|
||||||
void Foam::boundBox::calculate(const UList<point>& points, const bool doReduce)
|
face{4, 5, 6, 7} // z-max
|
||||||
{
|
});
|
||||||
if (points.empty())
|
|
||||||
{
|
|
||||||
min_ = Zero;
|
|
||||||
max_ = Zero;
|
|
||||||
|
|
||||||
if (doReduce && Pstream::parRun())
|
|
||||||
{
|
|
||||||
// Use values that get overwritten by reduce minOp, maxOp below
|
|
||||||
min_ = point(VGREAT, VGREAT, VGREAT);
|
|
||||||
max_ = point(-VGREAT, -VGREAT, -VGREAT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
min_ = points[0];
|
|
||||||
max_ = points[0];
|
|
||||||
|
|
||||||
|
|
||||||
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(min_, minOp<point>());
|
|
||||||
reduce(max_, maxOp<point>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::boundBox::boundBox(const UList<point>& points, const bool doReduce)
|
Foam::boundBox::boundBox(const UList<point>& points, bool doReduce)
|
||||||
:
|
:
|
||||||
min_(Zero),
|
min_(invertedBox.min()),
|
||||||
max_(Zero)
|
max_(invertedBox.max())
|
||||||
{
|
{
|
||||||
calculate(points, doReduce);
|
add(points);
|
||||||
|
|
||||||
|
if (doReduce)
|
||||||
|
{
|
||||||
|
reduce();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::boundBox::boundBox(const tmp<pointField>& points, const bool doReduce)
|
Foam::boundBox::boundBox(const tmp<pointField>& tpoints, bool doReduce)
|
||||||
:
|
:
|
||||||
min_(Zero),
|
min_(invertedBox.min()),
|
||||||
max_(Zero)
|
max_(invertedBox.max())
|
||||||
{
|
{
|
||||||
calculate(points(), doReduce);
|
add(tpoints);
|
||||||
points.clear();
|
|
||||||
|
if (doReduce)
|
||||||
|
{
|
||||||
|
reduce();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -130,38 +87,17 @@ Foam::boundBox::boundBox
|
|||||||
(
|
(
|
||||||
const UList<point>& points,
|
const UList<point>& points,
|
||||||
const labelUList& indices,
|
const labelUList& indices,
|
||||||
const bool doReduce
|
bool doReduce
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
min_(Zero),
|
min_(invertedBox.min()),
|
||||||
max_(Zero)
|
max_(invertedBox.max())
|
||||||
{
|
{
|
||||||
if (points.empty() || indices.empty())
|
add(points, indices);
|
||||||
{
|
|
||||||
if (doReduce && Pstream::parRun())
|
|
||||||
{
|
|
||||||
// Use values that get overwritten by reduce minOp, maxOp below
|
|
||||||
min_ = point(VGREAT, VGREAT, VGREAT);
|
|
||||||
max_ = point(-VGREAT, -VGREAT, -VGREAT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
min_ = points[indices[0]];
|
|
||||||
max_ = points[indices[0]];
|
|
||||||
|
|
||||||
for (label i=1; i < indices.size(); ++i)
|
|
||||||
{
|
|
||||||
min_ = ::Foam::min(min_, points[indices[i]]);
|
|
||||||
max_ = ::Foam::max(max_, points[indices[i]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reduce parallel information
|
|
||||||
if (doReduce)
|
if (doReduce)
|
||||||
{
|
{
|
||||||
reduce(min_, minOp<point>());
|
reduce();
|
||||||
reduce(max_, maxOp<point>());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,8 +106,8 @@ Foam::boundBox::boundBox
|
|||||||
|
|
||||||
Foam::tmp<Foam::pointField> Foam::boundBox::points() const
|
Foam::tmp<Foam::pointField> Foam::boundBox::points() const
|
||||||
{
|
{
|
||||||
tmp<pointField> tPts = tmp<pointField>(new pointField(8));
|
tmp<pointField> tpoints = tmp<pointField>(new pointField(8));
|
||||||
pointField& pt = tPts.ref();
|
pointField& pt = tpoints.ref();
|
||||||
|
|
||||||
pt[0] = min_; // min-x, min-y, min-z
|
pt[0] = min_; // min-x, min-y, min-z
|
||||||
pt[1] = point(max_.x(), min_.y(), min_.z()); // max-x, min-y, min-z
|
pt[1] = point(max_.x(), min_.y(), min_.z()); // max-x, min-y, min-z
|
||||||
@ -182,19 +118,35 @@ Foam::tmp<Foam::pointField> Foam::boundBox::points() const
|
|||||||
pt[6] = max_; // max-x, max-y, max-z
|
pt[6] = max_; // max-x, max-y, max-z
|
||||||
pt[7] = point(min_.x(), max_.y(), max_.z()); // min-x, max-y, max-z
|
pt[7] = point(min_.x(), max_.y(), max_.z()); // min-x, max-y, max-z
|
||||||
|
|
||||||
return tPts;
|
return tpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::boundBox::inflate(const scalar s)
|
void Foam::boundBox::inflate(const scalar s)
|
||||||
{
|
{
|
||||||
vector ext = vector::one*s*mag();
|
const vector ext = vector::one*s*mag();
|
||||||
|
|
||||||
min_ -= ext;
|
min_ -= ext;
|
||||||
max_ += ext;
|
max_ += ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::boundBox::reduce()
|
||||||
|
{
|
||||||
|
Foam::reduce(min_, minOp<point>());
|
||||||
|
Foam::reduce(max_, maxOp<point>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::boundBox::intersect(const boundBox& bb)
|
||||||
|
{
|
||||||
|
min_ = ::Foam::max(min_, bb.min_);
|
||||||
|
max_ = ::Foam::min(max_, bb.max_);
|
||||||
|
|
||||||
|
return !empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::boundBox::contains(const UList<point>& points) const
|
bool Foam::boundBox::contains(const UList<point>& points) const
|
||||||
{
|
{
|
||||||
if (points.empty())
|
if (points.empty())
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +27,11 @@ Class
|
|||||||
Description
|
Description
|
||||||
A bounding box defined in terms of the points at its extremities.
|
A bounding box defined in terms of the points at its extremities.
|
||||||
|
|
||||||
|
Note
|
||||||
|
When a bounding box is created without any points, it creates an inverted
|
||||||
|
bounding box. Points can be added later and the bounding box will grow to
|
||||||
|
include them.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef boundBox_H
|
#ifndef boundBox_H
|
||||||
@ -60,26 +65,17 @@ class boundBox
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Minimum and maximum describing the bounding box
|
//- Minimum and maximum points describing the bounding box
|
||||||
point min_, max_;
|
point min_, max_;
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Calculate the bounding box from the given points.
|
|
||||||
// Does parallel communication (doReduce = true)
|
|
||||||
void calculate(const UList<point>&, const bool doReduce = true);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Static data members
|
// Static data members
|
||||||
|
|
||||||
//- The great value used for greatBox and invertedBox
|
//- A large boundBox: min/max == -/+ ROOTVGREAT
|
||||||
static const scalar great;
|
|
||||||
|
|
||||||
//- A very large boundBox: min/max == -/+ VGREAT
|
|
||||||
static const boundBox greatBox;
|
static const boundBox greatBox;
|
||||||
|
|
||||||
//- A very large inverted boundBox: min/max == +/- VGREAT
|
//- A large inverted boundBox: min/max == +/- ROOTVGREAT
|
||||||
static const boundBox invertedBox;
|
static const boundBox invertedBox;
|
||||||
|
|
||||||
//- Faces to point addressing, as per a 'hex' cell
|
//- Faces to point addressing, as per a 'hex' cell
|
||||||
@ -88,49 +84,58 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null, setting points to zero
|
//- Construct without any points - an inverted bounding box
|
||||||
inline boundBox();
|
inline boundBox();
|
||||||
|
|
||||||
|
//- Construct a bounding box containing a single initial point
|
||||||
|
explicit inline boundBox(const point& pt);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
inline boundBox(const point& min, const point& max);
|
inline boundBox(const point& min, const point& max);
|
||||||
|
|
||||||
//- Construct as the bounding box of the given points
|
//- Construct as the bounding box of the given points
|
||||||
// Does parallel communication (doReduce = true)
|
// Does parallel communication (doReduce = true)
|
||||||
boundBox(const UList<point>&, const bool doReduce = true);
|
explicit boundBox(const UList<point>& points, bool doReduce = true);
|
||||||
|
|
||||||
//- Construct as the bounding box of the given temporary pointField.
|
//- Construct as the bounding box of the given temporary pointField.
|
||||||
// Does parallel communication (doReduce = true)
|
// Does parallel communication (doReduce = true)
|
||||||
boundBox(const tmp<pointField>&, const bool doReduce = true);
|
explicit boundBox(const tmp<pointField>& tpoints, bool doReduce = true);
|
||||||
|
|
||||||
//- Construct bounding box as subset of the pointField.
|
//- Construct bounding box as an indirect subset of the points.
|
||||||
// The indices could be from cell/face etc.
|
// The indices could be from cell/face etc.
|
||||||
// Does parallel communication (doReduce = true)
|
// Does parallel communication (doReduce = true)
|
||||||
boundBox
|
boundBox
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const labelUList& indices,
|
const labelUList& indices,
|
||||||
const bool doReduce = true
|
bool doReduce = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct bounding box as subset of the pointField.
|
//- Construct bounding box as an indirect subset of the points.
|
||||||
// The indices could be from edge/triFace etc.
|
// The indices could be from edge/triFace etc.
|
||||||
// Does parallel communication (doReduce = true)
|
// Does parallel communication (doReduce = true)
|
||||||
template<unsigned Size>
|
template<unsigned Size>
|
||||||
boundBox
|
boundBox
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const FixedList<label, Size>& indices,
|
const FixedList<label, Size>& indices,
|
||||||
const bool doReduce = true
|
bool doReduce = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
inline boundBox(Istream&);
|
inline boundBox(Istream& is);
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
//- Bounding box is inverted, contains no points.
|
||||||
|
inline bool empty() const;
|
||||||
|
|
||||||
|
//- Clear bounding box of all points - make it an inverted box
|
||||||
|
inline void clear();
|
||||||
|
|
||||||
//- Minimum describing the bounding box
|
//- Minimum describing the bounding box
|
||||||
inline const point& min() const;
|
inline const point& min() const;
|
||||||
|
|
||||||
@ -170,80 +175,130 @@ public:
|
|||||||
|
|
||||||
// Manipulate
|
// Manipulate
|
||||||
|
|
||||||
|
//- Extend to include the second box.
|
||||||
|
inline void add(const boundBox& bb);
|
||||||
|
|
||||||
|
//- Extend to include the point.
|
||||||
|
inline void add(const point& pt);
|
||||||
|
|
||||||
|
//- Extend to include the points.
|
||||||
|
inline void add(const UList<point>& points);
|
||||||
|
|
||||||
|
//- Extend to include the points from the temporary point field.
|
||||||
|
inline void add(const tmp<pointField>& tpoints);
|
||||||
|
|
||||||
|
//- Extend to include the subset of the point field.
|
||||||
|
// The indices could be from cell/face etc.
|
||||||
|
inline void add
|
||||||
|
(
|
||||||
|
const UList<point>& points,
|
||||||
|
const labelUList& indices
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Extend to include the points.
|
||||||
|
template<unsigned Size>
|
||||||
|
void add(const FixedList<point, Size>& points);
|
||||||
|
|
||||||
|
//- Extend to include the subset of the point field.
|
||||||
|
// The indices could be from edge/triFace etc.
|
||||||
|
template<unsigned Size>
|
||||||
|
void add
|
||||||
|
(
|
||||||
|
const UList<point>& points,
|
||||||
|
const FixedList<label, Size>& indices
|
||||||
|
);
|
||||||
|
|
||||||
//- Inflate box by factor*mag(span) in all dimensions
|
//- Inflate box by factor*mag(span) in all dimensions
|
||||||
void inflate(const scalar s);
|
void inflate(const scalar s);
|
||||||
|
|
||||||
|
//- Parallel reduction of min/max values
|
||||||
|
void reduce();
|
||||||
|
|
||||||
|
//- Intersection (union) with the second box.
|
||||||
|
// The return value is true if the intersection is non-empty.
|
||||||
|
bool intersect(const boundBox& bb);
|
||||||
|
|
||||||
|
|
||||||
// Query
|
// Query
|
||||||
|
|
||||||
//- Overlaps/touches boundingBox?
|
//- Overlaps/touches boundingBox?
|
||||||
inline bool overlaps(const boundBox&) const;
|
inline bool overlaps(const boundBox& bb) const;
|
||||||
|
|
||||||
//- Overlaps boundingSphere (centre + sqr(radius))?
|
//- Overlaps boundingSphere (centre + sqr(radius))?
|
||||||
inline bool overlaps(const point&, const scalar radiusSqr) const;
|
inline bool overlaps
|
||||||
|
(
|
||||||
|
const point& centre,
|
||||||
|
const scalar radiusSqr
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Contains point? (inside or on edge)
|
//- Contains point? (inside or on edge)
|
||||||
inline bool contains(const point&) const;
|
inline bool contains(const point& pt) const;
|
||||||
|
|
||||||
//- Fully contains other boundingBox?
|
//- Fully contains other boundingBox?
|
||||||
inline bool contains(const boundBox&) const;
|
inline bool contains(const boundBox& bb) const;
|
||||||
|
|
||||||
//- Contains point? (inside only)
|
//- Contains point? (inside only)
|
||||||
inline bool containsInside(const point&) const;
|
inline bool containsInside(const point& pt) const;
|
||||||
|
|
||||||
//- Contains all of the points? (inside or on edge)
|
//- Contains all of the points? (inside or on edge)
|
||||||
bool contains(const UList<point>&) const;
|
bool contains(const UList<point>& points) const;
|
||||||
|
|
||||||
//- Contains all of the points? (inside or on edge)
|
//- Contains all of the subset of points? (inside or on edge)
|
||||||
bool contains
|
bool contains
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const labelUList& indices
|
const labelUList& indices
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Contains all of the points? (inside or on edge)
|
//- Contains all of the subset of points? (inside or on edge)
|
||||||
template<unsigned Size>
|
template<unsigned Size>
|
||||||
bool contains
|
bool contains
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const FixedList<label, Size>& indices
|
const FixedList<label, Size>& indices
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Contains any of the points? (inside or on edge)
|
//- Contains any of the points? (inside or on edge)
|
||||||
bool containsAny(const UList<point>&) const;
|
bool containsAny(const UList<point>& points) const;
|
||||||
|
|
||||||
//- Contains any of the points? (inside or on edge)
|
//- Contains any of the subset of points? (inside or on edge)
|
||||||
bool containsAny
|
bool containsAny
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const labelUList& indices
|
const labelUList& indices
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Contains any of the points? (inside or on edge)
|
//- Contains any of the subset of points? (inside or on edge)
|
||||||
template<unsigned Size>
|
template<unsigned Size>
|
||||||
bool containsAny
|
bool containsAny
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const FixedList<label, Size>& indices
|
const FixedList<label, Size>& indices
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return the nearest point on the boundBox to the supplied point.
|
//- Return the nearest point on the boundBox to the supplied point.
|
||||||
// If point is inside the boundBox then the point is returned
|
// If point is inside the boundBox then the point is returned
|
||||||
// unchanged.
|
// unchanged.
|
||||||
point nearest(const point&) const;
|
point nearest(const point& pt) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
//- Extend box to include the second box, as per the add() method.
|
||||||
|
inline void operator+=(const boundBox& bb);
|
||||||
|
|
||||||
|
|
||||||
// Friend Operators
|
// Friend Operators
|
||||||
|
|
||||||
inline friend bool operator==(const boundBox&, const boundBox&);
|
inline friend bool operator==(const boundBox& a, const boundBox& b);
|
||||||
inline friend bool operator!=(const boundBox&, const boundBox&);
|
inline friend bool operator!=(const boundBox& a, const boundBox& b);
|
||||||
|
|
||||||
|
|
||||||
// IOstream operator
|
// IOstream operator
|
||||||
|
|
||||||
friend Istream& operator>>(Istream&, boundBox&);
|
friend Istream& operator>>(Istream& is, boundBox& bb);
|
||||||
friend Ostream& operator<<(Ostream&, const boundBox&);
|
friend Ostream& operator<<(Ostream& os, const boundBox& bb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,15 +24,21 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "pointField.H"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::boundBox::boundBox()
|
inline Foam::boundBox::boundBox()
|
||||||
:
|
:
|
||||||
min_(Zero),
|
min_(invertedBox.min()),
|
||||||
max_(Zero)
|
max_(invertedBox.max())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::boundBox::boundBox(const point& pt)
|
||||||
|
:
|
||||||
|
min_(pt),
|
||||||
|
max_(pt)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -51,6 +57,19 @@ inline Foam::boundBox::boundBox(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline bool Foam::boundBox::empty() const
|
||||||
|
{
|
||||||
|
return (min_ > max_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::clear()
|
||||||
|
{
|
||||||
|
min_ = invertedBox.min();
|
||||||
|
max_ = invertedBox.max();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::point& Foam::boundBox::min() const
|
inline const Foam::point& Foam::boundBox::min() const
|
||||||
{
|
{
|
||||||
return min_;
|
return min_;
|
||||||
@ -117,6 +136,52 @@ inline Foam::scalar Foam::boundBox::avgDim() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::add(const boundBox& bb)
|
||||||
|
{
|
||||||
|
min_ = ::Foam::min(min_, bb.min_);
|
||||||
|
max_ = ::Foam::max(max_, bb.max_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::add(const point& pt)
|
||||||
|
{
|
||||||
|
min_ = ::Foam::min(min_, pt);
|
||||||
|
max_ = ::Foam::max(max_, pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::add(const UList<point>& points)
|
||||||
|
{
|
||||||
|
forAll(points, i)
|
||||||
|
{
|
||||||
|
add(points[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::add(const tmp<pointField>& tpoints)
|
||||||
|
{
|
||||||
|
add(tpoints());
|
||||||
|
tpoints.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::add
|
||||||
|
(
|
||||||
|
const UList<point>& points,
|
||||||
|
const labelUList& indices
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!points.empty())
|
||||||
|
{
|
||||||
|
forAll(indices, i)
|
||||||
|
{
|
||||||
|
add(points[indices[i]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::boundBox::overlaps(const boundBox& bb) const
|
inline bool Foam::boundBox::overlaps(const boundBox& bb) const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
@ -138,7 +203,7 @@ inline bool Foam::boundBox::overlaps
|
|||||||
// Find nearest point on bb.
|
// Find nearest point on bb.
|
||||||
scalar distSqr = 0;
|
scalar distSqr = 0;
|
||||||
|
|
||||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
for (direction dir = 0; dir < vector::nComponents; ++dir)
|
||||||
{
|
{
|
||||||
scalar d0 = min_[dir] - centre[dir];
|
scalar d0 = min_[dir] - centre[dir];
|
||||||
scalar d1 = max_[dir] - centre[dir];
|
scalar d1 = max_[dir] - centre[dir];
|
||||||
@ -178,7 +243,6 @@ inline bool Foam::boundBox::contains(const point& pt) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this.bb fully contains bb
|
|
||||||
inline bool Foam::boundBox::contains(const boundBox& bb) const
|
inline bool Foam::boundBox::contains(const boundBox& bb) const
|
||||||
{
|
{
|
||||||
return contains(bb.min()) && contains(bb.max());
|
return contains(bb.min()) && contains(bb.max());
|
||||||
@ -196,6 +260,14 @@ inline bool Foam::boundBox::containsInside(const point& pt) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline void Foam::boundBox::operator+=(const boundBox& bb)
|
||||||
|
{
|
||||||
|
add(bb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline bool Foam::operator==(const boundBox& a, const boundBox& b)
|
inline bool Foam::operator==(const boundBox& a, const boundBox& b)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,8 +25,6 @@ License
|
|||||||
|
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "FixedList.H"
|
#include "FixedList.H"
|
||||||
#include "PstreamReduceOps.H"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -35,45 +33,55 @@ Foam::boundBox::boundBox
|
|||||||
(
|
(
|
||||||
const UList<point>& points,
|
const UList<point>& points,
|
||||||
const FixedList<label, Size>& indices,
|
const FixedList<label, Size>& indices,
|
||||||
const bool doReduce
|
bool doReduce
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
min_(Zero),
|
min_(invertedBox.min()),
|
||||||
max_(Zero)
|
max_(invertedBox.max())
|
||||||
{
|
{
|
||||||
// a FixedList is never empty
|
add(points, indices);
|
||||||
if (points.empty())
|
|
||||||
{
|
|
||||||
if (doReduce && Pstream::parRun())
|
|
||||||
{
|
|
||||||
// Use values that get overwritten by reduce minOp, maxOp below
|
|
||||||
min_ = point(VGREAT, VGREAT, VGREAT);
|
|
||||||
max_ = point(-VGREAT, -VGREAT, -VGREAT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
min_ = points[indices[0]];
|
|
||||||
max_ = points[indices[0]];
|
|
||||||
|
|
||||||
for (unsigned i=1; i < Size; ++i)
|
|
||||||
{
|
|
||||||
min_ = ::Foam::min(min_, points[indices[i]]);
|
|
||||||
max_ = ::Foam::max(max_, points[indices[i]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reduce parallel information
|
|
||||||
if (doReduce)
|
if (doReduce)
|
||||||
{
|
{
|
||||||
reduce(min_, minOp<point>());
|
reduce();
|
||||||
reduce(max_, maxOp<point>());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<unsigned Size>
|
||||||
|
void Foam::boundBox::add
|
||||||
|
(
|
||||||
|
const FixedList<point, Size>& points
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// a FixedList is never empty
|
||||||
|
for (unsigned i=0; i < Size; ++i)
|
||||||
|
{
|
||||||
|
add(points[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<unsigned Size>
|
||||||
|
void Foam::boundBox::add
|
||||||
|
(
|
||||||
|
const UList<point>& points,
|
||||||
|
const FixedList<label, Size>& indices
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// points may be empty, but a FixedList is never empty
|
||||||
|
if (!points.empty())
|
||||||
|
{
|
||||||
|
for (unsigned i=0; i < Size; ++i)
|
||||||
|
{
|
||||||
|
add(points[indices[i]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<unsigned Size>
|
template<unsigned Size>
|
||||||
bool Foam::boundBox::contains
|
bool Foam::boundBox::contains
|
||||||
(
|
(
|
||||||
@ -81,7 +89,7 @@ bool Foam::boundBox::contains
|
|||||||
const FixedList<label, Size>& indices
|
const FixedList<label, Size>& indices
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// a FixedList is never empty
|
// points may be empty, but a FixedList is never empty
|
||||||
if (points.empty())
|
if (points.empty())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -106,7 +114,7 @@ bool Foam::boundBox::containsAny
|
|||||||
const FixedList<label, Size>& indices
|
const FixedList<label, Size>& indices
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// a FixedList is never empty
|
// points may be empty, but a FixedList is never empty
|
||||||
if (points.empty())
|
if (points.empty())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -236,9 +236,8 @@ void Foam::PatchTools::calcBounds
|
|||||||
label pointi = f[fp];
|
label pointi = f[fp];
|
||||||
if (pointIsUsed.set(pointi, 1u))
|
if (pointIsUsed.set(pointi, 1u))
|
||||||
{
|
{
|
||||||
bb.min() = ::Foam::min(bb.min(), points[pointi]);
|
bb.add(points[pointi]);
|
||||||
bb.max() = ::Foam::max(bb.max(), points[pointi]);
|
++nPoints;
|
||||||
nPoints++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -48,8 +48,7 @@ bool Foam::primitiveMesh::pointInCellBB
|
|||||||
|
|
||||||
if (inflationFraction > SMALL)
|
if (inflationFraction > SMALL)
|
||||||
{
|
{
|
||||||
vector inflation = inflationFraction*vector::one*mag(bb.span());
|
bb.inflate(inflationFraction);
|
||||||
bb = boundBox(bb.min() - inflation, bb.max() + inflation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bb.contains(p);
|
return bb.contains(p);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -92,11 +92,10 @@ public:
|
|||||||
//- Calculate the bounding box
|
//- Calculate the bounding box
|
||||||
inline treeBoundBox bounds() const
|
inline treeBoundBox bounds() const
|
||||||
{
|
{
|
||||||
treeBoundBox bb(operator[](0), operator[](0));
|
treeBoundBox bb(operator[](0));
|
||||||
for (label i = 1; i < size(); i++)
|
for (label i = 1; i < size(); ++i)
|
||||||
{
|
{
|
||||||
bb.min() = min(bb.min(), operator[](i));
|
bb.add(operator[](i));
|
||||||
bb.max() = max(bb.max(), operator[](i));
|
|
||||||
}
|
}
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -78,11 +78,10 @@ public:
|
|||||||
//- Calculate the bounding box
|
//- Calculate the bounding box
|
||||||
inline treeBoundBox bounds() const
|
inline treeBoundBox bounds() const
|
||||||
{
|
{
|
||||||
treeBoundBox bb(operator[](0), operator[](0));
|
treeBoundBox bb(operator[](0));
|
||||||
for (label i = 1; i < size(); i++)
|
for (label i = 1; i < size(); ++i)
|
||||||
{
|
{
|
||||||
bb.min() = min(bb.min(), operator[](i));
|
bb.add(operator[](i));
|
||||||
bb.max() = max(bb.max(), operator[](i));
|
|
||||||
}
|
}
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,50 +24,21 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "ListOps.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::scalar Foam::treeBoundBox::great(GREAT);
|
|
||||||
|
|
||||||
const Foam::treeBoundBox Foam::treeBoundBox::greatBox
|
|
||||||
(
|
|
||||||
vector(-GREAT, -GREAT, -GREAT),
|
|
||||||
vector(GREAT, GREAT, GREAT)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::treeBoundBox Foam::treeBoundBox::invertedBox
|
|
||||||
(
|
|
||||||
vector(GREAT, GREAT, GREAT),
|
|
||||||
vector(-GREAT, -GREAT, -GREAT)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//! \cond ignoreDocumentation
|
|
||||||
//- Skip documentation : local scope only
|
|
||||||
const Foam::label facesArray[6][4] =
|
|
||||||
{
|
|
||||||
{0, 4, 6, 2}, // left
|
|
||||||
{1, 3, 7, 5}, // right
|
|
||||||
{0, 1, 5, 4}, // bottom
|
|
||||||
{2, 6, 7, 3}, // top
|
|
||||||
{0, 2, 3, 1}, // back
|
|
||||||
{4, 5, 7, 6} // front
|
|
||||||
};
|
|
||||||
//! \endcond
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::faceList Foam::treeBoundBox::faces
|
const Foam::faceList Foam::treeBoundBox::faces
|
||||||
(
|
({
|
||||||
initListList<face, label, 6, 4>(facesArray)
|
face{0, 4, 6, 2}, // left
|
||||||
);
|
face{1, 3, 7, 5}, // right
|
||||||
|
face{0, 1, 5, 4}, // bottom
|
||||||
|
face{2, 6, 7, 3}, // top
|
||||||
|
face{0, 2, 3, 1}, // back
|
||||||
|
face{4, 5, 7, 6} // front
|
||||||
|
});
|
||||||
|
|
||||||
|
const Foam::edgeList Foam::treeBoundBox::edges
|
||||||
//! \cond ignoreDocumentation
|
({
|
||||||
//- Skip documentation : local scope only
|
|
||||||
const Foam::label edgesArray[12][2] =
|
|
||||||
{
|
|
||||||
{0, 1}, // 0
|
{0, 1}, // 0
|
||||||
{1, 3},
|
{1, 3},
|
||||||
{2, 3}, // 2
|
{2, 3}, // 2
|
||||||
@ -80,48 +51,17 @@ const Foam::label edgesArray[12][2] =
|
|||||||
{1, 5},
|
{1, 5},
|
||||||
{3, 7}, // 10
|
{3, 7}, // 10
|
||||||
{2, 6}
|
{2, 6}
|
||||||
};
|
});
|
||||||
//! \endcond
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::edgeList Foam::treeBoundBox::edges
|
|
||||||
(
|
|
||||||
//initListList<edge, label, 12, 2>(edgesArray)
|
|
||||||
calcEdges(edgesArray)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::FixedList<Foam::vector, 6> Foam::treeBoundBox::faceNormals
|
const Foam::FixedList<Foam::vector, 6> Foam::treeBoundBox::faceNormals
|
||||||
(
|
({
|
||||||
calcFaceNormals()
|
vector(-1, 0, 0), // left
|
||||||
);
|
vector( 1, 0, 0), // right
|
||||||
|
vector( 0, -1, 0), // bottom
|
||||||
|
vector( 0, 1, 0), // top
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
vector( 0, 0, -1), // back
|
||||||
|
vector( 0, 0, 1) // front
|
||||||
Foam::edgeList Foam::treeBoundBox::calcEdges(const label edgesArray[12][2])
|
});
|
||||||
{
|
|
||||||
edgeList edges(12);
|
|
||||||
forAll(edges, edgeI)
|
|
||||||
{
|
|
||||||
edges[edgeI][0] = edgesArray[edgeI][0];
|
|
||||||
edges[edgeI][1] = edgesArray[edgeI][1];
|
|
||||||
}
|
|
||||||
return edges;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::FixedList<Foam::vector, 6> Foam::treeBoundBox::calcFaceNormals()
|
|
||||||
{
|
|
||||||
FixedList<vector, 6> normals;
|
|
||||||
normals[LEFT] = vector(-1, 0, 0);
|
|
||||||
normals[RIGHT] = vector( 1, 0, 0);
|
|
||||||
normals[BOTTOM] = vector( 0, -1, 0);
|
|
||||||
normals[TOP] = vector( 0, 1, 0);
|
|
||||||
normals[BACK] = vector( 0, 0, -1);
|
|
||||||
normals[FRONT] = vector( 0, 0, 1);
|
|
||||||
return normals;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -164,15 +104,15 @@ Foam::treeBoundBox::treeBoundBox
|
|||||||
|
|
||||||
Foam::tmp<Foam::pointField> Foam::treeBoundBox::points() const
|
Foam::tmp<Foam::pointField> Foam::treeBoundBox::points() const
|
||||||
{
|
{
|
||||||
tmp<pointField> tPts = tmp<pointField>(new pointField(8));
|
tmp<pointField> tpoints = tmp<pointField>(new pointField(8));
|
||||||
pointField& points = tPts.ref();
|
pointField& pts = tpoints.ref();
|
||||||
|
|
||||||
forAll(points, octant)
|
forAll(pts, octant)
|
||||||
{
|
{
|
||||||
points[octant] = corner(octant);
|
pts[octant] = corner(octant);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tPts;
|
return tpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -394,7 +334,7 @@ bool Foam::treeBoundBox::contains(const vector& dir, const point& pt) const
|
|||||||
{
|
{
|
||||||
// Compare all components against min and max of bb
|
// Compare all components against min and max of bb
|
||||||
|
|
||||||
for (direction cmpt=0; cmpt<3; cmpt++)
|
for (direction cmpt=0; cmpt<3; ++cmpt)
|
||||||
{
|
{
|
||||||
if (pt[cmpt] < min()[cmpt])
|
if (pt[cmpt] < min()[cmpt])
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -46,6 +46,10 @@ Description
|
|||||||
|
|
||||||
For the front plane add 4 to the point labels.
|
For the front plane add 4 to the point labels.
|
||||||
|
|
||||||
|
Note
|
||||||
|
When a bounding box is created without any points, it creates an inverted
|
||||||
|
bounding box. Points can be added later and the bounding box will grow to
|
||||||
|
include them.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
treeBoundBoxI.H
|
treeBoundBoxI.H
|
||||||
@ -74,11 +78,11 @@ class Random;
|
|||||||
|
|
||||||
class treeBoundBox;
|
class treeBoundBox;
|
||||||
|
|
||||||
bool operator==(const treeBoundBox&, const treeBoundBox&);
|
bool operator==(const treeBoundBox& a, const treeBoundBox& b);
|
||||||
bool operator!=(const treeBoundBox&, const treeBoundBox&);
|
bool operator!=(const treeBoundBox& a, const treeBoundBox& b);
|
||||||
|
|
||||||
Istream& operator>>(Istream& is, treeBoundBox&);
|
Istream& operator>>(Istream& is, treeBoundBox& bb);
|
||||||
Ostream& operator<<(Ostream& os, const treeBoundBox&);
|
Ostream& operator<<(Ostream& os, const treeBoundBox& bb);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -90,27 +94,10 @@ class treeBoundBox
|
|||||||
public boundBox
|
public boundBox
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
//- To initialise edges.
|
|
||||||
static edgeList calcEdges(const label[12][2]);
|
|
||||||
|
|
||||||
//- To initialise faceNormals.
|
|
||||||
static FixedList<vector, 6> calcFaceNormals();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Static data members
|
// Static data members
|
||||||
|
|
||||||
//- The great value used for greatBox and invertedBox
|
|
||||||
static const scalar great;
|
|
||||||
|
|
||||||
//- As per boundBox::greatBox, but with GREAT instead of VGREAT
|
|
||||||
static const treeBoundBox greatBox;
|
|
||||||
|
|
||||||
//- As per boundBox::invertedBox, but with GREAT instead of VGREAT
|
|
||||||
static const treeBoundBox invertedBox;
|
|
||||||
|
|
||||||
//- Bits used for octant/point coding.
|
//- Bits used for octant/point coding.
|
||||||
// Every octant/corner point is the combination of three faces.
|
// Every octant/corner point is the combination of three faces.
|
||||||
enum octantBit
|
enum octantBit
|
||||||
@ -169,7 +156,7 @@ public:
|
|||||||
//- Edge to point addressing
|
//- Edge to point addressing
|
||||||
static const edgeList edges;
|
static const edgeList edges;
|
||||||
|
|
||||||
//- Per face the unit normal
|
//- The unit normal per face
|
||||||
static const FixedList<vector, 6> faceNormals;
|
static const FixedList<vector, 6> faceNormals;
|
||||||
|
|
||||||
|
|
||||||
@ -181,16 +168,19 @@ public:
|
|||||||
//- Construct from a boundBox
|
//- Construct from a boundBox
|
||||||
explicit inline treeBoundBox(const boundBox& bb);
|
explicit inline treeBoundBox(const boundBox& bb);
|
||||||
|
|
||||||
|
//- Construct a bounding box containing a single initial point
|
||||||
|
explicit inline treeBoundBox(const point& pt);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
inline treeBoundBox(const point& min, const point& max);
|
inline treeBoundBox(const point& min, const point& max);
|
||||||
|
|
||||||
//- Construct as the bounding box of the given pointField.
|
//- Construct as the bounding box of the given pointField.
|
||||||
// Local processor domain only (no reduce as in boundBox)
|
// Local processor domain only (no reduce as in boundBox)
|
||||||
explicit treeBoundBox(const UList<point>&);
|
explicit treeBoundBox(const UList<point>& points);
|
||||||
|
|
||||||
//- Construct as subset of points
|
//- Construct as subset of points
|
||||||
// Local processor domain only (no reduce as in boundBox)
|
// Local processor domain only (no reduce as in boundBox)
|
||||||
treeBoundBox(const UList<point>&, const labelUList& indices);
|
treeBoundBox(const UList<point>& points, const labelUList& indices);
|
||||||
|
|
||||||
//- Construct as subset of points
|
//- Construct as subset of points
|
||||||
// The indices could be from edge/triFace etc.
|
// The indices could be from edge/triFace etc.
|
||||||
@ -198,13 +188,13 @@ public:
|
|||||||
template<unsigned Size>
|
template<unsigned Size>
|
||||||
treeBoundBox
|
treeBoundBox
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const FixedList<label, Size>& indices
|
const FixedList<label, Size>& indices
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
inline treeBoundBox(Istream&);
|
inline treeBoundBox(Istream& is);
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
@ -220,13 +210,13 @@ public:
|
|||||||
|
|
||||||
// Check
|
// Check
|
||||||
|
|
||||||
//- Corner point given octant
|
//- Corner point of given octant
|
||||||
inline point corner(const direction) const;
|
inline point corner(const direction octant) const;
|
||||||
|
|
||||||
//- Sub box given by octant number. Midpoint calculated.
|
//- Sub-box of given octant. Midpoint calculated.
|
||||||
treeBoundBox subBbox(const direction) const;
|
treeBoundBox subBbox(const direction octant) const;
|
||||||
|
|
||||||
//- Sub box given by octant number. Midpoint provided.
|
//- Sub-box given by octant number. Midpoint provided.
|
||||||
treeBoundBox subBbox(const point& mid, const direction) const;
|
treeBoundBox subBbox(const point& mid, const direction) const;
|
||||||
|
|
||||||
//- Returns octant number given point and the calculated midpoint.
|
//- Returns octant number given point and the calculated midpoint.
|
||||||
@ -318,10 +308,10 @@ public:
|
|||||||
bool contains(const vector& dir, const point&) const;
|
bool contains(const vector& dir, const point&) const;
|
||||||
|
|
||||||
//- Code position of point on bounding box faces
|
//- Code position of point on bounding box faces
|
||||||
direction faceBits(const point&) const;
|
direction faceBits(const point& pt) const;
|
||||||
|
|
||||||
//- Position of point relative to bounding box
|
//- Position of point relative to bounding box
|
||||||
direction posBits(const point&) const;
|
direction posBits(const point& pt) const;
|
||||||
|
|
||||||
//- Calculate nearest and furthest (to point) vertex coords of
|
//- Calculate nearest and furthest (to point) vertex coords of
|
||||||
// bounding box
|
// bounding box
|
||||||
@ -333,7 +323,7 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Returns distance point to furthest away corner.
|
//- Returns distance point to furthest away corner.
|
||||||
scalar maxDist(const point&) const;
|
scalar maxDist(const point& pt) const;
|
||||||
|
|
||||||
//- Compare distance to point with other bounding box
|
//- Compare distance to point with other bounding box
|
||||||
// return:
|
// return:
|
||||||
@ -342,22 +332,24 @@ public:
|
|||||||
// +1 : all vertices of my bounding box are further away than
|
// +1 : all vertices of my bounding box are further away than
|
||||||
// any of other
|
// any of other
|
||||||
// 0 : none of the above.
|
// 0 : none of the above.
|
||||||
label distanceCmp(const point&, const treeBoundBox& other) const;
|
label distanceCmp(const point& pt, const treeBoundBox& other) const;
|
||||||
|
|
||||||
//- Return slightly wider bounding box
|
//- Return slightly wider bounding box
|
||||||
// Extends all dimensions with s*span*Random::scalar01()
|
// Extends all dimensions with s*span*Random::scalar01()
|
||||||
// and guarantees in any direction s*mag(span) minimum width
|
// and guarantees in any direction s*mag(span) minimum width
|
||||||
inline treeBoundBox extend(Random&, const scalar s) const;
|
inline treeBoundBox extend(Random& rndGen, const scalar s) const;
|
||||||
|
|
||||||
|
|
||||||
// Friend Operators
|
// Friend Operators
|
||||||
|
|
||||||
friend bool operator==(const treeBoundBox&, const treeBoundBox&);
|
friend bool operator==(const treeBoundBox& a, const treeBoundBox& b);
|
||||||
friend bool operator!=(const treeBoundBox&, const treeBoundBox&);
|
friend bool operator!=(const treeBoundBox& a, const treeBoundBox& b);
|
||||||
|
|
||||||
|
|
||||||
// IOstream operator
|
// IOstream operator
|
||||||
|
|
||||||
friend Istream& operator>>(Istream& is, treeBoundBox&);
|
friend Istream& operator>>(Istream& is, treeBoundBox& bb);
|
||||||
friend Ostream& operator<<(Ostream& os, const treeBoundBox&);
|
friend Ostream& operator<<(Ostream& os, const treeBoundBox& bb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,18 +34,24 @@ inline Foam::treeBoundBox::treeBoundBox()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::treeBoundBox::treeBoundBox(const point& min, const point& max)
|
|
||||||
:
|
|
||||||
boundBox(min, max)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
inline Foam::treeBoundBox::treeBoundBox(const boundBox& bb)
|
inline Foam::treeBoundBox::treeBoundBox(const boundBox& bb)
|
||||||
:
|
:
|
||||||
boundBox(bb)
|
boundBox(bb)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::treeBoundBox::treeBoundBox(const point& pt)
|
||||||
|
:
|
||||||
|
boundBox(pt)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::treeBoundBox::treeBoundBox(const point& min, const point& max)
|
||||||
|
:
|
||||||
|
boundBox(min, max)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::treeBoundBox::treeBoundBox(Istream& is)
|
inline Foam::treeBoundBox::treeBoundBox(Istream& is)
|
||||||
:
|
:
|
||||||
boundBox(is)
|
boundBox(is)
|
||||||
@ -312,7 +318,6 @@ inline void Foam::treeBoundBox::searchOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return slightly wider bounding box
|
|
||||||
inline Foam::treeBoundBox Foam::treeBoundBox::extend
|
inline Foam::treeBoundBox Foam::treeBoundBox::extend
|
||||||
(
|
(
|
||||||
Random& rndGen,
|
Random& rndGen,
|
||||||
@ -326,7 +331,7 @@ inline Foam::treeBoundBox Foam::treeBoundBox::extend
|
|||||||
// Make 3D
|
// Make 3D
|
||||||
scalar minSpan = s * Foam::mag(newSpan);
|
scalar minSpan = s * Foam::mag(newSpan);
|
||||||
|
|
||||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
for (direction dir = 0; dir < vector::nComponents; ++dir)
|
||||||
{
|
{
|
||||||
newSpan[dir] = Foam::max(newSpan[dir], minSpan);
|
newSpan[dir] = Foam::max(newSpan[dir], minSpan);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -125,8 +125,7 @@ void Foam::polyMeshGeometry::updateCellCentresAndVols
|
|||||||
{
|
{
|
||||||
const point& fc = faceCentres_[cFaces[cFaceI]];
|
const point& fc = faceCentres_[cFaces[cFaceI]];
|
||||||
cEst += fc;
|
cEst += fc;
|
||||||
bb.max() = max(bb.max(), fc);
|
bb.add(fc);
|
||||||
bb.min() = min(bb.min(), fc);
|
|
||||||
}
|
}
|
||||||
cEst /= cFaces.size();
|
cEst /= cFaces.size();
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -76,7 +76,7 @@ Usage
|
|||||||
trackLength | Tracking segment length | no |
|
trackLength | Tracking segment length | no |
|
||||||
nSubCycle | Number of tracking steps per cell | no|
|
nSubCycle | Number of tracking steps per cell | no|
|
||||||
cloudName | Cloud name to use | yes |
|
cloudName | Cloud name to use | yes |
|
||||||
bounds | Bounding box to trim tracks | no | greatBox
|
bounds | Bounding box to trim tracks | no | invertedBox
|
||||||
seedSampleSet| Seeding method (see below)| yes |
|
seedSampleSet| Seeding method (see below)| yes |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
@ -136,10 +136,10 @@ class streamLine
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
streamLine(const streamLine&);
|
streamLine(const streamLine&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const streamLine&);
|
void operator=(const streamLine&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -545,8 +545,8 @@ bool Foam::functionObjects::streamLineBase::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bounds_ = boundBox::greatBox;
|
bounds_ = boundBox::invertedBox;
|
||||||
if (dict.readIfPresent("bounds", bounds_))
|
if (dict.readIfPresent("bounds", bounds_) && !bounds_.empty())
|
||||||
{
|
{
|
||||||
Info<< " clipping all segments to " << bounds_ << nl << endl;
|
Info<< " clipping all segments to " << bounds_ << nl << endl;
|
||||||
}
|
}
|
||||||
@ -701,7 +701,7 @@ bool Foam::functionObjects::streamLineBase::write()
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
if (bounds_ != boundBox::greatBox)
|
if (!bounds_.empty())
|
||||||
{
|
{
|
||||||
// Clip to bounding box
|
// Clip to bounding box
|
||||||
trimToBox(treeBoundBox(bounds_));
|
trimToBox(treeBoundBox(bounds_));
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -79,7 +79,7 @@ Usage
|
|||||||
trackLength | Tracking segment length | no |
|
trackLength | Tracking segment length | no |
|
||||||
nSubCycle | Number of tracking steps per cell | no|
|
nSubCycle | Number of tracking steps per cell | no|
|
||||||
cloudName | Cloud name to use | yes |
|
cloudName | Cloud name to use | yes |
|
||||||
bounds | Bounding box to trim tracks | no | greatBox
|
bounds | Bounding box to trim tracks | no | invertedBox
|
||||||
seedSampleSet| Seeding method (see below)| yes |
|
seedSampleSet| Seeding method (see below)| yes |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -179,7 +179,7 @@ void Foam::functionObjects::runTimePostPro::scene::initialise
|
|||||||
vtkSmartPointer<vtkLightKit> lightKit = vtkSmartPointer<vtkLightKit>::New();
|
vtkSmartPointer<vtkLightKit> lightKit = vtkSmartPointer<vtkLightKit>::New();
|
||||||
lightKit->AddLightsToRenderer(renderer);
|
lightKit->AddLightsToRenderer(renderer);
|
||||||
|
|
||||||
if (clipBox_ != boundBox::greatBox)
|
if (!clipBox_.empty())
|
||||||
{
|
{
|
||||||
const point& min = clipBox_.min();
|
const point& min = clipBox_.min();
|
||||||
const point& max = clipBox_.max();
|
const point& max = clipBox_.max();
|
||||||
@ -237,7 +237,7 @@ void Foam::functionObjects::runTimePostPro::scene::setCamera
|
|||||||
// Apply clipping if required
|
// Apply clipping if required
|
||||||
// Note: possible optimisation - if the camera is static, this only needs
|
// Note: possible optimisation - if the camera is static, this only needs
|
||||||
// to be done once on initialisation
|
// to be done once on initialisation
|
||||||
if (clipBox_ != boundBox::greatBox)
|
if (!clipBox_.empty())
|
||||||
{
|
{
|
||||||
// Call ResetCamera() to fit clip box in view
|
// Call ResetCamera() to fit clip box in view
|
||||||
clipBoxActor_->VisibilityOn();
|
clipBoxActor_->VisibilityOn();
|
||||||
@ -278,7 +278,7 @@ Foam::functionObjects::runTimePostPro::scene::scene
|
|||||||
cameraUp_(nullptr),
|
cameraUp_(nullptr),
|
||||||
cameraViewAngle_(nullptr),
|
cameraViewAngle_(nullptr),
|
||||||
cameraZoom_(nullptr),
|
cameraZoom_(nullptr),
|
||||||
clipBox_(boundBox::greatBox),
|
clipBox_(boundBox::invertedBox),
|
||||||
clipBoxActor_(),
|
clipBoxActor_(),
|
||||||
parallelProjection_(true),
|
parallelProjection_(true),
|
||||||
nFrameTotal_(1),
|
nFrameTotal_(1),
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -199,21 +199,9 @@ void Foam::shellSurfaces::orient()
|
|||||||
|
|
||||||
if (shell.triSurface::size())
|
if (shell.triSurface::size())
|
||||||
{
|
{
|
||||||
const pointField& points = shell.points();
|
|
||||||
|
|
||||||
hasSurface = true;
|
hasSurface = true;
|
||||||
|
|
||||||
boundBox shellBb(points[0], points[0]);
|
|
||||||
// Assume surface is compact!
|
// Assume surface is compact!
|
||||||
forAll(points, i)
|
overallBb.add(shell.points());
|
||||||
{
|
|
||||||
const point& pt = points[i];
|
|
||||||
shellBb.min() = min(shellBb.min(), pt);
|
|
||||||
shellBb.max() = max(shellBb.max(), pt);
|
|
||||||
}
|
|
||||||
|
|
||||||
overallBb.min() = min(overallBb.min(), shellBb.min());
|
|
||||||
overallBb.max() = max(overallBb.max(), shellBb.max());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -198,10 +198,10 @@ void Foam::AABBTree<Type>::createBoxes
|
|||||||
// Assign the objects to min or max bin
|
// Assign the objects to min or max bin
|
||||||
|
|
||||||
DynamicList<label> minBinObjectIDs(objectIDs.size());
|
DynamicList<label> minBinObjectIDs(objectIDs.size());
|
||||||
treeBoundBox minBb(point::max, point::min);
|
treeBoundBox minBb(boundBox::invertedBox);
|
||||||
|
|
||||||
DynamicList<label> maxBinObjectIDs(objectIDs.size());
|
DynamicList<label> maxBinObjectIDs(objectIDs.size());
|
||||||
treeBoundBox maxBb(point::max, point::min);
|
treeBoundBox maxBb(boundBox::invertedBox);
|
||||||
|
|
||||||
forAll(objectIDs, i)
|
forAll(objectIDs, i)
|
||||||
{
|
{
|
||||||
@ -229,16 +229,12 @@ void Foam::AABBTree<Type>::createBoxes
|
|||||||
if (intoMin)
|
if (intoMin)
|
||||||
{
|
{
|
||||||
minBinObjectIDs.append(objI);
|
minBinObjectIDs.append(objI);
|
||||||
const boundBox objBb(points, obj, false);
|
minBb.add(points, obj);
|
||||||
minBb.min() = min(minBb.min(), objBb.min());
|
|
||||||
minBb.max() = max(minBb.max(), objBb.max());
|
|
||||||
}
|
}
|
||||||
if (intoMax)
|
if (intoMax)
|
||||||
{
|
{
|
||||||
maxBinObjectIDs.append(objI);
|
maxBinObjectIDs.append(objI);
|
||||||
const boundBox objBb(points, obj, false);
|
maxBb.add(points, obj);
|
||||||
maxBb.min() = min(maxBb.min(), objBb.min());
|
|
||||||
maxBb.max() = max(maxBb.max(), objBb.max());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -41,20 +41,7 @@ namespace Foam
|
|||||||
|
|
||||||
Foam::treeBoundBox Foam::treeDataFace::calcBb(const label facei) const
|
Foam::treeBoundBox Foam::treeDataFace::calcBb(const label facei) const
|
||||||
{
|
{
|
||||||
const pointField& points = mesh_.points();
|
return treeBoundBox(mesh_.points(), mesh_.faces()[facei]);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -31,26 +31,6 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class PatchType>
|
|
||||||
Foam::treeBoundBox Foam::treeDataPrimitivePatch<PatchType>::calcBb
|
|
||||||
(
|
|
||||||
const pointField& points,
|
|
||||||
const face& f
|
|
||||||
)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class PatchType>
|
template<class PatchType>
|
||||||
void Foam::treeDataPrimitivePatch<PatchType>::update()
|
void Foam::treeDataPrimitivePatch<PatchType>::update()
|
||||||
{
|
{
|
||||||
@ -60,7 +40,7 @@ void Foam::treeDataPrimitivePatch<PatchType>::update()
|
|||||||
|
|
||||||
forAll(patch_, i)
|
forAll(patch_, i)
|
||||||
{
|
{
|
||||||
bbs_[i] = calcBb(patch_.points(), patch_[i]);
|
bbs_[i] = treeBoundBox(patch_.points(), patch_[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -386,19 +366,14 @@ bool Foam::treeDataPrimitivePatch<PatchType>::overlaps
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// 1. Quick rejection: bb does not intersect face bb at all
|
// 1. Quick rejection: bb does not intersect face bb at all
|
||||||
if (cacheBb_)
|
if
|
||||||
|
(
|
||||||
|
cacheBb_
|
||||||
|
? !cubeBb.overlaps(bbs_[index])
|
||||||
|
: !cubeBb.overlaps(treeBoundBox(patch_.points(), patch_[index]))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (!cubeBb.overlaps(bbs_[index]))
|
return false;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!cubeBb.overlaps(calcBb(patch_.points(), patch_[index])))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -459,19 +434,14 @@ bool Foam::treeDataPrimitivePatch<PatchType>::overlaps
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// 1. Quick rejection: sphere does not intersect face bb at all
|
// 1. Quick rejection: sphere does not intersect face bb at all
|
||||||
if (cacheBb_)
|
if
|
||||||
|
(
|
||||||
|
cacheBb_
|
||||||
|
? !bbs_[index].overlaps(centre, radiusSqr)
|
||||||
|
: !treeBoundBox(patch_.points(),patch_[index]).overlaps(centre, radiusSqr)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (!bbs_[index].overlaps(centre, radiusSqr))
|
return false;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!calcBb(patch_.points(), patch_[index]).overlaps(centre, radiusSqr))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const pointField& points = patch_.points();
|
const pointField& points = patch_.points();
|
||||||
|
|||||||
@ -80,9 +80,6 @@ class treeDataPrimitivePatch
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Calculate face bounding box
|
|
||||||
static treeBoundBox calcBb(const pointField&, const face&);
|
|
||||||
|
|
||||||
//- Initialise all member data
|
//- Initialise all member data
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -244,8 +244,8 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
|
|||||||
subGeom_.setSize(surfI);
|
subGeom_.setSize(surfI);
|
||||||
indexOffset_.setSize(surfI+1);
|
indexOffset_.setSize(surfI+1);
|
||||||
|
|
||||||
// Bounds is the overall bounds
|
// Bounds is the overall bounds - prepare for min/max ops
|
||||||
bounds() = boundBox(point::max, point::min);
|
bounds() = boundBox::invertedBox;
|
||||||
|
|
||||||
forAll(subGeom_, surfI)
|
forAll(subGeom_, surfI)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -659,18 +659,14 @@ Foam::boundBox Foam::searchableSurfacesQueries::bounds
|
|||||||
const labelList& surfacesToTest
|
const labelList& surfacesToTest
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
pointField bbPoints(2*surfacesToTest.size());
|
boundBox bb(boundBox::invertedBox);
|
||||||
|
|
||||||
forAll(surfacesToTest, testI)
|
forAll(surfacesToTest, testi)
|
||||||
{
|
{
|
||||||
const searchableSurface& surface(allSurfaces[surfacesToTest[testI]]);
|
bb.add(allSurfaces[surfacesToTest[testi]].bounds());
|
||||||
|
|
||||||
bbPoints[2*testI] = surface.bounds().min();
|
|
||||||
|
|
||||||
bbPoints[2*testI + 1] = surface.bounds().max();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return boundBox(bbPoints);
|
return bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -55,13 +55,9 @@ Foam::treeBoundBox Foam::tetOverlapVolume::pyrBb
|
|||||||
const point& fc
|
const point& fc
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
treeBoundBox bb(fc, fc);
|
treeBoundBox bb(fc);
|
||||||
forAll(f, fp)
|
bb.add(points, f);
|
||||||
{
|
|
||||||
const point& pt = points[f[fp]];
|
|
||||||
bb.min() = min(bb.min(), pt);
|
|
||||||
bb.max() = max(bb.max(), pt);
|
|
||||||
}
|
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -891,39 +891,28 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
|
|||||||
|
|
||||||
// Find bounding box for all triangles on new distribution.
|
// Find bounding box for all triangles on new distribution.
|
||||||
|
|
||||||
// Initialise to inverted box (VGREAT, -VGREAT)
|
// Initialise to inverted box
|
||||||
List<List<treeBoundBox>> bbs(Pstream::nProcs());
|
List<List<treeBoundBox>> bbs(Pstream::nProcs());
|
||||||
forAll(bbs, procI)
|
forAll(bbs, procI)
|
||||||
{
|
{
|
||||||
bbs[procI].setSize(1);
|
bbs[procI].setSize(1, treeBoundBox(boundBox::invertedBox));
|
||||||
//bbs[procI][0] = boundBox::invertedBox;
|
|
||||||
bbs[procI][0].min() = point( VGREAT, VGREAT, VGREAT);
|
|
||||||
bbs[procI][0].max() = point(-VGREAT, -VGREAT, -VGREAT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(s, triI)
|
forAll(s, triI)
|
||||||
{
|
{
|
||||||
point& bbMin = bbs[distribution[triI]][0].min();
|
|
||||||
point& bbMax = bbs[distribution[triI]][0].max();
|
|
||||||
|
|
||||||
const triSurface::FaceType& f = s[triI];
|
const triSurface::FaceType& f = s[triI];
|
||||||
forAll(f, fp)
|
|
||||||
{
|
treeBoundBox& bb = bbs[distribution[triI]][0];
|
||||||
const point& pt = s.points()[f[fp]];
|
bb.add(s.points(), f);
|
||||||
bbMin = ::Foam::min(bbMin, pt);
|
|
||||||
bbMax = ::Foam::max(bbMax, pt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now combine for all processors and convert to correct format.
|
// Now combine for all processors and convert to correct format.
|
||||||
forAll(bbs, procI)
|
forAll(bbs, procI)
|
||||||
{
|
{
|
||||||
forAll(bbs[procI], i)
|
Pstream::listCombineGather(bbs[procI], plusEqOp<boundBox>());
|
||||||
{
|
Pstream::listCombineScatter(bbs[procI]);
|
||||||
reduce(bbs[procI][i].min(), minOp<point>());
|
|
||||||
reduce(bbs[procI][i].max(), maxOp<point>());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bbs;
|
return bbs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -937,17 +926,14 @@ bool Foam::distributedTriSurfaceMesh::overlaps
|
|||||||
const point& p2
|
const point& p2
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
treeBoundBox triBb(p0);
|
||||||
|
triBb.add(p1);
|
||||||
|
triBb.add(p2);
|
||||||
|
|
||||||
forAll(bbs, bbI)
|
forAll(bbs, bbI)
|
||||||
{
|
{
|
||||||
const treeBoundBox& bb = bbs[bbI];
|
const treeBoundBox& bb = bbs[bbI];
|
||||||
|
|
||||||
treeBoundBox triBb(p0, p0);
|
|
||||||
triBb.min() = min(triBb.min(), p1);
|
|
||||||
triBb.min() = min(triBb.min(), p2);
|
|
||||||
|
|
||||||
triBb.max() = max(triBb.max(), p1);
|
|
||||||
triBb.max() = max(triBb.max(), p2);
|
|
||||||
|
|
||||||
// Exact test of triangle intersecting bb
|
// Exact test of triangle intersecting bb
|
||||||
|
|
||||||
// Quick rejection. If whole bounding box of tri is outside cubeBb then
|
// Quick rejection. If whole bounding box of tri is outside cubeBb then
|
||||||
@ -1334,8 +1320,7 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
|
|||||||
{
|
{
|
||||||
read();
|
read();
|
||||||
|
|
||||||
reduce(bounds().min(), minOp<point>());
|
bounds().reduce();
|
||||||
reduce(bounds().max(), maxOp<point>());
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -1390,8 +1375,7 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io)
|
|||||||
{
|
{
|
||||||
read();
|
read();
|
||||||
|
|
||||||
reduce(bounds().min(), minOp<point>());
|
bounds().reduce();
|
||||||
reduce(bounds().max(), maxOp<point>());
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -1452,8 +1436,7 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
|
|||||||
{
|
{
|
||||||
read();
|
read();
|
||||||
|
|
||||||
reduce(bounds().min(), minOp<point>());
|
bounds().reduce();
|
||||||
reduce(bounds().max(), maxOp<point>());
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -2026,7 +2009,7 @@ Foam::triSurface Foam::distributedTriSurfaceMesh::overlappingSurface
|
|||||||
const scalar eps = 1.0e-4;
|
const scalar eps = 1.0e-4;
|
||||||
forAll(bbs, i)
|
forAll(bbs, i)
|
||||||
{
|
{
|
||||||
const point mid = 0.5*(bbs[i].min() + bbs[i].max());
|
const point mid = bbs[i].midpoint();
|
||||||
const vector halfSpan = (1.0+eps)*(bbs[i].max() - mid);
|
const vector halfSpan = (1.0+eps)*(bbs[i].max() - mid);
|
||||||
|
|
||||||
bbsX[i].min() = mid - halfSpan;
|
bbsX[i].min() = mid - halfSpan;
|
||||||
@ -2434,8 +2417,7 @@ void Foam::distributedTriSurfaceMesh::writeStats(Ostream& os) const
|
|||||||
boundBox bb;
|
boundBox bb;
|
||||||
label nPoints;
|
label nPoints;
|
||||||
PatchTools::calcBounds(static_cast<const triSurface&>(*this), bb, nPoints);
|
PatchTools::calcBounds(static_cast<const triSurface&>(*this), bb, nPoints);
|
||||||
reduce(bb.min(), minOp<point>());
|
bb.reduce();
|
||||||
reduce(bb.max(), maxOp<point>());
|
|
||||||
|
|
||||||
os << "Triangles : " << returnReduce(triSurface::size(), sumOp<label>())
|
os << "Triangles : " << returnReduce(triSurface::size(), sumOp<label>())
|
||||||
<< endl
|
<< endl
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -177,14 +177,13 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
|||||||
const cell& c = cells[celli];
|
const cell& c = cells[celli];
|
||||||
|
|
||||||
// determine bounding box of tgt cell
|
// determine bounding box of tgt cell
|
||||||
boundBox cellBb(point::max, point::min);
|
boundBox cellBb(boundBox::invertedBox);
|
||||||
forAll(c, facei)
|
forAll(c, facei)
|
||||||
{
|
{
|
||||||
const face& f = faces[c[facei]];
|
const face& f = faces[c[facei]];
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
cellBb.min() = min(cellBb.min(), points[f[fp]]);
|
cellBb.add(points, f);
|
||||||
cellBb.max() = max(cellBb.max(), points[f[fp]]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -69,7 +69,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
|
|||||||
{
|
{
|
||||||
// Collect mesh faces and bounding box
|
// Collect mesh faces and bounding box
|
||||||
labelList bndFaces(nFaces);
|
labelList bndFaces(nFaces);
|
||||||
treeBoundBox overallBb(treeBoundBox::invertedBox);
|
treeBoundBox overallBb(boundBox::invertedBox);
|
||||||
|
|
||||||
nFaces = 0;
|
nFaces = 0;
|
||||||
forAll(patchIDs, i)
|
forAll(patchIDs, i)
|
||||||
@ -79,12 +79,9 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
|
|||||||
{
|
{
|
||||||
bndFaces[nFaces++] = pp.start()+i;
|
bndFaces[nFaces++] = pp.start()+i;
|
||||||
const face& f = pp[i];
|
const face& f = pp[i];
|
||||||
forAll(f, fp)
|
|
||||||
{
|
// Without reduction.
|
||||||
const point& pt = pp.points()[f[fp]];
|
overallBb.add(pp.points(), f);
|
||||||
overallBb.min() = min(overallBb.min(), pt);
|
|
||||||
overallBb.max() = max(overallBb.max(), pt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -74,7 +74,7 @@ void Foam::patchCloudSet::calcSamples
|
|||||||
|
|
||||||
labelList patchFaces(sz);
|
labelList patchFaces(sz);
|
||||||
sz = 0;
|
sz = 0;
|
||||||
treeBoundBox bb(point::max, point::min);
|
treeBoundBox bb(boundBox::invertedBox);
|
||||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = mesh().boundaryMesh()[iter.key()];
|
const polyPatch& pp = mesh().boundaryMesh()[iter.key()];
|
||||||
@ -84,11 +84,8 @@ void Foam::patchCloudSet::calcSamples
|
|||||||
patchFaces[sz++] = pp.start()+i;
|
patchFaces[sz++] = pp.start()+i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not do reduction.
|
// Without reduction.
|
||||||
const boundBox patchBb(pp.points(), pp.meshPoints(), false);
|
bb.add(pp.points(), pp.meshPoints());
|
||||||
|
|
||||||
bb.min() = min(bb.min(), patchBb.min());
|
|
||||||
bb.max() = max(bb.max(), patchBb.max());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not very random
|
// Not very random
|
||||||
@ -97,8 +94,8 @@ void Foam::patchCloudSet::calcSamples
|
|||||||
bb = bb.extend(rndGen, 1e-4);
|
bb = bb.extend(rndGen, 1e-4);
|
||||||
|
|
||||||
// Make sure bb is 3D.
|
// Make sure bb is 3D.
|
||||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
bb.min() -= point::uniform(ROOTVSMALL);
|
||||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
bb.max() += point::uniform(ROOTVSMALL);
|
||||||
|
|
||||||
|
|
||||||
indexedOctree<treeDataFace> patchTree
|
indexedOctree<treeDataFace> patchTree
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -334,7 +334,7 @@ Foam::distanceSurface::distanceSurface
|
|||||||
cell_(dict.lookupOrDefault("cell", true)),
|
cell_(dict.lookupOrDefault("cell", true)),
|
||||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
regularise_(dict.lookupOrDefault("regularise", true)),
|
||||||
average_(dict.lookupOrDefault("average", false)),
|
average_(dict.lookupOrDefault("average", false)),
|
||||||
bounds_(dict.lookupOrDefault("bounds", boundBox::greatBox)),
|
bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)),
|
||||||
zoneKey_(keyType::null),
|
zoneKey_(keyType::null),
|
||||||
needsUpdate_(true),
|
needsUpdate_(true),
|
||||||
isoSurfCellPtr_(nullptr),
|
isoSurfCellPtr_(nullptr),
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -145,7 +145,7 @@ public:
|
|||||||
const bool cell,
|
const bool cell,
|
||||||
const Switch regularise,
|
const Switch regularise,
|
||||||
const Switch average,
|
const Switch average,
|
||||||
const boundBox& bounds = boundBox::greatBox
|
const boundBox& bounds = boundBox::invertedBox
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -468,7 +468,7 @@ Foam::sampledIsoSurface::sampledIsoSurface
|
|||||||
sampledSurface(name, mesh, dict),
|
sampledSurface(name, mesh, dict),
|
||||||
isoField_(dict.lookup("isoField")),
|
isoField_(dict.lookup("isoField")),
|
||||||
isoVal_(readScalar(dict.lookup("isoValue"))),
|
isoVal_(readScalar(dict.lookup("isoValue"))),
|
||||||
bounds_(dict.lookupOrDefault("bounds", boundBox::greatBox)),
|
bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)),
|
||||||
mergeTol_(dict.lookupOrDefault("mergeTol", 1e-6)),
|
mergeTol_(dict.lookupOrDefault("mergeTol", 1e-6)),
|
||||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
regularise_(dict.lookupOrDefault("regularise", true)),
|
||||||
average_(dict.lookupOrDefault("average", false)),
|
average_(dict.lookupOrDefault("average", false)),
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -207,7 +207,7 @@ Foam::sampledIsoSurfaceCell::sampledIsoSurfaceCell
|
|||||||
MeshStorage(),
|
MeshStorage(),
|
||||||
isoField_(dict.lookup("isoField")),
|
isoField_(dict.lookup("isoField")),
|
||||||
isoVal_(readScalar(dict.lookup("isoValue"))),
|
isoVal_(readScalar(dict.lookup("isoValue"))),
|
||||||
bounds_(dict.lookupOrDefault("bounds", boundBox::greatBox)),
|
bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)),
|
||||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
regularise_(dict.lookupOrDefault("regularise", true)),
|
||||||
average_(dict.lookupOrDefault("average", true)),
|
average_(dict.lookupOrDefault("average", true)),
|
||||||
zoneKey_(keyType::null),
|
zoneKey_(keyType::null),
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -263,7 +263,7 @@ Foam::sampledCuttingPlane::sampledCuttingPlane
|
|||||||
:
|
:
|
||||||
sampledSurface(name, mesh, dict),
|
sampledSurface(name, mesh, dict),
|
||||||
plane_(dict),
|
plane_(dict),
|
||||||
bounds_(dict.lookupOrDefault("bounds", boundBox::greatBox)),
|
bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)),
|
||||||
mergeTol_(dict.lookupOrDefault("mergeTol", 1e-6)),
|
mergeTol_(dict.lookupOrDefault("mergeTol", 1e-6)),
|
||||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
regularise_(dict.lookupOrDefault("regularise", true)),
|
||||||
average_(dict.lookupOrDefault("average", false)),
|
average_(dict.lookupOrDefault("average", false)),
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -778,8 +778,8 @@ bool Foam::sampledTriSurfaceMesh::update()
|
|||||||
surface_.triSurface::points(),
|
surface_.triSurface::points(),
|
||||||
surface_.triSurface::meshPoints()
|
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
|
// Extend a bit
|
||||||
const vector span(bb.span());
|
const vector span(bb.span());
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -1619,7 +1619,7 @@ Foam::isoSurface::isoSurface
|
|||||||
DynamicList<label> trimTriMap;
|
DynamicList<label> trimTriMap;
|
||||||
// Trimmed to original point
|
// Trimmed to original point
|
||||||
labelList trimTriPointMap;
|
labelList trimTriPointMap;
|
||||||
if (bounds_ != boundBox::greatBox)
|
if (!bounds_.empty())
|
||||||
{
|
{
|
||||||
trimToBox
|
trimToBox
|
||||||
(
|
(
|
||||||
@ -1652,7 +1652,7 @@ Foam::isoSurface::isoSurface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (bounds_ != boundBox::greatBox)
|
if (!bounds_.empty())
|
||||||
{
|
{
|
||||||
// Adjust interpolatedPoints_
|
// Adjust interpolatedPoints_
|
||||||
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);
|
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -411,7 +411,7 @@ public:
|
|||||||
const scalarField& pointIsoVals,
|
const scalarField& pointIsoVals,
|
||||||
const scalar iso,
|
const scalar iso,
|
||||||
const bool regularise,
|
const bool regularise,
|
||||||
const boundBox& bounds = boundBox::greatBox,
|
const boundBox& bounds = boundBox::invertedBox,
|
||||||
const scalar mergeTol = 1e-6 // fraction of bounding box
|
const scalar mergeTol = 1e-6 // fraction of bounding box
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -1436,7 +1436,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
|
|||||||
DynamicList<label> trimTriMap;
|
DynamicList<label> trimTriMap;
|
||||||
// Trimmed to original point
|
// Trimmed to original point
|
||||||
labelList trimTriPointMap;
|
labelList trimTriPointMap;
|
||||||
if (bounds_ != boundBox::greatBox)
|
if (!bounds_.empty())
|
||||||
{
|
{
|
||||||
isoSurface::trimToBox
|
isoSurface::trimToBox
|
||||||
(
|
(
|
||||||
@ -1468,7 +1468,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
|
|||||||
<< " merged triangles." << endl;
|
<< " merged triangles." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bounds_ != boundBox::greatBox)
|
if (!bounds_.empty())
|
||||||
{
|
{
|
||||||
// Adjust interpolatedPoints_
|
// Adjust interpolatedPoints_
|
||||||
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);
|
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -330,7 +330,7 @@ public:
|
|||||||
const scalarField& pointValues,
|
const scalarField& pointValues,
|
||||||
const scalar iso,
|
const scalar iso,
|
||||||
const bool regularise,
|
const bool regularise,
|
||||||
const boundBox& bounds = boundBox::greatBox,
|
const boundBox& bounds = boundBox::invertedBox,
|
||||||
const scalar mergeTol = 1e-6 // fraction of bounding box
|
const scalar mergeTol = 1e-6 // fraction of bounding box
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1106,7 +1106,7 @@ void Foam::triSurface::writeStats(Ostream& os) const
|
|||||||
PackedBoolList pointIsUsed(points().size());
|
PackedBoolList pointIsUsed(points().size());
|
||||||
|
|
||||||
label nPoints = 0;
|
label nPoints = 0;
|
||||||
boundBox bb = boundBox::invertedBox;
|
boundBox bb(boundBox::invertedBox);
|
||||||
|
|
||||||
forAll(*this, facei)
|
forAll(*this, facei)
|
||||||
{
|
{
|
||||||
@ -1117,9 +1117,8 @@ void Foam::triSurface::writeStats(Ostream& os) const
|
|||||||
label pointi = f[fp];
|
label pointi = f[fp];
|
||||||
if (pointIsUsed.set(pointi, 1))
|
if (pointIsUsed.set(pointi, 1))
|
||||||
{
|
{
|
||||||
bb.min() = ::Foam::min(bb.min(), points()[pointi]);
|
bb.add(points()[pointi]);
|
||||||
bb.max() = ::Foam::max(bb.max(), points()[pointi]);
|
++nPoints;
|
||||||
nPoints++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user