Salome HOME
Fix regressions in the test scripts.
authorvsr <vsr@opencascade.com>
Thu, 16 Dec 2010 12:39:52 +0000 (12:39 +0000)
committervsr <vsr@opencascade.com>
Thu, 16 Dec 2010 12:39:52 +0000 (12:39 +0000)
The mesh nodes/elements should be re-initialized when re-using them from pool

src/SMDS/SMDS_MeshElement.cxx
src/SMDS/SMDS_MeshElement.hxx
src/SMDS/SMDS_MeshNode.cxx
src/SMDS/SMDS_VtkEdge.cxx
src/SMDS/SMDS_VtkFace.cxx
src/SMDS/SMDS_VtkVolume.cxx

index 3b4cd2520115c4f741c4ab737b7f8911a76e9700..17a1935aedfc0adb60a2f632f4fc9d33935bfe09 100644 (file)
 
 using namespace std;
 
-SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID), myMeshId(-1), myShapeId(0), myIdInShape(-1)
+SMDS_MeshElement::SMDS_MeshElement(int ID)
 {
+  init(ID);
 }
 
-SMDS_MeshElement::SMDS_MeshElement(int id, ShortType meshId, ShortType shapeId):
-  myID(id), myMeshId(meshId), myShapeId(shapeId), myIdInShape(-1)
+SMDS_MeshElement::SMDS_MeshElement(int id, ShortType meshId, ShortType shapeId)
 {
+  init(id, meshId, shapeId);
+}
+
+void SMDS_MeshElement::init(int id, ShortType meshId, ShortType shapeId )
+{
+  myID = id;
+  myMeshId = meshId;
+  myShapeId = shapeId;
+  myIdInShape = -1;
 }
 
 void SMDS_MeshElement::Print(ostream & OS) const
index d4f32a51b40e68426a55d5fc545abed0a570f51a..374d67379aafbd865f53a253aa1725352a07e524 100644 (file)
@@ -151,6 +151,7 @@ protected:
   inline void setVtkId(int vtkId) { myVtkID = vtkId; };
   SMDS_MeshElement(int ID=-1);
   SMDS_MeshElement(int id, ShortType meshId, ShortType shapeId = 0);
+  virtual void init(int id = -1, ShortType meshId = -1, ShortType shapeId = 0);
   virtual void Print(std::ostream & OS) const;
 
   //! Element index in vector SMDS_Mesh::myNodes or SMDS_Mesh::myCells
index de0f10e3e42c7e173ede193e5ecb0f4f2f31ea3b..acb2f49042f6c981b9c618dfb592cf79b9f253e6 100644 (file)
@@ -61,12 +61,9 @@ SMDS_MeshNode::SMDS_MeshNode(int id, int meshId, int shapeId, double x, double y
 
 void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, double z)
 {
+  SMDS_MeshElement::init(id, meshId, shapeId);
   myVtkID = id -1;
   assert(myVtkID >= 0);
-  myID = id;
-  myMeshId = meshId;
-  myShapeId = shapeId;
-  myIdInShape = -1;
   //MESSAGE("Node " << myID << " " << myVtkID << " (" << x << ", " << y << ", " << z << ")");
   SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId];
   SMDS_UnstructuredGrid * grid = mesh->getGrid();
index 6cd006d51752510429018d70e5bd89c45acad1ba..a314565c7b670742ae4f8b3276491ca30628e068 100644 (file)
@@ -25,8 +25,8 @@ SMDS_VtkEdge::~SMDS_VtkEdge()
 
 void SMDS_VtkEdge::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
 {
+  SMDS_MeshEdge::init();
   vtkUnstructuredGrid* grid = mesh->getGrid();
-  myIdInShape = -1;
   myMeshId = mesh->getMeshId();
   vtkIdType aType = VTK_LINE;
   if (nodeIds.size() == 3)
index 79a087709d43857ffb2a97618b225385f24eb62d..7437d145243ac55b59afb13e116d316205b5f621 100644 (file)
@@ -24,8 +24,8 @@ SMDS_VtkFace::~SMDS_VtkFace()
 
 void SMDS_VtkFace::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
 {
+  SMDS_MeshFace::init();
   vtkUnstructuredGrid* grid = mesh->getGrid();
-  myIdInShape = -1;
   myMeshId = mesh->getMeshId();
   vtkIdType aType = VTK_TRIANGLE;
   switch (nodeIds.size())
@@ -53,8 +53,8 @@ void SMDS_VtkFace::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
 
 void SMDS_VtkFace::initPoly(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
 {
+  SMDS_MeshFace::init();
   vtkUnstructuredGrid* grid = mesh->getGrid();
-  myIdInShape = -1;
   myMeshId = mesh->getMeshId();
   myVtkID = grid->InsertNextLinkedCell(VTK_POLYGON, nodeIds.size(), &nodeIds[0]);
   mesh->setMyModified();
index 3f5026f371b15f792872354221655b3140e570d0..15664b6107a1f1b7899a97c7528c0ecf5a961f80 100644 (file)
@@ -21,8 +21,8 @@ SMDS_VtkVolume::SMDS_VtkVolume(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
  */
 void SMDS_VtkVolume::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
 {
+  SMDS_MeshVolume::init();
   vtkUnstructuredGrid* grid = mesh->getGrid();
-  myIdInShape = -1;
   myMeshId = mesh->getMeshId();
   vtkIdType aType = VTK_TETRA;
   switch (nodeIds.size())
@@ -63,6 +63,7 @@ void SMDS_VtkVolume::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
 //#ifdef VTK_HAVE_POLYHEDRON
 void SMDS_VtkVolume::initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> nbNodesPerFace, SMDS_Mesh* mesh)
 {
+  SMDS_MeshVolume::init();
   //MESSAGE("SMDS_VtkVolume::initPoly");
   SMDS_UnstructuredGrid* grid = mesh->getGrid();
   double center[3];