Fix regressions in the test scripts.

The mesh nodes/elements should be re-initialized when re-using them from pool
This commit is contained in:
vsr 2010-12-16 12:39:52 +00:00
parent 6f147152f5
commit 0817528bf6
6 changed files with 19 additions and 11 deletions

View File

@ -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

View 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

View 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();

View 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)

View 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();

View 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];