#define protected protected
#include "utilities.h"
+#include "Utils_SALOME_Exception.hxx"
+#include <cassert>
using namespace std;
SMDS_MeshElement(-1, -1, -1),
myPosition(SMDS_SpacePosition::originSpacePosition())
{
+ nbNodes++;
}
SMDS_MeshNode::SMDS_MeshNode(int id, int meshId, int shapeId, double x, double y, double z):
SMDS_MeshElement(id, meshId, shapeId),
myPosition(SMDS_SpacePosition::originSpacePosition())
{
+ nbNodes++;
init(id, meshId, shapeId, x, y ,z);
}
void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, double z)
{
- nbNodes++;
myID = id;
myMeshId = meshId;
myShapeId = shapeId;
SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId];
vtkUnstructuredGrid * grid = mesh->getGrid();
vtkPoints *points = grid->GetPoints();
- //int nbp = points->GetNumberOfPoints();
points->InsertPoint(myID, x, y, z);
- if (myID >= mesh->myCellLinksSize)
- {
- //points->SetNumberOfPoints(myID+SMDS_Mesh::chunkSize);
- vtkCellLinks *cellLinks = grid->GetCellLinks();
-
-// int imax = cellLinks->Size;
-// for (int i =0; i<imax; i++)
-// {
-// vtkCellLinks::Link &ilink = cellLinks->GetLink(i);
-// int ncells = ilink.ncells;
-// int *cells = ilink.cells;
-// MESSAGE("NODE " << i << " " << cellLinks << " " << cells << " " << ncells);
-// for (int j=0; j< ncells; j++)
-// MESSAGE(" " << j << " " << cells[j]);
-// }
-
- cellLinks->Resize(myID+SMDS_Mesh::chunkSize);
-
-// cellLinks = grid->GetCellLinks();
-// imax = cellLinks->Size;
-// for (int i =0; i<imax; i++)
-// {
-// vtkCellLinks::Link &ilink = cellLinks->GetLink(i);
-// int ncells = ilink.ncells;
-// int *cells = ilink.cells;
-// MESSAGE("NODE " << i << " " << cellLinks << " " << cells << " " << ncells);
-// for (int j=0; j< ncells; j++)
-// MESSAGE(" " << j << " " << cells[j]);
-// }
-
- mesh->myCellLinksSize = cellLinks->Size;
- //MESSAGE(" -------------------------------------- resize CellLinks " << myID << " --> " << mesh->myCellLinksSize);
- }
- //setXYZ(x, y, z);
+ vtkCellLinks *cellLinks = grid->GetCellLinks();
+ if (myID >=cellLinks->Size)
+ cellLinks->Resize(myID+SMDS_Mesh::chunkSize);
}
SMDS_MeshNode::~SMDS_MeshNode()
int vtkId = myCells[iter];
int smdsId = myMesh->fromVtkToSmds(vtkId);
const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
+ if (!elem)
+ {
+ assert(0);
+ throw SALOME_Exception("SMDS_MeshNode_MyInvIterator problem Null element");
+ }
+ //MESSAGE("vtkId " << vtkId << " smdsId " << smdsId << " " << (elem!=0));
iter++;
return elem;
}
GetInverseElementIterator(SMDSAbs_ElementType type) const
{
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myID);
- //MESSAGE("ncells " << l.ncells);
+ //MESSAGE("myID " << myID << " ncells " << l.ncells);
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
}
SMDSAbs_ElementType type):
myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0)
{
- for (; iter<ncells; iter++)
+ //MESSAGE("myNcells " << myNcells);
+ for (; iter<ncells; iter++)
{
int vtkId = myCells[iter];
int smdsId = myMesh->fromVtkToSmds(vtkId);
+ //MESSAGE("vtkId " << vtkId << " smdsId " << smdsId);
const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
if (elem->GetType() == type)
myFiltCells.push_back((SMDS_MeshElement*)elem);
}
myNcells = myFiltCells.size();
- iter = 0;
+ //MESSAGE("myNcells " << myNcells);
+ iter = 0;
//MESSAGE("SMDS_MeshNode_MyIterator (filter) " << ncells << " " << myNcells);
}