PAL13639 (EDF PAL 317 : SMESH : Create "0D Hypothesis")

ignore shape orientation at hypothesis addition/removal
This commit is contained in:
eap 2007-02-19 15:35:40 +00:00
parent 926b45eef1
commit ad9b0aac3a

View File

@ -107,13 +107,13 @@ void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape & S)
bool SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape & SS, bool SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape & SS,
const SMESHDS_Hypothesis * H) const SMESHDS_Hypothesis * H)
{ {
list<const SMESHDS_Hypothesis *>& alist=myShapeToHypothesis[SS]; list<const SMESHDS_Hypothesis *>& alist=
myShapeToHypothesis[SS.Oriented(TopAbs_FORWARD)]; // ignore orientation of SS
//Check if the Hypothesis is still present //Check if the Hypothesis is still present
list<const SMESHDS_Hypothesis*>::iterator ith=alist.begin(); list<const SMESHDS_Hypothesis*>::iterator ith=find(alist.begin(),alist.end(), H );
for (; ith!=alist.end(); ith++) if (alist.end() != ith) return false;
if (H == *ith) return false;
alist.push_back(H); alist.push_back(H);
return true; return true;
@ -127,15 +127,16 @@ bool SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape & SS,
bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S, bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S,
const SMESHDS_Hypothesis * H) const SMESHDS_Hypothesis * H)
{ {
ShapeToHypothesis::iterator its=myShapeToHypothesis.find(S); ShapeToHypothesis::iterator its=
myShapeToHypothesis.find(S.Oriented(TopAbs_FORWARD)); // ignore orientation of S
if(its!=myShapeToHypothesis.end()) if(its!=myShapeToHypothesis.end())
{ {
list<const SMESHDS_Hypothesis*>::iterator ith=(*its).second.begin(); list<const SMESHDS_Hypothesis *>& alist=(*its).second;
list<const SMESHDS_Hypothesis*>::iterator ith=find(alist.begin(),alist.end(), H );
for (; ith!=(*its).second.end(); ith++) if (ith != alist.end())
if (H == *ith)
{ {
(*its).second.erase(ith); alist.erase(ith);
return true; return true;
} }
} }
@ -1015,11 +1016,13 @@ list<int> SMESHDS_Mesh::SubMeshIndices()
//purpose : //purpose :
//======================================================================= //=======================================================================
const list<const SMESHDS_Hypothesis*>& SMESHDS_Mesh::GetHypothesis( const list<const SMESHDS_Hypothesis*>&
const TopoDS_Shape & S) const SMESHDS_Mesh::GetHypothesis(const TopoDS_Shape & S) const
{ {
if (myShapeToHypothesis.find(S)!=myShapeToHypothesis.end()) ShapeToHypothesis::const_iterator its=
return myShapeToHypothesis.find(S)->second; myShapeToHypothesis.find(S.Oriented(TopAbs_FORWARD)); // ignore orientation of S
if (its!=myShapeToHypothesis.end())
return its->second;
static list<const SMESHDS_Hypothesis*> empty; static list<const SMESHDS_Hypothesis*> empty;
return empty; return empty;
@ -1060,7 +1063,7 @@ bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S)
//======================================================================= //=======================================================================
bool SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape & S) bool SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape & S)
{ {
return myShapeToHypothesis.find(S)!=myShapeToHypothesis.end(); return myShapeToHypothesis.find(S.Oriented(TopAbs_FORWARD))!=myShapeToHypothesis.end();
} }
//======================================================================= //=======================================================================