#include <SMDS_MeshElementIDFactory.hxx>

Public Member Functions | |
| SMDS_MeshElementIDFactory () | |
| bool | BindID (int ID, SMDS_MeshElement *elem) |
| int | SetInVtkGrid (SMDS_MeshElement *elem) |
| SMDS_MeshElement * | MeshElement (int ID) |
| virtual int | GetFreeID () |
| virtual void | ReleaseID (int ID, int vtkId=-1) |
| SMDS_ElemIteratorPtr | elementsIterator () const |
| virtual void | Clear () |
| int | GetVtkCellType (int SMDSType) |
| int | GetMaxID () const |
| int | GetMinID () const |
| virtual void | emptyPool (int maxId) |
| void | SetMesh (SMDS_Mesh *mesh) |
| SMDS_Mesh * | GetMesh () |
| bool | isPoolIdEmpty () |
| void | adjustMaxId (int ID) |
Protected Member Functions | |
| void | updateMinMax () const |
| void | updateMinMax (int id) const |
Protected Attributes | |
| std::vector< int > | myVtkCellTypes |
| int | myMin |
| int | myMax |
| int | myMaxID |
| std::set< int > | myPoolOfID |
| SMDS_Mesh * | myMesh |
Friends | |
| class | SMDS_Mesh |
Definition at line 39 of file SMDS_MeshElementIDFactory.hxx.
| SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory | ( | ) |
Definition at line 49 of file SMDS_MeshElementIDFactory.cxx.
References myVtkCellTypes, SMDSEntity_0D, SMDSEntity_Edge, SMDSEntity_Hexa, SMDSEntity_Last, SMDSEntity_Node, SMDSEntity_Penta, SMDSEntity_Polygon, SMDSEntity_Polyhedra, SMDSEntity_Pyramid, SMDSEntity_Quad_Edge, SMDSEntity_Quad_Hexa, SMDSEntity_Quad_Penta, SMDSEntity_Quad_Polygon, SMDSEntity_Quad_Polyhedra, SMDSEntity_Quad_Pyramid, SMDSEntity_Quad_Quadrangle, SMDSEntity_Quad_Tetra, SMDSEntity_Quad_Triangle, SMDSEntity_Quadrangle, SMDSEntity_Tetra, and SMDSEntity_Triangle.
: SMDS_MeshNodeIDFactory() { // myIDElements.clear(); // myVtkIndex.clear(); myVtkCellTypes.clear(); myVtkCellTypes.reserve(SMDSEntity_Last); myVtkCellTypes[SMDSEntity_Node] = VTK_VERTEX; myVtkCellTypes[SMDSEntity_0D] = VTK_VERTEX; myVtkCellTypes[SMDSEntity_Edge] = VTK_LINE; myVtkCellTypes[SMDSEntity_Quad_Edge] = VTK_QUADRATIC_EDGE; myVtkCellTypes[SMDSEntity_Triangle] = VTK_TRIANGLE; myVtkCellTypes[SMDSEntity_Quad_Triangle] = VTK_QUADRATIC_TRIANGLE; myVtkCellTypes[SMDSEntity_Quadrangle] = VTK_QUAD; myVtkCellTypes[SMDSEntity_Quad_Quadrangle] = VTK_QUADRATIC_TRIANGLE; myVtkCellTypes[SMDSEntity_Polygon] = VTK_POLYGON; myVtkCellTypes[SMDSEntity_Quad_Polygon] = VTK_POLYGON; // -PR- verifer myVtkCellTypes[SMDSEntity_Tetra] = VTK_TETRA; myVtkCellTypes[SMDSEntity_Quad_Tetra] = VTK_QUADRATIC_TETRA; myVtkCellTypes[SMDSEntity_Pyramid] = VTK_PYRAMID; myVtkCellTypes[SMDSEntity_Quad_Pyramid] = VTK_CONVEX_POINT_SET; myVtkCellTypes[SMDSEntity_Hexa] = VTK_HEXAHEDRON; myVtkCellTypes[SMDSEntity_Quad_Hexa] = VTK_QUADRATIC_HEXAHEDRON; myVtkCellTypes[SMDSEntity_Penta] = VTK_WEDGE; myVtkCellTypes[SMDSEntity_Quad_Penta] = VTK_QUADRATIC_WEDGE; //#ifdef VTK_HAVE_POLYHEDRON myVtkCellTypes[SMDSEntity_Polyhedra] = VTK_POLYHEDRON; //#else // myVtkCellTypes[SMDSEntity_Polyhedra] = VTK_CONVEX_POINT_SET; //#endif myVtkCellTypes[SMDSEntity_Quad_Polyhedra] = VTK_CONVEX_POINT_SET; }
| void SMDS_MeshIDFactory.adjustMaxId | ( | int | ID | ) | [inherited] |
Definition at line 48 of file SMDS_MeshIDFactory.hxx.
Referenced by SMDS_Mesh.AddNodeWithID().
| bool SMDS_MeshElementIDFactory::BindID | ( | int | ID, |
| SMDS_MeshElement * | elem | ||
| ) |
Reimplemented from SMDS_MeshNodeIDFactory.
Definition at line 113 of file SMDS_MeshElementIDFactory.cxx.
References MESSAGE, SMDS_MeshIDFactory.myMesh, SMDS_Mesh.registerElement(), and SetInVtkGrid().
Referenced by SMDS_Mesh.Add0DElementWithID().
{
MESSAGE("SMDS_MeshElementIDFactory::BindID " << ID);
SetInVtkGrid(elem);
return myMesh->registerElement(ID, elem);
}
| void SMDS_MeshElementIDFactory::Clear | ( | ) | [virtual] |
Reimplemented from SMDS_MeshNodeIDFactory.
Definition at line 205 of file SMDS_MeshElementIDFactory.cxx.
References SMDS_Mesh.myCellIdVtkToSmds, SMDS_MeshNodeIDFactory.myMax, SMDS_MeshIDFactory.myMesh, and SMDS_MeshNodeIDFactory.myMin.
Referenced by SMDS_Mesh.Clear().
{
//myMesh->myCellIdSmdsToVtk.clear();
myMesh->myCellIdVtkToSmds.clear();
myMin = myMax = 0;
SMDS_MeshIDFactory::Clear();
}
| SMDS_ElemIteratorPtr SMDS_MeshElementIDFactory::elementsIterator | ( | ) | const |
Reimplemented from SMDS_MeshNodeIDFactory.
Definition at line 200 of file SMDS_MeshElementIDFactory.cxx.
References SMDS_Mesh.elementsIterator(), SMDS_MeshIDFactory.myMesh, and SMDSAbs_All.
Referenced by SMDS_Mesh.elementsIterator().
{
return myMesh->elementsIterator(SMDSAbs_All);
}
| void SMDS_MeshNodeIDFactory::emptyPool | ( | int | maxId | ) | [virtual, inherited] |
Reimplemented from SMDS_MeshIDFactory.
Definition at line 145 of file SMDS_MeshNodeIDFactory.cxx.
References SMDS_MeshNodeIDFactory.myMax.
Referenced by SMESHDS_Mesh.compactMesh().
{
SMDS_MeshIDFactory::emptyPool(maxId);
myMax = maxId;
}
| int SMDS_MeshElementIDFactory::GetFreeID | ( | ) | [virtual] |
Reimplemented from SMDS_MeshNodeIDFactory.
Definition at line 137 of file SMDS_MeshElementIDFactory.cxx.
References MeshElement().
Referenced by SMDS_Mesh.Add0DElement(), SMDS_Mesh.AddEdge(), SMDS_Mesh.AddFace(), SMDS_Mesh.AddFaceWithID(), SMDS_Mesh.AddPolygonalFace(), SMDS_Mesh.AddVolume(), SMDS_Mesh.AddVolumeFromVtkIds(), SMDS_Mesh.AddVolumeWithID(), SMDS_Mesh.FindEdgeOrCreate(), and SMDS_Mesh.FindFaceOrCreate().
{
int ID;
do {
ID = SMDS_MeshIDFactory::GetFreeID();
} while ( MeshElement( ID ));
return ID;
}
| int SMDS_MeshNodeIDFactory::GetMaxID | ( | ) | const [inherited] |
Definition at line 103 of file SMDS_MeshNodeIDFactory.cxx.
References SMDS_MeshNodeIDFactory.myMax, and SMDS_MeshNodeIDFactory.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 SMDS_MeshNodeIDFactory.MeshElement(), and MeshElement().
{
return myMesh;
}
| int SMDS_MeshNodeIDFactory::GetMinID | ( | ) | const [inherited] |
Definition at line 115 of file SMDS_MeshNodeIDFactory.cxx.
References SMDS_MeshNodeIDFactory.myMax, SMDS_MeshNodeIDFactory.myMin, and SMDS_MeshNodeIDFactory.updateMinMax().
Referenced by SMDS_Mesh.MinElementID().
{
if (myMax == 0)
updateMinMax();
return myMin;
}
Definition at line 213 of file SMDS_MeshElementIDFactory.cxx.
References myVtkCellTypes, and SMDSEntity_Last.
{
assert((SMDSType >=0) && (SMDSType< SMDSEntity_Last));
return myVtkCellTypes[SMDSType];
}
| bool SMDS_MeshIDFactory.isPoolIdEmpty | ( | ) | [inherited] |
Definition at line 46 of file SMDS_MeshIDFactory.hxx.
{ return myPoolOfID.empty(); };
| SMDS_MeshElement * SMDS_MeshElementIDFactory::MeshElement | ( | int | ID | ) |
Reimplemented from SMDS_MeshNodeIDFactory.
Definition at line 124 of file SMDS_MeshElementIDFactory.cxx.
References SMDS_Mesh.FindElement(), SMDS_MeshIDFactory.GetMesh(), SMDS_Mesh.myCells, and SMDS_MeshIDFactory.myMesh.
Referenced by SMDS_Mesh.GetElementType(), and GetFreeID().
{
if ((ID<1) || (ID>=myMesh->myCells.size()))
return NULL;
const SMDS_MeshElement* elem = GetMesh()->FindElement(ID);
return (SMDS_MeshElement*)(elem);
}
Reimplemented from SMDS_MeshNodeIDFactory.
Definition at line 150 of file SMDS_MeshElementIDFactory.cxx.
References MESSAGE, SMDS_Mesh.myCellIdVtkToSmds, SMDS_MeshNodeIDFactory.myMax, SMDS_MeshIDFactory.myMesh, SMDS_MeshNodeIDFactory.myMin, and SMDS_Mesh.setMyModified().
Referenced by SMDS_Mesh.AddVolume(), SMDS_Mesh.AddVolumeFromVtkIds(), SMDS_Mesh.Clear(), SMDS_Mesh.RemoveElement(), SMDS_Mesh.RemoveFreeElement(), and SMDS_Mesh.~SMDS_Mesh().
{
if (ID < 1) // TODO check case ID == O
{
MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID ID = " << ID);
return;
}
//MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID smdsId vtkId " << ID << " " << vtkId);
if (vtkId >= 0)
{
assert(vtkId < myMesh->myCellIdVtkToSmds.size());
myMesh->myCellIdVtkToSmds[vtkId] = -1;
myMesh->setMyModified();
}
SMDS_MeshIDFactory::ReleaseID(ID);
if (ID == myMax)
myMax = 0;
if (ID == myMin)
myMax = 0;
}
| int SMDS_MeshElementIDFactory::SetInVtkGrid | ( | SMDS_MeshElement * | elem | ) |
Definition at line 82 of file SMDS_MeshElementIDFactory.cxx.
References SMDS_Mesh.getGrid(), SMDS_MeshElement.getVtkId(), ex11_grid3partition.grid, MESSAGE, SMDS_MeshIDFactory.myMesh, SMDS_MeshElement.nodesIterator(), and SMDS_MeshElement.setVtkId().
Referenced by BindID(), and SMDS_Mesh.registerElement().
{
// --- retrieve nodes ID
SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(elem);
assert(cell);
vector<vtkIdType> nodeIds;
SMDS_ElemIteratorPtr it = elem->nodesIterator();
while(it->more())
{
int nodeId = (static_cast<const SMDS_MeshNode*>(it->next()))->getVtkId();
MESSAGE(" node in cell " << cell->getVtkId() << " : " << nodeId)
nodeIds.push_back(nodeId);
}
// --- insert cell in vtkUnstructuredGrid
vtkUnstructuredGrid * grid = myMesh->getGrid();
//int locType = elem->GetType();
int typ = VTK_VERTEX;//GetVtkCellType(locType);
int cellId = grid->InsertNextLinkedCell(typ, nodeIds.size(), &nodeIds[0]);
cell->setVtkId(cellId);
//MESSAGE("SMDS_MeshElementIDFactory::SetInVtkGrid " << cellId);
return cellId;
}
| 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().
| void SMDS_MeshElementIDFactory.updateMinMax | ( | int | id | ) | const [protected] |
Reimplemented from SMDS_MeshNodeIDFactory.
Definition at line 56 of file SMDS_MeshElementIDFactory.hxx.
| void SMDS_MeshElementIDFactory::updateMinMax | ( | ) | const [protected] |
Reimplemented from SMDS_MeshNodeIDFactory.
Definition at line 176 of file SMDS_MeshElementIDFactory.cxx.
References SMDS_Mesh.myCells, SMDS_MeshNodeIDFactory.myMax, SMDS_MeshIDFactory.myMesh, and SMDS_MeshNodeIDFactory.myMin.
Referenced by SMDS_Mesh.registerElement().
friend class SMDS_Mesh [friend] |
Definition at line 42 of file SMDS_MeshElementIDFactory.hxx.
int SMDS_MeshNodeIDFactory.myMax [mutable, protected, inherited] |
Definition at line 61 of file SMDS_MeshNodeIDFactory.hxx.
Referenced by SMDS_MeshNodeIDFactory.Clear(), Clear(), SMDS_MeshNodeIDFactory.emptyPool(), SMDS_MeshNodeIDFactory.GetMaxID(), SMDS_MeshNodeIDFactory.GetMinID(), SMDS_MeshNodeIDFactory.ReleaseID(), ReleaseID(), SMDS_MeshNodeIDFactory.updateMinMax(), and updateMinMax().
int SMDS_MeshIDFactory.myMaxID [protected, inherited] |
Definition at line 51 of file SMDS_MeshIDFactory.hxx.
Referenced by SMDS_MeshIDFactory.Clear(), SMDS_MeshIDFactory.emptyPool(), SMDS_MeshIDFactory.GetFreeID(), and SMDS_MeshIDFactory.ReleaseID().
SMDS_Mesh* SMDS_MeshIDFactory.myMesh [protected, inherited] |
Definition at line 53 of file SMDS_MeshIDFactory.hxx.
Referenced by BindID(), Clear(), SMDS_MeshNodeIDFactory.elementsIterator(), elementsIterator(), SMDS_MeshIDFactory.GetMesh(), MeshElement(), SMDS_MeshNodeIDFactory.ReleaseID(), ReleaseID(), SetInVtkGrid(), SMDS_MeshIDFactory.SetMesh(), SMDS_MeshNodeIDFactory.updateMinMax(), and updateMinMax().
int SMDS_MeshNodeIDFactory.myMin [mutable, protected, inherited] |
Definition at line 61 of file SMDS_MeshNodeIDFactory.hxx.
Referenced by SMDS_MeshNodeIDFactory.Clear(), Clear(), SMDS_MeshNodeIDFactory.GetMinID(), SMDS_MeshNodeIDFactory.ReleaseID(), ReleaseID(), SMDS_MeshNodeIDFactory.updateMinMax(), and updateMinMax().
std::set<int> SMDS_MeshIDFactory.myPoolOfID [protected, inherited] |
Definition at line 52 of file SMDS_MeshIDFactory.hxx.
Referenced by SMDS_MeshIDFactory.Clear(), SMDS_MeshIDFactory.emptyPool(), SMDS_MeshIDFactory.GetFreeID(), and SMDS_MeshIDFactory.ReleaseID().
std::vector<int> SMDS_MeshElementIDFactory.myVtkCellTypes [protected] |
Definition at line 62 of file SMDS_MeshElementIDFactory.hxx.
Referenced by GetVtkCellType(), and SMDS_MeshElementIDFactory().