X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHDS%2FSMESHDS_Mesh.cxx;h=6fab4c837e60032d7db8d8c99a02c9d9bc66be2a;hp=c1d3cc45c57837ba80a211819b53d54db8c78341;hb=57b43b4d010e2d0a1529d3c131bbb9d416e63258;hpb=06c42e9c9528a8d54fed01e266c949676fa0d929 diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index c1d3cc45c..6fab4c837 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -46,10 +46,12 @@ using namespace std; //purpose : //======================================================================= SMESHDS_Mesh::SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode): + myMeshID(theMeshID), myIsEmbeddedMode(theIsEmbeddedMode), - myMeshID(theMeshID) + myCurSubID(-1) { myScript = new SMESHDS_Script(theIsEmbeddedMode); + myCurSubMesh = 0; } //======================================================================= @@ -711,7 +713,8 @@ void SMESHDS_Mesh::RemoveFreeNode(const SMDS_MeshNode * n, SMESHDS_SubMesh * sub // Rm from sub-mesh // Node should belong to only one sub-mesh - subMesh->RemoveNode(n); + if( subMesh ) + subMesh->RemoveNode(n); SMDS_Mesh::RemoveFreeElement(n); } @@ -768,7 +771,8 @@ void SMESHDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elt, SMESHDS_SubMe // Rm from sub-mesh // Element should belong to only one sub-mesh - subMesh->RemoveElement(elt); + if( subMesh ) + subMesh->RemoveElement(elt); SMDS_Mesh::RemoveFreeElement(elt); } @@ -846,7 +850,8 @@ bool SMESHDS_Mesh::add(const SMDS_MeshElement* elem, SMESHDS_SubMesh* subMesh ) void SMESHDS_Mesh::SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S) { - add( aNode, getSubmesh(S) ); + if ( add( aNode, getSubmesh(S) )) + const_cast( aNode->GetPosition().get() )->SetShapeId( myCurSubID ); } //======================================================================= //function : SetNodeOnVolume @@ -855,7 +860,8 @@ void SMESHDS_Mesh::SetNodeInVolume(SMDS_MeshNode * aNode, void SMESHDS_Mesh::SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Solid & S) { - add( aNode, getSubmesh(S) ); + if ( add( aNode, getSubmesh(S) )) + const_cast( aNode->GetPosition().get() )->SetShapeId( myCurSubID ); } //======================================================================= @@ -1140,7 +1146,8 @@ int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S) const //======================================================================= void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index) { - add( aNode, getSubmesh( Index )); + if ( add( aNode, getSubmesh( Index ))) + const_cast( aNode->GetPosition().get() )->SetShapeId( Index ); } //=======================================================================