ENH: use simpler constructor forms for treeData types

This commit is contained in:
Mark Olesen 2022-11-14 16:28:12 +01:00 committed by Andrew Heather
parent fc0b980333
commit 98598ba0bb
17 changed files with 68 additions and 155 deletions

View File

@ -67,17 +67,10 @@ int main(int argc, char *argv[])
treeBoundBox bb(efem.points());
bb.grow(ROOTVSMALL);
labelList allEdges(identity(efem.edges().size()));
indexedOctree<treeDataEdge> edgeTree
(
treeDataEdge
(
false, // cachebb
efem.edges(), // edges
efem.points(), // points
allEdges // selected edges
),
treeDataEdge(efem.edges(), efem.points()), // All edges
bb, // bb
8, // maxLevel
10, // leafsize

View File

@ -166,11 +166,7 @@ void createBoundaryEdgeTrees
// Boundary edges
treeBoundaryEdges[surfI] =
identity
(
surf.nEdges() - surf.nInternalEdges(),
surf.nInternalEdges()
);
identity(surf.nBoundaryEdges(), surf.nInternalEdges());
Random rndGen(17301893);
@ -188,9 +184,8 @@ void createBoundaryEdgeTrees
(
treeDataEdge
(
false, // cachebb
surf.edges(), // edges
surf.localPoints(), // points
surf.edges(),
surf.localPoints(),
treeBoundaryEdges[surfI] // selected edges
),
bb, // bb

View File

@ -989,23 +989,20 @@ void Foam::faceCoupleInfo::findSlavesCoveringMaster
)
{
// Construct octree from all mesh0 boundary faces
labelList bndFaces
(
identity(mesh0.nBoundaryFaces(), mesh0.nInternalFaces())
);
treeBoundBox overallBb(mesh0.points());
Random rndGen(123456);
treeBoundBox overallBb(mesh0.points());
indexedOctree<treeDataFace> tree
(
treeDataFace // all information needed to search faces
treeDataFace
(
false, // do not cache bb
mesh0,
bndFaces // boundary faces only
// boundary faces only
identity(mesh0.nBoundaryFaces(), mesh0.nInternalFaces())
),
overallBb.extend(rndGen, 1e-4), // overall search domain
8, // maxLevel
10, // leafsize

View File

@ -304,13 +304,8 @@ void Foam::refinementFeatures::buildTrees(const label featI)
featI,
new indexedOctree<treeDataEdge>
(
treeDataEdge
(
false, // do not cache bb
edges,
points,
identity(edges.size())
),
treeDataEdge(edges, points), // All edges
bb, // overall search domain
8, // maxLevel
10, // leafsize
@ -327,6 +322,7 @@ void Foam::refinementFeatures::buildTrees(const label featI)
new indexedOctree<treeDataPoint>
(
treeDataPoint(points, featurePoints),
bb, // overall search domain
8, // maxLevel
10, // leafsize
@ -443,13 +439,8 @@ Foam::refinementFeatures::regionEdgeTrees() const
featI,
new indexedOctree<treeDataEdge>
(
treeDataEdge
(
false, // do not cache bb
edges,
points,
eMesh.regionEdges()
),
treeDataEdge(edges, points, eMesh.regionEdges()),
bb, // overall search domain
8, // maxLevel
10, // leafsize

View File

@ -167,7 +167,7 @@ Foam::boolList Foam::cellClassification::markFaces
indexedOctree<treeDataFace> faceTree
(
treeDataFace(false, mesh_, allFaces),
treeDataFace(mesh_, allFaces),
allBb, // overall search domain
8, // maxLevel
10, // leafsize

View File

@ -815,11 +815,8 @@ Foam::extendedEdgeMesh::pointTree() const
(
new indexedOctree<treeDataPoint>
(
treeDataPoint
(
points(),
featurePointLabels
),
treeDataPoint(points(), featurePointLabels),
bb, // bb
8, // maxLevel
10, // leafsize
@ -846,19 +843,12 @@ Foam::extendedEdgeMesh::edgeTree() const
treeBoundBox(points()).extend(rndGen, 1e-4, ROOTVSMALL)
);
labelList allEdges(identity(edges().size()));
edgeTree_.reset
(
new indexedOctree<treeDataEdge>
(
treeDataEdge
(
false, // cachebb
edges(), // edges
points(), // points
allEdges // selected edges
),
treeDataEdge(edges(), points()), // All edges
bb, // bb
8, // maxLevel
10, // leafsize
@ -885,24 +875,22 @@ Foam::extendedEdgeMesh::edgeTreesByType() const
treeBoundBox(points()).extend(rndGen, 1e-4, ROOTVSMALL)
);
labelListList sliceEdges(nEdgeTypes);
List<labelRange> sliceEdges(nEdgeTypes);
// External edges
sliceEdges[0] =
identity((internalStart_ - externalStart_), externalStart_);
sliceEdges[0].reset(externalStart_, (internalStart_ - externalStart_));
// Internal edges
sliceEdges[1] = identity((flatStart_ - internalStart_), internalStart_);
sliceEdges[1].reset(internalStart_, (flatStart_ - internalStart_));
// Flat edges
sliceEdges[2] = identity((openStart_ - flatStart_), flatStart_);
sliceEdges[2].reset(flatStart_, (openStart_ - flatStart_));
// Open edges
sliceEdges[3] = identity((multipleStart_ - openStart_), openStart_);
sliceEdges[3].reset(openStart_, (multipleStart_ - openStart_));
// Multiple edges
sliceEdges[4] =
identity((edges().size() - multipleStart_), multipleStart_);
sliceEdges[4].reset(multipleStart_, (edges().size() - multipleStart_));
edgeTreesByType_.resize(nEdgeTypes);
@ -914,13 +902,9 @@ Foam::extendedEdgeMesh::edgeTreesByType() const
i,
new indexedOctree<treeDataEdge>
(
treeDataEdge
(
false, // cachebb
edges(), // edges
points(), // points
sliceEdges[i] // selected edges
),
// Selected edges
treeDataEdge(edges(), points(), sliceEdges[i]),
bb, // bb
8, // maxLevel
10, // leafsize

View File

@ -403,12 +403,8 @@ void Foam::mappedPatchBase::findLocalSamples
indexedOctree<treeDataFace> boundaryTree
(
treeDataFace // all information needed to search faces
(
false, // do not cache bb
mesh,
identity(pp.range()) // boundary faces only
),
treeDataFace(mesh, pp.range()), // Patch faces
patchBb, // overall search domain
8, // maxLevel
10, // leafsize
@ -479,11 +475,9 @@ void Foam::mappedPatchBase::findLocalSamples
indexedOctree<treeDataPoint> boundaryTree
(
treeDataPoint // all information needed to search faces
(
mesh.points(),
pp.meshPoints() // selection of points to search on
),
// Patch points
treeDataPoint(mesh.points(), pp.meshPoints()),
patchBb, // overall search domain
8, // maxLevel
10, // leafsize

View File

@ -628,12 +628,8 @@ Foam::meshSearch::boundaryTree() const
(
new indexedOctree<treeDataFace>
(
treeDataFace // all information needed to search faces
(
false, // do not cache bb
mesh_,
bndFaces // boundary faces only
),
treeDataFace(mesh_, bndFaces), // Boundary faces
dataBoundBox(), // overall search domain
8, // maxLevel
10, // leafsize
@ -668,18 +664,14 @@ Foam::meshSearch::nonCoupledBoundaryTree() const
}
}
}
bndFaces.setSize(bndi);
bndFaces.resize(bndi);
nonCoupledBoundaryTreePtr_.reset
(
new indexedOctree<treeDataFace>
(
treeDataFace // all information needed to search faces
(
false, // do not cache bb
mesh_,
bndFaces // boundary faces only
),
treeDataFace(mesh_, bndFaces), // Boundary faces
dataBoundBox(), // overall search domain
8, // maxLevel
10, // leafsize

View File

@ -104,13 +104,8 @@ Foam::searchableExtrudedCircle::searchableExtrudedCircle
(
new indexedOctree<treeDataEdge>
(
treeDataEdge
(
false, // do not cache bb
edges,
points,
identity(edges.size())
),
treeDataEdge(edges, points), // All edges
bb, // overall search domain
8, // maxLevel
10, // leafsize

View File

@ -768,10 +768,7 @@ Foam::triSurfaceMesh::edgeTree() const
}
// Boundary edges
labelList bEdges
(
identity(nEdges() - nInternalEdges(), nInternalEdges())
);
const labelRange bEdges(nInternalEdges(), nBoundaryEdges());
treeBoundBox bb(point::zero);
@ -808,13 +805,9 @@ Foam::triSurfaceMesh::edgeTree() const
(
new indexedOctree<treeDataEdge>
(
treeDataEdge
(
false, // cachebb
edges(), // edges
localPoints(), // points
bEdges // selected edges
),
// Boundary edges
treeDataEdge(edges(), localPoints(), bEdges),
bb, // bb
maxTreeDepth(), // maxLevel
10, // leafsize

View File

@ -1243,13 +1243,13 @@ Foam::Map<Foam::label> Foam::surfaceFeatures::nearestSamples
{
// Build tree out of all samples.
// Note: cannot be done one the fly - gcc4.4 compiler bug.
treeBoundBox bb(samples);
// Define bound box here (gcc-4.8.5)
const treeBoundBox overallBb(samples);
indexedOctree<treeDataPoint> ppTree
(
treeDataPoint(samples), // all information needed to do checks
bb, // overall search domain
treeDataPoint(samples),
overallBb,
8, // maxLevel
10, // leafsize
3.0 // duplicity
@ -1330,13 +1330,13 @@ Foam::Map<Foam::label> Foam::surfaceFeatures::nearestSamples
scalar maxSearchSqr = max(maxDistSqr);
//Note: cannot be done one the fly - gcc4.4 compiler bug.
treeBoundBox bb(samples);
// Define bound box here (gcc-4.8.5)
const treeBoundBox overallBb(samples);
indexedOctree<treeDataPoint> ppTree
(
treeDataPoint(samples), // all information needed to do checks
bb, // overall search domain
treeDataPoint(samples),
overallBb,
8, // maxLevel
10, // leafsize
3.0 // duplicity
@ -1468,11 +1468,10 @@ Foam::Map<Foam::pointIndexHit> Foam::surfaceFeatures::nearestEdges
(
treeDataEdge
(
false,
sampleEdges,
samplePoints,
selectedSampleEdges
), // geometric info container for edges
),
treeBoundBox(samplePoints), // overall search domain
8, // maxLevel
10, // leafsize
@ -1626,11 +1625,10 @@ void Foam::surfaceFeatures::nearestSurfEdge
(
treeDataEdge
(
false,
surf_.edges(),
localPoints,
selectedEdges
), // all information needed to do geometric checks
),
searchDomain, // overall search domain
8, // maxLevel
10, // leafsize
@ -1694,11 +1692,10 @@ void Foam::surfaceFeatures::nearestSurfEdge
(
treeDataEdge
(
false,
surf_.edges(),
surf_.localPoints(),
selectedEdges
), // all information needed to do geometric checks
),
searchDomain, // overall search domain
8, // maxLevel
10, // leafsize
@ -1751,13 +1748,8 @@ void Foam::surfaceFeatures::nearestFeatEdge
indexedOctree<treeDataEdge> ppTree
(
treeDataEdge
(
false,
edges,
points,
identity(edges.size())
), // all information needed to do geometric checks
treeDataEdge(edges, points), // All edges
searchDomain, // overall search domain
8, // maxLevel
10, // leafsize

View File

@ -165,7 +165,6 @@ Foam::triSurfaceRegionSearch::treeByRegion() const
(
treeDataIndirectTriSurface
(
false, //true,
indirectRegionPatches_[regionI],
tolerance()
),

View File

@ -240,7 +240,7 @@ Foam::triSurfaceSearch::tree() const
(
new indexedOctree<treeDataTriSurface>
(
treeDataTriSurface(false, surface_, tolerance_),
treeDataTriSurface(surface_, tolerance_),
bb,
maxTreeDepth_, // maxLevel
10, // leafsize

View File

@ -90,7 +90,7 @@ void Foam::meshToMesh0::calcAddressing()
indexedOctree<treeDataCell> cellTree
(
treeDataCell(false, fromMesh_, polyMesh::CELL_TETS),
treeDataCell(fromMesh_, polyMesh::CELL_TETS),
shiftedBb, // overall bounding box
8, // maxLevel
10, // leafsize
@ -162,7 +162,7 @@ void Foam::meshToMesh0::calcAddressing()
// is not as big as all boundary faces
indexedOctree<treeDataFace> faceTree
(
treeDataFace(false, fromPatch),
treeDataFace(fromPatch),
shiftedBb, // overall search domain
12, // maxLevel
10, // leafsize

View File

@ -93,12 +93,8 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
const indexedOctree<treeDataFace> boundaryTree
(
treeDataFace // all information needed to search faces
(
false, // do not cache bb
mesh,
bndFaces // patch faces only
),
treeDataFace(mesh, bndFaces), // patch faces only
overallBb, // overall search domain
8, // maxLevel
10, // leafsize

View File

@ -94,12 +94,8 @@ void Foam::patchCloudSet::calcSamples
indexedOctree<treeDataFace> patchTree
(
treeDataFace // all information needed to search faces
(
false, // do not cache bb
mesh(),
patchFaces // boundary faces only
),
treeDataFace(mesh(), patchFaces), // boundary faces only
bb, // overall search domain
8, // maxLevel
10, // leafsize

View File

@ -114,12 +114,8 @@ void Foam::patchSeedSet::calcSamples
indexedOctree<treeDataFace> boundaryTree
(
treeDataFace // all information needed to search faces
(
false, // do not cache bb
mesh(),
patchFaces // boundary faces only
),
treeDataFace(mesh(), patchFaces), // boundary faces only
patchBb, // overall search domain
8, // maxLevel
10, // leafsize