mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: surfaceFeatures trim walking - never walk over feature points.
This commit is contained in:
@ -535,37 +535,6 @@ int main(int argc, char *argv[])
|
|||||||
<< " internal edges : " << newSet.nInternalEdges() << nl
|
<< " internal edges : " << newSet.nInternalEdges() << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// Dummy trim operation to mark features
|
|
||||||
labelList featureEdgeIndexing = newSet.trimFeatures(-GREAT, 0);
|
|
||||||
|
|
||||||
scalarField surfacePtFeatureIndex(surf.points().size(), -1);
|
|
||||||
|
|
||||||
forAll(newSet.featureEdges(), eI)
|
|
||||||
{
|
|
||||||
const edge& e = surf.edges()[newSet.featureEdges()[eI]];
|
|
||||||
|
|
||||||
surfacePtFeatureIndex[surf.meshPoints()[e.start()]] =
|
|
||||||
featureEdgeIndexing[newSet.featureEdges()[eI]];
|
|
||||||
|
|
||||||
surfacePtFeatureIndex[surf.meshPoints()[e.end()]] =
|
|
||||||
featureEdgeIndexing[newSet.featureEdges()[eI]];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (writeVTK)
|
|
||||||
{
|
|
||||||
vtkSurfaceWriter<scalar>().write
|
|
||||||
(
|
|
||||||
runTime.constant()/"triSurface", // outputDir
|
|
||||||
sFeatFileName, // surfaceName
|
|
||||||
surf.points(),
|
|
||||||
faces,
|
|
||||||
"surfacePtFeatureIndex", // fieldName
|
|
||||||
surfacePtFeatureIndex,
|
|
||||||
true, // isNodeValues
|
|
||||||
true // verbose
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extracting and writing a featureEdgeMesh
|
// Extracting and writing a featureEdgeMesh
|
||||||
|
|
||||||
Pout<< nl << "Writing featureEdgeMesh to constant/featureEdgeMesh."
|
Pout<< nl << "Writing featureEdgeMesh to constant/featureEdgeMesh."
|
||||||
@ -608,30 +577,61 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Find close features
|
// Find close features
|
||||||
|
|
||||||
Random rndGen(343267);
|
// // Dummy trim operation to mark features
|
||||||
|
// labelList featureEdgeIndexing = newSet.trimFeatures(-GREAT, 0);
|
||||||
|
|
||||||
treeBoundBox surfBB
|
// scalarField surfacePtFeatureIndex(surf.points().size(), -1);
|
||||||
(
|
|
||||||
treeBoundBox(searchSurf.bounds()).extend(rndGen, 1e-4)
|
|
||||||
);
|
|
||||||
|
|
||||||
surfBB.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
// forAll(newSet.featureEdges(), eI)
|
||||||
surfBB.max() += Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
// {
|
||||||
|
// const edge& e = surf.edges()[newSet.featureEdges()[eI]];
|
||||||
|
|
||||||
indexedOctree<treeDataEdge> ftEdTree
|
// surfacePtFeatureIndex[surf.meshPoints()[e.start()]] =
|
||||||
(
|
// featureEdgeIndexing[newSet.featureEdges()[eI]];
|
||||||
treeDataEdge
|
|
||||||
(
|
// surfacePtFeatureIndex[surf.meshPoints()[e.end()]] =
|
||||||
false,
|
// featureEdgeIndexing[newSet.featureEdges()[eI]];
|
||||||
surf.edges(),
|
// }
|
||||||
surf.localPoints(),
|
|
||||||
newSet.featureEdges()
|
// if (writeVTK)
|
||||||
),
|
// {
|
||||||
surfBB,
|
// vtkSurfaceWriter<scalar>().write
|
||||||
8, // maxLevel
|
// (
|
||||||
10, // leafsize
|
// runTime.constant()/"triSurface", // outputDir
|
||||||
3.0 // duplicity
|
// sFeatFileName, // surfaceName
|
||||||
);
|
// surf.points(),
|
||||||
|
// faces,
|
||||||
|
// "surfacePtFeatureIndex", // fieldName
|
||||||
|
// surfacePtFeatureIndex,
|
||||||
|
// true, // isNodeValues
|
||||||
|
// true // verbose
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Random rndGen(343267);
|
||||||
|
|
||||||
|
// treeBoundBox surfBB
|
||||||
|
// (
|
||||||
|
// treeBoundBox(searchSurf.bounds()).extend(rndGen, 1e-4)
|
||||||
|
// );
|
||||||
|
|
||||||
|
// surfBB.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
// surfBB.max() += Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
|
||||||
|
// indexedOctree<treeDataEdge> ftEdTree
|
||||||
|
// (
|
||||||
|
// treeDataEdge
|
||||||
|
// (
|
||||||
|
// false,
|
||||||
|
// surf.edges(),
|
||||||
|
// surf.localPoints(),
|
||||||
|
// newSet.featureEdges()
|
||||||
|
// ),
|
||||||
|
// surfBB,
|
||||||
|
// 8, // maxLevel
|
||||||
|
// 10, // leafsize
|
||||||
|
// 3.0 // duplicity
|
||||||
|
// );
|
||||||
|
|
||||||
// labelList nearPoints = ftEdTree.findBox
|
// labelList nearPoints = ftEdTree.findBox
|
||||||
// (
|
// (
|
||||||
@ -905,6 +905,8 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Info<< nl << "End" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -263,6 +263,16 @@ Foam::surfaceFeatures::labelScalar Foam::surfaceFeatures::walkSegment
|
|||||||
|
|
||||||
label vertI = startPointI;
|
label vertI = startPointI;
|
||||||
|
|
||||||
|
scalar visitedLength = 0.0;
|
||||||
|
|
||||||
|
label nVisited = 0;
|
||||||
|
|
||||||
|
if (findIndex(featurePoints_, startPointI) >= 0)
|
||||||
|
{
|
||||||
|
// Do not walk across feature points
|
||||||
|
|
||||||
|
return labelScalar(nVisited, visitedLength);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now we have:
|
// Now we have:
|
||||||
@ -284,11 +294,6 @@ Foam::surfaceFeatures::labelScalar Foam::surfaceFeatures::walkSegment
|
|||||||
unsetVal = currentFeatI;
|
unsetVal = currentFeatI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scalar visitedLength = 0.0;
|
|
||||||
|
|
||||||
label nVisited = 0;
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// Step to next feature edge with value unsetVal
|
// Step to next feature edge with value unsetVal
|
||||||
|
|||||||
Reference in New Issue
Block a user