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.
Conflicts:
tests/bugs/heal/bug26219_1
B.MakeFace(aResult,aBaseSurface,aBaseLocation,0);
Standard_Integer nbWires = 0;
+ TopoDS_Face tmpF = TopoDS::Face(myContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
// connecting wires
while (edges.Length()>0) {
aWire.Closed (BRep_Tool::IsClosed (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());
sfw->FixReorder();
Standard_Boolean isDegRemoved = Standard_False;
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
for (exp.Init(aRes, TopAbs_FACE); exp.More(); exp.Next()) {
//TopoDS_Face aFace = TopoDS::Face(aContext->Apply(exp.Current().Oriented(TopAbs_FORWARD)));
Standard_Integer NbFacesPerEdge = aList.Extent();
for ( ; anIter.More(); anIter.Next()) {
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)
continue;
if (NbFacesPerEdge == 1)
--- /dev/null
+puts "========================"
+puts " OCC26219"
+puts "========================"
+puts ""
+###########################################################
+## ShapeUpgrade_UnifySameDomain fails with StdFail_NotDone exception
+###########################################################
+
+restore [locate_data_file bug26219_unifysamedomain.valid_input.brep] p
+
+# -----------------------------------------------------------------------------
+# Attempt to simplify the model
+# -----------------------------------------------------------------------------
+
+set nbshapes_before_simplify "
+Number of shapes in shape
+ VERTEX : 200
+ EDGE : 348
+ WIRE : 150
+ FACE : 150
+ SHELL : 1
+ SOLID : 1
+ COMPSOLID : 0
+ COMPOUND : 1
+ SHAPE : 851
+"
+checknbshapes p -ref ${nbshapes_before_simplify} -t -m "result before attempt to simplify the model"
+
+axo; donly p; fit
+xwd ${imagedir}/${casename}_1.png
+
+unifysamedom p p
+
+set nbshapes_after_simplify "
+Number of shapes in shape
+ VERTEX : 128
+ EDGE : 192
+ WIRE : 66
+ FACE : 66
+ SHELL : 1
+ SOLID : 1
+ COMPSOLID : 0
+ COMPOUND : 1
+ SHAPE : 455
+"
+checknbshapes p -ref ${nbshapes_after_simplify} -t -m "result after attempt to simplify the model"
+
+xwd ${imagedir}/${casename}_2.png
--- /dev/null
+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"
+}
--- /dev/null
+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"
+}