#include <SMDS_MeshIDFactory.hxx>

Public Member Functions | |
| int | GetFreeID () |
| virtual void | ReleaseID (int ID, int vtkId=-1) |
| virtual void | Clear () |
| void | SetMesh (SMDS_Mesh *mesh) |
| SMDS_Mesh * | GetMesh () |
| bool | isPoolIdEmpty () |
| virtual void | emptyPool (int maxId) |
| void | adjustMaxId (int ID) |
Protected Member Functions | |
| SMDS_MeshIDFactory () | |
Protected Attributes | |
| int | myMaxID |
| std::set< int > | myPoolOfID |
| SMDS_Mesh * | myMesh |
Definition at line 37 of file SMDS_MeshIDFactory.hxx.
| SMDS_MeshIDFactory::SMDS_MeshIDFactory | ( | ) | [protected] |
Definition at line 39 of file SMDS_MeshIDFactory.cxx.
| void SMDS_MeshIDFactory.adjustMaxId | ( | int | ID | ) |
Definition at line 48 of file SMDS_MeshIDFactory.hxx.
Referenced by SMDS_Mesh.AddNodeWithID().
| void SMDS_MeshIDFactory::Clear | ( | ) | [virtual] |
Reimplemented in SMDS_MeshElementIDFactory, and SMDS_MeshNodeIDFactory.
Definition at line 92 of file SMDS_MeshIDFactory.cxx.
References myMaxID, and myPoolOfID.
{
myMaxID = 0;
myPoolOfID.clear();
}
| void SMDS_MeshIDFactory::emptyPool | ( | int | maxId | ) | [virtual] |
Reimplemented in SMDS_MeshNodeIDFactory.
Definition at line 108 of file SMDS_MeshIDFactory.cxx.
References MESSAGE, myMaxID, and myPoolOfID.
{
MESSAGE("SMDS_MeshIDFactory::emptyPool " << myMaxID << " --> " << maxId);
myMaxID = maxId;
myPoolOfID.clear();
}
| int SMDS_MeshIDFactory::GetFreeID | ( | ) |
Reimplemented in SMDS_MeshElementIDFactory, and SMDS_MeshNodeIDFactory.
Definition at line 43 of file SMDS_MeshIDFactory.cxx.
References myMaxID, and myPoolOfID.
{
int newid;
if (myPoolOfID.empty())
{
newid = ++myMaxID;
//MESSAGE("GetFreeID new " << newid);
}
else
{
set<int>::iterator i = myPoolOfID.begin();
newid = *i;//myPoolOfID.top();
myPoolOfID.erase( i );//myPoolOfID.pop();
//MESSAGE("GetFreeID pool " << newid);
}
return newid;
}
| SMDS_Mesh * SMDS_MeshIDFactory::GetMesh | ( | ) |
Definition at line 103 of file SMDS_MeshIDFactory.cxx.
References myMesh.
Referenced by SMDS_MeshNodeIDFactory.MeshElement(), and SMDS_MeshElementIDFactory.MeshElement().
{
return myMesh;
}
| bool SMDS_MeshIDFactory.isPoolIdEmpty | ( | ) |
Definition at line 46 of file SMDS_MeshIDFactory.hxx.
{ return myPoolOfID.empty(); };
Reimplemented in SMDS_MeshElementIDFactory, and SMDS_MeshNodeIDFactory.
Definition at line 65 of file SMDS_MeshIDFactory.cxx.
References myMaxID, and myPoolOfID.
{
if ( ID > 0 )
{
if ( ID < myMaxID )
{
myPoolOfID.insert(ID);
}
else if ( ID == myMaxID )
{
--myMaxID;
if ( !myPoolOfID.empty() ) // assure that myMaxID is not in myPoolOfID
{
set<int>::iterator i = --myPoolOfID.end();
while ( i != myPoolOfID.begin() && myMaxID == *i ) {
--myMaxID; --i;
}
if ( myMaxID == *i )
--myMaxID; // begin of myPoolOfID reached
else
++i;
myPoolOfID.erase( i, myPoolOfID.end() );
}
}
}
}
| void SMDS_MeshIDFactory::SetMesh | ( | SMDS_Mesh * | mesh | ) |
Definition at line 98 of file SMDS_MeshIDFactory.cxx.
References PAL_MESH_041_mesh.mesh, and myMesh.
Referenced by SMDS_Mesh.SMDS_Mesh().
int SMDS_MeshIDFactory.myMaxID [protected] |
Definition at line 51 of file SMDS_MeshIDFactory.hxx.
Referenced by Clear(), emptyPool(), GetFreeID(), and ReleaseID().
SMDS_Mesh* SMDS_MeshIDFactory.myMesh [protected] |
Definition at line 53 of file SMDS_MeshIDFactory.hxx.
Referenced by SMDS_MeshElementIDFactory.BindID(), SMDS_MeshElementIDFactory.Clear(), SMDS_MeshNodeIDFactory.elementsIterator(), SMDS_MeshElementIDFactory.elementsIterator(), GetMesh(), SMDS_MeshElementIDFactory.MeshElement(), SMDS_MeshNodeIDFactory.ReleaseID(), SMDS_MeshElementIDFactory.ReleaseID(), SMDS_MeshElementIDFactory.SetInVtkGrid(), SetMesh(), SMDS_MeshNodeIDFactory.updateMinMax(), and SMDS_MeshElementIDFactory.updateMinMax().
std::set<int> SMDS_MeshIDFactory.myPoolOfID [protected] |
Definition at line 52 of file SMDS_MeshIDFactory.hxx.
Referenced by Clear(), emptyPool(), GetFreeID(), and ReleaseID().