1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-07-30 13:05:50 +03:00

0025718: Unstable work of tests in bug5805 series

Force stable work of the algorithm BRepAlgo_Loop by replacing DataMap collections with List and/or IndexedDataMap in order to provide iterations independent on the memory addresses.

Avoid uninitialized fields in default constructor of Extrema_POnSurf.

Mark bad tests as known bad.
This commit is contained in:
msv 2015-03-19 16:08:06 +03:00 committed by bugmaster
parent 0a243bb4c4
commit 457b01e271
6 changed files with 110 additions and 59 deletions

View File

@ -94,10 +94,11 @@ fields
myFace : Face from TopoDS; myFace : Face from TopoDS;
myConstEdges : ListOfShape from TopTools; myConstEdges : ListOfShape from TopTools;
myEdges : ListOfShape from TopTools;
myVerOnEdges : DataMapOfShapeListOfShape from TopTools; myVerOnEdges : DataMapOfShapeListOfShape from TopTools;
myNewWires : ListOfShape from TopTools; myNewWires : ListOfShape from TopTools;
myNewFaces : ListOfShape from TopTools; myNewFaces : ListOfShape from TopTools;
myNewEdges : DataMapOfShapeListOfShape from TopTools; myCutEdges : DataMapOfShapeListOfShape from TopTools;
myVerticesForSubstitute : DataMapOfShapeShape from TopTools; myVerticesForSubstitute : DataMapOfShapeShape from TopTools;

View File

@ -28,6 +28,7 @@
#include <TopTools_SequenceOfShape.hxx> #include <TopTools_SequenceOfShape.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx> #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
@ -44,6 +45,7 @@
#ifdef DRAW #ifdef DRAW
#include <DBRep.hxx> #include <DBRep.hxx>
#pragma comment(lib,"TKDraw")
#endif #endif
#ifdef OCCT_DEBUG_ALGO #ifdef OCCT_DEBUG_ALGO
Standard_Boolean AffichLoop = Standard_False; Standard_Boolean AffichLoop = Standard_False;
@ -70,10 +72,11 @@ BRepAlgo_Loop::BRepAlgo_Loop()
void BRepAlgo_Loop::Init(const TopoDS_Face& F) void BRepAlgo_Loop::Init(const TopoDS_Face& F)
{ {
myConstEdges.Clear(); myConstEdges.Clear();
myEdges .Clear();
myVerOnEdges.Clear(); myVerOnEdges.Clear();
myNewWires .Clear(); myNewWires .Clear();
myNewFaces .Clear(); myNewFaces .Clear();
myNewEdges .Clear(); myCutEdges .Clear();
myFace = F; myFace = F;
} }
@ -121,6 +124,7 @@ static void Bubble(const TopoDS_Edge& E,
void BRepAlgo_Loop::AddEdge (TopoDS_Edge& E, void BRepAlgo_Loop::AddEdge (TopoDS_Edge& E,
const TopTools_ListOfShape& LV) const TopTools_ListOfShape& LV)
{ {
myEdges.Append(E);
myVerOnEdges.Bind(E,LV); myVerOnEdges.Bind(E,LV);
} }
@ -200,19 +204,41 @@ static TopoDS_Vertex UpdateClosedEdge(const TopoDS_Edge& E,
return VRes; return VRes;
} }
//=======================================================================
//function : RemoveFromMVE
//purpose :
//=======================================================================
static void RemoveFromMVE(TopTools_IndexedDataMapOfShapeListOfShape& MVE,
const TopoDS_Shape& theVertex)
{
// remove from the indexed data map by substituting last item instead of removed
Standard_Integer iV = MVE.FindIndex(theVertex);
if (iV > 0)
{
Standard_Integer iLast = MVE.Extent();
if (iV == iLast)
MVE.RemoveLast();
else
{
TopoDS_Shape aVertex = MVE.FindKey(iLast);
TopTools_ListOfShape anEdges = MVE(iLast);
MVE.RemoveLast();
MVE.Substitute(iV, aVertex, anEdges);
}
}
}
//======================================================================= //=======================================================================
//function : RemovePendingEdges //function : RemovePendingEdges
//purpose : //purpose :
//======================================================================= //=======================================================================
static void RemovePendingEdges(TopTools_DataMapOfShapeListOfShape& MVE) static void RemovePendingEdges(TopTools_IndexedDataMapOfShapeListOfShape& MVE)
{ {
//-------------------------------- //--------------------------------
// Remove hanging edges. // Remove hanging edges.
//-------------------------------- //--------------------------------
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape Mapit;
TopTools_ListOfShape ToRemove; TopTools_ListOfShape ToRemove;
TopTools_ListIteratorOfListOfShape itl; TopTools_ListIteratorOfListOfShape itl;
Standard_Boolean YaSupress = Standard_True; Standard_Boolean YaSupress = Standard_True;
@ -223,17 +249,18 @@ static void RemovePendingEdges(TopTools_DataMapOfShapeListOfShape& MVE)
TopTools_ListOfShape VToRemove; TopTools_ListOfShape VToRemove;
TopTools_MapOfShape EToRemove; TopTools_MapOfShape EToRemove;
for (Mapit.Initialize(MVE); Mapit.More(); Mapit.Next()) { for (Standard_Integer iV = 1; iV <= MVE.Extent(); iV++) {
const TopoDS_Shape& aVertex = MVE.FindKey(iV);
if (Mapit.Value().IsEmpty()) { const TopTools_ListOfShape& anEdges = MVE(iV);
VToRemove.Append(Mapit.Key()); if (anEdges.IsEmpty()) {
VToRemove.Append(aVertex);
} }
if (Mapit.Value().Extent() == 1) { if (anEdges.Extent() == 1) {
const TopoDS_Edge& E = TopoDS::Edge(Mapit.Value().First()); const TopoDS_Edge& E = TopoDS::Edge(anEdges.First());
TopExp::Vertices(E,V1,V2) ; TopExp::Vertices(E,V1,V2) ;
if (!V1.IsSame(V2)) { if (!V1.IsSame(V2)) {
VToRemove.Append(Mapit.Key()); VToRemove.Append(aVertex);
EToRemove.Add(Mapit.Value().First()); EToRemove.Add(anEdges.First());
} }
} }
} }
@ -241,11 +268,11 @@ static void RemovePendingEdges(TopTools_DataMapOfShapeListOfShape& MVE)
if (!VToRemove.IsEmpty()) { if (!VToRemove.IsEmpty()) {
YaSupress = Standard_True; YaSupress = Standard_True;
for (itl.Initialize(VToRemove); itl.More(); itl.Next()) { for (itl.Initialize(VToRemove); itl.More(); itl.Next()) {
MVE.UnBind(itl.Value()); RemoveFromMVE(MVE, itl.Value());
} }
if (!EToRemove.IsEmpty()) { if (!EToRemove.IsEmpty()) {
for (Mapit.Initialize(MVE); Mapit.More(); Mapit.Next()) { for (Standard_Integer iV = 1; iV <= MVE.Extent(); iV++) {
TopTools_ListOfShape& LE = MVE.ChangeFind(Mapit.Key()); TopTools_ListOfShape& LE = MVE.ChangeFromIndex(iV);
itl.Initialize(LE); itl.Initialize(LE);
while (itl.More()) { while (itl.More()) {
if (EToRemove.Contains(itl.Value())) { if (EToRemove.Contains(itl.Value())) {
@ -375,7 +402,7 @@ static Standard_Boolean SelectEdge(const TopoDS_Face& F,
return Standard_True; return Standard_True;
} }
//======================================================================= //=======================================================================
//function : Store //function : PurgeNewEdges
//purpose : //purpose :
//======================================================================= //=======================================================================
@ -400,13 +427,13 @@ static void PurgeNewEdges(TopTools_DataMapOfShapeListOfShape& NewEdges,
} }
//======================================================================= //=======================================================================
//function : Store //function : StoreInMVE
//purpose : //purpose :
//======================================================================= //=======================================================================
static void StoreInMVE (const TopoDS_Face& F, static void StoreInMVE (const TopoDS_Face& F,
TopoDS_Edge& E, TopoDS_Edge& E,
TopTools_DataMapOfShapeListOfShape& MVE, TopTools_IndexedDataMapOfShapeListOfShape& MVE,
Standard_Boolean& YaCouture, Standard_Boolean& YaCouture,
TopTools_DataMapOfShapeShape& VerticesForSubstitute ) TopTools_DataMapOfShapeShape& VerticesForSubstitute )
{ {
@ -416,11 +443,10 @@ static void StoreInMVE (const TopoDS_Face& F,
Standard_Real Tol = 0.001; //5.e-05; //5.e-07; Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
// gp_Pnt P1, P2, P; // gp_Pnt P1, P2, P;
gp_Pnt P1, P; gp_Pnt P1, P;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape Mapit;
BRep_Builder BB; BRep_Builder BB;
for (Mapit.Initialize( MVE ); Mapit.More(); Mapit.Next()) for (Standard_Integer iV = 1; iV <= MVE.Extent(); iV++)
{ {
V = TopoDS::Vertex( Mapit.Key() ); V = TopoDS::Vertex(MVE.FindKey(iV));
P = BRep_Tool::Pnt( V ); P = BRep_Tool::Pnt( V );
TopTools_ListOfShape VList; TopTools_ListOfShape VList;
TopoDS_Iterator VerExp( E ); TopoDS_Iterator VerExp( E );
@ -469,22 +495,22 @@ static void StoreInMVE (const TopoDS_Face& F,
TopExp::Vertices(E,V1,V2); TopExp::Vertices(E,V1,V2);
if( V1.IsNull() && V2.IsNull() ){ YaCouture = Standard_False; return; } if( V1.IsNull() && V2.IsNull() ){ YaCouture = Standard_False; return; }
if (!MVE.IsBound(V1)) { if (!MVE.Contains(V1)) {
MVE.Bind(V1,Empty); MVE.Add(V1,Empty);
} }
MVE(V1).Append(E); MVE.ChangeFromKey(V1).Append(E);
if (!V1.IsSame(V2)) { if (!V1.IsSame(V2)) {
if (!MVE.IsBound(V2)) { if (!MVE.Contains(V2)) {
MVE.Bind(V2,Empty); MVE.Add(V2,Empty);
} }
MVE(V2).Append(E); MVE.ChangeFromKey(V2).Append(E);
} }
TopLoc_Location L ; TopLoc_Location L ;
Handle(Geom_Surface) S = BRep_Tool::Surface(F,L); Handle(Geom_Surface) S = BRep_Tool::Surface(F,L);
if (BRep_Tool::IsClosed(E,S,L)) { if (BRep_Tool::IsClosed(E,S,L)) {
MVE(V2).Append(E.Reversed()); MVE.ChangeFromKey(V2).Append(E.Reversed());
if (!V1.IsSame(V2)) { if (!V1.IsSame(V2)) {
MVE(V1).Append(E.Reversed()); MVE.ChangeFromKey(V1).Append(E.Reversed());
} }
YaCouture = Standard_True; YaCouture = Standard_True;
} }
@ -497,8 +523,7 @@ static void StoreInMVE (const TopoDS_Face& F,
void BRepAlgo_Loop::Perform() void BRepAlgo_Loop::Perform()
{ {
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape Mapit; TopTools_ListIteratorOfListOfShape itl, itl1;
TopTools_ListIteratorOfListOfShape itl;
TopoDS_Vertex V1,V2; TopoDS_Vertex V1,V2;
Standard_Boolean YaCouture = Standard_False; Standard_Boolean YaCouture = Standard_False;
@ -511,8 +536,8 @@ void BRepAlgo_Loop::Perform()
DBRep::Set(name,myFace); DBRep::Set(name,myFace);
Standard_Integer NbEdges = 1; Standard_Integer NbEdges = 1;
#endif #endif
for (Mapit.Initialize(myVerOnEdges); Mapit.More(); Mapit.Next()) { for (itl.Initialize(myEdges); itl.More(); itl.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(Mapit.Key()); const TopoDS_Edge& E = TopoDS::Edge(itl.Value());
#ifdef DRAW #ifdef DRAW
sprintf(name,"EEE_%d_%d",NbLoops,NbEdges++); sprintf(name,"EEE_%d_%d",NbLoops,NbEdges++);
DBRep::Set(name,E); DBRep::Set(name,E);
@ -530,25 +555,36 @@ void BRepAlgo_Loop::Perform()
//------------------------------------------------ //------------------------------------------------
// Cut edges // Cut edges
//------------------------------------------------ //------------------------------------------------
for (Mapit.Initialize(myVerOnEdges); Mapit.More(); Mapit.Next()) { for (itl.Initialize(myEdges); itl.More(); itl.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge(itl.Value());
TopTools_ListOfShape LCE; TopTools_ListOfShape LCE;
const TopTools_ListOfShape* pVertices =
CutEdge (TopoDS::Edge(Mapit.Key()),Mapit.Value(), LCE); static_cast<TopTools_ListOfShape*>(myVerOnEdges.Find1(anEdge));
if (pVertices)
myNewEdges.Bind(Mapit.Key(),LCE); {
CutEdge (anEdge, *pVertices, LCE);
myCutEdges.Bind(anEdge, LCE);
}
} }
//----------------------------------- //-----------------------------------
// Construction map vertex => edges // Construction map vertex => edges
//----------------------------------- //-----------------------------------
TopTools_DataMapOfShapeListOfShape MVE; TopTools_IndexedDataMapOfShapeListOfShape MVE;
// add cut edges. // add cut edges.
for (Mapit.Initialize(myNewEdges); Mapit.More(); Mapit.Next()) { for (itl.Initialize(myEdges); itl.More(); itl.Next())
for (itl.Initialize(myNewEdges(Mapit.Key())); itl.More(); itl.Next()) { {
TopoDS_Edge& E = TopoDS::Edge(itl.Value()); const TopTools_ListOfShape* pLCE =
static_cast<TopTools_ListOfShape*>(myCutEdges.Find1(itl.Value()));
if (pLCE)
{
for (itl1.Initialize(*pLCE); itl1.More(); itl1.Next()) {
TopoDS_Edge& E = TopoDS::Edge(itl1.Value());
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute); StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
} }
} }
}
// add const edges // add const edges
// Sewn edges can be doubled or not in myConstEdges // Sewn edges can be doubled or not in myConstEdges
@ -565,8 +601,8 @@ void BRepAlgo_Loop::Perform()
cout <<"NewLoop"<<endl; cout <<"NewLoop"<<endl;
Standard_Integer NbEdges = 1; Standard_Integer NbEdges = 1;
TopTools_MapOfShape Done; TopTools_MapOfShape Done;
for (Mapit.Initialize(MVE); Mapit.More();Mapit.Next()) { for (Standard_Integer iV = 1; iV <= MVE.Extent(); iV++) {
for (itl.Initialize(Mapit.Value()); itl.More(); itl.Next()) { for (itl.Initialize(MVE(iV)); itl.More(); itl.Next()) {
TopoDS_Edge& E = TopoDS::Edge(itl.Value()); TopoDS_Edge& E = TopoDS::Edge(itl.Value());
if (Done.Add(E)) { if (Done.Add(E)) {
sprintf(name,"EEC_%d_%d",NbLoops,NbEdges++); sprintf(name,"EEC_%d_%d",NbLoops,NbEdges++);
@ -588,29 +624,29 @@ void BRepAlgo_Loop::Perform()
TopTools_MapOfShape UsedEdges; TopTools_MapOfShape UsedEdges;
while (!MVE.IsEmpty()) { while (MVE.Extent() > 0) {
B.MakeWire(NW); B.MakeWire(NW);
//-------------------------------- //--------------------------------
// Removal of hanging edges. // Removal of hanging edges.
//-------------------------------- //--------------------------------
RemovePendingEdges(MVE); RemovePendingEdges(MVE);
if (MVE.IsEmpty()) break; if (MVE.Extent() == 0) break;
//-------------------------------- //--------------------------------
// Start edge. // Start edge.
//-------------------------------- //--------------------------------
Mapit.Initialize(MVE); EF = CE = TopoDS::Edge(MVE(1).First());
EF = CE = TopoDS::Edge(Mapit.Value().First());
TopExp::Vertices(CE,V1,V2); TopExp::Vertices(CE,V1,V2);
//-------------------------------- //--------------------------------
// VF vertex start of new wire // VF vertex start of new wire
//-------------------------------- //--------------------------------
if (CE.Orientation() == TopAbs_FORWARD) { CV = VF = V1;} if (CE.Orientation() == TopAbs_FORWARD) { CV = VF = V1;}
else { CV = VF = V2;} else { CV = VF = V2;}
if (!MVE.IsBound(CV)) continue; if (!MVE.Contains(CV)) continue;
for ( itl.Initialize(MVE(CV)); itl.More(); itl.Next()) { TopTools_ListOfShape& aListEdges = MVE.ChangeFromKey(CV);
for ( itl.Initialize(aListEdges); itl.More(); itl.Next()) {
if (itl.Value().IsEqual(CE)) { if (itl.Value().IsEqual(CE)) {
MVE(CV).Remove(itl); aListEdges.Remove(itl);
break; break;
} }
} }
@ -626,14 +662,15 @@ void BRepAlgo_Loop::Perform()
B.Add (NW,CE); B.Add (NW,CE);
UsedEdges.Add(CE); UsedEdges.Add(CE);
if (!MVE.IsBound(CV) || MVE(CV).IsEmpty()) { if (!MVE.Contains(CV) || MVE.FindFromKey(CV).IsEmpty()) {
End = Standard_True; End = Standard_True;
} }
else { else {
End = !SelectEdge(myFace,CE,CV,NE,MVE(CV)); End = !SelectEdge(myFace,CE,CV,NE,MVE.ChangeFromKey(CV));
if (!End) { if (!End) {
CE = NE; CE = NE;
if (MVE(CV).IsEmpty()) MVE.UnBind(CV); if (MVE.FindFromKey(CV).IsEmpty())
RemoveFromMVE(MVE, CV);
} }
} }
} }
@ -677,7 +714,7 @@ void BRepAlgo_Loop::Perform()
#endif #endif
} }
PurgeNewEdges(myNewEdges,UsedEdges); PurgeNewEdges(myCutEdges,UsedEdges);
} }
//======================================================================= //=======================================================================
@ -891,7 +928,7 @@ void BRepAlgo_Loop::WiresToFaces()
const TopTools_ListOfShape& BRepAlgo_Loop::NewEdges(const TopoDS_Edge& E) const const TopTools_ListOfShape& BRepAlgo_Loop::NewEdges(const TopoDS_Edge& E) const
{ {
return myNewEdges(E); return myCutEdges(E);
} }
//======================================================================= //=======================================================================

View File

@ -12,7 +12,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
inline Extrema_POnSurf::Extrema_POnSurf () {} #include <Precision.hxx>
inline Extrema_POnSurf::Extrema_POnSurf ()
: myU (Precision::Infinite()),
myV (Precision::Infinite()),
myP (gp_Pnt(Precision::Infinite(),Precision::Infinite(),Precision::Infinite()))
{
}
inline Extrema_POnSurf::Extrema_POnSurf (const Standard_Real U, inline Extrema_POnSurf::Extrema_POnSurf (const Standard_Real U,
const Standard_Real V, const Standard_Real V,

View File

@ -1,4 +1,6 @@
#old file ofcb19 #old file ofcb19
puts "TODO CR25925 ALL: ERROR. offsetperform operation not done."
puts "TODO CR25925 ALL: TEST INCOMPLETE"
restore [locate_data_file CHE_bb17.rle] s restore [locate_data_file CHE_bb17.rle] s
OFFSETSHAPE -0.04 {s_4 s_9 s_3 s_5 s_2 s_7 s_11} $calcul $type OFFSETSHAPE -0.04 {s_4 s_9 s_3 s_5 s_2 s_7 s_11} $calcul $type

View File

@ -1,4 +1,6 @@
#old file ofcb23 #old file ofcb23
puts "TODO CR25925 ALL: ERROR. offsetperform operation not done."
puts "TODO CR25925 ALL: TEST INCOMPLETE"
restore [locate_data_file CHE_cc3.rle] s restore [locate_data_file CHE_cc3.rle] s
OFFSETSHAPE -0.01 {s_6} $calcul $type OFFSETSHAPE -0.01 {s_6} $calcul $type

View File

@ -1,4 +1,6 @@
#old file ofsb20 #old file ofsb20
puts "TODO CR25925 ALL: ERROR. offsetperform operation not done."
puts "TODO CR25925 ALL: TEST INCOMPLETE"
restore [locate_data_file CHE_bb20.rle] s restore [locate_data_file CHE_bb20.rle] s
OFFSETSHAPE -0.1 {s_4 s_7} $calcul $type OFFSETSHAPE -0.1 {s_4 s_7} $calcul $type