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

View File

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

View File

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

View File

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

View File

@ -239,31 +239,11 @@ Foam::treeBoundBox Foam::cellCellStencils::inverseDistance::cellBb
const label celli
)
{
const cellList& cells = mesh.cells();
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)
if (mesh.hasCellPoints())
{
const face& f = faces[cFaces[cFacei]];
forAll(f, fp)
{
const point& p = points[f[fp]];
bb.min() = min(bb.min(), p);
bb.max() = max(bb.max(), p);
}
return treeBoundBox(mesh.points(), mesh.cellPoints(celli));
}
return bb;
return treeBoundBox(mesh.cells()[celli].box(mesh));
}