+//=======================================================================
+//function : MeshElement
+//purpose :
+//=======================================================================
+SMDS_MeshElement* SMDS_MeshNodeIDFactory::MeshElement(int ID)
+{
+ // commented since myMax can be 0 after ReleaseID()
+// if ((ID < 1) || (ID > myMax))
+// return NULL;
+ const SMDS_MeshElement* elem = GetMesh()->FindNode(ID);
+ return (SMDS_MeshElement*) (elem);
+}
+
+//=======================================================================
+//function : GetFreeID
+//purpose :
+//=======================================================================
+int SMDS_MeshNodeIDFactory::GetFreeID()
+{
+ int ID;
+ do {
+ ID = SMDS_MeshIDFactory::GetFreeID();
+ } while ( MeshElement( ID ));
+ return ID;
+}
+
+//=======================================================================
+//function : ReleaseID
+//purpose :
+//=======================================================================
+void SMDS_MeshNodeIDFactory::ReleaseID(const int ID, int vtkId)
+{
+ SMDS_MeshIDFactory::ReleaseID(ID);
+ myMesh->setMyModified();
+ if (ID == myMax)
+ myMax = 0; // --- force updateMinMax
+ if (ID == myMin)
+ myMax = 0; // --- force updateMinMax
+}
+
+//=======================================================================
+//function : GetMaxID
+//purpose :
+//=======================================================================
+
+int SMDS_MeshNodeIDFactory::GetMaxID() const
+{
+ if (myMax == 0)
+ updateMinMax();
+ return myMax;
+}
+
+//=======================================================================
+//function : GetMinID
+//purpose :
+//=======================================================================
+
+int SMDS_MeshNodeIDFactory::GetMinID() const
+{
+ if (myMax == 0)
+ updateMinMax();
+ return myMin;
+}
+
+//=======================================================================
+//function : updateMinMax
+//purpose :
+//=======================================================================
+
+void SMDS_MeshNodeIDFactory::updateMinMax() const
+{
+ myMesh->updateNodeMinMax();
+ myMin = myMesh->MinNodeID();
+ myMax = myMesh->MaxNodeID();
+}
+
+SMDS_ElemIteratorPtr SMDS_MeshNodeIDFactory::elementsIterator() const
+{
+ return myMesh->elementsIterator(SMDSAbs_Node);
+}
+
+void SMDS_MeshNodeIDFactory::Clear()
+{
+ myMin = myMax = 0;
+ SMDS_MeshIDFactory::Clear();
+}
+
+void SMDS_MeshNodeIDFactory::emptyPool(int maxId)
+{
+ SMDS_MeshIDFactory::emptyPool(maxId);
+ myMax = maxId;
+}