+SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():
+ SMDS_MeshNodeIDFactory()
+{
+}
+
+int SMDS_MeshElementIDFactory::SetInVtkGrid(SMDS_MeshElement * elem)
+{
+ // --- retrieve nodes ID
+
+ SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(elem);
+ assert(cell);
+ vector<vtkIdType> nodeIds( elem->NbNodes() );
+ SMDS_ElemIteratorPtr it = elem->nodesIterator();
+ for( int i = 0; it->more(); ++i )
+ {
+ int nodeId = (static_cast<const SMDS_MeshNode*>(it->next()))->getVtkId();
+ nodeIds[i] = nodeId;
+ }
+
+ // --- insert cell in vtkUnstructuredGrid
+
+ int typ = VTK_VERTEX;
+ int cellId = myMesh->getGrid()->InsertNextLinkedCell(typ, nodeIds.size(), &nodeIds[0]);
+ cell->setVtkId(cellId);
+ return cellId;
+}
+
+//=======================================================================
+//function : BindID
+//purpose :
+//=======================================================================
+
+bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
+{
+ SetInVtkGrid(elem);
+ return myMesh->registerElement(ID, elem);
+}
+
+//=======================================================================
+//function : MeshElement
+//purpose :
+//=======================================================================
+SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
+{
+ if ( ID<1 || ID >= (int) myMesh->myCells.size() )
+ return NULL;
+ const SMDS_MeshElement* elem = GetMesh()->FindElement(ID);
+ return (SMDS_MeshElement*)(elem);
+}
+
+//=======================================================================
+//function : GetFreeID
+//purpose :
+//=======================================================================