From: vsr Date: Thu, 16 Dec 2010 12:39:52 +0000 (+0000) Subject: Fix regressions in the test scripts. X-Git-Tag: V6_2_0a2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0817528bf6ed9cf514689ae99574dc2237692219;p=modules%2Fsmesh.git Fix regressions in the test scripts. The mesh nodes/elements should be re-initialized when re-using them from pool --- diff --git a/src/SMDS/SMDS_MeshElement.cxx b/src/SMDS/SMDS_MeshElement.cxx index 3b4cd2520..17a1935ae 100644 --- a/src/SMDS/SMDS_MeshElement.cxx +++ b/src/SMDS/SMDS_MeshElement.cxx @@ -35,13 +35,22 @@ 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 diff --git a/src/SMDS/SMDS_MeshElement.hxx b/src/SMDS/SMDS_MeshElement.hxx index d4f32a51b..374d67379 100644 --- a/src/SMDS/SMDS_MeshElement.hxx +++ b/src/SMDS/SMDS_MeshElement.hxx @@ -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 diff --git a/src/SMDS/SMDS_MeshNode.cxx b/src/SMDS/SMDS_MeshNode.cxx index de0f10e3e..acb2f4904 100644 --- a/src/SMDS/SMDS_MeshNode.cxx +++ b/src/SMDS/SMDS_MeshNode.cxx @@ -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(); diff --git a/src/SMDS/SMDS_VtkEdge.cxx b/src/SMDS/SMDS_VtkEdge.cxx index 6cd006d51..a314565c7 100644 --- a/src/SMDS/SMDS_VtkEdge.cxx +++ b/src/SMDS/SMDS_VtkEdge.cxx @@ -25,8 +25,8 @@ SMDS_VtkEdge::~SMDS_VtkEdge() void SMDS_VtkEdge::init(std::vector nodeIds, SMDS_Mesh* mesh) { + SMDS_MeshEdge::init(); vtkUnstructuredGrid* grid = mesh->getGrid(); - myIdInShape = -1; myMeshId = mesh->getMeshId(); vtkIdType aType = VTK_LINE; if (nodeIds.size() == 3) diff --git a/src/SMDS/SMDS_VtkFace.cxx b/src/SMDS/SMDS_VtkFace.cxx index 79a087709..7437d1452 100644 --- a/src/SMDS/SMDS_VtkFace.cxx +++ b/src/SMDS/SMDS_VtkFace.cxx @@ -24,8 +24,8 @@ SMDS_VtkFace::~SMDS_VtkFace() void SMDS_VtkFace::init(std::vector 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 nodeIds, SMDS_Mesh* mesh) void SMDS_VtkFace::initPoly(std::vector 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(); diff --git a/src/SMDS/SMDS_VtkVolume.cxx b/src/SMDS/SMDS_VtkVolume.cxx index 3f5026f37..15664b610 100644 --- a/src/SMDS/SMDS_VtkVolume.cxx +++ b/src/SMDS/SMDS_VtkVolume.cxx @@ -21,8 +21,8 @@ SMDS_VtkVolume::SMDS_VtkVolume(std::vector nodeIds, SMDS_Mesh* mesh) */ void SMDS_VtkVolume::init(std::vector 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 nodeIds, SMDS_Mesh* mesh) //#ifdef VTK_HAVE_POLYHEDRON void SMDS_VtkVolume::initPoly(std::vector nodeIds, std::vector nbNodesPerFace, SMDS_Mesh* mesh) { + SMDS_MeshVolume::init(); //MESSAGE("SMDS_VtkVolume::initPoly"); SMDS_UnstructuredGrid* grid = mesh->getGrid(); double center[3];