From e1aa24d84b2162625ec7f1eb58bc6de17bc2721e Mon Sep 17 00:00:00 2001 From: pdn Date: Thu, 30 Oct 2014 11:59:38 +0300 Subject: [PATCH] 0025424: Performance regression on step import Regression was caused by checking of shell closeness on each face add iteration. Fixed. Test case for issue CR25424 --- src/ShapeFix/ShapeFix_Shell.cxx | 54 ++++++++++++++++++--------------- tests/bugs/heal/bug25424 | 51 +++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 24 deletions(-) create mode 100755 tests/bugs/heal/bug25424 diff --git a/src/ShapeFix/ShapeFix_Shell.cxx b/src/ShapeFix/ShapeFix_Shell.cxx index 5a03b46644..17a175843c 100644 --- a/src/ShapeFix/ShapeFix_Shell.cxx +++ b/src/ShapeFix/ShapeFix_Shell.cxx @@ -223,19 +223,19 @@ static Standard_Boolean GetShells(TopTools_SequenceOfShape& Lface, continue; if((edge.Orientation() == TopAbs_FORWARD && dire.Contains(edge)) - || (edge.Orientation() == TopAbs_REVERSED && reve.Contains(edge))) - nbbe++; + || (edge.Orientation() == TopAbs_REVERSED && reve.Contains(edge))) + nbbe++; else if((edge.Orientation() == TopAbs_FORWARD && reve.Contains(edge)) - || (edge.Orientation() == TopAbs_REVERSED && dire.Contains(edge))) - nbe++; + || (edge.Orientation() == TopAbs_REVERSED && dire.Contains(edge))) + nbe++; if(dire.Contains(edge)) dire.Remove(edge); else - if(reve.Contains(edge)) reve.Remove(edge); - else { - if(edge.Orientation() == TopAbs_FORWARD) dtemp.Add(edge); - if(edge.Orientation() == TopAbs_REVERSED) rtemp.Add(edge); - } + if(reve.Contains(edge)) reve.Remove(edge); + else { + if(edge.Orientation() == TopAbs_FORWARD) dtemp.Add(edge); + if(edge.Orientation() == TopAbs_REVERSED) rtemp.Add(edge); + } } if(!nbbe && !nbe && dtemp.IsEmpty() && rtemp.IsEmpty()) continue; @@ -251,30 +251,32 @@ static Standard_Boolean GetShells(TopTools_SequenceOfShape& Lface, // Addition of face to shell. In the dependance of orientation faces in the shell // added face can be reversed. - + if((nbe != 0 || nbbe != 0) || j == 1) { if(nbbe != 0) { - F1.Reverse(); - for(TopTools_MapIteratorOfMapOfShape ite(dtemp); ite.More(); ite.Next()) - reve.Add(ite.Key()); - for(TopTools_MapIteratorOfMapOfShape ite1(rtemp); ite1.More(); ite1.Next()) - dire.Add(ite1.Key()); - done = Standard_True; + F1.Reverse(); + for(TopTools_MapIteratorOfMapOfShape ite(dtemp); ite.More(); ite.Next()) + reve.Add(ite.Key()); + for(TopTools_MapIteratorOfMapOfShape ite1(rtemp); ite1.More(); ite1.Next()) + dire.Add(ite1.Key()); + done = Standard_True; } else { - for(TopTools_MapIteratorOfMapOfShape ite(dtemp); ite.More(); ite.Next()) - dire.Add(ite.Key()); - for(TopTools_MapIteratorOfMapOfShape ite1(rtemp); ite1.More(); ite1.Next()) - reve.Add(ite1.Key()); + for(TopTools_MapIteratorOfMapOfShape ite(dtemp); ite.More(); ite.Next()) + dire.Add(ite.Key()); + for(TopTools_MapIteratorOfMapOfShape ite1(rtemp); ite1.More(); ite1.Next()) + reve.Add(ite1.Key()); } j++; B.Add(nshell,F1); - nshell.Closed (BRep_Tool::IsClosed (nshell)); aMapFaceShells.Bind(F1,nshell); Lface.Remove(i); - // if closed shell is obtained it adds to sequence of shells and new shell begin to construct. - if(isMultiConnex && nshell.Closed()) { + // check if closed shell is obtained in multy connex mode and add to sequence of + // shells and new shell begin to construct. + // (check is n*2) + if(isMultiConnex && BRep_Tool::IsClosed (nshell)) { + nshell.Closed (Standard_True); aSeqShells.Append(nshell); TopoDS_Shell nshellnext; B.MakeShell(nshellnext); @@ -309,8 +311,12 @@ static Standard_Boolean GetShells(TopTools_SequenceOfShape& Lface, aFace = aItf.Value(); numFace++; } - if(numFace >1) + if(numFace >1) { + // close all closed shells in no multy connex mode + if(!isMultiConnex) + nshell.Closed (BRep_Tool::IsClosed (nshell)); aSeqShells.Append(nshell); + } else if(numFace == 1) { if(aMapFaceShells.IsBound(aFace)) aMapFaceShells.UnBind(aFace); diff --git a/tests/bugs/heal/bug25424 b/tests/bugs/heal/bug25424 new file mode 100755 index 0000000000..d69b7285e9 --- /dev/null +++ b/tests/bugs/heal/bug25424 @@ -0,0 +1,51 @@ +puts "================" +puts "OCC25424" +puts "================" +puts "" +####################################################################################### +# Performance regression on step import +###################################################################################### + +pload XDE +pload QAcommands + +if { [regexp {Debug mode} [dversion]] } { + set max_time 200 +} else { + if { [regexp {Windows} [dversion]] } { + set max_time 15 + } else { + set max_time 20 + } +} + +dchrono h reset +dchrono h start + +testreadstep [locate_data_file bug25424_Secure.stp] result + +dchrono h stop +set q [dchrono h show] + +regexp {CPU user time: ([-0-9.+eE]+) seconds} $q full z +puts "$z" + +if { $z > ${max_time} } { + puts "Elapsed time of testreadstep is more than ${max_time} seconds - Faulty" +} else { + puts "Elapsed time of testreadstep is less than ${max_time} seconds - OK" +} + +set square 6998.53 + +set nb_v_good 4482 +set nb_e_good 6781 +set nb_w_good 2309 +set nb_f_good 2305 +set nb_sh_good 1 +set nb_sol_good 1 +set nb_compsol_good 0 +set nb_compound_good 0 +set nb_shape_good 15879 + +set 3dviewer 1