diff --git a/src/QANewBRepNaming/QANewBRepNaming_ImportShape.cxx b/src/QANewBRepNaming/QANewBRepNaming_ImportShape.cxx index 4be9469479..9be4ee70ef 100755 --- a/src/QANewBRepNaming/QANewBRepNaming_ImportShape.cxx +++ b/src/QANewBRepNaming/QANewBRepNaming_ImportShape.cxx @@ -245,6 +245,8 @@ void QANewBRepNaming_ImportShape::LoadC0Edges(const TopoDS_Shape& S, Standard_Boolean aC0 = Standard_False; TopoDS_Shape anEdge1 = anEx.Current(); if (edgeNaborFaces.IsBound(anEdge1)) { + TopTools_ListOfShape aEdgesToRemove; // record items to be removed from the map (should be done after iteration) + aEdgesToRemove.Append (anEdge1); const TopTools_ListOfShape& aList1 = edgeNaborFaces.Find(anEdge1); TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itr(edgeNaborFaces); for (; itr.More(); itr.Next()) { @@ -261,11 +263,13 @@ void QANewBRepNaming_ImportShape::LoadC0Edges(const TopoDS_Shape& S, aC0=Standard_True; TNaming_Builder bC0Edge(Tagger->NewChild()); bC0Edge.Generated(anEdge2); - edgeNaborFaces.UnBind(anEdge2); + aEdgesToRemove.Append (anEdge2); } } } - edgeNaborFaces.UnBind(anEdge1); + // remove items from the data map + for(TopTools_ListIteratorOfListOfShape anIt(aEdgesToRemove); anIt.More(); anIt.Next()) + edgeNaborFaces.UnBind(anIt.Value()); } if (aC0) { TNaming_Builder bC0Edge(Tagger->NewChild()); diff --git a/src/QANewModTopOpe/QANewModTopOpe_Glue_SDFaces.cxx b/src/QANewModTopOpe/QANewModTopOpe_Glue_SDFaces.cxx index 9280bcafa4..9c477416be 100755 --- a/src/QANewModTopOpe/QANewModTopOpe_Glue_SDFaces.cxx +++ b/src/QANewModTopOpe/QANewModTopOpe_Glue_SDFaces.cxx @@ -532,7 +532,6 @@ QANewModTopOpe_Glue::PerformSDFaces() } } - anIter.Initialize(myMapModif); TopTools_MapOfShape aComVerMap; TopTools_MapOfShape aLocVerMap; @@ -541,6 +540,8 @@ QANewModTopOpe_Glue::PerformSDFaces() anExp1.Init(myS2, TopAbs_VERTEX); for(; anExp1.More(); anExp1.Next()) aComVerMap.Add(anExp1.Current()); + TopTools_ListOfShape aShapesToRemove; // record items to be removed from the map (should be done after iteration) + anIter.Initialize(myMapModif); for(; anIter.More(); anIter.Next()) { const TopoDS_Shape& aS = anIter.Key(); if(aS.ShapeType() == TopAbs_EDGE) { @@ -574,18 +575,19 @@ QANewModTopOpe_Glue::PerformSDFaces() myMapModif(aS).Remove(anI1); } else { - myMapModif.UnBind(aS); + aShapesToRemove.Append (aS); } } } if(!anI1.More()) break; } } - -// if(anIter.Value().Extent() == 0) myMapModif.UnBind(aS); - } + // remove items from the data map + for(TopTools_ListIteratorOfListOfShape anIt(aShapesToRemove); anIt.More(); anIt.Next()) + myMapModif.UnBind(anIt.Value()); + // Deleted vertices anExp1.Init(myShape, TopAbs_VERTEX); for(; anExp1.More(); anExp1.Next()) { diff --git a/tests/bugs/begin b/tests/bugs/begin index 7285857398..aac6c0d3b4 100755 --- a/tests/bugs/begin +++ b/tests/bugs/begin @@ -25,6 +25,16 @@ if { [info exists test_image] == 0 } { set test_image photo } +# Procedure to check equality of two reals with tolerance (relative and absolute) +proc checkreal {name value expected tol_abs tol_rel} { + if { abs ($value - $expected) > $tol_abs + $tol_rel * abs ($expected) } { + puts "Error: $name = $value is not equal to expected $expected" + } else { + puts "Check of $name OK: value = $value, expected = $expected" + } + return +} + # Procedure to check if sequence of values in listval follows linear trend # adding the same delta on each step. # diff --git a/tests/bugs/caf/bug114 b/tests/bugs/caf/bug114 index 23e7e155ed..c82cef86e3 100755 --- a/tests/bugs/caf/bug114 +++ b/tests/bugs/caf/bug114 @@ -2,62 +2,26 @@ puts "===========" puts "OCC114" puts "===========" -#-------------------------------------------------------------------- -####### Setting value of memory leakage in percents of memory allocated by shape -set percent_max 10 -puts "Max memory leakage is $percent_max%" -####### Setting amount of iterations for computing leackage +# Max number of iterations for computing memory leackage set i_max 20 puts "Amount of iterations is $i_max" -#-------------------------------------------------------------------- - -if ![string compare $tcl_platform(platform) "windows"] { - proc VMem { memory } { - upvar $memory mem - regsub "^.*PeakVirtualSize: *\(\[0-9\]*\) KB.*$" \ - [exec tlist [pid]] "\\1" mem - } -} else { - proc VMem { memory } { - upvar $memory mem - set mem [lindex [exec ps -o vsz -p [pid]] 1] - } -} NewDocument D MDTV-Standard UndoLimit D 10 -VMem Mem0 restore [locate_data_file OCC114.brep] s -VMem Mem1 -#puts "... The peak memory consumed: [expr $Mem1 - $Mem0] KB" - -set MemoryLeakage 0 +set listmem {} for {set i 1} {${i} <= ${i_max}} {incr i} { - OpenCommand D - SetShape D 0:1 s - AbortCommand D + OpenCommand D + SetShape D 0:1 s + AbortCommand D - VMem Mem2 - set Delta [expr $Mem2 - $Mem1] - set MemoryLeakage [expr $MemoryLeakage + $Delta] -# puts " $i delta memory consumed: $Delta KB" + # check memory usage (with tolerance equal to half page size) + lappend listmem [expr [meminfo w] / 1024] + if { [checktrend $listmem 0 1 "Memory leak detected"] } { + puts "No memory leak, $i iterations" + break + } } - - -if { $MemoryLeakage != 0 } then { - set percent [expr ${MemoryLeakage} / (double(${i_max}) * (${Mem1} - ${Mem0})) * 100.] -} else { - set percent 0 -} -puts "Current memory leakage in percents = ${percent}" - -if {${percent} > ${percent_max}} { - puts "OCC114: Error" -} else { - puts "OCC114: OK" -} - - diff --git a/tests/bugs/moddata/buc60654 b/tests/bugs/moddata/buc60654 deleted file mode 100755 index 8e7008e246..0000000000 --- a/tests/bugs/moddata/buc60654 +++ /dev/null @@ -1,21 +0,0 @@ -puts "==================================" -puts "BUC60654" -puts "==================================" -puts "" -########################################################## -## Raises exception in GCPnts_AbscissaPoint on a Geom2d_OffsetCurve -########################################################## - -set len_ch 4.0000000000000001e+100 - -line line_2d 0 0 1 1 - -offset result line_2d 10 1 0 - -set info [length $result] -regexp {The length result is +([-0-9.+eE]+)} $info full len - -if { ${len} != ${len_ch} } { - puts "Error : length is invalid" -} - diff --git a/tests/bugs/moddata/bug143 b/tests/bugs/moddata/bug143 index ee27c86060..a76fd4a84e 100755 --- a/tests/bugs/moddata/bug143 +++ b/tests/bugs/moddata/bug143 @@ -7,7 +7,7 @@ puts "" ## Raises exception "Standard_NotImplemented3" in GCPnts_AbscissaPoint on a Geom2d_OffsetCurve ###################################################################### -set len_ch 4.0000000000000001e+100 +set len_expected 4.e100 line line_2d 0 0 1 1 offset result line_2d 10 1 0 @@ -15,6 +15,4 @@ offset result line_2d 10 1 0 set info [length $result] regexp {The length result is +([-0-9.+eE]+)} $info full len -if { ${len} != ${len_ch} } { - puts "Error : Length is invalid" -} +checkreal "Length" $len $len_expected 0. 1e-10 diff --git a/tests/bugs/parse.rules b/tests/bugs/parse.rules index 8f729a9291..6f6569ccd1 100755 --- a/tests/bugs/parse.rules +++ b/tests/bugs/parse.rules @@ -1,4 +1,5 @@ FAILED /\bFaulty\b/ bad shape +IGNORE /^Error [23]d = [\d.-]+/ debug output of blend command diff --git a/tests/heal/parse.rules b/tests/heal/parse.rules index fdebf39410..ecb7c874b7 100644 --- a/tests/heal/parse.rules +++ b/tests/heal/parse.rules @@ -1,4 +1,6 @@ FAILED /\bFaulty\b/ bad shape IGNORE /Error: Number of intervals are not equal for 2d 3d. Ignored./ Debug mode message from DT_ShapeDivide IGNORE /Warning: GeomConvert_ApproxSurface Exception: try to decrease continuity/ DEbug mode message from DT_ToBspl -IGNORE /Error: ShapeFix_ComposeShell::MakeFacesOnPatch: can[']t dispatch wires/ Debug mode output \ No newline at end of file +IGNORE /Error: ShapeFix_ComposeShell::MakeFacesOnPatch: can[']t dispatch wires/ Debug mode output +IGNORE /Warning: ShapeFix_WireSegment::DefineI[UV]M[ia][nx]: indexation error/ debug mode output on bad geometries +IGNORE /error = [0-9eE.+-]+\s+spans = [0-9]+/ debug output of surface approximator \ No newline at end of file