X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHDS%2FSMESHDS_Mesh.cxx;h=9f48b7b15b588585f9f0e66f6e016f1105d7b208;hb=1c56e119671ced833a652de0cdcd66d82d06ee84;hp=36e185f8a94854228a98f33907a794cf86404c43;hpb=9d11375af40826e967ab2c3bcb77d1f9d439c90c;p=modules%2Fsmesh.git diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index 36e185f8a..9f48b7b15 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -110,25 +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 ) ) - myShapeToHypothesis.Bind( SS, list() ); - - list& alist = myShapeToHypothesis.ChangeFind( 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; } //======================================================================= @@ -136,34 +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; - } - }*/ - if ( myShapeToHypothesis.IsBound( S ) ) + if( myShapeToHypothesis.IsBound( S.Oriented(TopAbs_FORWARD) ) ) { - list& alist = myShapeToHypothesis.ChangeFind( S ); - list::iterator ith = alist.begin(); - - for (; ith != alist.end(); ith++) - if (H == *ith) - { - alist.erase(ith); - return true; - } + 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; + return false; } //======================================================================= @@ -1039,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.IsBound(S) ) - return myShapeToHypothesis.Find(S); + 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; } //======================================================================= @@ -1084,7 +1067,7 @@ bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S) //======================================================================= bool SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape & S) { - return myShapeToHypothesis.IsBound(S); + return myShapeToHypothesis.IsBound(S.Oriented(TopAbs_FORWARD)); } //=======================================================================