// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
//purpose :
//=======================================================================
SMESHDS_Mesh::SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode):
+ myMeshID(theMeshID),
myIsEmbeddedMode(theIsEmbeddedMode),
- myMeshID(theMeshID)
+ myCurSubID(-1)
{
myScript = new SMESHDS_Script(theIsEmbeddedMode);
+ myCurSubMesh = 0;
}
//=======================================================================
//=======================================================================
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
- list<const SMESHDS_Hypothesis*>::iterator ith=alist.begin();
+ //Check if the Hypothesis is still present
+ list<const SMESHDS_Hypothesis*>::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;
}
//=======================================================================
//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<const SMESHDS_Hypothesis*>::iterator ith=(*its).second.begin();
+ ShapeToHypothesis::iterator its=
+ myShapeToHypothesis.find(S.Oriented(TopAbs_FORWARD)); // ignore orientation of S
- for (; ith!=(*its).second.end(); ith++)
- if (H == *ith)
- {
- (*its).second.erase(ith);
- return true;
- }
- }
- return false;
+ if(its!=myShapeToHypothesis.end())
+ {
+ list<const SMESHDS_Hypothesis *>& alist=(*its).second;
+ list<const SMESHDS_Hypothesis*>::iterator ith=find(alist.begin(),alist.end(), H );
+ if (ith != alist.end())
+ {
+ alist.erase(ith);
+ return true;
+ }
+ }
+ return false;
}
//=======================================================================
// Rm from sub-mesh
// Node should belong to only one sub-mesh
- subMesh->RemoveNode(n);
+ if( subMesh )
+ subMesh->RemoveNode(n);
SMDS_Mesh::RemoveFreeElement(n);
}
// Rm from sub-mesh
// Element should belong to only one sub-mesh
- subMesh->RemoveElement(elt);
+ if( subMesh )
+ subMesh->RemoveElement(elt);
SMDS_Mesh::RemoveFreeElement(elt);
}
void SMESHDS_Mesh::SetNodeInVolume(SMDS_MeshNode * aNode,
const TopoDS_Shell & S)
{
- add( aNode, getSubmesh(S) );
+ if ( add( aNode, getSubmesh(S) ))
+ const_cast<SMDS_Position*>( aNode->GetPosition().get() )->SetShapeId( myCurSubID );
}
//=======================================================================
//function : SetNodeOnVolume
void SMESHDS_Mesh::SetNodeInVolume(SMDS_MeshNode * aNode,
const TopoDS_Solid & S)
{
- add( aNode, getSubmesh(S) );
+ if ( add( aNode, getSubmesh(S) ))
+ const_cast<SMDS_Position*>( aNode->GetPosition().get() )->SetShapeId( myCurSubID );
}
//=======================================================================
//purpose :
//=======================================================================
-const list<const SMESHDS_Hypothesis*>& SMESHDS_Mesh::GetHypothesis(
- const TopoDS_Shape & S) const
+const list<const SMESHDS_Hypothesis*>&
+SMESHDS_Mesh::GetHypothesis(const TopoDS_Shape & S) const
{
- if (myShapeToHypothesis.find(S)!=myShapeToHypothesis.end())
- return myShapeToHypothesis.find(S)->second;
+ ShapeToHypothesis::const_iterator its=
+ myShapeToHypothesis.find(S.Oriented(TopAbs_FORWARD)); // ignore orientation of S
+ if (its!=myShapeToHypothesis.end())
+ return its->second;
- static list<const SMESHDS_Hypothesis*> empty;
- return empty;
+ static list<const SMESHDS_Hypothesis*> empty;
+ return empty;
}
//=======================================================================
//=======================================================================
bool SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape & S)
{
- return myShapeToHypothesis.find(S)!=myShapeToHypothesis.end();
+ return myShapeToHypothesis.find(S.Oriented(TopAbs_FORWARD))!=myShapeToHypothesis.end();
}
//=======================================================================
//=======================================================================
void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index)
{
- add( aNode, getSubmesh( Index ));
+ if ( add( aNode, getSubmesh( Index )))
+ const_cast<SMDS_Position*>( aNode->GetPosition().get() )->SetShapeId( Index );
}
//=======================================================================