Salome HOME
NPAL16132 (GHS3D execution failed in Salome version 4.0.0)
authoreap <eap@opencascade.com>
Fri, 8 Jun 2007 09:00:52 +0000 (09:00 +0000)
committereap <eap@opencascade.com>
Fri, 8 Jun 2007 09:00:52 +0000 (09:00 +0000)
   make each node in volume has it's own position but not set volume
   ID to static originSpacePosition()

src/SMESHDS/SMESHDS_Mesh.cxx

index 9f48b7b15b588585f9f0e66f6e016f1105d7b208..4e75617552ee87f41fa6db7bb022b01a2311e814 100644 (file)
@@ -32,7 +32,9 @@
 #include "SMDS_VertexPosition.hxx"
 #include "SMDS_EdgePosition.hxx"
 #include "SMDS_FacePosition.hxx"
+#include "SMDS_SpacePosition.hxx"
 #include "SMESHDS_GroupOnGeom.hxx"
+
 #include <TopExp_Explorer.hxx>
 #include <TopExp.hxx>
 #include <TopoDS_Iterator.hxx>
@@ -850,6 +852,22 @@ bool SMESHDS_Mesh::add(const SMDS_MeshElement* elem, SMESHDS_SubMesh* subMesh )
   return false;
 }
 
+namespace {
+
+  //================================================================================
+  /*!
+   * \brief Creates a node position in volume
+   */
+  //================================================================================
+
+  inline SMDS_PositionPtr volumePosition(int volId)
+  {
+    SMDS_SpacePosition* pos = new SMDS_SpacePosition();
+    pos->SetShapeId( volId );
+    return SMDS_PositionPtr(pos);
+  }
+}
+
 //=======================================================================
 //function : SetNodeOnVolume
 //purpose  : 
@@ -858,7 +876,7 @@ void SMESHDS_Mesh::SetNodeInVolume(SMDS_MeshNode *      aNode,
                                    const TopoDS_Shell & S)
 {
   if ( add( aNode, getSubmesh(S) ))
-    const_cast<SMDS_Position*>( aNode->GetPosition().get() )->SetShapeId( myCurSubID );
+    aNode->SetPosition ( volumePosition( myCurSubID ));
 }
 //=======================================================================
 //function : SetNodeOnVolume
@@ -868,7 +886,7 @@ void SMESHDS_Mesh::SetNodeInVolume(SMDS_MeshNode *      aNode,
                                    const TopoDS_Solid & S)
 {
   if ( add( aNode, getSubmesh(S) ))
-    const_cast<SMDS_Position*>( aNode->GetPosition().get() )->SetShapeId( myCurSubID );
+    aNode->SetPosition ( volumePosition( myCurSubID ));
 }
 
 //=======================================================================
@@ -1154,7 +1172,7 @@ int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S) const
 void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index)
 {
   if ( add( aNode, getSubmesh( Index )))
-    const_cast<SMDS_Position*>( aNode->GetPosition().get() )->SetShapeId( Index );
+    ((SMDS_MeshNode*) aNode)->SetPosition( volumePosition( Index ));
 }
 
 //=======================================================================