X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHDS%2FSMESHDS_Mesh.cxx;h=9f48b7b15b588585f9f0e66f6e016f1105d7b208;hb=2884e2221b0afc70e9769d963522d8be0e963720;hp=d8a1d5942edec2e52f8f4d7a50f5eb302c419f7c;hpb=c63ee099ad2b149bd70136839c973e8910137bc5;p=modules%2Fsmesh.git diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index d8a1d5942..9f48b7b15 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -41,6 +41,11 @@ using namespace std; +/*Standard_Boolean IsEqual( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) + { + return S1.IsSame( S2 ); + }*/ + //======================================================================= //function : Create //purpose : @@ -70,7 +75,7 @@ void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape & S) { // removal of a shape to mesh, delete ... // - hypotheses - myShapeToHypothesis.clear(); + myShapeToHypothesis.Clear(); // - shape indices in SMDS_Position of nodes map::iterator i_sub = myShapeIndexToSubMesh.begin(); for ( ; i_sub != myShapeIndexToSubMesh.end(); i_sub++ ) { @@ -105,18 +110,22 @@ void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape & S) //======================================================================= bool SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape & SS, - const SMESHDS_Hypothesis * H) + const SMESHDS_Hypothesis * H) { - list& alist=myShapeToHypothesis[SS]; + if (!myShapeToHypothesis.IsBound(SS.Oriented(TopAbs_FORWARD))) { + list aList; + myShapeToHypothesis.Bind(SS.Oriented(TopAbs_FORWARD), aList); + } + list& alist = + myShapeToHypothesis(SS.Oriented(TopAbs_FORWARD)); // ignore orientation of SS - //Check if the Hypothesis is still present - list::iterator ith=alist.begin(); + //Check if the Hypothesis is still present + list::iterator ith = find(alist.begin(),alist.end(), H ); - for (; ith!=alist.end(); ith++) - if (H == *ith) return false; + if (alist.end() != ith) return false; - alist.push_back(H); - return true; + alist.push_back(H); + return true; } //======================================================================= @@ -124,22 +133,20 @@ bool SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape & SS, //purpose : //======================================================================= -bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S, - const SMESHDS_Hypothesis * H) +bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S, + const SMESHDS_Hypothesis * H) { - ShapeToHypothesis::iterator its=myShapeToHypothesis.find(S); - if(its!=myShapeToHypothesis.end()) - { - list::iterator ith=(*its).second.begin(); - - for (; ith!=(*its).second.end(); ith++) - if (H == *ith) - { - (*its).second.erase(ith); - return true; - } - } - return false; + if( myShapeToHypothesis.IsBound( S.Oriented(TopAbs_FORWARD) ) ) + { + list& alist=myShapeToHypothesis.ChangeFind( S.Oriented(TopAbs_FORWARD) ); + list::iterator ith=find(alist.begin(),alist.end(), H ); + if (ith != alist.end()) + { + alist.erase(ith); + return true; + } + } + return false; } //======================================================================= @@ -1015,14 +1022,14 @@ list SMESHDS_Mesh::SubMeshIndices() //purpose : //======================================================================= -const list& SMESHDS_Mesh::GetHypothesis( - const TopoDS_Shape & S) const +const list& +SMESHDS_Mesh::GetHypothesis(const TopoDS_Shape & S) const { - if (myShapeToHypothesis.find(S)!=myShapeToHypothesis.end()) - return myShapeToHypothesis.find(S)->second; + if ( myShapeToHypothesis.IsBound( S.Oriented(TopAbs_FORWARD) ) ) // ignore orientation of S + return myShapeToHypothesis.Find( S.Oriented(TopAbs_FORWARD) ); - static list empty; - return empty; + static list empty; + return empty; } //======================================================================= @@ -1060,7 +1067,7 @@ bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S) //======================================================================= bool SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape & S) { - return myShapeToHypothesis.find(S)!=myShapeToHypothesis.end(); + return myShapeToHypothesis.IsBound(S.Oriented(TopAbs_FORWARD)); } //=======================================================================