mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-26 10:19:45 +03:00
0027085: ShapeUpgrade_UnifySameDomain very large performance difference for seemingly similar shapes
Performance of the algorithm ShapeUpgrade_UnifySameDomain has been improved by avoiding of multiple calls of ShapeBuild_ReShape::Apply() method. New test cases have been added.
This commit is contained in:
parent
b846d1e002
commit
26ca3bd549
@ -1168,6 +1168,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
|||||||
B.MakeFace(aResult,aBaseSurface,aBaseLocation,0);
|
B.MakeFace(aResult,aBaseSurface,aBaseLocation,0);
|
||||||
Standard_Integer nbWires = 0;
|
Standard_Integer nbWires = 0;
|
||||||
|
|
||||||
|
TopoDS_Face tmpF = TopoDS::Face(myContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
|
||||||
// connecting wires
|
// connecting wires
|
||||||
while (edges.Length()>0) {
|
while (edges.Length()>0) {
|
||||||
|
|
||||||
@ -1215,7 +1216,6 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
|||||||
aWire.Closed (BRep_Tool::IsClosed (aWire));
|
aWire.Closed (BRep_Tool::IsClosed (aWire));
|
||||||
aWire = TopoDS::Wire(myContext->Apply(aWire));
|
aWire = TopoDS::Wire(myContext->Apply(aWire));
|
||||||
|
|
||||||
TopoDS_Face tmpF = TopoDS::Face(myContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
|
|
||||||
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(aWire,tmpF,Precision::Confusion());
|
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(aWire,tmpF,Precision::Confusion());
|
||||||
sfw->FixReorder();
|
sfw->FixReorder();
|
||||||
Standard_Boolean isDegRemoved = Standard_False;
|
Standard_Boolean isDegRemoved = Standard_False;
|
||||||
@ -1515,6 +1515,15 @@ void ShapeUpgrade_UnifySameDomain::UnifyEdges()
|
|||||||
MergeSeq(SeqEdges, Tol, myConcatBSplines, myContext, myOldShapes, SharedVert, NewEdges2OldEdges);
|
MergeSeq(SeqEdges, Tol, myConcatBSplines, myContext, myOldShapes, SharedVert, NewEdges2OldEdges);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TopTools_DataMapOfShapeShape oldFaces2NewFaces;
|
||||||
|
for (exp.Init(myShape, TopAbs_FACE); exp.More(); exp.Next())
|
||||||
|
{
|
||||||
|
const TopoDS_Face& f = TopoDS::Face(exp.Current());
|
||||||
|
TopoDS_Face NewF = TopoDS::Face(myContext->Apply(f));
|
||||||
|
if (!NewF.IsNull())
|
||||||
|
oldFaces2NewFaces.Bind(f, NewF);
|
||||||
|
}
|
||||||
|
|
||||||
// processing each face
|
// processing each face
|
||||||
for (exp.Init(aRes, TopAbs_FACE); exp.More(); exp.Next()) {
|
for (exp.Init(aRes, TopAbs_FACE); exp.More(); exp.Next()) {
|
||||||
//TopoDS_Face aFace = TopoDS::Face(aContext->Apply(exp.Current().Oriented(TopAbs_FORWARD)));
|
//TopoDS_Face aFace = TopoDS::Face(aContext->Apply(exp.Current().Oriented(TopAbs_FORWARD)));
|
||||||
@ -1529,7 +1538,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyEdges()
|
|||||||
Standard_Integer NbFacesPerEdge = aList.Extent();
|
Standard_Integer NbFacesPerEdge = aList.Extent();
|
||||||
for ( ; anIter.More(); anIter.Next()) {
|
for ( ; anIter.More(); anIter.Next()) {
|
||||||
TopoDS_Face face = TopoDS::Face(anIter.Value());
|
TopoDS_Face face = TopoDS::Face(anIter.Value());
|
||||||
TopoDS_Face face1 = TopoDS::Face(myContext->Apply(anIter.Value()));
|
TopoDS_Face face1 = TopoDS::Face(oldFaces2NewFaces(anIter.Value()));
|
||||||
if (face1.IsSame(aFace) && NbFacesPerEdge != 1)
|
if (face1.IsSame(aFace) && NbFacesPerEdge != 1)
|
||||||
continue;
|
continue;
|
||||||
if (NbFacesPerEdge == 1)
|
if (NbFacesPerEdge == 1)
|
||||||
|
@ -33,15 +33,15 @@ unifysamedom p p
|
|||||||
|
|
||||||
set nbshapes_after_simplify "
|
set nbshapes_after_simplify "
|
||||||
Number of shapes in shape
|
Number of shapes in shape
|
||||||
VERTEX : 130
|
VERTEX : 128
|
||||||
EDGE : 194
|
EDGE : 192
|
||||||
WIRE : 66
|
WIRE : 66
|
||||||
FACE : 66
|
FACE : 66
|
||||||
SHELL : 1
|
SHELL : 1
|
||||||
SOLID : 1
|
SOLID : 1
|
||||||
COMPSOLID : 0
|
COMPSOLID : 0
|
||||||
COMPOUND : 1
|
COMPOUND : 1
|
||||||
SHAPE : 459
|
SHAPE : 455
|
||||||
"
|
"
|
||||||
checknbshapes p -ref ${nbshapes_after_simplify} -t -m "result after attempt to simplify the model"
|
checknbshapes p -ref ${nbshapes_after_simplify} -t -m "result after attempt to simplify the model"
|
||||||
|
|
||||||
|
28
tests/bugs/modalg_6/bug27085_1
Normal file
28
tests/bugs/modalg_6/bug27085_1
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC27085"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
###############################
|
||||||
|
## ShapeUpgrade_UnifySameDomain very large performance difference for seemingly similar shapes
|
||||||
|
###############################
|
||||||
|
|
||||||
|
restore [locate_data_file bug27085_fused_primitive.fast.brep] fp
|
||||||
|
|
||||||
|
dchrono h reset
|
||||||
|
dchrono h start
|
||||||
|
|
||||||
|
unifysamedom res fp
|
||||||
|
|
||||||
|
dchrono h stop
|
||||||
|
set q [dchrono h show]
|
||||||
|
|
||||||
|
regexp {CPU user time: ([-0-9.+eE]+) seconds} $q full z
|
||||||
|
puts "$z"
|
||||||
|
|
||||||
|
set max_time 5
|
||||||
|
|
||||||
|
if { $z > ${max_time} } {
|
||||||
|
puts "Elapsed time is more than ${max_time} seconds - Faulty"
|
||||||
|
} else {
|
||||||
|
puts "Elapsed time is less than ${max_time} seconds - OK"
|
||||||
|
}
|
28
tests/bugs/modalg_6/bug27085_2
Normal file
28
tests/bugs/modalg_6/bug27085_2
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC27085"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
###############################
|
||||||
|
## ShapeUpgrade_UnifySameDomain very large performance difference for seemingly similar shapes
|
||||||
|
###############################
|
||||||
|
|
||||||
|
restore [locate_data_file bug27085_fused_primitive.slow.brep] sp
|
||||||
|
|
||||||
|
dchrono h reset
|
||||||
|
dchrono h start
|
||||||
|
|
||||||
|
unifysamedom res sp
|
||||||
|
|
||||||
|
dchrono h stop
|
||||||
|
set q [dchrono h show]
|
||||||
|
|
||||||
|
regexp {CPU user time: ([-0-9.+eE]+) seconds} $q full z
|
||||||
|
puts "$z"
|
||||||
|
|
||||||
|
set max_time 8
|
||||||
|
|
||||||
|
if { $z > ${max_time} } {
|
||||||
|
puts "Elapsed time is more than ${max_time} seconds - Faulty"
|
||||||
|
} else {
|
||||||
|
puts "Elapsed time is less than ${max_time} seconds - OK"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user