SMDS_MeshNode * node = myNodePool->getNew();
node->init(ID, myMeshId, 0, x, y, z);
- //rnv: Set SMDS_SpacePosition for node if need
- if( node->GetPosition()->GetTypeOfPosition() != SMDS_TOP_3DSPACE)
- node->SetPosition(SMDS_SpacePosition::originSpacePosition());
-
if (ID >= myNodes.size())
{
myNodes.resize(ID+SMDS_Mesh::chunkSize, 0);
///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::NbNodes() const
{
- //MESSAGE(myGrid->GetNumberOfPoints());
- //MESSAGE(myInfo.NbNodes());
- //MESSAGE(myNodeMax);
+ //MESSAGE(myGrid->GetNumberOfPoints());
+ //MESSAGE(myInfo.NbNodes());
+ //MESSAGE(myNodeMax);
return myInfo.NbNodes();
}
while (itn->more())
{
const SMDS_MeshNode *node = itn->next();
+ ((SMDS_MeshNode*)node)->SetPosition(SMDS_SpacePosition::originSpacePosition());
myNodeIDFactory->ReleaseID(node->GetID(), node->getVtkId());
}
}
while (itn->more())
{
SMDS_MeshNode *node = (SMDS_MeshNode*)(itn->next());
+ node->SetPosition(SMDS_SpacePosition::originSpacePosition());
myNodePool->destroy(node);
}
myNodes.clear();
myNodeIDFactory->ReleaseID((*it)->GetID(), (*it)->getVtkId());
removedNodes.push_back((*it));
if (const SMDS_MeshNode* vtkElem = dynamic_cast<const SMDS_MeshNode*>(*it))
+ {
+ ((SMDS_MeshNode*)vtkElem)->SetPosition(SMDS_SpacePosition::originSpacePosition());
myNodePool->destroy((SMDS_MeshNode*) vtkElem);
+ }
else
delete (*it);
it++;
if (!itFe->more()) { // free node
myNodes[elemId] = 0;
myInfo.myNbNodes--;
+ ((SMDS_MeshNode*) n)->SetPosition(SMDS_SpacePosition::originSpacePosition());
myNodePool->destroy(static_cast<SMDS_MeshNode*>(todest));
myNodeIDFactory->ReleaseID(elemId, vtkId);
}
myInfo.myNbQuadEdges++;
// if (!registerElement(ID, edge)) {
-// RemoveElement(edge, false);
-// edge = NULL;
+// RemoveElement(edge, false);
+// edge = NULL;
// }
return edge;
if ( !n1 || !n2 || !n3 || !n4 || !n12 || !n23 || !n34 || !n41) return 0;
if(hasConstructionEdges()) {
// creation quadratic edges - not implemented
- return 0;
+ return 0;
}
else
{
myNodeMin = 0;
if (myNodes.size() == 0)
{
- myNodeMax=0;
- return;
+ myNodeMax=0;
+ return;
}
while (!myNodes[myNodeMin] && (myNodeMin<myNodes.size()))
myNodeMin++;
void SMDS_Mesh::dumpGrid(string ficdump)
{
- MESSAGE("SMDS_Mesh::dumpGrid " << ficdump);
+ MESSAGE("SMDS_Mesh::dumpGrid " << ficdump);
// vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
// aWriter->SetFileName(ficdump.c_str());
// aWriter->SetInput(myGrid);
ficcon << "-------------------------------- points " << nbPoints << endl;
for (int i=0; i<nbPoints; i++)
{
- ficcon << i << " " << *(myGrid->GetPoint(i)) << " " << *(myGrid->GetPoint(i)+1) << " " << " " << *(myGrid->GetPoint(i)+2) << endl;
+ ficcon << i << " " << *(myGrid->GetPoint(i)) << " " << *(myGrid->GetPoint(i)+1) << " " << " " << *(myGrid->GetPoint(i)+2) << endl;
}
int nbCells = myGrid->GetNumberOfCells();
ficcon << "-------------------------------- cells " << nbCells << endl;
for (int i=0; i<nbCells; i++)
{
-// MESSAGE(i << " " << myGrid->GetCell(i));
-// MESSAGE(" " << myGrid->GetCell(i)->GetCellType());
- ficcon << i << " - " << myGrid->GetCell(i)->GetCellType() << " -";
- int nbptcell = myGrid->GetCell(i)->GetNumberOfPoints();
- vtkIdList *listid = myGrid->GetCell(i)->GetPointIds();
- for (int j=0; j<nbptcell; j++)
- {
- ficcon << " " << listid->GetId(j);
- }
- ficcon << endl;
+// MESSAGE(i << " " << myGrid->GetCell(i));
+// MESSAGE(" " << myGrid->GetCell(i)->GetCellType());
+ ficcon << i << " - " << myGrid->GetCell(i)->GetCellType() << " -";
+ int nbptcell = myGrid->GetCell(i)->GetNumberOfPoints();
+ vtkIdList *listid = myGrid->GetCell(i)->GetPointIds();
+ for (int j=0; j<nbptcell; j++)
+ {
+ ficcon << " " << listid->GetId(j);
+ }
+ ficcon << endl;
}
ficcon << "-------------------------------- connectivity " << nbPoints << endl;
- vtkCellLinks *links = myGrid->GetCellLinks();
+ vtkCellLinks *links = myGrid->GetCellLinks();
for (int i=0; i<nbPoints; i++)
{
- int ncells = links->GetNcells(i);
- vtkIdType *cells = links->GetCells(i);
- ficcon << i << " - " << ncells << " -";
- for (int j=0; j<ncells; j++)
- {
- ficcon << " " << cells[j];
- }
- ficcon << endl;
+ int ncells = links->GetNcells(i);
+ vtkIdType *cells = links->GetCells(i);
+ ficcon << i << " - " << ncells << " -";
+ for (int j=0; j<ncells; j++)
+ {
+ ficcon << " " << cells[j];
+ }
+ ficcon << endl;
}
ficcon.close();
SMDS_CellLinks *cellLinks = dynamic_cast<SMDS_CellLinks*>(grid->GetCellLinks());
assert(cellLinks);
if (myVtkID >= cellLinks->GetLinksSize())
- cellLinks->ResizeL(myVtkID+SMDS_Mesh::chunkSize);
+ cellLinks->ResizeL(myVtkID+SMDS_Mesh::chunkSize);
}
SMDS_MeshNode::~SMDS_MeshNode()
{
nbNodes--;
+ if ( myPosition && myPosition != SMDS_SpacePosition::originSpacePosition() )
+ delete myPosition, myPosition = 0;
}
//=======================================================================
void SMDS_MeshNode::SetPosition(const SMDS_PositionPtr& aPos)
{
- myPosition = aPos;
+ if ( myPosition && myPosition != aPos )
+ delete myPosition;
+ myPosition = aPos;
}
//=======================================================================
SMDSAbs_ElementType type):
myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0)
{
- //MESSAGE("myNcells " << myNcells);
+ //MESSAGE("myNcells " << myNcells);
for (; iter<ncells; iter++)
{
int vtkId = myCells[iter];
myFiltCells.push_back((SMDS_MeshElement*)elem);
}
myNcells = myFiltCells.size();
- //MESSAGE("myNcells " << myNcells);
+ //MESSAGE("myNcells " << myNcells);
iter = 0;
//MESSAGE("SMDS_MeshNode_MyIterator (filter) " << ncells << " " << myNcells);
}