ENH: use boundBox building blocks in misc places

This commit is contained in:
Mark Olesen
2022-10-10 19:16:11 +02:00
parent 61deacd24d
commit 18eeba116a
5 changed files with 15 additions and 69 deletions

View File

@ -167,14 +167,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
{ {
if (volumeStatus[celli] == volumeType::UNKNOWN) if (volumeStatus[celli] == volumeType::UNKNOWN)
{ {
treeBoundBox cellBb treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
(
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
)
);
if (geometry.overlaps(cellBb)) if (geometry.overlaps(cellBb))
{ {
@ -286,14 +279,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
{ {
if (volumeStatus[celli] == volumeType::UNKNOWN) if (volumeStatus[celli] == volumeType::UNKNOWN)
{ {
treeBoundBox cellBb treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
(
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
)
);
if (geometry.overlaps(cellBb)) if (geometry.overlaps(cellBb))
{ {
@ -512,14 +498,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
// const conformationSurfaces& geometry = geometryToConformTo_; // const conformationSurfaces& geometry = geometryToConformTo_;
treeBoundBox cellBb treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
(
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
)
);
weightEstimate = 1.0; weightEstimate = 1.0;

View File

@ -83,8 +83,7 @@ Foam::searchableBoxFeatures::features() const
{ {
autoPtr<extendedFeatureEdgeMesh> features; autoPtr<extendedFeatureEdgeMesh> features;
List<vector> faceNormalsList(treeBoundBox::faceNormals); vectorField faceNormals(List<vector>(treeBoundBox::faceNormals));
vectorField faceNormals(faceNormalsList);
vectorField edgeDirections(12); vectorField edgeDirections(12);
labelListList normalDirections(12); labelListList normalDirections(12);

View File

@ -29,8 +29,8 @@ License
#include "InteractionLists.H" #include "InteractionLists.H"
#include "globalIndexAndTransform.H" #include "globalIndexAndTransform.H"
#include "indexedOctree.H" #include "indexedOctree.H"
#include "treeDataFace.H"
#include "treeDataCell.H" #include "treeDataCell.H"
#include "treeDataFace.H"
#include "volFields.H" #include "volFields.H"
#include "meshTools.H" #include "meshTools.H"

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -133,22 +133,10 @@ void Foam::snappyVoxelMeshDriver::isInside
} }
else else
{ {
const cellList& cells = mesh.cells(); for (const cell& c : mesh.cells())
const faceList& faces = mesh.faces(); {
const pointField& points = mesh.points(); const boundBox cellBb(c.box(mesh));
for (label celli = 0; celli < mesh.nCells(); celli++)
{
const cell& cFaces = cells[celli];
boundBox cellBb(boundBox::invertedBox);
forAll(cFaces, cFacei)
{
const face& f = faces[cFaces[cFacei]];
forAll(f, fp)
{
cellBb.add(points[f[fp]]);
}
}
voxelMeshSearch::fill voxelMeshSearch::fill
( (
isVoxelInMesh, isVoxelInMesh,
@ -183,11 +171,11 @@ void Foam::snappyVoxelMeshDriver::markSurfaceRefinement
const triSurface& ts = refCast<const triSurface>(geom); const triSurface& ts = refCast<const triSurface>(geom);
const pointField& points = ts.points(); const pointField& points = ts.points();
forAll(ts, trii) for (const labelledTri& tri : ts)
{ {
label regioni = ts[trii].region(); label regioni = tri.region();
label globalRegioni = s.regionOffset()[surfi]+regioni; label globalRegioni = s.regionOffset()[surfi]+regioni;
const boundBox triBb(points, ts[trii], false); const boundBox triBb(tri.box(points));
// Fill cellLevel // Fill cellLevel
label level = s.minLevel()[globalRegioni]; label level = s.minLevel()[globalRegioni];

View File

@ -239,31 +239,11 @@ Foam::treeBoundBox Foam::cellCellStencils::inverseDistance::cellBb
const label celli const label celli
) )
{ {
const cellList& cells = mesh.cells(); if (mesh.hasCellPoints())
const faceList& faces = mesh.faces();
const pointField& points = mesh.points();
treeBoundBox bb
(
vector(GREAT, GREAT, GREAT),
vector(-GREAT, -GREAT, -GREAT)
);
const cell& cFaces = cells[celli];
forAll(cFaces, cFacei)
{ {
const face& f = faces[cFaces[cFacei]]; return treeBoundBox(mesh.points(), mesh.cellPoints(celli));
forAll(f, fp)
{
const point& p = points[f[fp]];
bb.min() = min(bb.min(), p);
bb.max() = max(bb.max(), p);
} }
} return treeBoundBox(mesh.cells()[celli].box(mesh));
return bb;
} }