1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

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
This commit is contained in:
pdn 2014-10-30 11:59:38 +03:00 committed by bugmaster
parent a0c202521d
commit e1aa24d84b
2 changed files with 81 additions and 24 deletions

View File

@ -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);

51
tests/bugs/heal/bug25424 Executable file
View File

@ -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