Version: 6.3.1
Public Member Functions | Protected Member Functions | Protected Attributes

SMDS_MeshNodeIDFactory Class Reference

#include <SMDS_MeshNodeIDFactory.hxx>

Inheritance diagram for SMDS_MeshNodeIDFactory:
Inheritance graph
[legend]

Public Member Functions

 SMDS_MeshNodeIDFactory ()
bool BindID (int ID, SMDS_MeshElement *elem)
SMDS_MeshElementMeshElement (int ID)
virtual int GetFreeID ()
virtual void ReleaseID (int ID, int vtkId=-1)
int GetMaxID () const
int GetMinID () const
SMDS_ElemIteratorPtr elementsIterator () const
virtual void Clear ()
virtual void emptyPool (int maxId)
void SetMesh (SMDS_Mesh *mesh)
SMDS_MeshGetMesh ()
bool isPoolIdEmpty ()
void adjustMaxId (int ID)

Protected Member Functions

void updateMinMax () const
void updateMinMax (int id) const

Protected Attributes

int myMin
int myMax
int myMaxID
std::set< intmyPoolOfID
SMDS_MeshmyMesh

Detailed Description

Definition at line 37 of file SMDS_MeshNodeIDFactory.hxx.


Constructor & Destructor Documentation

SMDS_MeshNodeIDFactory::SMDS_MeshNodeIDFactory ( )

Definition at line 43 of file SMDS_MeshNodeIDFactory.cxx.

                                               :
  SMDS_MeshIDFactory(), myMin(0), myMax(0)
{
}

Member Function Documentation

void SMDS_MeshIDFactory.adjustMaxId ( int  ID) [inherited]

Definition at line 48 of file SMDS_MeshIDFactory.hxx.

Referenced by SMDS_Mesh.AddNodeWithID().

{ if (ID > myMaxID) myMaxID = ID;};
bool SMDS_MeshNodeIDFactory::BindID ( int  ID,
SMDS_MeshElement elem 
)

Reimplemented in SMDS_MeshElementIDFactory.

Definition at line 52 of file SMDS_MeshNodeIDFactory.cxx.

References updateMinMax().

Referenced by SMDS_Mesh.AddNodeWithID(), and SMDS_Mesh.Renumber().

{
  updateMinMax(ID);
  return true;
}
void SMDS_MeshNodeIDFactory::Clear ( ) [virtual]

Reimplemented from SMDS_MeshIDFactory.

Reimplemented in SMDS_MeshElementIDFactory.

Definition at line 139 of file SMDS_MeshNodeIDFactory.cxx.

References myMax, and myMin.

Referenced by SMDS_Mesh.Clear(), and SMDS_Mesh.Renumber().

SMDS_ElemIteratorPtr SMDS_MeshNodeIDFactory::elementsIterator ( ) const
void SMDS_MeshNodeIDFactory::emptyPool ( int  maxId) [virtual]

Reimplemented from SMDS_MeshIDFactory.

Definition at line 145 of file SMDS_MeshNodeIDFactory.cxx.

References myMax.

Referenced by SMESHDS_Mesh.compactMesh().

{
  SMDS_MeshIDFactory::emptyPool(maxId);
  myMax = maxId;
}
int SMDS_MeshNodeIDFactory::GetFreeID ( ) [virtual]

Reimplemented from SMDS_MeshIDFactory.

Reimplemented in SMDS_MeshElementIDFactory.

Definition at line 75 of file SMDS_MeshNodeIDFactory.cxx.

References MeshElement().

Referenced by SMDS_Mesh.AddNode(), and SMDS_Mesh.AddNodeWithID().

{
  int ID;
  do {
    ID = SMDS_MeshIDFactory::GetFreeID();
  } while ( MeshElement( ID ));
  return ID;
}
int SMDS_MeshNodeIDFactory::GetMaxID ( ) const

Definition at line 103 of file SMDS_MeshNodeIDFactory.cxx.

References myMax, and updateMinMax().

Referenced by SMDS_Mesh.adjustStructure(), and SMDS_Mesh.MaxElementID().

{
  if (myMax == 0)
    updateMinMax();
  return myMax;
}
SMDS_Mesh * SMDS_MeshIDFactory::GetMesh ( ) [inherited]

Definition at line 103 of file SMDS_MeshIDFactory.cxx.

References SMDS_MeshIDFactory.myMesh.

Referenced by MeshElement(), and SMDS_MeshElementIDFactory.MeshElement().

{
        return myMesh;
}
int SMDS_MeshNodeIDFactory::GetMinID ( ) const

Definition at line 115 of file SMDS_MeshNodeIDFactory.cxx.

References myMax, myMin, and updateMinMax().

Referenced by SMDS_Mesh.MinElementID().

{
  if (myMax == 0)
    updateMinMax();
  return myMin;
}
bool SMDS_MeshIDFactory.isPoolIdEmpty ( ) [inherited]

Definition at line 46 of file SMDS_MeshIDFactory.hxx.

{ return myPoolOfID.empty(); };
SMDS_MeshElement * SMDS_MeshNodeIDFactory::MeshElement ( int  ID)

Reimplemented in SMDS_MeshElementIDFactory.

Definition at line 62 of file SMDS_MeshNodeIDFactory.cxx.

References SMDS_Mesh.FindNode(), and SMDS_MeshIDFactory.GetMesh().

Referenced by SMDS_Mesh.Add0DElementWithID(), SMDS_Mesh.AddEdgeWithID(), SMDS_Mesh.AddFaceWithID(), SMDS_Mesh.AddNodeWithID(), SMDS_Mesh.AddPolygonalFaceWithID(), SMDS_Mesh.AddVolumeWithID(), SMDS_Mesh.GetElementType(), and GetFreeID().

{
  // 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);
}
void SMDS_MeshNodeIDFactory::ReleaseID ( int  ID,
int  vtkId = -1 
) [virtual]

Reimplemented from SMDS_MeshIDFactory.

Reimplemented in SMDS_MeshElementIDFactory.

Definition at line 88 of file SMDS_MeshNodeIDFactory.cxx.

References myMax, SMDS_MeshIDFactory.myMesh, myMin, and SMDS_Mesh.setMyModified().

Referenced by SMDS_Mesh.Clear(), SMDS_Mesh.RemoveElement(), SMDS_Mesh.RemoveFreeElement(), and SMDS_Mesh.~SMDS_Mesh().

{
  SMDS_MeshIDFactory::ReleaseID(ID);
  myMesh->setMyModified();
  if (ID == myMax)
    myMax = 0; // --- force updateMinMax
  if (ID == myMin)
    myMax = 0; // --- force updateMinMax
}
void SMDS_MeshIDFactory::SetMesh ( SMDS_Mesh mesh) [inherited]

Definition at line 98 of file SMDS_MeshIDFactory.cxx.

References PAL_MESH_041_mesh.mesh, and SMDS_MeshIDFactory.myMesh.

Referenced by SMDS_Mesh.SMDS_Mesh().

{
        myMesh = mesh;
}
void SMDS_MeshNodeIDFactory.updateMinMax ( int  id) const [protected]

Reimplemented in SMDS_MeshElementIDFactory.

Definition at line 53 of file SMDS_MeshNodeIDFactory.hxx.

  {
    if (id > myMax)
      myMax = id;
    if (id < myMin)
      myMin = id;
  }
void SMDS_MeshNodeIDFactory::updateMinMax ( ) const [protected]

Field Documentation

int SMDS_MeshNodeIDFactory.myMax [mutable, protected]
int SMDS_MeshIDFactory.myMaxID [protected, inherited]
SMDS_Mesh* SMDS_MeshIDFactory.myMesh [protected, inherited]
int SMDS_MeshNodeIDFactory.myMin [mutable, protected]
std::set<int> SMDS_MeshIDFactory.myPoolOfID [protected, inherited]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS