mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: general boundBox/treeBoundBox improvements
- null() static method
* as const reference to the invertedBox with the appropriate casting.
- boundBox inflate(random)
* refactored from treeBoundBox::extend, but allows in-place modification
- boundBox::hexFaces() instead of boundBox::faces
* rarely used, but avoids confusion with treeBoundBox::faces
and reuses hexCell face definitions without code duplication
- boundBox::hexCorners() for corner points corresponding to a hexCell.
Can also be accessed from a treeBoundBox without ambiguity with
points(), which could be hex corners (boundBox) or octant corners
(treeBoundBox)
- boundBox::add with pairs of points
* convenient (for example) when adding edges or a 'box' that has
been extracted from a primitive mesh shape.
- declare boundBox nPoints(), nFaces(), nEdges() as per hexCell
ENH: return invertedBox instead of FatalError for empty trees
- similar to #2612
ENH: cellShape(HEX, ...) + boundBox hexCorners for block meshes
STYLE: cellModel::ref(...) instead of de-reference cellModel::ptr(...)
This commit is contained in:
committed by
Andrew Heather
parent
0ba458fdbc
commit
1339c3357b
@ -34,7 +34,6 @@ Description
|
||||
#include "line.H"
|
||||
#include "Random.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "cellModel.H"
|
||||
#include "bitSet.H"
|
||||
#include "HashSet.H"
|
||||
#include "ListOps.H"
|
||||
@ -59,8 +58,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
Info<<"boundBox faces: " << boundBox::faces << nl
|
||||
<<"hex faces: " << cellModel::ref(cellModel::HEX).modelFaces() << nl
|
||||
Info<<"boundBox faces: " << boundBox::hexFaces() << nl
|
||||
<<"tree-bb faces: " << treeBoundBox::faces << nl
|
||||
<<"tree-bb edges: " << treeBoundBox::edges << endl;
|
||||
|
||||
@ -113,10 +111,8 @@ int main(int argc, char *argv[])
|
||||
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.reset(point::zero);
|
||||
bb.add(point(1,1,1), point(0,1.5,0.5));
|
||||
bb.add(point(5,2,-2));
|
||||
|
||||
Info<<"repeated " << bb << endl;
|
||||
|
||||
@ -293,7 +293,7 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
|
||||
elemIdToCells
|
||||
);
|
||||
|
||||
const auto& model = *cellModel::ptr(cellModel::TET);
|
||||
const auto& model = cellModel::ref(cellModel::TET);
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
{
|
||||
readVerts(is, 4, nodeIdToPoints, verts);
|
||||
@ -326,7 +326,7 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
|
||||
elemIdToCells
|
||||
);
|
||||
|
||||
const auto& model = *cellModel::ptr(cellModel::PYR);
|
||||
const auto& model = cellModel::ref(cellModel::PYR);
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
{
|
||||
readVerts(is, 5, nodeIdToPoints, verts);
|
||||
@ -359,7 +359,7 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
|
||||
elemIdToCells
|
||||
);
|
||||
|
||||
const auto& model = *cellModel::ptr(cellModel::PRISM);
|
||||
const auto& model = cellModel::ref(cellModel::PRISM);
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
{
|
||||
readVerts(is, 6, nodeIdToPoints, verts);
|
||||
@ -392,7 +392,7 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
|
||||
elemIdToCells
|
||||
);
|
||||
|
||||
const auto& model = *cellModel::ptr(cellModel::HEX);
|
||||
const auto& model = cellModel::ref(cellModel::HEX);
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
{
|
||||
readVerts(is, 8, nodeIdToPoints, verts);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -389,7 +389,7 @@ Foam::meshedSurface Foam::PDRobstacle::surface() const
|
||||
boundBox box(obs.pt, obs.pt + obs.span);
|
||||
|
||||
pointField pts(box.points());
|
||||
faceList fcs(boundBox::faces);
|
||||
faceList fcs(boundBox::hexFaces());
|
||||
|
||||
surf.transfer(pts, fcs);
|
||||
|
||||
@ -436,7 +436,7 @@ Foam::meshedSurface Foam::PDRobstacle::surface() const
|
||||
);
|
||||
|
||||
pointField pts0(box.points());
|
||||
faceList fcs(boundBox::faces);
|
||||
faceList fcs(boundBox::hexFaces());
|
||||
|
||||
pointField pts(cs.globalPosition(pts0));
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
cellShapeList cellShapes;
|
||||
faceListList boundary;
|
||||
pointField points;
|
||||
@ -8,20 +6,8 @@ pointField points;
|
||||
|
||||
block b
|
||||
(
|
||||
cellShape(hex, identity(8)),
|
||||
pointField
|
||||
(
|
||||
{
|
||||
point(0, 0, 0),
|
||||
point(L.x(), 0, 0),
|
||||
point(L.x(), L.y(), 0),
|
||||
point(0, L.y(), 0),
|
||||
point(0, 0, L.z()),
|
||||
point(L.x(), 0, L.z()),
|
||||
point(L.x(), L.y(), L.z()),
|
||||
point(0, L.y(), L.z())
|
||||
}
|
||||
),
|
||||
cellShape(cellModel::HEX, identity(8)),
|
||||
pointField(boundBox(point::zero, L).hexCorners()),
|
||||
blockEdgeList(),
|
||||
blockFaceList(),
|
||||
N
|
||||
|
||||
Reference in New Issue
Block a user