X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMDS%2FSMDS_MeshNode.cxx;h=1752046b0bf49607c5c9d52cf6d553bd2ac0ccc2;hp=f7fe97cd30fac4eff867abca12fdcf97c5ddfa3b;hb=e3214b68d298250cb463df645aecb3d2fdd5627a;hpb=ea70fb08091e0a2ea837d77cd4785c07eba5a823 diff --git a/src/SMDS/SMDS_MeshNode.cxx b/src/SMDS/SMDS_MeshNode.cxx index f7fe97cd3..1752046b0 100644 --- a/src/SMDS/SMDS_MeshNode.cxx +++ b/src/SMDS/SMDS_MeshNode.cxx @@ -36,6 +36,8 @@ #define protected protected #include "utilities.h" +#include "Utils_SALOME_Exception.hxx" +#include using namespace std; @@ -49,18 +51,19 @@ SMDS_MeshNode::SMDS_MeshNode() : 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; @@ -69,42 +72,10 @@ void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, do 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; iGetLink(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; iGetLink(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() @@ -191,6 +162,12 @@ private: 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; } @@ -200,7 +177,7 @@ SMDS_ElemIteratorPtr SMDS_MeshNode:: 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)); } @@ -223,16 +200,19 @@ private: SMDSAbs_ElementType type): myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0) { - for (; iterfromVtkToSmds(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); }