Commit 7e376c96 authored by laurence's avatar laurence
Browse files

BUG: extendedFeatureEdgeMesh: Swap feature point algorithm for a faster one

The population of featurePointFeatureEdges was slow. Added a List called
edgeMap that contains the featureEdge index for every edge in a patch
(returns -1 if it is not a feature edge).
parent eecbe110
......@@ -65,8 +65,7 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges
labelListList featurePointFeatureEdges(nFeatPts);
forAll(featurePointFeatureEdges, pI)
{
featurePointFeatureEdges[pI] =
labelList(pointEdges[featurePoints[pI]].size(), -1);
featurePointFeatureEdges[pI] = pointEdges[featurePoints[pI]];
}
// Mapping between old and new indices, there is entry in the map for each
......@@ -74,6 +73,10 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges
// >= 0 corresponds to the index
labelList pointMap(sFeatLocalPts.size(), -1);
// Mapping between surface edge index and its feature edge index. -1 if it
// is not a feature edge
labelList edgeMap(sFeatEds.size(), -1);
// Noting when the normal of a face has been used so not to duplicate
labelList faceMap(surf.size(), -1);
......@@ -98,6 +101,8 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges
{
label sFEI = featureEdges[i];
edgeMap[sFEI] = i;
const edge& fE(sFeatEds[sFEI]);
// Check to see if the points have been already used
......@@ -156,43 +161,31 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges
{
regionEdges.append(i);
}
forAll(featurePointFeatureEdges, pI)
{
const labelList& fpfEdges = pointEdges[featurePoints[pI]];
labelList& fpfe = featurePointFeatureEdges[pI];
forAll(fpfEdges, eI)
{
if (sFEI == fpfEdges[eI])
{
fpfe[eI] = i;
}
}
}
}
// Populate feature point feature edges
DynamicList<label> newFeatureEdges;
forAll(featurePointFeatureEdges, pI)
{
const labelList& fpfe = featurePointFeatureEdges[pI];
DynamicList<label> newFeatureEdges(fpfe.size());
newFeatureEdges.setCapacity(fpfe.size());
forAll(fpfe, eI)
{
const label edgeIndex = fpfe[eI];
const label oldEdgeIndex = fpfe[eI];
const label newFeatureEdgeIndex = edgeMap[oldEdgeIndex];
if (edgeIndex != -1)
if (newFeatureEdgeIndex != -1)
{
newFeatureEdges.append(edgeIndex);
newFeatureEdges.append(newFeatureEdgeIndex);
}
}
featurePointFeatureEdges[pI] = newFeatureEdges;
featurePointFeatureEdges[pI].transfer(newFeatureEdges);
}
// Reorder the edges by classification
List<DynamicList<label> > allEds(nEdgeTypes);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment