mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0030914: Modeling Algorithms - Improve performance of UnifySameDom algorithm for specific case with many edges
Use cached containers to find the necessary shapes.
This commit is contained in:
parent
115d350e09
commit
fb64d0f4a2
@ -1671,7 +1671,8 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
|||||||
TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
|
TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
|
||||||
Standard_Integer j;
|
Standard_Integer j;
|
||||||
TopTools_MapOfShape VerticesToAvoid;
|
TopTools_MapOfShape VerticesToAvoid;
|
||||||
for (j = 1; j <= SeqEdges.Length(); j++)
|
const Standard_Integer aNbE = SeqEdges.Length();
|
||||||
|
for (j = 1; j <= aNbE; j++)
|
||||||
{
|
{
|
||||||
TopoDS_Edge anEdge = TopoDS::Edge(SeqEdges(j));
|
TopoDS_Edge anEdge = TopoDS::Edge(SeqEdges(j));
|
||||||
// fill in the map V-E
|
// fill in the map V-E
|
||||||
@ -1690,22 +1691,16 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
|||||||
|
|
||||||
// do loop while there are unused edges
|
// do loop while there are unused edges
|
||||||
TopTools_MapOfShape aUsedEdges;
|
TopTools_MapOfShape aUsedEdges;
|
||||||
for (;;)
|
|
||||||
|
for (Standard_Integer iE = 1; iE <= aNbE; ++iE)
|
||||||
{
|
{
|
||||||
TopoDS_Edge edge;
|
TopoDS_Edge edge = TopoDS::Edge (SeqEdges (iE));
|
||||||
for(j=1; j <= SeqEdges.Length(); j++)
|
if (!aUsedEdges.Add (edge))
|
||||||
{
|
continue;
|
||||||
edge = TopoDS::Edge(SeqEdges.Value(j));
|
|
||||||
if (!aUsedEdges.Contains(edge))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (j > SeqEdges.Length())
|
|
||||||
break; // all edges have been used
|
|
||||||
|
|
||||||
// make chain for unite
|
// make chain for unite
|
||||||
TopTools_SequenceOfShape aChain;
|
TopTools_SequenceOfShape aChain;
|
||||||
aChain.Append(edge);
|
aChain.Append(edge);
|
||||||
aUsedEdges.Add(edge);
|
|
||||||
TopoDS_Vertex V[2];
|
TopoDS_Vertex V[2];
|
||||||
TopExp::Vertices(edge, V[0], V[1], Standard_True);
|
TopExp::Vertices(edge, V[0], V[1], Standard_True);
|
||||||
|
|
||||||
@ -2214,32 +2209,16 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
|||||||
//Correct orientation of edges
|
//Correct orientation of edges
|
||||||
for (Standard_Integer ii = 1; ii <= edges.Length(); ii++)
|
for (Standard_Integer ii = 1; ii <= edges.Length(); ii++)
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& anEdge = edges(ii);
|
const TopoDS_Shape& anEdge = edges (ii);
|
||||||
const TopTools_ListOfShape& aLF = aMapEF.FindFromKey(anEdge);
|
Standard_Integer indE = aMapEF.FindIndex (anEdge);
|
||||||
|
const TopTools_ListOfShape& aLF = aMapEF (indE);
|
||||||
if (myAllowInternal &&
|
if (myAllowInternal &&
|
||||||
myKeepShapes.Contains(anEdge) &&
|
myKeepShapes.Contains(anEdge) &&
|
||||||
aLF.Extent() == 2)
|
aLF.Extent() == 2)
|
||||||
edges(ii).Orientation(TopAbs_INTERNAL);
|
edges(ii).Orientation(TopAbs_INTERNAL);
|
||||||
|
|
||||||
if (anEdge.Orientation() != TopAbs_INTERNAL)
|
if (anEdge.Orientation() != TopAbs_INTERNAL)
|
||||||
for (Standard_Integer jj = 1; jj <= faces.Length(); jj++)
|
edges (ii) = aMapEF.FindKey (indE);
|
||||||
{
|
|
||||||
const TopoDS_Shape aCurFace = faces(jj);
|
|
||||||
Standard_Boolean found = Standard_False;
|
|
||||||
TopExp_Explorer Explo(aCurFace, TopAbs_EDGE);
|
|
||||||
for (; Explo.More(); Explo.Next())
|
|
||||||
{
|
|
||||||
const TopoDS_Shape& aCurEdge = Explo.Current();
|
|
||||||
if (anEdge.IsSame(aCurEdge))
|
|
||||||
{
|
|
||||||
edges(ii) = aCurEdge;
|
|
||||||
found = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Exclude internal edges
|
//Exclude internal edges
|
||||||
|
Loading…
x
Reference in New Issue
Block a user