Version: 6.3.1
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends

SMDS_Mesh Class Reference

#include <SMDS_Mesh.hxx>

Inheritance diagram for SMDS_Mesh:
Inheritance graph
[legend]

Public Types

typedef std::vector
< SMDS_MeshNode * > 
SetOfNodes
typedef std::vector
< SMDS_MeshCell * > 
SetOfCells

Public Member Functions

 SMDS_Mesh ()
 Create a new mesh object.
SMDS_UnstructuredGridgetGrid ()
 actual nodes coordinates, cells definition and reverse connectivity are stored in a vtkUnstructuredGrid
int getMeshId ()
SMDS_NodeIteratorPtr nodesIterator (bool idInceasingOrder=false) const
 Return an iterator on nodes of the current mesh factory.
SMDS_0DElementIteratorPtr elements0dIterator (bool idInceasingOrder=false) const
 Return an iterator on 0D elements of the current mesh.
SMDS_EdgeIteratorPtr edgesIterator (bool idInceasingOrder=false) const
 Return an iterator on edges of the current mesh.
SMDS_FaceIteratorPtr facesIterator (bool idInceasingOrder=false) const
 Return an iterator on faces of the current mesh.
SMDS_VolumeIteratorPtr volumesIterator (bool idInceasingOrder=false) const
 Return an iterator on volumes of the current mesh.
SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type=SMDSAbs_All) const
 Return an iterator on elements of the current mesh factory.
SMDSAbs_ElementType GetElementType (const int id, const bool iselem) const
SMDS_MeshAddSubMesh ()
 Create a submesh and add it to the current mesh.
virtual SMDS_MeshNodeAddNodeWithID (double x, double y, double z, int ID)
 create a MeshNode and add it to the current Mesh
virtual SMDS_MeshNodeAddNode (double x, double y, double z)
 create a MeshNode and add it to the current Mesh An ID is automatically assigned to the node.
virtual SMDS_Mesh0DElementAdd0DElementWithID (int n, int ID)
 create a Mesh0DElement and add it to the current Mesh
virtual SMDS_Mesh0DElementAdd0DElementWithID (const SMDS_MeshNode *n, int ID)
 Create a new Mesh0DElement and at it to the mesh.
virtual SMDS_Mesh0DElementAdd0DElement (const SMDS_MeshNode *n)
 create a Mesh0DElement and add it to the current Mesh
virtual SMDS_MeshEdgeAddEdgeWithID (int n1, int n2, int ID)
 create a MeshEdge and add it to the current Mesh
virtual SMDS_MeshEdgeAddEdgeWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, int ID)
 Create a new edge and at it to the mesh.
virtual SMDS_MeshEdgeAddEdge (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2)
 create a MeshEdge and add it to the current Mesh
virtual SMDS_MeshEdgeAddEdgeWithID (int n1, int n2, int n12, int ID)
virtual SMDS_MeshEdgeAddEdgeWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n12, int ID)
virtual SMDS_MeshEdgeAddEdge (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n12)
virtual SMDS_MeshFaceAddFaceWithID (int n1, int n2, int n3, int ID)
 Add a triangle defined by its nodes IDs.
virtual SMDS_MeshFaceAddFaceWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, int ID)
 Add a triangle defined by its nodes.
virtual SMDS_MeshFaceAddFace (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3)
 Add a triangle defined by its nodes.
virtual SMDS_MeshFaceAddFaceWithID (int n1, int n2, int n3, int n4, int ID)
 Add a quadrangle defined by its nodes IDs.
virtual SMDS_MeshFaceAddFaceWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, int ID)
 Add a quadrangle defined by its nodes.
virtual SMDS_MeshFaceAddFace (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4)
 Add a quadrangle defined by its nodes.
virtual SMDS_MeshFaceAddFaceWithID (const SMDS_MeshEdge *e1, const SMDS_MeshEdge *e2, const SMDS_MeshEdge *e3, int ID)
 Add a triangle defined by its edges.
virtual SMDS_MeshFaceAddFace (const SMDS_MeshEdge *e1, const SMDS_MeshEdge *e2, const SMDS_MeshEdge *e3)
 Add a triangle defined by its edges.
virtual SMDS_MeshFaceAddFaceWithID (const SMDS_MeshEdge *e1, const SMDS_MeshEdge *e2, const SMDS_MeshEdge *e3, const SMDS_MeshEdge *e4, int ID)
 Add a quadrangle defined by its edges.
virtual SMDS_MeshFaceAddFace (const SMDS_MeshEdge *e1, const SMDS_MeshEdge *e2, const SMDS_MeshEdge *e3, const SMDS_MeshEdge *e4)
 Add a quadrangle defined by its edges.
virtual SMDS_MeshFaceAddFaceWithID (int n1, int n2, int n3, int n12, int n23, int n31, int ID)
virtual SMDS_MeshFaceAddFaceWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n31, int ID)
virtual SMDS_MeshFaceAddFace (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n31)
virtual SMDS_MeshFaceAddFaceWithID (int n1, int n2, int n3, int n4, int n12, int n23, int n34, int n41, int ID)
virtual SMDS_MeshFaceAddFaceWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n34, const SMDS_MeshNode *n41, int ID)
virtual SMDS_MeshFaceAddFace (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n34, const SMDS_MeshNode *n41)
virtual SMDS_MeshVolumeAddVolumeWithID (int n1, int n2, int n3, int n4, int ID)
 Create a new tetrahedron and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, int ID)
 Create a new tetrahedron and add it to the mesh.
virtual SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4)
 Create a new tetrahedron and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeWithID (int n1, int n2, int n3, int n4, int n5, int ID)
 Create a new pyramid and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, int ID)
 Create a new pyramid and add it to the mesh.
virtual SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5)
 Create a new pyramid and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeWithID (int n1, int n2, int n3, int n4, int n5, int n6, int ID)
 Create a new prism and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6, int ID)
 Create a new prism and add it to the mesh.
virtual SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6)
 Create a new prism and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeWithID (int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID)
 Create a new hexahedron and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6, const SMDS_MeshNode *n7, const SMDS_MeshNode *n8, int ID)
 Create a new hexahedron and add it to the mesh.
virtual SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6, const SMDS_MeshNode *n7, const SMDS_MeshNode *n8)
 Create a new hexahedron and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeWithID (const SMDS_MeshFace *f1, const SMDS_MeshFace *f2, const SMDS_MeshFace *f3, const SMDS_MeshFace *f4, int ID)
 Create a new tetrahedron defined by its faces and add it to the mesh.
virtual SMDS_MeshVolumeAddVolume (const SMDS_MeshFace *f1, const SMDS_MeshFace *f2, const SMDS_MeshFace *f3, const SMDS_MeshFace *f4)
 Create a new tetrahedron defined by its faces and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeWithID (const SMDS_MeshFace *f1, const SMDS_MeshFace *f2, const SMDS_MeshFace *f3, const SMDS_MeshFace *f4, const SMDS_MeshFace *f5, int ID)
 Create a new pyramid defined by its faces and add it to the mesh.
virtual SMDS_MeshVolumeAddVolume (const SMDS_MeshFace *f1, const SMDS_MeshFace *f2, const SMDS_MeshFace *f3, const SMDS_MeshFace *f4, const SMDS_MeshFace *f5)
 Create a new pyramid defined by its faces and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeWithID (const SMDS_MeshFace *f1, const SMDS_MeshFace *f2, const SMDS_MeshFace *f3, const SMDS_MeshFace *f4, const SMDS_MeshFace *f5, const SMDS_MeshFace *f6, int ID)
 Create a new prism defined by its faces and add it to the mesh.
virtual SMDS_MeshVolumeAddVolume (const SMDS_MeshFace *f1, const SMDS_MeshFace *f2, const SMDS_MeshFace *f3, const SMDS_MeshFace *f4, const SMDS_MeshFace *f5, const SMDS_MeshFace *f6)
 Create a new prism defined by its faces and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeWithID (int n1, int n2, int n3, int n4, int n12, int n23, int n31, int n14, int n24, int n34, int ID)
virtual SMDS_MeshVolumeAddVolumeWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n31, const SMDS_MeshNode *n14, const SMDS_MeshNode *n24, const SMDS_MeshNode *n34, int ID)
virtual SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n31, const SMDS_MeshNode *n14, const SMDS_MeshNode *n24, const SMDS_MeshNode *n34)
virtual SMDS_MeshVolumeAddVolumeWithID (int n1, int n2, int n3, int n4, int n5, int n12, int n23, int n34, int n41, int n15, int n25, int n35, int n45, int ID)
virtual SMDS_MeshVolumeAddVolumeWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n34, const SMDS_MeshNode *n41, const SMDS_MeshNode *n15, const SMDS_MeshNode *n25, const SMDS_MeshNode *n35, const SMDS_MeshNode *n45, int ID)
virtual SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n34, const SMDS_MeshNode *n41, const SMDS_MeshNode *n15, const SMDS_MeshNode *n25, const SMDS_MeshNode *n35, const SMDS_MeshNode *n45)
virtual SMDS_MeshVolumeAddVolumeWithID (int n1, int n2, int n3, int n4, int n5, int n6, int n12, int n23, int n31, int n45, int n56, int n64, int n14, int n25, int n36, int ID)
virtual SMDS_MeshVolumeAddVolumeWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n31, const SMDS_MeshNode *n45, const SMDS_MeshNode *n56, const SMDS_MeshNode *n64, const SMDS_MeshNode *n14, const SMDS_MeshNode *n25, const SMDS_MeshNode *n36, int ID)
virtual SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n31, const SMDS_MeshNode *n45, const SMDS_MeshNode *n56, const SMDS_MeshNode *n64, const SMDS_MeshNode *n14, const SMDS_MeshNode *n25, const SMDS_MeshNode *n36)
virtual SMDS_MeshVolumeAddVolumeWithID (int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n12, int n23, int n34, int n41, int n56, int n67, int n78, int n85, int n15, int n26, int n37, int n48, int ID)
virtual SMDS_MeshVolumeAddVolumeWithID (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6, const SMDS_MeshNode *n7, const SMDS_MeshNode *n8, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n34, const SMDS_MeshNode *n41, const SMDS_MeshNode *n56, const SMDS_MeshNode *n67, const SMDS_MeshNode *n78, const SMDS_MeshNode *n85, const SMDS_MeshNode *n15, const SMDS_MeshNode *n26, const SMDS_MeshNode *n37, const SMDS_MeshNode *n48, int ID)
virtual SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6, const SMDS_MeshNode *n7, const SMDS_MeshNode *n8, const SMDS_MeshNode *n12, const SMDS_MeshNode *n23, const SMDS_MeshNode *n34, const SMDS_MeshNode *n41, const SMDS_MeshNode *n56, const SMDS_MeshNode *n67, const SMDS_MeshNode *n78, const SMDS_MeshNode *n85, const SMDS_MeshNode *n15, const SMDS_MeshNode *n26, const SMDS_MeshNode *n37, const SMDS_MeshNode *n48)
virtual SMDS_MeshFaceAddPolygonalFaceWithID (std::vector< int > nodes_ids, const int ID)
 Add a polygon defined by its nodes IDs.
virtual SMDS_MeshFaceAddPolygonalFaceWithID (std::vector< const SMDS_MeshNode * > nodes, const int ID)
 Add a polygon defined by its nodes.
virtual SMDS_MeshFaceAddPolygonalFace (std::vector< const SMDS_MeshNode * > nodes)
 Add a polygon defined by its nodes.
virtual SMDS_MeshVolumeAddPolyhedralVolumeWithID (std::vector< int > nodes_ids, std::vector< int > quantities, const int ID)
 Create a new polyhedral volume and add it to the mesh.
virtual SMDS_MeshVolumeAddPolyhedralVolumeWithID (std::vector< const SMDS_MeshNode * > nodes, std::vector< int > quantities, const int ID)
 Create a new polyhedral volume and add it to the mesh.
virtual SMDS_MeshVolumeAddPolyhedralVolume (std::vector< const SMDS_MeshNode * > nodes, std::vector< int > quantities)
 Create a new polyhedral volume and add it to the mesh.
virtual SMDS_MeshVolumeAddVolumeFromVtkIds (const std::vector< vtkIdType > &vtkNodeIds)
virtual SMDS_MeshVolumeAddVolumeFromVtkIdsWithID (const std::vector< vtkIdType > &vtkNodeIds, const int ID)
virtual void RemoveElement (const SMDS_MeshElement *elem, std::list< const SMDS_MeshElement * > &removedElems, std::list< const SMDS_MeshElement * > &removedNodes, const bool removenodes=false)
virtual void RemoveElement (const SMDS_MeshElement *elem, bool removenodes=false)
virtual void RemoveNode (const SMDS_MeshNode *node)
 Remove a node and all the elements which own this node.
virtual void Remove0DElement (const SMDS_Mesh0DElement *elem0d)
 Remove an edge and all the elements which own this edge.
virtual void RemoveEdge (const SMDS_MeshEdge *edge)
 Remove an edge and all the elements which own this edge.
virtual void RemoveFace (const SMDS_MeshFace *face)
 Remove an face and all the elements which own this face.
virtual void RemoveVolume (const SMDS_MeshVolume *volume)
 Remove a volume.
virtual void RemoveFreeElement (const SMDS_MeshElement *elem)
 Remove only the given element and only if it is free.
virtual void Clear ()
 Clear all data.
virtual bool RemoveFromParent ()
virtual bool RemoveSubMesh (const SMDS_Mesh *aMesh)
bool ChangeElementNodes (const SMDS_MeshElement *elem, const SMDS_MeshNode *nodes[], const int nbnodes)
bool ChangePolyhedronNodes (const SMDS_MeshElement *elem, const std::vector< const SMDS_MeshNode * > &nodes, const std::vector< int > &quantities)
virtual void Renumber (const bool isNodes, const int startID=1, const int deltaID=1)
virtual void compactMesh ()
const SMDS_MeshNodeFindNode (int idnode) const
 Return the node whose SMDS ID is 'ID'.
const SMDS_MeshNodeFindNodeVtk (int idnode) const
 Return the node whose VTK ID is 'vtkId'.
const SMDS_Mesh0DElementFind0DElement (int idnode) const
const SMDS_MeshEdgeFindEdge (int idnode1, int idnode2) const
const SMDS_MeshEdgeFindEdge (int idnode1, int idnode2, int idnode3) const
const SMDS_MeshFaceFindFace (int idnode1, int idnode2, int idnode3) const
const SMDS_MeshFaceFindFace (int idnode1, int idnode2, int idnode3, int idnode4) const
const SMDS_MeshFaceFindFace (int idnode1, int idnode2, int idnode3, int idnode4, int idnode5, int idnode6) const
const SMDS_MeshFaceFindFace (int idnode1, int idnode2, int idnode3, int idnode4, int idnode5, int idnode6, int idnode7, int idnode8) const
const SMDS_MeshElementFindElement (int IDelem) const
const SMDS_MeshFaceFindFace (const std::vector< int > &nodes_ids) const
int MaxNodeID () const
int MinNodeID () const
int MaxElementID () const
int MinElementID () const
const SMDS_MeshInfoGetMeshInfo () const
int NbNodes () const
 Return the number of nodes.
int Nb0DElements () const
 Return the number of 0D elements.
int NbEdges () const
 Return the number of edges (including construction edges)
int NbFaces () const
 Return the number of faces (including construction faces)
int NbVolumes () const
 Return the number of volumes.
int NbSubMesh () const
 Return the number of child mesh of this mesh.
void DumpNodes () const
void Dump0DElements () const
void DumpEdges () const
void DumpFaces () const
void DumpVolumes () const
void DebugStats () const
SMDS_MeshboundaryFaces ()
SMDS_MeshboundaryEdges ()
virtual ~SMDS_Mesh ()
 Destroy the mesh and all its elements All pointer on elements owned by this mesh become illegals.
bool hasConstructionEdges ()
 Return true if this mesh create faces with edges.
bool hasConstructionFaces ()
 Return true if this mesh create volumes with faces A false returned value mean that volumes are created with nodes or edges.
bool hasInverseElements ()
 Return true if nodes are linked to the finit elements, they are belonging to.
void setConstructionEdges (bool)
 Make this mesh creating construction edges (see hasConstructionEdges)
void setConstructionFaces (bool)
 Make this mesh creating construction faces (see hasConstructionFaces)
void setInverseElements (bool)
 Make this mesh creating link from nodes to elements (see hasInverseElements)
bool Contains (const SMDS_MeshElement *elem) const
 Checks if the element is present in mesh.
void updateNodeMinMax ()
void updateBoundingBox ()
double getMaxDim ()
int fromVtkToSmds (int vtkid)
void incrementNodesCapacity (int nbNodes)
void incrementCellsCapacity (int nbCells)
void adjustStructure ()
void dumpGrid (string ficdump="dumpGrid")
void setMyModified ()
 low level modification: add, change or remove node or element
void Modified ()
 modification that needs compact structure and redraw
unsigned long GetMTime ()
 get last modification timeStamp
bool isCompacted ()

Static Public Member Functions

static const SMDS_Mesh0DElementFind0DElement (const SMDS_MeshNode *n)
static const SMDS_MeshEdgeFindEdge (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2)
static const SMDS_MeshEdgeFindEdge (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3)
static const SMDS_MeshFaceFindFace (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3)
static const SMDS_MeshFaceFindFace (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4)
static const SMDS_MeshFaceFindFace (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6)
static const SMDS_MeshFaceFindFace (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6, const SMDS_MeshNode *n7, const SMDS_MeshNode *n8)
static const SMDS_MeshFaceFindFace (const std::vector< const SMDS_MeshNode * > &nodes)
static const SMDS_MeshElementFindElement (const std::vector< const SMDS_MeshNode * > &nodes, const SMDSAbs_ElementType type=SMDSAbs_All, const bool noMedium=true)
 Return element based on all given nodes.
static int CheckMemory (const bool doNotRaise=false) throw (std::bad_alloc)
 Raise an exception if free memory (ram+swap) too low.

Static Public Attributes

static std::vector< SMDS_Mesh * > _meshList = vector<SMDS_Mesh*>()
 to retreive this SMDS_Mesh instance from its elements (index stored in SMDS_Elements)
static int chunkSize = 1024

Protected Member Functions

 SMDS_Mesh (SMDS_Mesh *parent)
 Create a new child mesh Note that the tree structure of SMDS_Mesh seems to be unused in this version (2003-09-08) of SMESH.
SMDS_MeshFacecreateTriangle (const SMDS_MeshNode *node1, const SMDS_MeshNode *node2, const SMDS_MeshNode *node3, int ID)
 Create a triangle and add it to the current mesh.
SMDS_MeshFacecreateQuadrangle (const SMDS_MeshNode *node1, const SMDS_MeshNode *node2, const SMDS_MeshNode *node3, const SMDS_MeshNode *node4, int ID)
 Create a quadrangle and add it to the current mesh.
SMDS_MeshEdgeFindEdgeOrCreate (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2)
SMDS_MeshFaceFindFaceOrCreate (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3)
SMDS_MeshFaceFindFaceOrCreate (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4)
bool registerElement (int ID, SMDS_MeshElement *element)
 Registers element with the given ID, maintains inverse connections.
void addChildrenWithNodes (std::set< const SMDS_MeshElement * > &setOfChildren, const SMDS_MeshElement *element, std::set< const SMDS_MeshElement * > &nodes)
 Find the children of an element that are made of given nodes.
void adjustmyCellsCapacity (int ID)
void adjustBoundingBox (double x, double y, double z)

Protected Attributes

int myMeshId
 index of this SMDS_mesh in the static vector<SMDS_Mesh*> _meshList
SMDS_UnstructuredGridmyGrid
 actual nodes coordinates, cells definition and reverse connectivity are stored in a vtkUnstructuredGrid
ObjectPool< SMDS_MeshNode > * myNodePool
 Small objects like SMDS_MeshNode are allocated by chunks to limit memory costs of new.
ObjectPool< SMDS_VtkVolume > * myVolumePool
 Small objects like SMDS_VtkVolume are allocated by chunks to limit memory costs of new.
ObjectPool< SMDS_VtkFace > * myFacePool
ObjectPool< SMDS_VtkEdge > * myEdgePool
SetOfNodes myNodes
 SMDS_MeshNodes refer to vtk nodes (vtk id = index in myNodes),store reference to this mesh, and subshape.
SetOfCells myCells
 SMDS_MeshCells refer to vtk cells (vtk id != index in myCells),store reference to this mesh, and subshape.
std::vector< intmyCellIdVtkToSmds
 for cells only: index = ID for SMDS users, value = ID in vtkUnstructuredGrid
SMDS_MeshmyParent
std::list< SMDS_Mesh * > myChildren
SMDS_MeshNodeIDFactorymyNodeIDFactory
SMDS_MeshElementIDFactorymyElementIDFactory
SMDS_MeshInfo myInfo
unsigned long myModifTime
 use a counter to keep track of modifications
unsigned long myCompactTime
int myNodeMin
int myNodeMax
bool myHasConstructionEdges
bool myHasConstructionFaces
bool myHasInverseElements
bool myModified
 any add, remove or change of node or cell
double xmin
double xmax
double ymin
double ymax
double zmin
double zmax

Friends

class SMDS_MeshIDFactory
class SMDS_MeshNodeIDFactory
class SMDS_MeshElementIDFactory
class SMDS_MeshVolumeVtkNodes
class SMDS_MeshNode

Detailed Description

Definition at line 58 of file SMDS_Mesh.hxx.


Member Typedef Documentation

typedef std::vector<SMDS_MeshCell *> SMDS_Mesh.SetOfCells

Definition at line 576 of file SMDS_Mesh.hxx.

typedef std::vector<SMDS_MeshNode *> SMDS_Mesh.SetOfNodes

Definition at line 575 of file SMDS_Mesh.hxx.


Constructor & Destructor Documentation

SMDS_Mesh::SMDS_Mesh ( )

Create a new mesh object.

Definition at line 124 of file SMDS_Mesh.cxx.

References _meshList, SMDS_UnstructuredGrid.BuildLinks(), chunkSize, MESSAGE, Modified(), myCellIdVtkToSmds, myCells, myEdgePool, myElementIDFactory, myFacePool, myGrid, myMeshId, myNodeIDFactory, myNodePool, myNodes, myVolumePool, SMDS_UnstructuredGrid.New(), SMDS_MeshIDFactory.SetMesh(), and SMDS_UnstructuredGrid.setSMDS_mesh().

Referenced by AddSubMesh().

        :myParent(NULL),
         myNodeIDFactory(new SMDS_MeshNodeIDFactory()),
         myElementIDFactory(new SMDS_MeshElementIDFactory()),
         myHasConstructionEdges(false), myHasConstructionFaces(false),
         myHasInverseElements(true),
         myNodeMin(0), myNodeMax(0),
         myNodePool(0), myEdgePool(0), myFacePool(0), myVolumePool(0),
         myModified(false), myModifTime(0), myCompactTime(0),
         xmin(0), xmax(0), ymin(0), ymax(0), zmin(0), zmax(0)
{
  myMeshId = _meshList.size();         // --- index of the mesh to push back in the vector
  MESSAGE("myMeshId=" << myMeshId);
  MESSAGE("sizeof(SMDS_MeshElement) " << sizeof(SMDS_MeshElement) );
  MESSAGE("sizeof(SMDS_MeshNode) " << sizeof(SMDS_MeshNode) );
  MESSAGE("sizeof(SMDS_MeshCell) " << sizeof(SMDS_MeshCell) );
  MESSAGE("sizeof(SMDS_VtkVolume) " << sizeof(SMDS_VtkVolume) );
  MESSAGE("sizeof(SMDS_Position) " << sizeof(SMDS_Position) );
  MESSAGE("sizeof(SMDS_SpacePosition) " << sizeof(SMDS_SpacePosition) );
  myNodeIDFactory->SetMesh(this);
  myElementIDFactory->SetMesh(this);
  _meshList.push_back(this);
  myNodePool = new ObjectPool<SMDS_MeshNode>(SMDS_Mesh::chunkSize);
  myEdgePool = new ObjectPool<SMDS_VtkEdge>(SMDS_Mesh::chunkSize);
  myFacePool = new ObjectPool<SMDS_VtkFace>(SMDS_Mesh::chunkSize);
  myVolumePool = new ObjectPool<SMDS_VtkVolume>(SMDS_Mesh::chunkSize);

  myNodes.clear();
  myCells.clear();
  //myCellIdSmdsToVtk.clear();
  myCellIdVtkToSmds.clear();
  myGrid = SMDS_UnstructuredGrid::New();
  myGrid->setSMDS_mesh(this);
  myGrid->Initialize();
  myGrid->Allocate();
  vtkPoints* points = vtkPoints::New();
  // rnv: to fix bug "21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion"
  // using double type for storing coordinates of nodes instead float.
  points->SetDataType(VTK_DOUBLE);
  points->SetNumberOfPoints(SMDS_Mesh::chunkSize);
  myGrid->SetPoints( points );
  points->Delete();
  myGrid->BuildLinks();
  this->Modified();
}
SMDS_Mesh::~SMDS_Mesh ( ) [virtual]

Destroy the mesh and all its elements All pointer on elements owned by this mesh become illegals.

Definition at line 2370 of file SMDS_Mesh.cxx.

References elementsIterator(), SMDS_MeshElement.GetID(), SMDS_MeshElement.getVtkId(), myChildren, myElementIDFactory, myNodeIDFactory, myParent, ex29_refine.node(), nodesIterator(), SMDS_SpacePosition.originSpacePosition(), SMDS_MeshNodeIDFactory.ReleaseID(), and SMDS_MeshElementIDFactory.ReleaseID().

{
  list<SMDS_Mesh*>::iterator itc=myChildren.begin();
  while(itc!=myChildren.end())
  {
    delete *itc;
    itc++;
  }

  if(myParent==NULL)
  {
    delete myNodeIDFactory;
    delete myElementIDFactory;
  }
  else
  {
    SMDS_ElemIteratorPtr eIt = elementsIterator();
    while ( eIt->more() )
      {
        const SMDS_MeshElement *elem = eIt->next();
        myElementIDFactory->ReleaseID(elem->GetID(), elem->getVtkId());
      }
    SMDS_NodeIteratorPtr itn = nodesIterator();
    while (itn->more())
      {
        const SMDS_MeshNode *node = itn->next();
        ((SMDS_MeshNode*)node)->SetPosition(SMDS_SpacePosition::originSpacePosition());
        myNodeIDFactory->ReleaseID(node->GetID(), node->getVtkId());
      }
  }

//   SetOfNodes::Iterator itn(myNodes);
//   for (; itn.More(); itn.Next())
//     delete itn.Value();

//   SetOf0DElements::Iterator it0d (my0DElements);
//   for (; it0d.More(); it0d.Next())
//   {
//     SMDS_MeshElement* elem = it0d.Value();
//     delete elem;
//   }

//   SetOfEdges::Iterator ite(myEdges);
//   for (; ite.More(); ite.Next())
//   {
//     SMDS_MeshElement* elem = ite.Value();
//     delete elem;
//   }

//   SetOfFaces::Iterator itf(myFaces);
//   for (; itf.More(); itf.Next())
//   {
//     SMDS_MeshElement* elem = itf.Value();
//     delete elem;
//   }

//   SetOfVolumes::Iterator itv(myVolumes);
//   for (; itv.More(); itv.Next())
//   {
//     SMDS_MeshElement* elem = itv.Value();
//     delete elem;
//   }
}
SMDS_Mesh::SMDS_Mesh ( SMDS_Mesh parent) [protected]

Create a new child mesh Note that the tree structure of SMDS_Mesh seems to be unused in this version (2003-09-08) of SMESH.

Definition at line 175 of file SMDS_Mesh.cxx.


Member Function Documentation

SMDS_Mesh0DElement * SMDS_Mesh::Add0DElement ( const SMDS_MeshNode node) [virtual]

create a Mesh0DElement and add it to the current Mesh

Returns:
: The created Mesh0DElement

Reimplemented in SMESHDS_Mesh.

Definition at line 258 of file SMDS_Mesh.cxx.

References Add0DElementWithID(), SMDS_MeshElementIDFactory.GetFreeID(), and myElementIDFactory.

SMDS_Mesh0DElement * SMDS_Mesh::Add0DElementWithID ( int  idnode,
int  ID 
) [virtual]

create a Mesh0DElement and add it to the current Mesh

Returns:
: The created Mesh0DElement

Reimplemented in SMESHDS_Mesh.

Definition at line 247 of file SMDS_Mesh.cxx.

References SMDS_MeshNodeIDFactory.MeshElement(), myNodeIDFactory, and ex29_refine.node().

Referenced by Add0DElement().

{
  SMDS_MeshNode * node = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode);
  if (!node) return NULL;
  return SMDS_Mesh::Add0DElementWithID(node, ID);
}
SMDS_Mesh0DElement * SMDS_Mesh::Add0DElementWithID ( const SMDS_MeshNode n,
int  ID 
) [virtual]

Create a new Mesh0DElement and at it to the mesh.

Parameters:
idnodeID of the node
IDID of the 0D element to create
Returns:
The created 0D element or NULL if an element with this ID already exists or if input node is not found.

Reimplemented in SMESHDS_Mesh.

Definition at line 270 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), SMDS_MeshElementIDFactory.BindID(), CheckMemory(), CHECKMEMORY_INTERVAL, myCells, myElementIDFactory, myInfo, SMDS_MeshInfo.myNb0DElements, and Nb0DElements().

{
  if (!n) return 0;

  if (Nb0DElements() % CHECKMEMORY_INTERVAL == 0) CheckMemory();
  //MESSAGE("Add0DElementWithID" << ID)
  SMDS_Mesh0DElement * el0d = new SMDS_Mesh0DElement(n);
  if (myElementIDFactory->BindID(ID, el0d)) {
    //SMDS_MeshNode *node = const_cast<SMDS_MeshNode*>(n);
    //node->AddInverseElement(el0d);// --- fait avec BindID
    adjustmyCellsCapacity(ID);
    myCells[ID] = el0d;
    myInfo.myNb0DElements++;
    return el0d;
  }

  delete el0d;
  return NULL;
}
void SMDS_Mesh::addChildrenWithNodes ( std::set< const SMDS_MeshElement * > &  setOfChildren,
const SMDS_MeshElement element,
std::set< const SMDS_MeshElement * > &  nodes 
) [protected]

Find the children of an element that are made of given nodes.

Parameters:
setOfChildrenThe set in which matching children will be inserted
elementThe element were to search matching children
nodesThe nodes that the children must have to be selected

Definition at line 2913 of file SMDS_Mesh.cxx.

References SMDS_MeshElement.edgesIterator(), SMDS_MeshElement.facesIterator(), SMDS_MeshElement.GetType(), hasConstructionEdges(), hasConstructionFaces(), MESSAGE, SMESH_AdvancedEditor.nodes, SMDS_MeshElement.nodesIterator(), SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Node, and SMDSAbs_Volume.

Referenced by RemoveElement().

{
  switch(element->GetType())
    {
    case SMDSAbs_Node:
      MESSAGE("Internal Error: This should not happen");
      break;
    case SMDSAbs_0DElement:
      {
      }
      break;
    case SMDSAbs_Edge:
        {
                SMDS_ElemIteratorPtr itn=element->nodesIterator();
                while(itn->more())
                {
                        const SMDS_MeshElement * e=itn->next();
                        if(nodes.find(e)!=nodes.end())
                        {
                          setOfChildren.insert(element);
                          break;
                        }
                }
        } break;
    case SMDSAbs_Face:
        {
                SMDS_ElemIteratorPtr itn=element->nodesIterator();
                while(itn->more())
                {
                        const SMDS_MeshElement * e=itn->next();
                        if(nodes.find(e)!=nodes.end())
                        {
                          setOfChildren.insert(element);
                          break;
                        }
                }
                if(hasConstructionEdges())
                {
                        SMDS_ElemIteratorPtr ite=element->edgesIterator();
                        while(ite->more())
                                addChildrenWithNodes(setOfChildren, ite->next(), nodes);
                }
        } break;
    case SMDSAbs_Volume:
        {
                if(hasConstructionFaces())
                {
                        SMDS_ElemIteratorPtr ite=element->facesIterator();
                        while(ite->more())
                                addChildrenWithNodes(setOfChildren, ite->next(), nodes);
                }
                else if(hasConstructionEdges())
                {
                        SMDS_ElemIteratorPtr ite=element->edgesIterator();
                        while(ite->more())
                                addChildrenWithNodes(setOfChildren, ite->next(), nodes);
                }
        }
    }
}
SMDS_MeshEdge * SMDS_Mesh::AddEdge ( const SMDS_MeshNode node1,
const SMDS_MeshNode node2 
) [virtual]

create a MeshEdge and add it to the current Mesh

Returns:
: The created MeshEdge

Reimplemented in SMESHDS_Mesh.

Definition at line 308 of file SMDS_Mesh.cxx.

References AddEdgeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), and myElementIDFactory.

SMDS_MeshEdge * SMDS_Mesh::AddEdge ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n12 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3375 of file SMDS_Mesh.cxx.

References AddEdgeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), and myElementIDFactory.

SMDS_MeshEdge * SMDS_Mesh::AddEdgeWithID ( int  idnode1,
int  idnode2,
int  ID 
) [virtual]

create a MeshEdge and add it to the current Mesh

Returns:
: The created MeshEdge

Reimplemented in SMESHDS_Mesh.

Definition at line 295 of file SMDS_Mesh.cxx.

References SMDS_MeshNodeIDFactory.MeshElement(), and myNodeIDFactory.

Referenced by AddEdge(), and AddEdgeWithID().

{
  SMDS_MeshNode * node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
  SMDS_MeshNode * node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
  if(!node1 || !node2) return NULL;
  return SMDS_Mesh::AddEdgeWithID(node1, node2, ID);
}
SMDS_MeshEdge * SMDS_Mesh::AddEdgeWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
int  ID 
) [virtual]

Create a new edge and at it to the mesh.

Parameters:
idnode1ID of the first node
idnode2ID of the second node
IDID of the edge to create
Returns:
The created edge or NULL if an element with this ID already exists or if input nodes are not found.

Reimplemented in SMESHDS_Mesh.

Definition at line 323 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), ObjectPool< X >.destroy(), SMESH_test.edge, ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), SMDS_VtkEdge.init(), myCells, myEdgePool, myGrid, myInfo, SMDS_MeshInfo.myNbEdges, and registerElement().

{
  if ( !n1 || !n2 ) return 0;
  SMDS_MeshEdge * edge = 0;

  // --- retreive nodes ID
  vector<vtkIdType> nodeIds;
  nodeIds.clear();
  nodeIds.push_back(n1->getVtkId());
  nodeIds.push_back(n2->getVtkId());

  SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
  edgevtk->init(nodeIds, this);
  if (!this->registerElement(ID,edgevtk))
    {
      this->myGrid->GetCellTypesArray()->SetValue(edgevtk->getVtkId(), VTK_EMPTY_CELL);
      myEdgePool->destroy(edgevtk);
      return 0;
    }
  edge = edgevtk;
  adjustmyCellsCapacity(ID);
  myCells[ID] = edge;
  myInfo.myNbEdges++;

//  if (edge && !registerElement(ID, edge))
//  {
//    RemoveElement(edge, false);
//    edge = NULL;
//  }
  return edge;
}
SMDS_MeshEdge * SMDS_Mesh::AddEdgeWithID ( int  n1,
int  n2,
int  n12,
int  ID 
) [virtual]
SMDS_MeshEdge * SMDS_Mesh::AddEdgeWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n12,
int  ID 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3386 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), ObjectPool< X >.destroy(), SMESH_test.edge, ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), SMDS_VtkEdge.init(), myCells, myEdgePool, myGrid, myInfo, SMDS_MeshInfo.myNbQuadEdges, and registerElement().

{
  if ( !n1 || !n2 || !n12 ) return 0;

  // --- retrieve nodes ID
  vector<vtkIdType> nodeIds;
  nodeIds.clear();
  nodeIds.push_back(n1->getVtkId());
  nodeIds.push_back(n2->getVtkId());
  nodeIds.push_back(n12->getVtkId());

  SMDS_MeshEdge * edge = 0;
  SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
  edgevtk->init(nodeIds, this);
  if (!this->registerElement(ID,edgevtk))
    {
      this->myGrid->GetCellTypesArray()->SetValue(edgevtk->getVtkId(), VTK_EMPTY_CELL);
      myEdgePool->destroy(edgevtk);
      return 0;
    }
  edge = edgevtk;
  adjustmyCellsCapacity(ID);
  myCells[ID] = edge;
  myInfo.myNbQuadEdges++;

//  if (!registerElement(ID, edge)) {
//        RemoveElement(edge, false);
//        edge = NULL;
//  }
  return edge;

}
SMDS_MeshFace * SMDS_Mesh::AddFace ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n31 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3427 of file SMDS_Mesh.cxx.

References AddFaceWithID(), SMDS_MeshElementIDFactory.GetFreeID(), and myElementIDFactory.

{
  return SMDS_Mesh::AddFaceWithID(n1,n2,n3,n12,n23,n31,
                                  myElementIDFactory->GetFreeID());
}
SMDS_MeshFace * SMDS_Mesh::AddFace ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n34,
const SMDS_MeshNode n41 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3511 of file SMDS_Mesh.cxx.

References AddFaceWithID(), SMDS_MeshElementIDFactory.GetFreeID(), and myElementIDFactory.

{
  return SMDS_Mesh::AddFaceWithID(n1,n2,n3,n4,n12,n23,n34,n41,
                                  myElementIDFactory->GetFreeID());
}
SMDS_MeshFace * SMDS_Mesh::AddFace ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3 
) [virtual]

Add a triangle defined by its nodes.

An ID is automatically affected to the Created face

Reimplemented in SMESHDS_Mesh.

Definition at line 362 of file SMDS_Mesh.cxx.

References AddFaceWithID(), SMDS_MeshElementIDFactory.GetFreeID(), and myElementIDFactory.

Referenced by DriverSTL_R_SMDS_Mesh.readAscii(), and DriverSTL_R_SMDS_Mesh.readBinary().

SMDS_MeshFace * SMDS_Mesh::AddFace ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4 
) [virtual]

Add a quadrangle defined by its nodes.

An ID is automatically affected to the created face

Reimplemented in SMESHDS_Mesh.

Definition at line 406 of file SMDS_Mesh.cxx.

References AddFaceWithID(), SMDS_MeshElementIDFactory.GetFreeID(), and myElementIDFactory.

SMDS_MeshFace * SMDS_Mesh::AddFace ( const SMDS_MeshEdge e1,
const SMDS_MeshEdge e2,
const SMDS_MeshEdge e3 
) [virtual]

Add a triangle defined by its edges.

An ID is automatically assigned to the Created face

Definition at line 458 of file SMDS_Mesh.cxx.

References AddFaceWithID(), SMDS_MeshElementIDFactory.GetFreeID(), hasConstructionEdges(), and myElementIDFactory.

{
  if (!hasConstructionEdges())
    return NULL;
     //MESSAGE("AddFaceWithID");
 return AddFaceWithID(e1,e2,e3, myElementIDFactory->GetFreeID());
}
SMDS_MeshFace * SMDS_Mesh::AddFace ( const SMDS_MeshEdge e1,
const SMDS_MeshEdge e2,
const SMDS_MeshEdge e3,
const SMDS_MeshEdge e4 
) [virtual]

Add a quadrangle defined by its edges.

An ID is automatically assigned to the Created face

Definition at line 502 of file SMDS_Mesh.cxx.

References AddFaceWithID(), SMDS_MeshElementIDFactory.GetFreeID(), hasConstructionEdges(), and myElementIDFactory.

{
  if (!hasConstructionEdges())
    return NULL;
     //MESSAGE("AddFaceWithID" );
 return AddFaceWithID(e1,e2,e3,e4, myElementIDFactory->GetFreeID());
}
SMDS_MeshFace * SMDS_Mesh::AddFaceWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n31,
int  ID 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3459 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), ObjectPool< X >.destroy(), PAL_MESH_043_3D.face, ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionEdges(), SMDS_VtkFace.init(), myCells, myFacePool, myGrid, myInfo, SMDS_MeshInfo.myNbQuadTriangles, and registerElement().

{
  if ( !n1 || !n2 || !n3 || !n12 || !n23 || !n31) return 0;
  if(hasConstructionEdges()) {
    // creation quadratic edges - not implemented
    return 0;
  }
  else
  {
    // --- retrieve nodes ID
    vector<vtkIdType> nodeIds;
    nodeIds.clear();
    nodeIds.push_back(n1->getVtkId());
    nodeIds.push_back(n2->getVtkId());
    nodeIds.push_back(n3->getVtkId());
    nodeIds.push_back(n12->getVtkId());
    nodeIds.push_back(n23->getVtkId());
    nodeIds.push_back(n31->getVtkId());

    SMDS_MeshFace * face = 0;
    SMDS_VtkFace *facevtk = myFacePool->getNew();
    facevtk->init(nodeIds, this);
    if (!this->registerElement(ID,facevtk))
      {
        this->myGrid->GetCellTypesArray()->SetValue(facevtk->getVtkId(), VTK_EMPTY_CELL);
        myFacePool->destroy(facevtk);
        return 0;
      }
    face = facevtk;
    adjustmyCellsCapacity(ID);
    myCells[ID] = face;
    myInfo.myNbQuadTriangles++;

//    if (!registerElement(ID, face)) {
//      RemoveElement(face, false);
//      face = NULL;
//    }
    return face;
  }
}
SMDS_MeshFace * SMDS_Mesh::AddFaceWithID ( int  n1,
int  n2,
int  n3,
int  n12,
int  n23,
int  n31,
int  ID 
) [virtual]
SMDS_MeshFace * SMDS_Mesh::AddFaceWithID ( int  n1,
int  n2,
int  n3,
int  n4,
int  n12,
int  n23,
int  n34,
int  n41,
int  ID 
) [virtual]
SMDS_MeshFace * SMDS_Mesh::AddFaceWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n34,
const SMDS_MeshNode n41,
int  ID 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3547 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), ObjectPool< X >.destroy(), PAL_MESH_043_3D.face, ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionEdges(), SMDS_VtkFace.init(), myCells, myFacePool, myGrid, myInfo, SMDS_MeshInfo.myNbQuadQuadrangles, and registerElement().

{
  if ( !n1 || !n2 || !n3 || !n4 || !n12 || !n23 || !n34 || !n41) return 0;
  if(hasConstructionEdges()) {
    // creation quadratic edges - not implemented
        return 0;
  }
  else
  {
    // --- retrieve nodes ID
    vector<vtkIdType> nodeIds;
    nodeIds.clear();
    nodeIds.push_back(n1->getVtkId());
    nodeIds.push_back(n2->getVtkId());
    nodeIds.push_back(n3->getVtkId());
    nodeIds.push_back(n4->getVtkId());
    nodeIds.push_back(n12->getVtkId());
    nodeIds.push_back(n23->getVtkId());
    nodeIds.push_back(n34->getVtkId());
    nodeIds.push_back(n41->getVtkId());

    SMDS_MeshFace * face = 0;
    SMDS_VtkFace *facevtk = myFacePool->getNew();
    facevtk->init(nodeIds, this);
    if (!this->registerElement(ID,facevtk))
      {
        this->myGrid->GetCellTypesArray()->SetValue(facevtk->getVtkId(), VTK_EMPTY_CELL);
        myFacePool->destroy(facevtk);
        return 0;
      }
    face = facevtk;
    adjustmyCellsCapacity(ID);
    myCells[ID] = face;
    myInfo.myNbQuadQuadrangles++;

//    if (!registerElement(ID, face)) {
//      RemoveElement(face, false);
//      face = NULL;
//    }
    return face;
  }
}
SMDS_MeshFace * SMDS_Mesh::AddFaceWithID ( int  n1,
int  n2,
int  n3,
int  ID 
) [virtual]

Add a triangle defined by its nodes IDs.

Reimplemented in SMESHDS_Mesh.

Definition at line 373 of file SMDS_Mesh.cxx.

References SMDS_MeshNodeIDFactory.MeshElement(), and myNodeIDFactory.

Referenced by AddFace(), and AddFaceWithID().

{
  SMDS_MeshNode * node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
  SMDS_MeshNode * node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
  SMDS_MeshNode * node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3);
  if(!node1 || !node2 || !node3) return NULL;
  return SMDS_Mesh::AddFaceWithID(node1, node2, node3, ID);
}
SMDS_MeshFace * SMDS_Mesh::AddFaceWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
int  ID 
) [virtual]

Add a triangle defined by its nodes.

Reimplemented in SMESHDS_Mesh.

Definition at line 386 of file SMDS_Mesh.cxx.

References createTriangle(), and PAL_MESH_043_3D.face.

{
  //MESSAGE("AddFaceWithID " << ID)
  SMDS_MeshFace * face=createTriangle(n1, n2, n3, ID);

//  if (face && !registerElement(ID, face)) {
//    RemoveElement(face, false);
//    face = NULL;
//  }
  return face;
}
SMDS_MeshFace * SMDS_Mesh::AddFaceWithID ( int  n1,
int  n2,
int  n3,
int  n4,
int  ID 
) [virtual]

Add a quadrangle defined by its nodes IDs.

Reimplemented in SMESHDS_Mesh.

Definition at line 418 of file SMDS_Mesh.cxx.

References AddFaceWithID(), SMDS_MeshNodeIDFactory.MeshElement(), and myNodeIDFactory.

{
  SMDS_MeshNode *node1, *node2, *node3, *node4;
  node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
  node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
  node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3);
  node4 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode4);
  if(!node1 || !node2 || !node3 || !node4) return NULL;
  return SMDS_Mesh::AddFaceWithID(node1, node2, node3, node4, ID);
}
SMDS_MeshFace * SMDS_Mesh::AddFaceWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
int  ID 
) [virtual]

Add a quadrangle defined by its nodes.

Reimplemented in SMESHDS_Mesh.

Definition at line 437 of file SMDS_Mesh.cxx.

References createQuadrangle(), and PAL_MESH_043_3D.face.

{
  //MESSAGE("AddFaceWithID " << ID);
  SMDS_MeshFace * face=createQuadrangle(n1, n2, n3, n4, ID);

//  if (face && !registerElement(ID, face)) {
//    RemoveElement(face, false);
//    face = NULL;
//  }
  return face;
}
SMDS_MeshFace * SMDS_Mesh::AddFaceWithID ( const SMDS_MeshEdge e1,
const SMDS_MeshEdge e2,
const SMDS_MeshEdge e3,
int  ID 
) [virtual]

Add a triangle defined by its edges.

Definition at line 472 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, PAL_MESH_043_3D.face, SMDS_MeshElementIDFactory.GetFreeID(), hasConstructionEdges(), MESSAGE, myCells, myElementIDFactory, myInfo, SMDS_MeshInfo.myNbTriangles, NbFaces(), and registerElement().

{
  if (!hasConstructionEdges())
    return NULL;
  if ( !e1 || !e2 || !e3 ) return 0;

  if ( NbFaces() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  MESSAGE("AddFaceWithID" << ID);

  SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3);
  adjustmyCellsCapacity(ID);
  myCells[ID] = face;
  myInfo.myNbTriangles++;

  if (!registerElement(ID, face)) {
    registerElement(myElementIDFactory->GetFreeID(), face);
    //RemoveElement(face, false);
    //face = NULL;
  }
  return face;
}
SMDS_MeshFace * SMDS_Mesh::AddFaceWithID ( const SMDS_MeshEdge e1,
const SMDS_MeshEdge e2,
const SMDS_MeshEdge e3,
const SMDS_MeshEdge e4,
int  ID 
) [virtual]

Add a quadrangle defined by its edges.

Definition at line 517 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, PAL_MESH_043_3D.face, SMDS_MeshElementIDFactory.GetFreeID(), hasConstructionEdges(), MESSAGE, myCells, myElementIDFactory, myInfo, SMDS_MeshInfo.myNbQuadrangles, NbFaces(), and registerElement().

{
  if (!hasConstructionEdges())
    return NULL;
  MESSAGE("AddFaceWithID" << ID);
  if ( !e1 || !e2 || !e3 || !e4 ) return 0;
  if ( NbFaces() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3,e4);
  adjustmyCellsCapacity(ID);
  myCells[ID] = face;
  myInfo.myNbQuadrangles++;

  if (!registerElement(ID, face))
  {
    registerElement(myElementIDFactory->GetFreeID(), face);
    //RemoveElement(face, false);
    //face = NULL;
  }
  return face;
}
SMDS_MeshNode * SMDS_Mesh::AddNode ( double  x,
double  y,
double  z 
) [virtual]

create a MeshNode and add it to the current Mesh An ID is automatically assigned to the node.

Returns:
: The created node

Reimplemented in SMESHDS_Mesh.

Definition at line 204 of file SMDS_Mesh.cxx.

References AddNodeWithID(), SMDS_MeshNodeIDFactory.GetFreeID(), and myNodeIDFactory.

Referenced by addNode(), SMDS_UnstructuredGrid.extrudeVolumeFromFace(), and SMDS_VolumeTool.GetSize().

SMDS_MeshNode * SMDS_Mesh::AddNodeWithID ( double  x,
double  y,
double  z,
int  ID 
) [virtual]

create a MeshNode and add it to the current Mesh

Parameters:
ID: The ID of the MeshNode to create
Returns:
: The created node or NULL if a node with this ID already exists

Reimplemented in SMESHDS_Mesh.

Definition at line 214 of file SMDS_Mesh.cxx.

References adjustBoundingBox(), SMDS_MeshIDFactory.adjustMaxId(), SMDS_MeshNodeIDFactory.BindID(), chunkSize, SMDS_MeshNodeIDFactory.GetFreeID(), ObjectPool< X >.getNew(), SMDS_MeshNode.init(), SMDS_MeshNodeIDFactory.MeshElement(), MESSAGE, myInfo, myMeshId, myModified, SMDS_MeshInfo.myNbNodes, myNodeIDFactory, myNodePool, myNodes, and ex29_refine.node().

Referenced by AddNode().

{
  // find the MeshNode corresponding to ID
  const SMDS_MeshElement *node = myNodeIDFactory->MeshElement(ID);
  if(!node){
    if (ID < 1)
      {
        MESSAGE("=============>  Bad Node Id: " << ID);
        ID = myNodeIDFactory->GetFreeID();
      }
    myNodeIDFactory->adjustMaxId(ID);
    SMDS_MeshNode * node = myNodePool->getNew();
    node->init(ID, myMeshId, 0, x, y, z);

    if (ID >= myNodes.size())
    {
        myNodes.resize(ID+SMDS_Mesh::chunkSize, 0);
        MESSAGE(" ------------------ myNodes resize " << ID << " --> " << ID+SMDS_Mesh::chunkSize);
    }
    myNodes[ID] = node;
    myNodeIDFactory->BindID(ID,node);
    myInfo.myNbNodes++;
    myModified = true;
    this->adjustBoundingBox(x, y, z);
    return node;
  }else
    return NULL;
}
SMDS_MeshFace * SMDS_Mesh::AddPolygonalFace ( std::vector< const SMDS_MeshNode * >  nodes) [virtual]

Add a polygon defined by its nodes.

An ID is automatically affected to the created face.

Definition at line 1214 of file SMDS_Mesh.cxx.

References AddPolygonalFaceWithID(), SMDS_MeshElementIDFactory.GetFreeID(), and myElementIDFactory.

Referenced by SMESHDS_Mesh.AddPolygonalFace().

SMDS_MeshFace * SMDS_Mesh::AddPolygonalFaceWithID ( std::vector< int nodes_ids,
const int  ID 
) [virtual]

Add a polygon defined by its nodes IDs.

Definition at line 1140 of file SMDS_Mesh.cxx.

References SMDS_MeshNodeIDFactory.MeshElement(), myNodeIDFactory, and SMESH_AdvancedEditor.nodes.

Referenced by AddPolygonalFace(), and SMESHDS_Mesh.AddPolygonalFaceWithID().

{
  int nbNodes = nodes_ids.size();
  vector<const SMDS_MeshNode*> nodes (nbNodes);
  for (int i = 0; i < nbNodes; i++) {
    nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]);
    if (!nodes[i]) return NULL;
  }
  return SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID);
}
SMDS_MeshFace * SMDS_Mesh::AddPolygonalFaceWithID ( std::vector< const SMDS_MeshNode * >  nodes,
const int  ID 
) [virtual]

Add a polygon defined by its nodes.

Definition at line 1157 of file SMDS_Mesh.cxx.

References CHECKMEMORY_INTERVAL, PAL_MESH_043_3D.face, SMDS_MeshElement.getVtkId(), SMDS_VtkFace.initPoly(), and MESSAGE.

{
  SMDS_MeshFace * face;

  if ( NbFaces() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  if (hasConstructionEdges())
    {
      MESSAGE("Error : Not implemented");
      return NULL;
    }
  else
    {
//#ifdef VTK_HAVE_POLYHEDRON
    //MESSAGE("AddPolygonalFaceWithID vtk " << ID);
    vector<vtkIdType> nodeIds;
    nodeIds.clear();
    vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
    for ( ; it != nodes.end(); ++it)
      nodeIds.push_back((*it)->getVtkId());

    SMDS_VtkFace *facevtk = myFacePool->getNew();
    facevtk->initPoly(nodeIds, this);
    if (!this->registerElement(ID,facevtk))
      {
        this->myGrid->GetCellTypesArray()->SetValue(facevtk->getVtkId(), VTK_EMPTY_CELL);
        myFacePool->destroy(facevtk);
        return 0;
      }
    face = facevtk;
//#else
//    MESSAGE("AddPolygonalFaceWithID smds " << ID);
//     for ( int i = 0; i < nodes.size(); ++i )
//      if ( !nodes[ i ] ) return 0;
//      face = new SMDS_PolygonalFaceOfNodes(nodes);
//#endif
      adjustmyCellsCapacity(ID);
      myCells[ID] = face;
      myInfo.myNbPolygons++;
    }

//#ifndef VTK_HAVE_POLYHEDRON
//  if (!registerElement(ID, face))
//    {
//      registerElement(myElementIDFactory->GetFreeID(), face);
//      //RemoveElement(face, false);
//      //face = NULL;
//    }
//#endif
 return face;
}
SMDS_MeshVolume * SMDS_Mesh::AddPolyhedralVolume ( std::vector< const SMDS_MeshNode * >  nodes,
std::vector< int quantities 
) [virtual]

Create a new polyhedral volume and add it to the mesh.

Returns:
The created volume

Definition at line 1310 of file SMDS_Mesh.cxx.

References AddPolyhedralVolumeWithID().

Referenced by SMESHDS_Mesh.AddPolyhedralVolume().

{
  int ID = myElementIDFactory->GetFreeID();
  SMDS_MeshVolume * v = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
  if (v == NULL) myElementIDFactory->ReleaseID(ID);
  return v;
}
SMDS_MeshVolume * SMDS_Mesh::AddPolyhedralVolumeWithID ( std::vector< int nodes_ids,
std::vector< int quantities,
const int  ID 
) [virtual]

Create a new polyhedral volume and add it to the mesh.

Parameters:
IDThe ID of the new volume
Returns:
The created volume or NULL if an element with this ID already exists or if input nodes are not found.

Definition at line 1227 of file SMDS_Mesh.cxx.

References SMESH_AdvancedEditor.nodes.

Referenced by AddPolyhedralVolume(), and SMESHDS_Mesh.AddPolyhedralVolumeWithID().

{
  int nbNodes = nodes_ids.size();
  vector<const SMDS_MeshNode*> nodes (nbNodes);
  for (int i = 0; i < nbNodes; i++) {
    nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]);
    if (!nodes[i]) return NULL;
  }
  return SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
}
SMDS_MeshVolume * SMDS_Mesh::AddPolyhedralVolumeWithID ( std::vector< const SMDS_MeshNode * >  nodes,
std::vector< int quantities,
const int  ID 
) [virtual]

Create a new polyhedral volume and add it to the mesh.

Parameters:
IDThe ID of the new volume
Returns:
The created volume

Definition at line 1247 of file SMDS_Mesh.cxx.

References CHECKMEMORY_INTERVAL, SMDS_MeshElement.getVtkId(), SMDS_VtkVolume.initPoly(), and MESSAGE.

{
  SMDS_MeshVolume* volume;
  if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  if (hasConstructionFaces())
    {
      MESSAGE("Error : Not implemented");
      return NULL;
    }
  else if (hasConstructionEdges())
    {
      MESSAGE("Error : Not implemented");
      return NULL;
    }
  else
    {
//#ifdef VTK_HAVE_POLYHEDRON
      //MESSAGE("AddPolyhedralVolumeWithID vtk " << ID);
      vector<vtkIdType> nodeIds;
      nodeIds.clear();
      vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
      for (; it != nodes.end(); ++it)
        nodeIds.push_back((*it)->getVtkId());

      SMDS_VtkVolume *volvtk = myVolumePool->getNew();
      volvtk->initPoly(nodeIds, quantities, this);
      if (!this->registerElement(ID, volvtk))
        {
          this->myGrid->GetCellTypesArray()->SetValue(volvtk->getVtkId(), VTK_EMPTY_CELL);
          myVolumePool->destroy(volvtk);
          return 0;
        }
      volume = volvtk;
//#else
//      MESSAGE("AddPolyhedralVolumeWithID smds " << ID);
//      for ( int i = 0; i < nodes.size(); ++i )
//      if ( !nodes[ i ] ) return 0;
//      volume = new SMDS_PolyhedralVolumeOfNodes(nodes, quantities);
//#endif
      adjustmyCellsCapacity(ID);
      myCells[ID] = volume;
      myInfo.myNbPolyhedrons++;
    }

//#ifndef VTK_HAVE_POLYHEDRON
//  if (!registerElement(ID, volume))
//    {
//      registerElement(myElementIDFactory->GetFreeID(), volume);
//      //RemoveElement(volume, false);
//      //volume = NULL;
//    }
//#endif
  return volume;
}
SMDS_Mesh * SMDS_Mesh::AddSubMesh ( )

Create a submesh and add it to the current mesh.

Definition at line 191 of file SMDS_Mesh.cxx.

References myChildren, SMDS_Mesh(), and SMESH_test4.submesh.

{
        SMDS_Mesh *submesh = new SMDS_Mesh(this);
        myChildren.insert(myChildren.end(), submesh);
        return submesh;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n31,
const SMDS_MeshNode n45,
const SMDS_MeshNode n56,
const SMDS_MeshNode n64,
const SMDS_MeshNode n14,
const SMDS_MeshNode n25,
const SMDS_MeshNode n36 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3821 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), myElementIDFactory, and SMDS_MeshElementIDFactory.ReleaseID().

{
  int ID = myElementIDFactory->GetFreeID();
  SMDS_MeshVolume * v =
    SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n12, n23, n31,
                               n45, n56, n64, n14, n25, n36, ID);
  if(v==NULL) myElementIDFactory->ReleaseID(ID);
  return v;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6,
const SMDS_MeshNode n7,
const SMDS_MeshNode n8,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n34,
const SMDS_MeshNode n41,
const SMDS_MeshNode n56,
const SMDS_MeshNode n67,
const SMDS_MeshNode n78,
const SMDS_MeshNode n85,
const SMDS_MeshNode n15,
const SMDS_MeshNode n26,
const SMDS_MeshNode n37,
const SMDS_MeshNode n48 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3949 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), myElementIDFactory, and SMDS_MeshElementIDFactory.ReleaseID().

{
  int ID = myElementIDFactory->GetFreeID();
  SMDS_MeshVolume * v =
    SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, n12, n23, n34, n41,
                               n56, n67, n78, n85, n15, n26, n37, n48, ID);
  if(v==NULL) myElementIDFactory->ReleaseID(ID);
  return v;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4 
) [virtual]

Create a new tetrahedron and add it to the mesh.

Returns:
The created tetrahedron

Reimplemented in SMESHDS_Mesh.

Definition at line 547 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), myElementIDFactory, and SMDS_MeshElementIDFactory.ReleaseID().

{
  int ID = myElementIDFactory->GetFreeID();
    //MESSAGE("AddVolumeWithID " << ID);
  SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, ID);
  if(v==NULL) myElementIDFactory->ReleaseID(ID);
  return v;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5 
) [virtual]

Create a new pyramid and add it to the mesh.

Nodes 1,2,3 and 4 define the base of the pyramid

Returns:
The created pyramid

Reimplemented in SMESHDS_Mesh.

Definition at line 648 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), myElementIDFactory, and SMDS_MeshElementIDFactory.ReleaseID().

{
  int ID = myElementIDFactory->GetFreeID();
    //MESSAGE("AddVolumeWithID " << ID);
  SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, ID);
  if(v==NULL) myElementIDFactory->ReleaseID(ID);
  return v;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6 
) [virtual]

Create a new prism and add it to the mesh.

Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle.

Returns:
The created prism

Reimplemented in SMESHDS_Mesh.

Definition at line 756 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), myElementIDFactory, and SMDS_MeshElementIDFactory.ReleaseID().

{
  int ID = myElementIDFactory->GetFreeID();
    //MESSAGE("AddVolumeWithID " << ID);
  SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, ID);
  if(v==NULL) myElementIDFactory->ReleaseID(ID);
  return v;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6,
const SMDS_MeshNode n7,
const SMDS_MeshNode n8 
) [virtual]

Create a new hexahedron and add it to the mesh.

Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges.

Returns:
The created hexahedron

Reimplemented in SMESHDS_Mesh.

Definition at line 870 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), myElementIDFactory, and SMDS_MeshElementIDFactory.ReleaseID().

{
  int ID = myElementIDFactory->GetFreeID();
     //MESSAGE("AddVolumeWithID " << ID);
 SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, ID);
  if(v==NULL) myElementIDFactory->ReleaseID(ID);
  return v;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolume ( const SMDS_MeshFace f1,
const SMDS_MeshFace f2,
const SMDS_MeshFace f3,
const SMDS_MeshFace f4 
) [virtual]

Create a new tetrahedron defined by its faces and add it to the mesh.

Returns:
The created tetrahedron

Definition at line 997 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), hasConstructionFaces(), and myElementIDFactory.

{
    //MESSAGE("AddVolumeWithID");
  if (!hasConstructionFaces())
    return NULL;
  return AddVolumeWithID(f1,f2,f3,f4, myElementIDFactory->GetFreeID());
}
SMDS_MeshVolume * SMDS_Mesh::AddVolume ( const SMDS_MeshFace f1,
const SMDS_MeshFace f2,
const SMDS_MeshFace f3,
const SMDS_MeshFace f4,
const SMDS_MeshFace f5 
) [virtual]

Create a new pyramid defined by its faces and add it to the mesh.

Returns:
The created pyramid

Definition at line 1043 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), hasConstructionFaces(), and myElementIDFactory.

{
     //MESSAGE("AddVolumeWithID");
 if (!hasConstructionFaces())
    return NULL;
  return AddVolumeWithID(f1,f2,f3,f4,f5, myElementIDFactory->GetFreeID());
}
SMDS_MeshVolume * SMDS_Mesh::AddVolume ( const SMDS_MeshFace f1,
const SMDS_MeshFace f2,
const SMDS_MeshFace f3,
const SMDS_MeshFace f4,
const SMDS_MeshFace f5,
const SMDS_MeshFace f6 
) [virtual]

Create a new prism defined by its faces and add it to the mesh.

Returns:
The created prism

Definition at line 1091 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), hasConstructionFaces(), and myElementIDFactory.

{
     //MESSAGE("AddVolumeWithID" );
 if (!hasConstructionFaces())
    return NULL;
  return AddVolumeWithID(f1,f2,f3,f4,f5,f6, myElementIDFactory->GetFreeID());
}
SMDS_MeshVolume * SMDS_Mesh::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n31,
const SMDS_MeshNode n14,
const SMDS_MeshNode n24,
const SMDS_MeshNode n34 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3603 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), myElementIDFactory, and SMDS_MeshElementIDFactory.ReleaseID().

{
  int ID = myElementIDFactory->GetFreeID();
  SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n12, n23,
                                                   n31, n14, n24, n34, ID);
  if(v==NULL) myElementIDFactory->ReleaseID(ID);
  return v;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n34,
const SMDS_MeshNode n41,
const SMDS_MeshNode n15,
const SMDS_MeshNode n25,
const SMDS_MeshNode n35,
const SMDS_MeshNode n45 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3705 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshElementIDFactory.GetFreeID(), myElementIDFactory, and SMDS_MeshElementIDFactory.ReleaseID().

{
  int ID = myElementIDFactory->GetFreeID();
  SMDS_MeshVolume * v =
    SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n12, n23, n34, n41,
                               n15, n25, n35, n45, ID);
  if(v==NULL) myElementIDFactory->ReleaseID(ID);
  return v;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeFromVtkIds ( const std::vector< vtkIdType > &  vtkNodeIds) [virtual]
SMDS_MeshVolume * SMDS_Mesh::AddVolumeFromVtkIdsWithID ( const std::vector< vtkIdType > &  vtkNodeIds,
const int  ID 
) [virtual]

Definition at line 1327 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), ObjectPool< X >.destroy(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), SMDS_VtkVolume.GetVtkType(), SMDS_VtkVolume.init(), myCells, myGrid, myInfo, SMDS_MeshInfo.myNbHexas, SMDS_MeshInfo.myNbPolyhedrons, SMDS_MeshInfo.myNbPrisms, SMDS_MeshInfo.myNbPyramids, SMDS_MeshInfo.myNbQuadHexas, SMDS_MeshInfo.myNbQuadPrisms, SMDS_MeshInfo.myNbQuadPyramids, SMDS_MeshInfo.myNbQuadTetras, SMDS_MeshInfo.myNbTetras, myVolumePool, and registerElement().

Referenced by AddVolumeFromVtkIds().

{
  SMDS_VtkVolume *volvtk = myVolumePool->getNew();
  volvtk->init(vtkNodeIds, this);
  if (!this->registerElement(ID,volvtk))
    {
      this->myGrid->GetCellTypesArray()->SetValue(volvtk->getVtkId(), VTK_EMPTY_CELL);
      myVolumePool->destroy(volvtk);
      return 0;
    }
  adjustmyCellsCapacity(ID);
  myCells[ID] = volvtk;
  vtkIdType aVtkType = volvtk->GetVtkType();
  switch (aVtkType)
  {
    case VTK_TETRA:
      myInfo.myNbTetras++;
      break;
    case VTK_PYRAMID:
      myInfo.myNbPyramids++;
      break;
    case VTK_WEDGE:
      myInfo.myNbPrisms++;
      break;
    case VTK_HEXAHEDRON:
      myInfo.myNbHexas++;
      break;
    case VTK_QUADRATIC_TETRA:
      myInfo.myNbQuadTetras++;
      break;
    case VTK_QUADRATIC_PYRAMID:
      myInfo.myNbQuadPyramids++;
      break;
    case VTK_QUADRATIC_WEDGE:
      myInfo.myNbQuadPrisms++;
      break;
    case VTK_QUADRATIC_HEXAHEDRON:
      myInfo.myNbQuadHexas++;
      break;
//#ifdef VTK_HAVE_POLYHEDRON
    case VTK_POLYHEDRON:
      myInfo.myNbPolyhedrons++;
      break;
//#endif
    default:
      myInfo.myNbPolyhedrons++;
      break;
  }
  return volvtk;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n12,
int  n23,
int  n34,
int  n41,
int  n56,
int  n67,
int  n78,
int  n85,
int  n15,
int  n26,
int  n37,
int  n48,
int  ID 
) [virtual]
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6,
const SMDS_MeshNode n7,
const SMDS_MeshNode n8,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n34,
const SMDS_MeshNode n41,
const SMDS_MeshNode n56,
const SMDS_MeshNode n67,
const SMDS_MeshNode n78,
const SMDS_MeshNode n85,
const SMDS_MeshNode n15,
const SMDS_MeshNode n26,
const SMDS_MeshNode n37,
const SMDS_MeshNode n48,
int  ID 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 4016 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), ObjectPool< X >.destroy(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionFaces(), SMDS_VtkVolume.init(), myCells, myGrid, myInfo, SMDS_MeshInfo.myNbQuadHexas, myVolumePool, and registerElement().

{
  if (!n1 || !n2 || !n3 || !n4 || !n5 || !n6 || !n7 || !n8 || !n12 || !n23 ||
      !n34 || !n41 || !n56 || !n67 || !n78 || !n85 || !n15 || !n26 || !n37 || !n48)
    return 0;
  if(hasConstructionFaces()) {
    return 0;
    // creation quadratic faces - not implemented
  }
  // --- retrieve nodes ID
  vector<vtkIdType> nodeIds;
  nodeIds.clear();
  nodeIds.push_back(n1->getVtkId());
  nodeIds.push_back(n4->getVtkId());
  nodeIds.push_back(n3->getVtkId());
  nodeIds.push_back(n2->getVtkId());

  nodeIds.push_back(n5->getVtkId());
  nodeIds.push_back(n8->getVtkId());
  nodeIds.push_back(n7->getVtkId());
  nodeIds.push_back(n6->getVtkId());

  nodeIds.push_back(n41->getVtkId());
  nodeIds.push_back(n34->getVtkId());
  nodeIds.push_back(n23->getVtkId());
  nodeIds.push_back(n12->getVtkId());

  nodeIds.push_back(n85->getVtkId());
  nodeIds.push_back(n78->getVtkId());
  nodeIds.push_back(n67->getVtkId());
  nodeIds.push_back(n56->getVtkId());

  nodeIds.push_back(n15->getVtkId());
  nodeIds.push_back(n48->getVtkId());
  nodeIds.push_back(n37->getVtkId());
  nodeIds.push_back(n26->getVtkId());

  SMDS_VtkVolume *volvtk = myVolumePool->getNew();
  volvtk->init(nodeIds, this);
  if (!this->registerElement(ID,volvtk))
    {
      this->myGrid->GetCellTypesArray()->SetValue(volvtk->getVtkId(), VTK_EMPTY_CELL);
      myVolumePool->destroy(volvtk);
      return 0;
    }
  adjustmyCellsCapacity(ID);
  myCells[ID] = volvtk;
  myInfo.myNbQuadHexas++;

//  if (!registerElement(ID, volvtk)) {
//    RemoveElement(volvtk, false);
//    volvtk = NULL;
//  }
  return volvtk;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( int  idnode1,
int  idnode2,
int  idnode3,
int  idnode4,
int  ID 
) [virtual]

Create a new tetrahedron and add it to the mesh.

Parameters:
IDThe ID of the new volume
Returns:
The created tetrahedron or NULL if an element with this ID already exists or if input nodes are not found.

Reimplemented in SMESHDS_Mesh.

Definition at line 566 of file SMDS_Mesh.cxx.

References SMDS_MeshNodeIDFactory.MeshElement(), and myNodeIDFactory.

Referenced by AddVolume(), and AddVolumeWithID().

{
    //MESSAGE("AddVolumeWithID" << ID);
  SMDS_MeshNode *node1, *node2, *node3, *node4;
  node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
  node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
  node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3);
  node4 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode4);
  if(!node1 || !node2 || !node3 || !node4) return NULL;
  return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, ID);
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
int  ID 
) [virtual]

Create a new tetrahedron and add it to the mesh.

Parameters:
IDThe ID of the new volume
Returns:
The created tetrahedron

Reimplemented in SMESHDS_Mesh.

Definition at line 588 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, ObjectPool< X >.destroy(), ex19_sphereINcube.f1, ex19_sphereINcube.f2, ex19_sphereINcube.f3, ex19_sphereINcube.f4, FindFaceOrCreate(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionEdges(), hasConstructionFaces(), SMDS_VtkVolume.init(), MESSAGE, myCells, myGrid, myInfo, SMDS_MeshInfo.myNbTetras, myVolumePool, NbVolumes(), and registerElement().

{
    //MESSAGE("AddVolumeWithID " << ID);
  SMDS_MeshVolume* volume = 0;
  if ( !n1 || !n2 || !n3 || !n4) return volume;
  if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  if(hasConstructionFaces()) {
    SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3);
    SMDS_MeshFace * f2=FindFaceOrCreate(n1,n2,n4);
    SMDS_MeshFace * f3=FindFaceOrCreate(n1,n3,n4);
    SMDS_MeshFace * f4=FindFaceOrCreate(n2,n3,n4);
    volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4);
    adjustmyCellsCapacity(ID);
    myCells[ID] = volume;
    myInfo.myNbTetras++;
  }
  else if(hasConstructionEdges()) {
    MESSAGE("Error : Not implemented");
    return NULL;
  }
  else {
    // --- retrieve nodes ID
    vector<vtkIdType> nodeIds;
    nodeIds.clear();
    nodeIds.push_back(n1->getVtkId());
    nodeIds.push_back(n3->getVtkId()); // order SMDS-->VTK
    nodeIds.push_back(n2->getVtkId());
    nodeIds.push_back(n4->getVtkId());

    SMDS_VtkVolume *volvtk = myVolumePool->getNew();
    volvtk->init(nodeIds, this);
    if (!this->registerElement(ID,volvtk))
      {
        this->myGrid->GetCellTypesArray()->SetValue(volvtk->getVtkId(), VTK_EMPTY_CELL);
        myVolumePool->destroy(volvtk);
        return 0;
      }
    volume = volvtk;
    adjustmyCellsCapacity(ID);
    myCells[ID] = volume;
    myInfo.myNbTetras++;
  }

//  if (!registerElement(ID, volume)) {
//    RemoveElement(volume, false);
//    volume = NULL;
//  }
  return volume;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( int  idnode1,
int  idnode2,
int  idnode3,
int  idnode4,
int  idnode5,
int  ID 
) [virtual]

Create a new pyramid and add it to the mesh.

Nodes 1,2,3 and 4 define the base of the pyramid

Parameters:
IDThe ID of the new volume
Returns:
The created pyramid or NULL if an element with this ID already exists or if input nodes are not found.

Reimplemented in SMESHDS_Mesh.

Definition at line 669 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshNodeIDFactory.MeshElement(), and myNodeIDFactory.

{
    //MESSAGE("AddVolumeWithID " << ID);
  SMDS_MeshNode *node1, *node2, *node3, *node4, *node5;
  node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
  node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
  node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3);
  node4 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode4);
  node5 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode5);
  if(!node1 || !node2 || !node3 || !node4 || !node5) return NULL;
  return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, ID);
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
int  ID 
) [virtual]

Create a new pyramid and add it to the mesh.

Nodes 1,2,3 and 4 define the base of the pyramid

Parameters:
IDThe ID of the new volume
Returns:
The created pyramid

Reimplemented in SMESHDS_Mesh.

Definition at line 694 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, ObjectPool< X >.destroy(), ex19_sphereINcube.f1, ex19_sphereINcube.f2, ex19_sphereINcube.f3, ex19_sphereINcube.f4, FindFaceOrCreate(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionEdges(), hasConstructionFaces(), SMDS_VtkVolume.init(), MESSAGE, myCells, myGrid, myInfo, SMDS_MeshInfo.myNbPyramids, myVolumePool, NbVolumes(), and registerElement().

{
    //MESSAGE("AddVolumeWithID " << ID);
  SMDS_MeshVolume* volume = 0;
  if ( !n1 || !n2 || !n3 || !n4 || !n5) return volume;
  if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  if(hasConstructionFaces()) {
    SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3,n4);
    SMDS_MeshFace * f2=FindFaceOrCreate(n1,n2,n5);
    SMDS_MeshFace * f3=FindFaceOrCreate(n2,n3,n5);
    SMDS_MeshFace * f4=FindFaceOrCreate(n3,n4,n5);
    volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4);
    adjustmyCellsCapacity(ID);
    myCells[ID] = volume;
    myInfo.myNbPyramids++;
  }
  else if(hasConstructionEdges()) {
    MESSAGE("Error : Not implemented");
    return NULL;
  }
  else {
    // --- retrieve nodes ID
    vector<vtkIdType> nodeIds;
    nodeIds.clear();
    nodeIds.push_back(n1->getVtkId());
    nodeIds.push_back(n4->getVtkId());
    nodeIds.push_back(n3->getVtkId());
    nodeIds.push_back(n2->getVtkId());
    nodeIds.push_back(n5->getVtkId());

    SMDS_VtkVolume *volvtk = myVolumePool->getNew();
    volvtk->init(nodeIds, this);
    if (!this->registerElement(ID,volvtk))
      {
        this->myGrid->GetCellTypesArray()->SetValue(volvtk->getVtkId(), VTK_EMPTY_CELL);
        myVolumePool->destroy(volvtk);
        return 0;
      }
    volume = volvtk;
    adjustmyCellsCapacity(ID);
    myCells[ID] = volume;
    myInfo.myNbPyramids++;
  }

//  if (!registerElement(ID, volume)) {
//    RemoveElement(volume, false);
//    volume = NULL;
//  }
  return volume;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( int  idnode1,
int  idnode2,
int  idnode3,
int  idnode4,
int  idnode5,
int  idnode6,
int  ID 
) [virtual]

Create a new prism and add it to the mesh.

Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle.

Parameters:
IDThe ID of the new volume
Returns:
The created prism or NULL if an element with this ID already exists or if input nodes are not found.

Reimplemented in SMESHDS_Mesh.

Definition at line 778 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshNodeIDFactory.MeshElement(), and myNodeIDFactory.

{
    //MESSAGE("AddVolumeWithID " << ID);
  SMDS_MeshNode *node1, *node2, *node3, *node4, *node5, *node6;
  node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
  node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
  node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3);
  node4 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode4);
  node5 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode5);
  node6 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode6);
  if(!node1 || !node2 || !node3 || !node4 || !node5 || !node6) return NULL;
  return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, node6, ID);
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6,
int  ID 
) [virtual]

Create a new prism and add it to the mesh.

Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle.

Parameters:
IDThe ID of the new volume
Returns:
The created prism

Reimplemented in SMESHDS_Mesh.

Definition at line 805 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, ObjectPool< X >.destroy(), ex19_sphereINcube.f1, ex19_sphereINcube.f2, ex19_sphereINcube.f3, ex19_sphereINcube.f4, FindFaceOrCreate(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionEdges(), hasConstructionFaces(), SMDS_VtkVolume.init(), MESSAGE, myCells, myGrid, myInfo, SMDS_MeshInfo.myNbPrisms, myVolumePool, NbVolumes(), and registerElement().

{
    //MESSAGE("AddVolumeWithID " << ID);
  SMDS_MeshVolume* volume = 0;
  if ( !n1 || !n2 || !n3 || !n4 || !n5 || !n6) return volume;
  if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  if(hasConstructionFaces()) {
    SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3);
    SMDS_MeshFace * f2=FindFaceOrCreate(n4,n5,n6);
    SMDS_MeshFace * f3=FindFaceOrCreate(n1,n4,n5,n2);
    SMDS_MeshFace * f4=FindFaceOrCreate(n2,n5,n6,n3);
    SMDS_MeshFace * f5=FindFaceOrCreate(n3,n6,n4,n1);
    volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5);
    adjustmyCellsCapacity(ID);
    myCells[ID] = volume;
    myInfo.myNbPrisms++;
  }
  else if(hasConstructionEdges()) {
    MESSAGE("Error : Not implemented");
    return NULL;
  }
  else {
    // --- retrieve nodes ID
    vector<vtkIdType> nodeIds;
    nodeIds.clear();
    nodeIds.push_back(n1->getVtkId());
    nodeIds.push_back(n2->getVtkId());
    nodeIds.push_back(n3->getVtkId());
    nodeIds.push_back(n4->getVtkId());
    nodeIds.push_back(n5->getVtkId());
    nodeIds.push_back(n6->getVtkId());

    SMDS_VtkVolume *volvtk = myVolumePool->getNew();
    volvtk->init(nodeIds, this);
    if (!this->registerElement(ID,volvtk))
      {
        this->myGrid->GetCellTypesArray()->SetValue(volvtk->getVtkId(), VTK_EMPTY_CELL);
        myVolumePool->destroy(volvtk);
        return 0;
      }
    volume = volvtk;
    adjustmyCellsCapacity(ID);
    myCells[ID] = volume;
    myInfo.myNbPrisms++;
  }

//  if (!registerElement(ID, volume)) {
//    RemoveElement(volume, false);
//    volume = NULL;
//  }
  return volume;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( int  idnode1,
int  idnode2,
int  idnode3,
int  idnode4,
int  idnode5,
int  idnode6,
int  idnode7,
int  idnode8,
int  ID 
) [virtual]

Create a new hexahedron and add it to the mesh.

Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges.

Parameters:
IDThe ID of the new volume
Returns:
The created hexahedron or NULL if an element with this ID already exists or if input nodes are not found.

Reimplemented in SMESHDS_Mesh.

Definition at line 894 of file SMDS_Mesh.cxx.

References AddVolumeWithID(), SMDS_MeshNodeIDFactory.MeshElement(), and myNodeIDFactory.

{
    //MESSAGE("AddVolumeWithID " << ID);
  SMDS_MeshNode *node1, *node2, *node3, *node4, *node5, *node6, *node7, *node8;
  node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
  node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
  node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3);
  node4 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode4);
  node5 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode5);
  node6 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode6);
  node7 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode7);
  node8 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode8);
  if(!node1 || !node2 || !node3 || !node4 || !node5 || !node6 || !node7 || !node8)
    return NULL;
  return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, node6,
                                    node7, node8, ID);
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6,
const SMDS_MeshNode n7,
const SMDS_MeshNode n8,
int  ID 
) [virtual]

Create a new hexahedron and add it to the mesh.

Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges.

Parameters:
IDThe ID of the new volume
Returns:
The created prism or NULL if an element with this ID already exists or if input nodes are not found.

Reimplemented in SMESHDS_Mesh.

Definition at line 928 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, ObjectPool< X >.destroy(), ex19_sphereINcube.f1, ex19_sphereINcube.f2, ex19_sphereINcube.f3, ex19_sphereINcube.f4, FindFaceOrCreate(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionEdges(), hasConstructionFaces(), SMDS_VtkVolume.init(), MESSAGE, myCells, myGrid, myInfo, SMDS_MeshInfo.myNbHexas, myVolumePool, NbVolumes(), and registerElement().

{
    //MESSAGE("AddVolumeWithID " << ID);
  SMDS_MeshVolume* volume = 0;
  if ( !n1 || !n2 || !n3 || !n4 || !n5 || !n6 || !n7 || !n8) return volume;
  if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  if(hasConstructionFaces()) {
    SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3,n4);
    SMDS_MeshFace * f2=FindFaceOrCreate(n5,n6,n7,n8);
    SMDS_MeshFace * f3=FindFaceOrCreate(n1,n4,n8,n5);
    SMDS_MeshFace * f4=FindFaceOrCreate(n1,n2,n6,n5);
    SMDS_MeshFace * f5=FindFaceOrCreate(n2,n3,n7,n6);
    SMDS_MeshFace * f6=FindFaceOrCreate(n3,n4,n8,n7);
    volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6);
    adjustmyCellsCapacity(ID);
    myCells[ID] = volume;
    myInfo.myNbHexas++;
  }
  else if(hasConstructionEdges()) {
    MESSAGE("Error : Not implemented");
    return NULL;
  }
  else {
    // --- retrieve nodes ID
    vector<vtkIdType> nodeIds;
    nodeIds.clear();
    nodeIds.push_back(n1->getVtkId());
    nodeIds.push_back(n4->getVtkId());
    nodeIds.push_back(n3->getVtkId());
    nodeIds.push_back(n2->getVtkId());
    nodeIds.push_back(n5->getVtkId());
    nodeIds.push_back(n8->getVtkId());
    nodeIds.push_back(n7->getVtkId());
    nodeIds.push_back(n6->getVtkId());

    SMDS_VtkVolume *volvtk = myVolumePool->getNew();
    volvtk->init(nodeIds, this);
    if (!this->registerElement(ID,volvtk))
      {
        this->myGrid->GetCellTypesArray()->SetValue(volvtk->getVtkId(), VTK_EMPTY_CELL);
        myVolumePool->destroy(volvtk);
        return 0;
      }
    volume = volvtk;
    adjustmyCellsCapacity(ID);
    myCells[ID] = volume;
    myInfo.myNbHexas++;
  }
 
//  if (!registerElement(ID, volume)) {
//    RemoveElement(volume, false);
//    volume = NULL;
//  }
  return volume;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( const SMDS_MeshFace f1,
const SMDS_MeshFace f2,
const SMDS_MeshFace f3,
const SMDS_MeshFace f4,
int  ID 
) [virtual]

Create a new tetrahedron defined by its faces and add it to the mesh.

Parameters:
IDThe ID of the new volume
Returns:
The created tetrahedron

Definition at line 1014 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, SMDS_MeshElementIDFactory.GetFreeID(), hasConstructionFaces(), MESSAGE, myCells, myElementIDFactory, myInfo, SMDS_MeshInfo.myNbTetras, NbVolumes(), and registerElement().

{
  MESSAGE("AddVolumeWithID" << ID);
  if (!hasConstructionFaces())
    return NULL;
  if ( !f1 || !f2 || !f3 || !f4) return 0;
  if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4);
  adjustmyCellsCapacity(ID);
  myCells[ID] = volume;
  myInfo.myNbTetras++;

  if (!registerElement(ID, volume)) {
    registerElement(myElementIDFactory->GetFreeID(), volume);
    //RemoveElement(volume, false);
    //volume = NULL;
  }
  return volume;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( const SMDS_MeshFace f1,
const SMDS_MeshFace f2,
const SMDS_MeshFace f3,
const SMDS_MeshFace f4,
const SMDS_MeshFace f5,
int  ID 
) [virtual]

Create a new pyramid defined by its faces and add it to the mesh.

Parameters:
IDThe ID of the new volume
Returns:
The created pyramid

Definition at line 1061 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, SMDS_MeshElementIDFactory.GetFreeID(), hasConstructionFaces(), MESSAGE, myCells, myElementIDFactory, myInfo, SMDS_MeshInfo.myNbPyramids, NbVolumes(), and registerElement().

{
  MESSAGE("AddVolumeWithID" << ID);
  if (!hasConstructionFaces())
    return NULL;
  if ( !f1 || !f2 || !f3 || !f4 || !f5) return 0;
  if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5);
  adjustmyCellsCapacity(ID);
  myCells[ID] = volume;
  myInfo.myNbPyramids++;

  if (!registerElement(ID, volume)) {
    registerElement(myElementIDFactory->GetFreeID(), volume);
    //RemoveElement(volume, false);
    //volume = NULL;
  }
  return volume;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( const SMDS_MeshFace f1,
const SMDS_MeshFace f2,
const SMDS_MeshFace f3,
const SMDS_MeshFace f4,
const SMDS_MeshFace f5,
const SMDS_MeshFace f6,
int  ID 
) [virtual]

Create a new prism defined by its faces and add it to the mesh.

Parameters:
IDThe ID of the new volume
Returns:
The created prism

Definition at line 1110 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, SMDS_MeshElementIDFactory.GetFreeID(), hasConstructionFaces(), MESSAGE, myCells, myElementIDFactory, myInfo, SMDS_MeshInfo.myNbPrisms, NbVolumes(), and registerElement().

{
  MESSAGE("AddVolumeWithID" << ID);
  if (!hasConstructionFaces())
    return NULL;
  if ( !f1 || !f2 || !f3 || !f4 || !f5 || !f6) return 0;
  if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6);
  adjustmyCellsCapacity(ID);
  myCells[ID] = volume;
  myInfo.myNbPrisms++;

  if (!registerElement(ID, volume)) {
    registerElement(myElementIDFactory->GetFreeID(), volume);
    //RemoveElement(volume, false);
    //volume = NULL;
  }
  return volume;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( int  n1,
int  n2,
int  n3,
int  n4,
int  n12,
int  n23,
int  n31,
int  n14,
int  n24,
int  n34,
int  ID 
) [virtual]
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n31,
const SMDS_MeshNode n14,
const SMDS_MeshNode n24,
const SMDS_MeshNode n34,
int  ID 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3647 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), ObjectPool< X >.destroy(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionFaces(), SMDS_VtkVolume.init(), myCells, myGrid, myInfo, SMDS_MeshInfo.myNbQuadTetras, myVolumePool, and registerElement().

{
  if ( !n1 || !n2 || !n3 || !n4 || !n12 || !n23 || !n31 || !n14 || !n24 || !n34)
    return 0;
  if(hasConstructionFaces()) {
    // creation quadratic faces - not implemented
    return 0;
  }
  // --- retrieve nodes ID
  vector<vtkIdType> nodeIds;
  nodeIds.clear();
  nodeIds.push_back(n1->getVtkId());
  nodeIds.push_back(n3->getVtkId());
  nodeIds.push_back(n2->getVtkId());
  nodeIds.push_back(n4->getVtkId());

  nodeIds.push_back(n31->getVtkId());
  nodeIds.push_back(n23->getVtkId());
  nodeIds.push_back(n12->getVtkId());

  nodeIds.push_back(n14->getVtkId());
  nodeIds.push_back(n34->getVtkId());
  nodeIds.push_back(n24->getVtkId());

  SMDS_VtkVolume *volvtk = myVolumePool->getNew();
  volvtk->init(nodeIds, this);
  if (!this->registerElement(ID,volvtk))
    {
      this->myGrid->GetCellTypesArray()->SetValue(volvtk->getVtkId(), VTK_EMPTY_CELL);
      myVolumePool->destroy(volvtk);
      return 0;
    }
  adjustmyCellsCapacity(ID);
  myCells[ID] = volvtk;
  myInfo.myNbQuadTetras++;

//  if (!registerElement(ID, volvtk)) {
//    RemoveElement(volvtk, false);
//    volvtk = NULL;
//  }
  return volvtk;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n12,
int  n23,
int  n34,
int  n41,
int  n15,
int  n25,
int  n35,
int  n45,
int  ID 
) [virtual]
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n34,
const SMDS_MeshNode n41,
const SMDS_MeshNode n15,
const SMDS_MeshNode n25,
const SMDS_MeshNode n35,
const SMDS_MeshNode n45,
int  ID 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3756 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), ObjectPool< X >.destroy(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionFaces(), SMDS_VtkVolume.init(), myCells, myGrid, myInfo, SMDS_MeshInfo.myNbQuadPyramids, myVolumePool, and registerElement().

{
  if (!n1 || !n2 || !n3 || !n4 || !n5 || !n12 || !n23 ||
      !n34 || !n41 || !n15 || !n25 || !n35 || !n45)
    return 0;
  if(hasConstructionFaces()) {
    // creation quadratic faces - not implemented
    return 0;
  }
  // --- retrieve nodes ID
  vector<vtkIdType> nodeIds;
  nodeIds.clear();
  nodeIds.push_back(n1->getVtkId());
  nodeIds.push_back(n4->getVtkId());
  nodeIds.push_back(n3->getVtkId());
  nodeIds.push_back(n2->getVtkId());
  nodeIds.push_back(n5->getVtkId());

  nodeIds.push_back(n41->getVtkId());
  nodeIds.push_back(n34->getVtkId());
  nodeIds.push_back(n23->getVtkId());
  nodeIds.push_back(n12->getVtkId());

  nodeIds.push_back(n15->getVtkId());
  nodeIds.push_back(n45->getVtkId());
  nodeIds.push_back(n35->getVtkId());
  nodeIds.push_back(n25->getVtkId());

  SMDS_VtkVolume *volvtk = myVolumePool->getNew();
  volvtk->init(nodeIds, this);
  if (!this->registerElement(ID,volvtk))
    {
      this->myGrid->GetCellTypesArray()->SetValue(volvtk->getVtkId(), VTK_EMPTY_CELL);
      myVolumePool->destroy(volvtk);
      return 0;
    }
  adjustmyCellsCapacity(ID);
  myCells[ID] = volvtk;
  myInfo.myNbQuadPyramids++;

//  if (!registerElement(ID, volvtk)) {
//    RemoveElement(volvtk, false);
//    volvtk = NULL;
//  }
  return volvtk;
}
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n12,
int  n23,
int  n31,
int  n45,
int  n56,
int  n64,
int  n14,
int  n25,
int  n36,
int  ID 
) [virtual]
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6,
const SMDS_MeshNode n12,
const SMDS_MeshNode n23,
const SMDS_MeshNode n31,
const SMDS_MeshNode n45,
const SMDS_MeshNode n56,
const SMDS_MeshNode n64,
const SMDS_MeshNode n14,
const SMDS_MeshNode n25,
const SMDS_MeshNode n36,
int  ID 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3878 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), ObjectPool< X >.destroy(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionFaces(), SMDS_VtkVolume.init(), myCells, myGrid, myInfo, SMDS_MeshInfo.myNbQuadPrisms, myVolumePool, and registerElement().

{
  if (!n1 || !n2 || !n3 || !n4 || !n5 || !n6 || !n12 || !n23 ||
      !n31 || !n45 || !n56 || !n64 || !n14 || !n25 || !n36)
    return 0;
  if(hasConstructionFaces()) {
    // creation quadratic faces - not implemented
    return 0;
  }
  // --- retrieve nodes ID
  vector<vtkIdType> nodeIds;
  nodeIds.clear();
  nodeIds.push_back(n1->getVtkId());
  nodeIds.push_back(n2->getVtkId());
  nodeIds.push_back(n3->getVtkId());

  nodeIds.push_back(n4->getVtkId());
  nodeIds.push_back(n5->getVtkId());
  nodeIds.push_back(n6->getVtkId());

  nodeIds.push_back(n12->getVtkId());
  nodeIds.push_back(n23->getVtkId());
  nodeIds.push_back(n31->getVtkId());

  nodeIds.push_back(n45->getVtkId());
  nodeIds.push_back(n56->getVtkId());
  nodeIds.push_back(n64->getVtkId());

  nodeIds.push_back(n14->getVtkId());
  nodeIds.push_back(n25->getVtkId());
  nodeIds.push_back(n36->getVtkId());

  SMDS_VtkVolume *volvtk = myVolumePool->getNew();
  volvtk->init(nodeIds, this);
  if (!this->registerElement(ID,volvtk))
    {
      this->myGrid->GetCellTypesArray()->SetValue(volvtk->getVtkId(), VTK_EMPTY_CELL);
      myVolumePool->destroy(volvtk);
      return 0;
    }
  adjustmyCellsCapacity(ID);
  myCells[ID] = volvtk;
  myInfo.myNbQuadPrisms++;

//  if (!registerElement(ID, volvtk)) {
//    RemoveElement(volvtk, false);
//    volvtk = NULL;
//  }
  return volvtk;
}
void SMDS_Mesh.adjustBoundingBox ( double  x,
double  y,
double  z 
) [protected]

Definition at line 633 of file SMDS_Mesh.hxx.

References ex13_hole1partial.x, and ex13_hole1partial.y.

Referenced by AddNodeWithID(), and SMDS_MeshNode.setXYZ().

  {
    if (x > xmax) xmax = x;
    else if (x < xmin) xmin = x;
    if (y > ymax) ymax = y;
    else if (y < ymin) ymin = y;
    if (z > zmax) zmax = z;
    else if (z < zmin) zmin = z;
  }
void SMDS_Mesh.adjustmyCellsCapacity ( int  ID) [protected]
void SMDS_Mesh::adjustStructure ( )

Definition at line 4127 of file SMDS_Mesh.cxx.

References SMDS_MeshNodeIDFactory.GetMaxID(), SMDS_UnstructuredGrid.GetPoints(), myGrid, and myNodeIDFactory.

{
  myGrid->GetPoints()->GetData()->SetNumberOfTuples(myNodeIDFactory->GetMaxID());
}
SMDS_Mesh* SMDS_Mesh.boundaryEdges ( )
SMDS_Mesh* SMDS_Mesh.boundaryFaces ( )
bool SMDS_Mesh::ChangeElementNodes ( const SMDS_MeshElement elem,
const SMDS_MeshNode nodes[],
const int  nbnodes 
)

Reimplemented in SMESHDS_Mesh.

Definition at line 1636 of file SMDS_Mesh.cxx.

References SMDS_MeshCell.ChangeNodes(), MESSAGE, SMDS_MeshElement.nodesIterator(), SMDS_MeshNode.RemoveInverseElement(), and SMDS_MeshCell.vtkOrder().

Referenced by SMESHDS_Mesh.ChangeElementNodes(), and SMESH_Client.Update().

{
  MESSAGE("SMDS_Mesh::ChangeElementNodes");
  // keep current nodes of elem
  set<const SMDS_MeshElement*> oldNodes;
  SMDS_ElemIteratorPtr itn = element->nodesIterator();
  while(itn->more())
    oldNodes.insert(itn->next());

  // change nodes
  bool Ok = false;
  SMDS_MeshCell* cell = dynamic_cast<SMDS_MeshCell*>((SMDS_MeshElement*) element);
  if (cell)
    {
      Ok = cell->vtkOrder(nodes, nbnodes);
      Ok = cell->ChangeNodes(nodes, nbnodes);
    }

  if ( Ok ) { // update InverseElements

    set<const SMDS_MeshElement*>::iterator it;

    // AddInverseElement to new nodes
    for ( int i = 0; i < nbnodes; i++ ) {
      it = oldNodes.find( nodes[i] );
      if ( it == oldNodes.end() )
        // new node
        const_cast<SMDS_MeshNode*>( nodes[i] )->AddInverseElement( cell );
      else
        // remove from oldNodes a node that remains in elem
        oldNodes.erase( it );
    }
    // RemoveInverseElement from the nodes removed from elem
    for ( it = oldNodes.begin(); it != oldNodes.end(); it++ )
    {
      SMDS_MeshNode * n = static_cast<SMDS_MeshNode *>
        (const_cast<SMDS_MeshElement *>( *it ));
      n->RemoveInverseElement( cell );
    }
  }

  return Ok;
}
bool SMDS_Mesh::ChangePolyhedronNodes ( const SMDS_MeshElement elem,
const std::vector< const SMDS_MeshNode * > &  nodes,
const std::vector< int > &  quantities 
)

Definition at line 1686 of file SMDS_Mesh.cxx.

References SMDS_MeshElement.GetType(), MESSAGE, SMDS_MeshElement.nodesIterator(), SMDS_MeshNode.RemoveInverseElement(), SMDSAbs_Volume, and SMESH_demo_hexa2_upd.vol.

Referenced by SMESHDS_Mesh.ChangePolyhedronNodes().

{
  if (elem->GetType() != SMDSAbs_Volume) {
    MESSAGE("WRONG ELEM TYPE");
    return false;
  }

  const SMDS_VtkVolume* vol = dynamic_cast<const SMDS_VtkVolume*>(elem);
  if (!vol) {
    return false;
  }

  // keep current nodes of elem
  set<const SMDS_MeshElement*> oldNodes;
  SMDS_ElemIteratorPtr itn = elem->nodesIterator();
  while (itn->more()) {
    oldNodes.insert(itn->next());
  }

  // change nodes
  // TODO remove this function
  //bool Ok = const_cast<SMDS_VtkVolume*>(vol)->ChangeNodes(nodes, quantities);
  bool Ok = false;
  if (!Ok) {
    return false;
  }

  // update InverseElements

  // AddInverseElement to new nodes
  int nbnodes = nodes.size();
  set<const SMDS_MeshElement*>::iterator it;
  for (int i = 0; i < nbnodes; i++) {
    it = oldNodes.find(nodes[i]);
    if (it == oldNodes.end()) {
      // new node
      const_cast<SMDS_MeshNode*>(nodes[i])->AddInverseElement(elem);
    } else {
      // remove from oldNodes a node that remains in elem
      oldNodes.erase(it);
    }
  }

  // RemoveInverseElement from the nodes removed from elem
  for (it = oldNodes.begin(); it != oldNodes.end(); it++) {
    SMDS_MeshNode * n = static_cast<SMDS_MeshNode *>
      (const_cast<SMDS_MeshElement *>( *it ));
    n->RemoveInverseElement(elem);
  }

  return Ok;
}
int SMDS_Mesh::CheckMemory ( const bool  doNotRaise = false) throw (std::bad_alloc) [static]

Raise an exception if free memory (ram+swap) too low.

Parameters:
doNotRaise- if true, suppres exception, just return free memory size
Return values:
int- amount of available memory in MB or negative number in failure case

Definition at line 75 of file SMDS_Mesh.cxx.

References MESSAGE, and ex30_tepal.status.

Referenced by Add0DElementWithID(), AddFaceWithID(), AddVolumeWithID(), SMESH_VisualObjDef.buildElemPrs(), SMESH_VisualObjDef.buildNodePrs(), SMESHGUI_BaseComputeOp.computeMesh(), SMESH_subMesh.ComputeStateEngine(), createQuadrangle(), createTriangle(), FindEdgeOrCreate(), and SMESH.GetVisualObj().

{
#ifndef WIN32
  struct sysinfo si;
  int err = sysinfo( &si );
  if ( err )
    return -1;

  const unsigned long Mbyte = 1024 * 1024;

  static int limit = -1;
  if ( limit < 0 ) {
    int status = system("SMDS_MemoryLimit"); // it returns lower limit of free RAM
    if (status >= 0 ) {
      limit = WEXITSTATUS(status);
    }
    else {
      double factor = ( si.totalswap == 0 ) ? 0.1 : 0.2;
      limit = int(( factor * si.totalram * si.mem_unit ) / Mbyte );
    }
    if ( limit < 20 )
      limit = 20;
    else
      limit = int ( limit * 1.5 );
    MESSAGE ( "SMDS_Mesh::CheckMemory() memory limit = " << limit << " MB" );
  }

  // compute separately to avoid overflow
  int freeMb =
    ( si.freeram  * si.mem_unit ) / Mbyte +
    ( si.freeswap * si.mem_unit ) / Mbyte;
  //cout << "freeMb = " << freeMb << " limit = " << limit << endl;

  if ( freeMb > limit )
    return freeMb - limit;

  if ( doNotRaise )
    return 0;

  MESSAGE ("SMDS_Mesh::CheckMemory() throws as free memory too low: " << freeMb <<" MB" );
  throw std::bad_alloc();
#else
  return -1;
#endif
}
void SMDS_Mesh::Clear ( ) [virtual]

Clear all data.

Definition at line 2440 of file SMDS_Mesh.cxx.

References SMDS_UnstructuredGrid.BuildLinks(), SMDS_MeshInfo.Clear(), SMDS_MeshElementIDFactory.Clear(), SMDS_MeshNodeIDFactory.Clear(), ObjectPool< X >.destroy(), elementsIterator(), SMDS_MeshElement.GetID(), SMDS_MeshElement.GetType(), SMDS_MeshElement.getVtkId(), MESSAGE, myCellIdVtkToSmds, myCells, myChildren, myEdgePool, myElementIDFactory, myFacePool, myGrid, myInfo, myModified, myNodeIDFactory, myNodePool, myNodes, myParent, myVolumePool, ex29_refine.node(), nodesIterator(), SMDS_SpacePosition.originSpacePosition(), SMDS_MeshNodeIDFactory.ReleaseID(), SMDS_MeshElementIDFactory.ReleaseID(), SMDS_MeshNode.SetPosition(), SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume, xmax, xmin, ymax, ymin, zmax, and zmin.

Referenced by SMESHDS_Mesh.ClearMesh(), SMESH.Controls.ElementsOnSurface.ElementsOnSurface(), and SMESH_Client.Update().

{
  MESSAGE("SMDS_Mesh::Clear");
  if (myParent!=NULL)
    {
    SMDS_ElemIteratorPtr eIt = elementsIterator();
    while ( eIt->more() )
      {
        const SMDS_MeshElement *elem = eIt->next();
        myElementIDFactory->ReleaseID(elem->GetID(), elem->getVtkId());
      }
    SMDS_NodeIteratorPtr itn = nodesIterator();
    while (itn->more())
      {
        const SMDS_MeshNode *node = itn->next();
        myNodeIDFactory->ReleaseID(node->GetID(), node->getVtkId());
      }
    }
  else
    {
    myNodeIDFactory->Clear();
    myElementIDFactory->Clear();
    }

  SMDS_ElemIteratorPtr itv = elementsIterator();
  while (itv->more())
    {
      SMDS_MeshElement* elem = (SMDS_MeshElement*)(itv->next());
      SMDSAbs_ElementType aType = elem->GetType();
      switch (aType)
      {
        case SMDSAbs_0DElement:
          delete elem;
          break;
        case SMDSAbs_Edge:
           myEdgePool->destroy(static_cast<SMDS_VtkEdge*>(elem));
          break;
        case SMDSAbs_Face:
          myFacePool->destroy(static_cast<SMDS_VtkFace*>(elem));
          break;
        case SMDSAbs_Volume:
          myVolumePool->destroy(static_cast<SMDS_VtkVolume*>(elem));
          break;
        default:
          break;
      }
    }
  myCells.clear();
  myCellIdVtkToSmds.clear();
  //myCellIdSmdsToVtk.clear();

  SMDS_NodeIteratorPtr itn = nodesIterator();
  while (itn->more())
    {
      SMDS_MeshNode *node = (SMDS_MeshNode*)(itn->next());
      node->SetPosition(SMDS_SpacePosition::originSpacePosition());
      myNodePool->destroy(node);
    }
  myNodes.clear();

  list<SMDS_Mesh*>::iterator itc=myChildren.begin();
  while(itc!=myChildren.end())
    (*itc)->Clear();

  myModified = false;
  xmin = 0; xmax = 0;
  ymin = 0; ymax = 0;
  zmin = 0; zmax = 0;

  myInfo.Clear();

  myGrid->Initialize();
  myGrid->Allocate();
  vtkPoints* points = vtkPoints::New();
  // rnv: to fix bug "21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion"
  // using double type for storing coordinates of nodes instead float.
  points->SetDataType(VTK_DOUBLE);
  points->SetNumberOfPoints(0 /*SMDS_Mesh::chunkSize*/);
  myGrid->SetPoints( points );
  points->Delete();
  myGrid->BuildLinks();
}
void SMDS_Mesh::compactMesh ( ) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 4183 of file SMDS_Mesh.cxx.

References MESSAGE.

{
  MESSAGE("SMDS_Mesh::compactMesh do nothing!");
}
bool SMDS_Mesh::Contains ( const SMDS_MeshElement elem) const

Checks if the element is present in mesh.

Useful to determine dead pointers. Use this function for debug purpose only! Do not check in the code using it even in _DEBUG_ mode

Useful to determine dead pointers.

Definition at line 3219 of file SMDS_Mesh.cxx.

References edgesIterator(), elements0dIterator(), facesIterator(), nodesIterator(), and volumesIterator().

{
  // we should not imply on validity of *elem, so iterate on containers
  // of all types in the hope of finding <elem> somewhere there
  SMDS_NodeIteratorPtr itn = nodesIterator();
  while (itn->more())
    if (elem == itn->next())
      return true;
  SMDS_0DElementIteratorPtr it0d = elements0dIterator();
  while (it0d->more())
    if (elem == it0d->next())
      return true;
  SMDS_EdgeIteratorPtr ite = edgesIterator();
  while (ite->more())
    if (elem == ite->next())
      return true;
  SMDS_FaceIteratorPtr itf = facesIterator();
  while (itf->more())
    if (elem == itf->next())
      return true;
  SMDS_VolumeIteratorPtr itv = volumesIterator();
  while (itv->more())
    if (elem == itv->next())
      return true;
  return false;
}
SMDS_MeshFace * SMDS_Mesh::createQuadrangle ( const SMDS_MeshNode node1,
const SMDS_MeshNode node2,
const SMDS_MeshNode node3,
const SMDS_MeshNode node4,
int  ID 
) [protected]

Create a quadrangle and add it to the current mesh.

This methode do not bind a ID to the create triangle.

Definition at line 1497 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, ObjectPool< X >.destroy(), ex06_hole1boolean.edge1, ex06_hole1boolean.edge2, ex06_hole1boolean.edge3, ex06_hole1boolean.edge4, PAL_MESH_043_3D.face, FindEdgeOrCreate(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionEdges(), SMDS_VtkFace.init(), myCells, myFacePool, myGrid, myInfo, SMDS_MeshInfo.myNbQuadrangles, NbFaces(), and registerElement().

Referenced by AddFaceWithID(), and FindFaceOrCreate().

{
  if ( !node1 || !node2 || !node3 || !node4 ) return 0;
  if ( NbFaces() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  if(hasConstructionEdges())
  {
      //MESSAGE("createQuadrangle hasConstructionEdges "<< ID);
    SMDS_MeshEdge *edge1, *edge2, *edge3, *edge4;
    edge1=FindEdgeOrCreate(node1,node2);
    edge2=FindEdgeOrCreate(node2,node3);
    edge3=FindEdgeOrCreate(node3,node4);
    edge4=FindEdgeOrCreate(node4,node1);

    SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3,edge4);
    adjustmyCellsCapacity(ID);
    myCells[ID] = face;
    myInfo.myNbQuadrangles++;
    return face;
  }
  else
  {
    // --- retrieve nodes ID
    vector<vtkIdType> nodeIds;
    nodeIds.clear();
    nodeIds.push_back(node1->getVtkId());
    nodeIds.push_back(node2->getVtkId());
    nodeIds.push_back(node3->getVtkId());
    nodeIds.push_back(node4->getVtkId());

    SMDS_MeshFace * face = 0;
    SMDS_VtkFace *facevtk = myFacePool->getNew();
    facevtk->init(nodeIds, this);
    if (!this->registerElement(ID,facevtk))
      {
        this->myGrid->GetCellTypesArray()->SetValue(facevtk->getVtkId(), VTK_EMPTY_CELL);
        myFacePool->destroy(facevtk);
        return 0;
      }
    face = facevtk;
    adjustmyCellsCapacity(ID);
    myCells[ID] = face;
    myInfo.myNbQuadrangles++;
    return face;
  }
}
SMDS_MeshFace * SMDS_Mesh::createTriangle ( const SMDS_MeshNode node1,
const SMDS_MeshNode node2,
const SMDS_MeshNode node3,
int  ID 
) [protected]

Create a triangle and add it to the current mesh.

This method do not bind an ID to the create triangle.

Definition at line 1445 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, ObjectPool< X >.destroy(), ex06_hole1boolean.edge1, ex06_hole1boolean.edge2, ex06_hole1boolean.edge3, PAL_MESH_043_3D.face, FindEdgeOrCreate(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), hasConstructionEdges(), SMDS_VtkFace.init(), myCells, myFacePool, myGrid, myInfo, SMDS_MeshInfo.myNbTriangles, NbFaces(), and registerElement().

Referenced by AddFaceWithID(), and FindFaceOrCreate().

{
  if ( !node1 || !node2 || !node3) return 0;
  if ( NbFaces() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
  if(hasConstructionEdges())
  {
    SMDS_MeshEdge *edge1, *edge2, *edge3;
    edge1=FindEdgeOrCreate(node1,node2);
    edge2=FindEdgeOrCreate(node2,node3);
    edge3=FindEdgeOrCreate(node3,node1);

    //int ID = myElementIDFactory->GetFreeID(); // -PR- voir si on range cet element
    SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3);
    adjustmyCellsCapacity(ID);
    myCells[ID] = face;
    myInfo.myNbTriangles++;
    return face;
  }
  else
  {
    // --- retrieve nodes ID
    vector<vtkIdType> nodeIds;
    nodeIds.clear();
    nodeIds.push_back(node1->getVtkId());
    nodeIds.push_back(node2->getVtkId());
    nodeIds.push_back(node3->getVtkId());

    SMDS_MeshFace * face = 0;
    SMDS_VtkFace *facevtk = myFacePool->getNew();
    facevtk->init(nodeIds, this); // put in vtkUnstructuredGrid
    if (!this->registerElement(ID,facevtk))
      {
        this->myGrid->GetCellTypesArray()->SetValue(facevtk->getVtkId(), VTK_EMPTY_CELL);
        myFacePool->destroy(facevtk);
        return 0;
      }
    face = facevtk;
    adjustmyCellsCapacity(ID);
    myCells[ID] = face;
    //MESSAGE("createTriangle " << ID << " " << face);
    myInfo.myNbTriangles++;
    return face;
  }
}
void SMDS_Mesh::DebugStats ( ) const

Definition at line 2268 of file SMDS_Mesh.cxx.

References PAL_MESH_043_3D.face, facesIterator(), SMDS_MeshNode.GetInverseElementIterator(), MESSAGE, Nb0DElements(), NbEdges(), NbFaces(), NbNodes(), NbVolumes(), ex29_refine.node(), and nodesIterator().

{
  MESSAGE("Debug stats of mesh : ");

  MESSAGE("===== NODES ====="<<NbNodes());
  MESSAGE("===== 0DELEMS ====="<<Nb0DElements());
  MESSAGE("===== EDGES ====="<<NbEdges());
  MESSAGE("===== FACES ====="<<NbFaces());
  MESSAGE("===== VOLUMES ====="<<NbVolumes());

  MESSAGE("End Debug stats of mesh ");

  //#ifdef DEB

  SMDS_NodeIteratorPtr itnode=nodesIterator();
  int sizeofnodes = 0;
  int sizeoffaces = 0;

  while(itnode->more())
  {
    const SMDS_MeshNode *node = itnode->next();

    sizeofnodes += sizeof(*node);

    SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
    while(it->more())
    {
      const SMDS_MeshElement *me = it->next();
      sizeofnodes += sizeof(me);
    }
  }

  SMDS_FaceIteratorPtr itface=facesIterator();
  while(itface->more())
  {
    const SMDS_MeshElement *face = itface->next();
    sizeoffaces += sizeof(*face);
  }

  MESSAGE("total size of node elements = " << sizeofnodes);;
  MESSAGE("total size of face elements = " << sizeoffaces);;

  //#endif
}
void SMDS_Mesh::Dump0DElements ( ) const

Definition at line 2220 of file SMDS_Mesh.cxx.

References elements0dIterator(), and MESSAGE.

{
  MESSAGE("dump 0D elements of mesh : ");
  SMDS_0DElementIteratorPtr it0d = elements0dIterator();
  while(it0d->more()) ; //MESSAGE(it0d->next());
}
void SMDS_Mesh::DumpEdges ( ) const

Definition at line 2232 of file SMDS_Mesh.cxx.

References edgesIterator(), and MESSAGE.

{
        MESSAGE("dump edges of mesh : ");
        SMDS_EdgeIteratorPtr itedge=edgesIterator();
        while(itedge->more()) ; //MESSAGE(itedge->next());
}
void SMDS_Mesh::DumpFaces ( ) const

Definition at line 2244 of file SMDS_Mesh.cxx.

References facesIterator(), and MESSAGE.

{
        MESSAGE("dump faces of mesh : ");
        SMDS_FaceIteratorPtr itface=facesIterator();
        while(itface->more()) ; //MESSAGE(itface->next());
}
void SMDS_Mesh::dumpGrid ( string  ficdump = "dumpGrid")

Definition at line 4132 of file SMDS_Mesh.cxx.

References MESSAGE, and myGrid.

{
        MESSAGE("SMDS_Mesh::dumpGrid " << ficdump);
//  vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
//  aWriter->SetFileName(ficdump.c_str());
//  aWriter->SetInput(myGrid);
//  if(myGrid->GetNumberOfCells())
//  {
//    aWriter->Write();
//  }
//  aWriter->Delete();
  ficdump = ficdump + "_connectivity";
  ofstream ficcon(ficdump.c_str(), ios::out);
  int nbPoints = myGrid->GetNumberOfPoints();
  ficcon << "-------------------------------- points " <<  nbPoints << endl;
  for (int i=0; i<nbPoints; i++)
  {
        ficcon << i << " " << *(myGrid->GetPoint(i)) << " " << *(myGrid->GetPoint(i)+1) << " " << " " << *(myGrid->GetPoint(i)+2) << endl;
  }
  int nbCells = myGrid->GetNumberOfCells();
  ficcon << "-------------------------------- cells " <<  nbCells << endl;
  for (int i=0; i<nbCells; i++)
  {
//      MESSAGE(i << " " << myGrid->GetCell(i));
//      MESSAGE("  " << myGrid->GetCell(i)->GetCellType());
        ficcon << i << " - " << myGrid->GetCell(i)->GetCellType() << " -";
        int nbptcell = myGrid->GetCell(i)->GetNumberOfPoints();
        vtkIdList *listid = myGrid->GetCell(i)->GetPointIds();
        for (int j=0; j<nbptcell; j++)
        {
                ficcon << " " <<  listid->GetId(j);
        }
        ficcon << endl;
  }
  ficcon << "-------------------------------- connectivity " <<  nbPoints << endl;
        vtkCellLinks *links = myGrid->GetCellLinks();
  for (int i=0; i<nbPoints; i++)
  {
        int ncells = links->GetNcells(i);
        vtkIdType *cells = links->GetCells(i);
        ficcon << i << " - " << ncells << " -";
        for (int j=0; j<ncells; j++)
        {
                ficcon << " " << cells[j];
        }
        ficcon << endl;
  }
  ficcon.close();

}
void SMDS_Mesh::DumpNodes ( ) const

Definition at line 2209 of file SMDS_Mesh.cxx.

References MESSAGE, and nodesIterator().

{
        MESSAGE("dump nodes of mesh : ");
        SMDS_NodeIteratorPtr itnode=nodesIterator();
        while(itnode->more()) ; //MESSAGE(itnode->next());
}
void SMDS_Mesh::DumpVolumes ( ) const

Definition at line 2256 of file SMDS_Mesh.cxx.

References MESSAGE, and volumesIterator().

{
        MESSAGE("dump volumes of mesh : ");
        SMDS_VolumeIteratorPtr itvol=volumesIterator();
        while(itvol->more()) ; //MESSAGE(itvol->next());
}
SMDS_EdgeIteratorPtr SMDS_Mesh::edgesIterator ( bool  idInceasingOrder = false) const

Return an iterator on edges of the current mesh.

Definition at line 2740 of file SMDS_Mesh.cxx.

References myCells, and SMDSAbs_Edge.

Referenced by SMESH_MEDMesh_i.calculeNbElts(), Contains(), SMESH_MeshEditor.ConvertToQuadratic(), DumpEdges(), SMESH.Controls.Filter.GetElementsId(), SMESH.Filter_i.GetMeshInfo(), DriverMED_W_SMESHDS_Mesh.Perform(), SMESH.Controls.ElementsOnShape.process(), and SMESH.Controls.ElementsOnSurface.process().

{
  typedef MYElem_Map_Iterator
    < SetOfCells, const SMDS_MeshEdge*, SMDS_EdgeIterator > TIterator;
  return SMDS_EdgeIteratorPtr(new TIterator(myCells, SMDSAbs_Edge)); // naturally always sorted by ID

//  typedef MYNCollection_Map_Iterator
//    < SetOfEdges, const SMDS_MeshEdge*, SMDS_EdgeIterator > TIterator;
//  typedef IdSortedIterator< const SMDS_MeshEdge* >          TSortedIterator;
//  return ( idInceasingOrder ?
//           SMDS_EdgeIteratorPtr( new TSortedIterator( *myElementIDFactory,
//                                                      SMDSAbs_Edge,
//                                                      NbEdges() )) :
//           SMDS_EdgeIteratorPtr(new TIterator(myEdges)));
}
SMDS_0DElementIteratorPtr SMDS_Mesh::elements0dIterator ( bool  idInceasingOrder = false) const

Return an iterator on 0D elements of the current mesh.

Definition at line 2720 of file SMDS_Mesh.cxx.

References myCells, and SMDSAbs_0DElement.

Referenced by Contains(), Dump0DElements(), and DriverMED_W_SMESHDS_Mesh.Perform().

{
  typedef MYElem_Map_Iterator
    < SetOfCells, const SMDS_Mesh0DElement*, SMDS_0DElementIterator > TIterator;
  return SMDS_0DElementIteratorPtr(new TIterator(myCells, SMDSAbs_0DElement)); // naturally always sorted by ID

//  typedef MYNCollection_Map_Iterator
//    < SetOf0DElements, const SMDS_Mesh0DElement*, SMDS_0DElementIterator > TIterator;
//  typedef IdSortedIterator< const SMDS_Mesh0DElement* >                    TSortedIterator;
//  return ( idInceasingOrder ?
//           SMDS_0DElementIteratorPtr( new TSortedIterator( *myElementIDFactory,
//                                                           SMDSAbs_0DElement,
//                                                           Nb0DElements() )) :
//           SMDS_0DElementIteratorPtr( new TIterator(my0DElements)));
}
SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator ( SMDSAbs_ElementType  type = SMDSAbs_All) const

Return an iterator on elements of the current mesh factory.

Definition at line 2799 of file SMDS_Mesh.cxx.

References SMDS_MeshElementIDFactory.elementsIterator(), myCells, myElementIDFactory, myNodes, SMDSAbs_0DElement, SMDSAbs_All, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Node, and SMDSAbs_Volume.

Referenced by Clear(), SMESH_Gen_i.ConcatenateCommon(), SMESH_Gen_i.CopyMesh(), SMDS_MeshNodeIDFactory.elementsIterator(), SMDS_MeshElementIDFactory.elementsIterator(), SMESH_Mesh_i.GetElementsByType(), SMESH_Mesh_i.GetElementsId(), SMESH_ProxyMesh.GetFaces(), DriverSTL_W_SMDS_Mesh.getFaces(), SMESH.Filter_i.GetMeshInfo(), SMESH_ElementSearcherImpl.getTolerance(), StdMeshers_Import_1D.importMesh(), SMESH_Gen_i.Load(), SMESH_Gen_i.Save(), SMESH_MeshEditor_i.storeResult(), SMESH_MeshEditor.Transform(), and ~SMDS_Mesh().

{
  switch (type) {
  case SMDSAbs_All:
    return SMDS_ElemIteratorPtr (new MYElem_Map_Iterator< SetOfCells >(myCells, SMDSAbs_All));
    break;
  case SMDSAbs_Volume:
    return SMDS_ElemIteratorPtr (new MYElem_Map_Iterator< SetOfCells >(myCells, SMDSAbs_Volume));
  case SMDSAbs_Face:
    return SMDS_ElemIteratorPtr (new MYElem_Map_Iterator< SetOfCells >(myCells, SMDSAbs_Face));
  case SMDSAbs_Edge:
    return SMDS_ElemIteratorPtr (new MYElem_Map_Iterator< SetOfCells >(myCells, SMDSAbs_Edge));
  case SMDSAbs_0DElement:
    return SMDS_ElemIteratorPtr (new MYElem_Map_Iterator< SetOfCells >(myCells, SMDSAbs_0DElement));
  case SMDSAbs_Node:
    return SMDS_ElemIteratorPtr (new MYElem_Map_Iterator< SetOfNodes >(myNodes, SMDSAbs_All));
    //return myNodeIDFactory->elementsIterator();
  default:;
  }
  return myElementIDFactory->elementsIterator();
}
SMDS_FaceIteratorPtr SMDS_Mesh::facesIterator ( bool  idInceasingOrder = false) const

Return an iterator on faces of the current mesh.

Definition at line 2760 of file SMDS_Mesh.cxx.

References myCells, and SMDSAbs_Face.

Referenced by SMESH_MEDMesh_i.calculeNbElts(), StdMeshers_QuadToTriaAdaptor.Compute(), Contains(), SMESH_MeshEditor.ConvertToQuadratic(), DebugStats(), DumpFaces(), SMESH.Controls.FreeEdges.GetBoreders(), SMESH.Controls.Filter.GetElementsId(), SMESH.Filter_i.GetMeshInfo(), SMESH.Controls.MultiConnection2D.GetValues(), SMESH.Controls.Length2D.GetValues(), isMeshBoundToShape(), SMESH_MesherHelper.IsQuadraticSubMesh(), DriverMED_W_SMESHDS_Mesh.Perform(), SMESH.Controls.ElementsOnShape.process(), SMESH.Controls.ElementsOnSurface.process(), SMESH.Controls.ManifoldPart.process(), and DriverSTL_W_SMDS_Mesh.writeBinary().

{
  typedef MYElem_Map_Iterator
    < SetOfCells, const SMDS_MeshFace*, SMDS_FaceIterator > TIterator;
  return SMDS_FaceIteratorPtr(new TIterator(myCells, SMDSAbs_Face)); // naturally always sorted by ID

//  typedef MYNCollection_Map_Iterator
//    < SetOfFaces, const SMDS_MeshFace*, SMDS_FaceIterator > TIterator;
//  typedef IdSortedIterator< const SMDS_MeshFace* >          TSortedIterator;
//  return ( idInceasingOrder ?
//           SMDS_FaceIteratorPtr( new TSortedIterator( *myElementIDFactory,
//                                                      SMDSAbs_Face,
//                                                      NbFaces() )) :
//           SMDS_FaceIteratorPtr(new TIterator(myFaces)));
}
const SMDS_Mesh0DElement * SMDS_Mesh::Find0DElement ( int  idnode) const

Definition at line 1746 of file SMDS_Mesh.cxx.

References FindNode(), and ex29_refine.node().

{
  const SMDS_MeshNode * node = FindNode(idnode);
  if(node == NULL) return NULL;
  return Find0DElement(node);
}
const SMDS_Mesh0DElement * SMDS_Mesh::Find0DElement ( const SMDS_MeshNode n) [static]

Definition at line 1753 of file SMDS_Mesh.cxx.

References SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.NbNodes(), and SMDSAbs_0DElement.

{
  if (!node) return 0;
  const SMDS_Mesh0DElement* toReturn = NULL;
  SMDS_ElemIteratorPtr it1 = node->GetInverseElementIterator(SMDSAbs_0DElement);
  while (it1->more() && (toReturn == NULL)) {
    const SMDS_MeshElement* e = it1->next();
    if (e->NbNodes() == 1) {
      toReturn = static_cast<const SMDS_Mesh0DElement*>(e);
    }
  }
  return toReturn;
}
const SMDS_MeshEdge * SMDS_Mesh::FindEdge ( int  idnode1,
int  idnode2 
) const

Definition at line 1791 of file SMDS_Mesh.cxx.

References FindNode().

Referenced by _MyEdgeIterator._MyEdgeIterator(), FindEdge(), FindEdgeOrCreate(), and SMDS_VolumeTool.GetAllExistingEdges().

{
  const SMDS_MeshNode * node1=FindNode(idnode1);
  const SMDS_MeshNode * node2=FindNode(idnode2);
  if((node1==NULL)||(node2==NULL)) return NULL;
  return FindEdge(node1,node2);
}
const SMDS_MeshEdge * SMDS_Mesh::FindEdge ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2 
) [static]

Definition at line 1800 of file SMDS_Mesh.cxx.

References SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.GetNodeIndex(), SMDS_MeshElement.NbNodes(), and SMDSAbs_Edge.

{
  if ( !node1 ) return 0;
  const SMDS_MeshEdge * toReturn=NULL;
  //PROFILER_Init();
  //PROFILER_Set();
  SMDS_ElemIteratorPtr it1=node1->GetInverseElementIterator(SMDSAbs_Edge);
  //PROFILER_Get(0);
  //PROFILER_Set();
  while(it1->more()) {
    const SMDS_MeshElement * e = it1->next();
    if ( e->NbNodes() == 2 && e->GetNodeIndex( node2 ) >= 0 ) {
      toReturn = static_cast<const SMDS_MeshEdge*>( e );
      break;
    }
  }
  //PROFILER_Get(1);
  return toReturn;
}
const SMDS_MeshEdge * SMDS_Mesh::FindEdge ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3 
) [static]

Definition at line 1872 of file SMDS_Mesh.cxx.

References SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.NbNodes(), SMDS_MeshElement.nodesIterator(), and SMDSAbs_Edge.

{
  if ( !node1 ) return 0;
  SMDS_ElemIteratorPtr it1 = node1->GetInverseElementIterator(SMDSAbs_Edge);
  while(it1->more()) {
    const SMDS_MeshElement * e = it1->next();
    if ( e->NbNodes() == 3 ) {
      SMDS_ElemIteratorPtr it2 = e->nodesIterator();
      while(it2->more()) {
        const SMDS_MeshElement* n = it2->next();
        if( n!=node1 &&
            n!=node2 &&
            n!=node3 )
        {
          e = 0;
          break;
        }
      }
      if ( e )
        return static_cast<const SMDS_MeshEdge *> (e);
    }
  }
  return 0;
}
const SMDS_MeshEdge * SMDS_Mesh::FindEdge ( int  idnode1,
int  idnode2,
int  idnode3 
) const

Definition at line 1863 of file SMDS_Mesh.cxx.

References FindEdge(), and FindNode().

{
  const SMDS_MeshNode * node1=FindNode(idnode1);
  const SMDS_MeshNode * node2=FindNode(idnode2);
  const SMDS_MeshNode * node3=FindNode(idnode3);
  return FindEdge(node1,node2,node3);
}
SMDS_MeshEdge * SMDS_Mesh::FindEdgeOrCreate ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2 
) [protected]

Definition at line 1827 of file SMDS_Mesh.cxx.

References adjustmyCellsCapacity(), CheckMemory(), CHECKMEMORY_INTERVAL, ObjectPool< X >.destroy(), FindEdge(), SMDS_MeshElementIDFactory.GetFreeID(), ObjectPool< X >.getNew(), SMDS_MeshElement.getVtkId(), SMDS_VtkEdge.init(), myCells, myEdgePool, myElementIDFactory, myGrid, myInfo, SMDS_MeshInfo.myNbEdges, NbEdges(), and registerElement().

Referenced by createQuadrangle(), and createTriangle().

{
  if ( !node1 || !node2) return 0;
  SMDS_MeshEdge * toReturn=NULL;
  toReturn=const_cast<SMDS_MeshEdge*>(FindEdge(node1,node2));
  if(toReturn==NULL) {
    if ( NbEdges() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
    int ID = myElementIDFactory->GetFreeID(); // -PR- voir si on range cet element
    adjustmyCellsCapacity(ID);
    vector<vtkIdType> nodeIds;
    nodeIds.clear();
    nodeIds.push_back(node1->getVtkId());
    nodeIds.push_back(node2->getVtkId());

    SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
    edgevtk->init(nodeIds, this);
    if (!this->registerElement(ID,edgevtk))
      {
        this->myGrid->GetCellTypesArray()->SetValue(edgevtk->getVtkId(), VTK_EMPTY_CELL);
        myEdgePool->destroy(edgevtk);
        return 0;
      }
    toReturn = edgevtk;
    myCells[ID] = toReturn;
    myInfo.myNbEdges++;
  }
  return toReturn;
}
const SMDS_MeshElement * SMDS_Mesh::FindElement ( const std::vector< const SMDS_MeshNode * > &  nodes,
const SMDSAbs_ElementType  type = SMDSAbs_All,
const bool  noMedium = true 
) [static]

Return element based on all given nodes.

Parameters:
nodes- node of element
type- type of element
noMedium- true if medium nodes of quadratic element are not included in <nodes>
Return values:
constSMDS_MeshElement* - found element or NULL

Definition at line 2177 of file SMDS_Mesh.cxx.

References SMDS_MeshElement.GetNodeIndex(), SMDS_MeshElement.NbCornerNodes(), and SMDS_MeshElement.NbNodes().

{
  if ( nodes.size() > 0 && nodes[0] )
  {
    SMDS_ElemIteratorPtr itF = nodes[0]->GetInverseElementIterator(type);
    while (itF->more())
    {
      const SMDS_MeshElement* e = itF->next();
      int nbNodesToCheck = noMedium ? e->NbCornerNodes() : e->NbNodes();
      if ( nbNodesToCheck == nodes.size() )
      {
        for ( int i = 1; e && i < nodes.size(); ++ i )
        {
          int nodeIndex = e->GetNodeIndex( nodes[ i ]);
          if ( nodeIndex < 0 || nodeIndex >= nbNodesToCheck )
            e = 0;
        }
        if ( e )
          return static_cast<const SMDS_MeshFace *> (e);
      }
    }
  }
  return NULL;
}
const SMDS_MeshElement * SMDS_Mesh::FindElement ( int  IDelem) const

Definition at line 2130 of file SMDS_Mesh.cxx.

References MESSAGE, and myCells.

Referenced by SMESH_Mesh_i.BaryCenter(), SMESHGUI_CreatePolyhedralVolumeDlg.checkEditLine(), SMESH_Gen_i.CopyMesh(), SMESH_Mesh_i.CreateDimGroup(), SMESHGUI_CuttingOfQuadsDlg.displayPreview(), SMESHGUI_CreatePolyhedralVolumeDlg.displaySimulation(), SMESH_MeshEditor.DoubleNodes(), SMESH_MeshEditor.DoubleNodesOnGroupBoundaries(), SMESH_Mesh_i.ElemNbEdges(), SMESH_Mesh_i.ElemNbFaces(), enlargeBoundingBox(), SMESH_MeshEditor_i.FindEqualElements(), FindFace(), SMESH_Gen_i.FindGeometryByMeshElement(), SMESHGUI_MergeDlg.FindGravityCenter(), SMESHDS_GroupBase.findInMesh(), DriverSTL_W_SMDS_Mesh.findVolumeTriangles(), SMESH_VisualObjDef.GetEdgeNodes(), SMESH_Mesh_i.GetElemNbNodes(), SMESH_Mesh_i.GetElemNode(), getNodesFromElems(), getPointers(), SMESH.Controls.NumericalFunctor.GetPoints(), SMESHGUI_ExtrusionAlongPathDlg.getSelectedElements(), SMESH_Mesh_i.GetShapeIDForElem(), SMESH.Controls.MultiConnection2D.GetValue(), SMESH.Controls.Length2D.GetValue(), SMESH.Controls.AspectRatio3D.GetValue(), SMESH.Controls.MaxElementLength3D.GetValue(), SMESH.Controls.MaxElementLength2D.GetValue(), SMESH.Controls.Volume.GetValue(), SMESH.Controls.NumericalFunctor.GetValue(), StdMeshers_Import_1D.importMesh(), SMESH_Mesh_i.IsMediumNode(), SMESHGUI_VolumesFilter.IsObjValid(), SMESHGUI_FacesFilter.IsObjValid(), SMESHGUI_TriangleFilter.IsObjValid(), SMESHGUI_QuadrangleFilter.IsObjValid(), SMESHGUI_PredicateFilter.IsObjValid(), SMESH_Mesh_i.IsPoly(), SMESH_Mesh_i.IsQuadratic(), SMESH.Controls.RangeOfIds.IsSatisfy(), SMESH.Controls.CoplanarFaces.IsSatisfy(), SMESH.Controls.ElemGeomType.IsSatisfy(), SMESH.Controls.LinearOrQuadratic.IsSatisfy(), SMESH.Controls.FreeFaces.IsSatisfy(), SMESH.Controls.FreeEdges.IsSatisfy(), SMESH.Controls.OverConstrainedFace.IsSatisfy(), SMESH.Controls.OverConstrainedVolume.IsSatisfy(), SMESH.Controls.BareBorderFace.IsSatisfy(), SMESH.Controls.BareBorderVolume.IsSatisfy(), SMESH.Controls.BadOrientedVolume.IsSatisfy(), SMESHGUI_VolumesFilter.IsValid(), SMESHGUI_FacesFilter.IsValid(), SMESHGUI_TriangleFilter.IsValid(), SMESHGUI_QuadrangleFilter.IsValid(), SMESHGUI_PredicateFilter.IsValid(), SMESH_MeshEditor.MergeElements(), SMDS_MeshElementIDFactory.MeshElement(), SMDS_MeshNode.NbInverseElements(), SMDS_MeshNode_MyInvIterator.next(), SMESHGUI_WhatIsDlg.onTextChange(), SMESHGUI_TranslationDlg.onTextChange(), SMESHGUI_SymmetryDlg.onTextChange(), SMESHGUI_SmoothingDlg.onTextChange(), SMESHGUI_SewingDlg.onTextChange(), SMESHGUI_ScaleDlg.onTextChange(), SMESHGUI_RotationDlg.onTextChange(), SMESHGUI_RevolutionDlg.onTextChange(), SMESHGUI_ExtrusionDlg.onTextChange(), SMESHGUI_ExtrusionAlongPathDlg.onTextChange(), SMESHGUI_CreatePolyhedralVolumeDlg.onTextChange(), SMESHGUI_CopyMeshDlg.onTextChange(), SMESHGUI_MeshPatternDlg.onTextChanged(), SMESH.Controls.ManifoldPart.process(), SMESH.SMESH_Group.Remove(), SMESHGUI_RevolutionDlg.SelectionIntoArgument(), SMESHGUI_ExtrusionDlg.SelectionIntoArgument(), SMESH_MeshEditor_i.SetMeshElementOnShape(), SMDS_MeshNode_MyInvIterator.SMDS_MeshNode_MyInvIterator(), and SMDS_MeshNode_MyIterator.SMDS_MeshNode_MyIterator().

{
  if ((IDelem <= 0) || IDelem >= myCells.size())
  {
    MESSAGE("--------------------------------------------------------------------------------- ");
    MESSAGE("----------------------------------- bad IDelem " << IDelem << " " << myCells.size());
    MESSAGE("--------------------------------------------------------------------------------- ");
    // TODO raise an exception
    //assert(0);
    return 0;
  }
  return myCells[IDelem];
}
const SMDS_MeshFace * SMDS_Mesh::FindFace ( const std::vector< const SMDS_MeshNode * > &  nodes) [static]

Definition at line 2161 of file SMDS_Mesh.cxx.

References FindElement(), and SMDSAbs_Face.

{
  return (const SMDS_MeshFace*) FindElement( nodes, SMDSAbs_Face );
}
const SMDS_MeshFace * SMDS_Mesh::FindFace ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6,
const SMDS_MeshNode n7,
const SMDS_MeshNode n8 
) [static]

Definition at line 2087 of file SMDS_Mesh.cxx.

References SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.NbNodes(), SMDS_MeshElement.nodesIterator(), and SMDSAbs_Face.

{
  if ( !node1 ) return 0;
  SMDS_ElemIteratorPtr it1 = node1->GetInverseElementIterator(SMDSAbs_Face);
  while(it1->more()) {
    const SMDS_MeshElement * e = it1->next();
    if ( e->NbNodes() == 8 ) {
      SMDS_ElemIteratorPtr it2 = e->nodesIterator();
      while(it2->more()) {
        const SMDS_MeshElement* n = it2->next();
        if( n!=node1 &&
            n!=node2 &&
            n!=node3 &&
            n!=node4 &&
            n!=node5 &&
            n!=node6 &&
            n!=node7 &&
            n!=node8 )
        {
          e = 0;
          break;
        }
      }
      if ( e )
        return static_cast<const SMDS_MeshFace *> (e);
    }
  }
  return 0;
}
const SMDS_MeshFace * SMDS_Mesh::FindFace ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4 
) [static]

Definition at line 1970 of file SMDS_Mesh.cxx.

References SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.NbNodes(), SMDS_MeshElement.nodesIterator(), and SMDSAbs_Face.

{
  if ( !node1 ) return 0;
  SMDS_ElemIteratorPtr it1 = node1->GetInverseElementIterator(SMDSAbs_Face);
  while(it1->more()) {
    const SMDS_MeshElement * e = it1->next();
    if ( e->NbNodes() == 4 ) {
      SMDS_ElemIteratorPtr it2 = e->nodesIterator();
      while(it2->more()) {
        const SMDS_MeshElement* n = it2->next();
        if( n!=node1 &&
            n!=node2 &&
            n!=node3 &&
            n!=node4 )
        {
          e = 0;
          break;
        }
      }
      if ( e )
        return static_cast<const SMDS_MeshFace *> (e);
    }
  }
  return 0;
}
const SMDS_MeshFace * SMDS_Mesh::FindFace ( int  idnode1,
int  idnode2,
int  idnode3 
) const

Definition at line 1905 of file SMDS_Mesh.cxx.

References FindNode().

Referenced by FindFace(), FindFaceOrCreate(), SMESH_MesherHelper.FixQuadraticElements(), SMDS_VolumeTool.GetAllExistingFaces(), and SMESH.SMESH_MeshEditor.Make2DMeshFrom3D().

{
  const SMDS_MeshNode * node1=FindNode(idnode1);
  const SMDS_MeshNode * node2=FindNode(idnode2);
  const SMDS_MeshNode * node3=FindNode(idnode3);
  return FindFace(node1, node2, node3);
}
const SMDS_MeshFace * SMDS_Mesh::FindFace ( int  idnode1,
int  idnode2,
int  idnode3,
int  idnode4 
) const

Definition at line 1960 of file SMDS_Mesh.cxx.

References FindFace(), and FindNode().

{
  const SMDS_MeshNode * node1=FindNode(idnode1);
  const SMDS_MeshNode * node2=FindNode(idnode2);
  const SMDS_MeshNode * node3=FindNode(idnode3);
  const SMDS_MeshNode * node4=FindNode(idnode4);
  return FindFace(node1, node2, node3, node4);
}
const SMDS_MeshFace * SMDS_Mesh::FindFace ( int  idnode1,
int  idnode2,
int  idnode3,
int  idnode4,
int  idnode5,
int  idnode6 
) const

Definition at line 2019 of file SMDS_Mesh.cxx.

References FindFace(), and FindNode().

{
  const SMDS_MeshNode * node1 = FindNode(idnode1);
  const SMDS_MeshNode * node2 = FindNode(idnode2);
  const SMDS_MeshNode * node3 = FindNode(idnode3);
  const SMDS_MeshNode * node4 = FindNode(idnode4);
  const SMDS_MeshNode * node5 = FindNode(idnode5);
  const SMDS_MeshNode * node6 = FindNode(idnode6);
  return FindFace(node1, node2, node3, node4, node5, node6);
}
const SMDS_MeshFace * SMDS_Mesh::FindFace ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3 
) [static]

Definition at line 1914 of file SMDS_Mesh.cxx.

References SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.NbNodes(), SMDS_MeshElement.nodesIterator(), and SMDSAbs_Face.

{
  if ( !node1 ) return 0;
  SMDS_ElemIteratorPtr it1 = node1->GetInverseElementIterator(SMDSAbs_Face);
  while(it1->more()) {
    const SMDS_MeshElement * e = it1->next();
    if ( e->NbNodes() == 3 ) {
      SMDS_ElemIteratorPtr it2 = e->nodesIterator();
      while(it2->more()) {
        const SMDS_MeshElement* n = it2->next();
        if( n!=node1 &&
            n!=node2 &&
            n!=node3 )
        {
          e = 0;
          break;
        }
      }
      if ( e )
        return static_cast<const SMDS_MeshFace *> (e);
    }
  }
  return 0;
}
const SMDS_MeshFace * SMDS_Mesh::FindFace ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6 
) [static]

Definition at line 2032 of file SMDS_Mesh.cxx.

References SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.NbNodes(), SMDS_MeshElement.nodesIterator(), and SMDSAbs_Face.

{
  if ( !node1 ) return 0;
  SMDS_ElemIteratorPtr it1 = node1->GetInverseElementIterator(SMDSAbs_Face);
  while(it1->more()) {
    const SMDS_MeshElement * e = it1->next();
    if ( e->NbNodes() == 6 ) {
      SMDS_ElemIteratorPtr it2 = e->nodesIterator();
      while(it2->more()) {
        const SMDS_MeshElement* n = it2->next();
        if( n!=node1 &&
            n!=node2 &&
            n!=node3 &&
            n!=node4 &&
            n!=node5 &&
            n!=node6 )
        {
          e = 0;
          break;
        }
      }
      if ( e )
        return static_cast<const SMDS_MeshFace *> (e);
    }
  }
  return 0;
}
const SMDS_MeshFace * SMDS_Mesh::FindFace ( const std::vector< int > &  nodes_ids) const

Definition at line 2149 of file SMDS_Mesh.cxx.

References FindFace(), FindNode(), and ex29_refine.node().

{
  int nbnodes = nodes_ids.size();
  vector<const SMDS_MeshNode *> poly_nodes (nbnodes);
  for (int inode = 0; inode < nbnodes; inode++) {
    const SMDS_MeshNode * node = FindNode(nodes_ids[inode]);
    if (node == NULL) return NULL;
    poly_nodes[inode] = node;
  }
  return FindFace(poly_nodes);
}
const SMDS_MeshFace * SMDS_Mesh::FindFace ( int  idnode1,
int  idnode2,
int  idnode3,
int  idnode4,
int  idnode5,
int  idnode6,
int  idnode7,
int  idnode8 
) const

Definition at line 2071 of file SMDS_Mesh.cxx.

References FindFace(), and FindNode().

{
  const SMDS_MeshNode * node1 = FindNode(idnode1);
  const SMDS_MeshNode * node2 = FindNode(idnode2);
  const SMDS_MeshNode * node3 = FindNode(idnode3);
  const SMDS_MeshNode * node4 = FindNode(idnode4);
  const SMDS_MeshNode * node5 = FindNode(idnode5);
  const SMDS_MeshNode * node6 = FindNode(idnode6);
  const SMDS_MeshNode * node7 = FindNode(idnode7);
  const SMDS_MeshNode * node8 = FindNode(idnode8);
  return FindFace(node1, node2, node3, node4, node5, node6, node7, node8);
}
SMDS_MeshFace * SMDS_Mesh::FindFaceOrCreate ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4 
) [protected]

Definition at line 1999 of file SMDS_Mesh.cxx.

References createQuadrangle(), FindFace(), SMDS_MeshElementIDFactory.GetFreeID(), and myElementIDFactory.

{
  SMDS_MeshFace * toReturn=NULL;
  toReturn=const_cast<SMDS_MeshFace*>(FindFace(node1,node2,node3,node4));
  if(toReturn==NULL) {
    int ID = myElementIDFactory->GetFreeID();
    toReturn=createQuadrangle(node1,node2,node3,node4,ID);
  }
  return toReturn;
}
SMDS_MeshFace * SMDS_Mesh::FindFaceOrCreate ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3 
) [protected]

Definition at line 1941 of file SMDS_Mesh.cxx.

References createTriangle(), FindFace(), SMDS_MeshElementIDFactory.GetFreeID(), and myElementIDFactory.

Referenced by AddVolumeWithID().

{
  SMDS_MeshFace * toReturn=NULL;
  toReturn = const_cast<SMDS_MeshFace*>(FindFace(node1,node2,node3));
  if(toReturn==NULL) {
    int ID = myElementIDFactory->GetFreeID();
    toReturn = createTriangle(node1,node2,node3, ID);
  }
  return toReturn;
}
const SMDS_MeshNode * SMDS_Mesh::FindNode ( int  idnode) const

Return the node whose SMDS ID is 'ID'.

Definition at line 1413 of file SMDS_Mesh.cxx.

References MESSAGE, and myNodes.

Referenced by SMESHGUI_CreatePolyhedralVolumeDlg.checkEditLine(), SMESH_Gen_i.ConcatenateCommon(), SMESH_Gen_i.CopyMesh(), SMESH_Mesh_i.CreateDimGroup(), SMESHGUI_CreatePolyhedralVolumeDlg.displaySimulation(), SMESH_MeshEditor.DoubleNodes(), enlargeBoundingBox(), Find0DElement(), FindEdge(), FindFace(), SMESHDS_GroupBase.findInMesh(), FindNode(), SMESH_Mesh_i.GetNodeInverseElements(), SMESH_Mesh_i.GetNodePosition(), SMESH_Mesh_i.GetNodeXYZ(), getPointers(), SMESH_Mesh_i.GetShapeID(), SMESH_Mesh_i.IsMediumNode(), SMESH_Mesh_i.IsMediumNodeOfAnyElem(), SMESHGUI_PredicateFilter.IsObjValid(), SMESH.Controls.RangeOfIds.IsSatisfy(), SMESH.Controls.FreeNodes.IsSatisfy(), SMESHGUI_PredicateFilter.IsValid(), SMESHGUI_AddQuadraticElementDlg.IsValid(), SMESH_Gen_i.Load(), SMESH_MeshEditor_i.MergeNodes(), SMDS_MeshNodeIDFactory.MeshElement(), SMESH.Measurements_i.MinDistance(), SMESHGUI_WhatIsDlg.onTextChange(), SMESHGUI_SmoothingDlg.onTextChange(), SMESHGUI_SewingDlg.onTextChange(), SMESHGUI_ExtrusionAlongPathDlg.onTextChange(), SMESHGUI_CreatePolyhedralVolumeDlg.onTextChange(), SMESHGUI_AddQuadraticElementDlg.onTextChange(), SMESHGUI_AddMeshElementDlg.onTextChange(), SMESHGUI_SelectionOp.onTextChanged(), SMESH.SMESH_Group.Remove(), SMESHGUI_TranslationDlg.SelectionIntoArgument(), SMESHGUI_SymmetryDlg.SelectionIntoArgument(), SMESHGUI_ScaleDlg.SelectionIntoArgument(), SMESHGUI_RotationDlg.SelectionIntoArgument(), SMESHGUI_RevolutionDlg.SelectionIntoArgument(), SMESHGUI_ExtrusionAlongPathDlg.SelectionIntoArgument(), SMESH_MeshEditor_i.SetNodeInVolume(), SMESH_MeshEditor_i.SetNodeOnEdge(), SMESH_MeshEditor_i.SetNodeOnFace(), SMESH_MeshEditor_i.SetNodeOnVertex(), SMESH.TIdPreview.SetPointsData(), SMESH_MeshEditor_i.SewBorderToSide(), SMESH_MeshEditor_i.SewConformFreeBorders(), SMESH_MeshEditor_i.SewFreeBorders(), SMESH_MeshEditor_i.SewSideElements(), and SMESH_MeshEditor_i.smooth().

{
  if (ID < 1 || ID >= myNodes.size())
  {
    MESSAGE("------------------------------------------------------------------------- ");
    MESSAGE("----------------------------------- bad ID " << ID << " " << myNodes.size());
    MESSAGE("------------------------------------------------------------------------- ");
    return 0;
  }
  return (const SMDS_MeshNode *)myNodes[ID];
}
const SMDS_MeshNode * SMDS_Mesh::FindNodeVtk ( int  idnode) const

Return the node whose VTK ID is 'vtkId'.

Definition at line 1428 of file SMDS_Mesh.cxx.

References MESSAGE, and myNodes.

Referenced by SMDS_VtkVolume.GetFaceNode(), and SMDS_VtkCellIterator.next().

{
  // TODO if needed use mesh->nodeIdFromVtkToSmds
  if (vtkId < 0 || vtkId >= (myNodes.size() -1))
  {
    MESSAGE("------------------------------------------------------------------------- ");
    MESSAGE("---------------------------- bad VTK ID " << vtkId << " " << myNodes.size());
    MESSAGE("------------------------------------------------------------------------- ");
    return 0;
  }
  return (const SMDS_MeshNode *)myNodes[vtkId+1];
}
int SMDS_Mesh::fromVtkToSmds ( int  vtkid)
SMDSAbs_ElementType SMDS_Mesh::GetElementType ( const int  id,
const bool  iselem 
) const

Definition at line 3331 of file SMDS_Mesh.cxx.

References SMDS_MeshElement.GetType(), SMDS_MeshNodeIDFactory.MeshElement(), SMDS_MeshElementIDFactory.MeshElement(), myElementIDFactory, myNodeIDFactory, and SMDSAbs_All.

Referenced by SMESHGUI_CreatePolyhedralVolumeDlg.checkEditLine(), and SMESHGUI_CreatePolyhedralVolumeDlg.displaySimulation().

{
  SMDS_MeshElement* elem = 0;
  if( iselem )
    elem = myElementIDFactory->MeshElement( id );
  else
    elem = myNodeIDFactory->MeshElement( id );

  if( !elem )
  {
    //throw SALOME_Exception(LOCALIZED ("this element isn't exist"));
    return SMDSAbs_All;
  }
  else
    return elem->GetType();
}
SMDS_UnstructuredGrid* SMDS_Mesh.getGrid ( )
double SMDS_Mesh::getMaxDim ( )

Definition at line 4218 of file SMDS_Mesh.cxx.

References MESSAGE, xmax, xmin, ymax, ymin, zmax, and zmin.

{
  double dmax = 1.e-3;
  if ((xmax - xmin) > dmax) dmax = xmax -xmin;
  if ((ymax - ymin) > dmax) dmax = ymax -ymin;
  if ((zmax - zmin) > dmax) dmax = zmax -zmin;
  MESSAGE("getMaxDim " << dmax);
  return dmax;
}
int SMDS_Mesh.getMeshId ( )
const SMDS_MeshInfo& SMDS_Mesh.GetMeshInfo ( ) const
unsigned long SMDS_Mesh::GetMTime ( )

get last modification timeStamp

Definition at line 4240 of file SMDS_Mesh.cxx.

References myModifTime.

{
  return this->myModifTime;
}
bool SMDS_Mesh::hasConstructionEdges ( )

Return true if this mesh create faces with edges.

A false returned value mean that faces are created with nodes. A concequence is, iteration on edges (SMDS_Element.edgesIterator) will be unavailable.

Definition at line 2528 of file SMDS_Mesh.cxx.

References myHasConstructionEdges.

Referenced by addChildrenWithNodes(), AddFace(), AddFaceWithID(), AddVolumeWithID(), createQuadrangle(), createTriangle(), DriverMED_W_SMESHDS_Mesh.Perform(), SMESHDS_Mesh.RemoveElement(), RemoveElement(), SMESHDS_Mesh.RemoveFreeElement(), RemoveFreeElement(), and SMESHDS_Mesh.RemoveNode().

bool SMDS_Mesh::hasConstructionFaces ( )

Return true if this mesh create volumes with faces A false returned value mean that volumes are created with nodes or edges.

(see hasConstructionEdges) A concequence is, iteration on faces (SMDS_Element.facesIterator) will be unavailable.

Definition at line 2540 of file SMDS_Mesh.cxx.

References myHasConstructionFaces.

Referenced by addChildrenWithNodes(), AddVolume(), AddVolumeWithID(), DriverMED_W_SMESHDS_Mesh.Perform(), SMESHDS_Mesh.RemoveElement(), RemoveElement(), SMESHDS_Mesh.RemoveFreeElement(), RemoveFreeElement(), and SMESHDS_Mesh.RemoveNode().

bool SMDS_Mesh::hasInverseElements ( )

Return true if nodes are linked to the finit elements, they are belonging to.

Currently, It always return true.

Definition at line 2549 of file SMDS_Mesh.cxx.

References myHasInverseElements.

void SMDS_Mesh::incrementCellsCapacity ( int  nbCells)

Definition at line 4117 of file SMDS_Mesh.cxx.

References MESSAGE, myCellIdVtkToSmds, myCells, and myNodes.

{
  int val = myCellIdVtkToSmds.size();
  MESSAGE(" ------------------- resize myCellIdVtkToSmds " << val << " --> " << val + nbCells);
  myCellIdVtkToSmds.resize(val + nbCells, -1); // fill new elements with -1
  val = myCells.size();
  MESSAGE(" ------------------- resize myCells " << val << " --> " << val + nbCells);
  myNodes.resize(val +nbCells, 0);
}
void SMDS_Mesh::incrementNodesCapacity ( int  nbNodes)

Definition at line 4107 of file SMDS_Mesh.cxx.

References MESSAGE, and myNodes.

{
//  int val = myCellIdSmdsToVtk.size();
//  MESSAGE(" ------------------- resize myCellIdSmdsToVtk " << val << " --> " << val + nbNodes);
//  myCellIdSmdsToVtk.resize(val + nbNodes, -1); // fill new elements with -1
  int val = myNodes.size();
  MESSAGE(" ------------------- resize myNodes " << val << " --> " << val + nbNodes);
  myNodes.resize(val +nbNodes, 0);
}
bool SMDS_Mesh::isCompacted ( )

Definition at line 4245 of file SMDS_Mesh.cxx.

References MESSAGE, myCompactTime, and myModifTime.

Referenced by SMESHDS_Mesh.Renumber().

{
  if (this->myModifTime > this->myCompactTime)
    {
      MESSAGE(" *** isCompacted " << myCompactTime << " < " << myModifTime);
      this->myCompactTime = this->myModifTime;
      return false;
    }
  return true;
}
int SMDS_Mesh::MaxElementID ( ) const

Definition at line 3271 of file SMDS_Mesh.cxx.

References SMDS_MeshNodeIDFactory.GetMaxID(), and myElementIDFactory.

int SMDS_Mesh::MaxNodeID ( ) const

Definition at line 3251 of file SMDS_Mesh.cxx.

References myNodeMax.

Referenced by SMDS_MeshNodeIDFactory.updateMinMax().

{
  return myNodeMax;
}
int SMDS_Mesh::MinElementID ( ) const

Definition at line 3281 of file SMDS_Mesh.cxx.

References SMDS_MeshNodeIDFactory.GetMinID(), and myElementIDFactory.

int SMDS_Mesh::MinNodeID ( ) const

Definition at line 3261 of file SMDS_Mesh.cxx.

References myNodeMin.

Referenced by SMDS_MeshNodeIDFactory.updateMinMax().

{
  return myNodeMin;
}
void SMDS_Mesh::Modified ( )

modification that needs compact structure and redraw

Definition at line 4229 of file SMDS_Mesh.cxx.

References MESSAGE, myModified, and myModifTime.

Referenced by SMESH_Gen_i.ConcatenateCommon(), SMESH_Gen_i.CopyMesh(), and SMDS_Mesh().

{
  if (this->myModified)
    {
      this->myModifTime++;
      MESSAGE("modified");
      myModified = false;
    }
}
int SMDS_Mesh::Nb0DElements ( ) const

Return the number of 0D elements.

Definition at line 2327 of file SMDS_Mesh.cxx.

References myInfo, and SMDS_MeshInfo.Nb0DElements().

Referenced by Add0DElementWithID(), DebugStats(), and SMESH_Client.Update().

{
  return myInfo.Nb0DElements(); // -PR- a verfier
}
int SMDS_Mesh::NbEdges ( ) const
int SMDS_Mesh::NbFaces ( ) const
int SMDS_Mesh::NbNodes ( ) const
int SMDS_Mesh::NbSubMesh ( ) const

Return the number of child mesh of this mesh.

Note that the tree structure of SMDS_Mesh seems to be unused in this version (2003-09-08) of SMESH

Definition at line 2361 of file SMDS_Mesh.cxx.

References myChildren.

{
        return myChildren.size();
}
int SMDS_Mesh::NbVolumes ( ) const
SMDS_NodeIteratorPtr SMDS_Mesh::nodesIterator ( bool  idInceasingOrder = false) const

Return an iterator on nodes of the current mesh factory.

Definition at line 2704 of file SMDS_Mesh.cxx.

References myNodes.

Referenced by SMESH_MEDMesh_i.calculeNbElts(), Clear(), SMESH_Gen_i.ConcatenateCommon(), Contains(), StdMeshers_Penta_3D.CreateNode(), DebugStats(), DumpNodes(), SMESH.Controls.Filter.GetElementsId(), SMESH.Filter_i.GetMeshInfo(), SMESH_Mesh_i.GetNodesId(), SMESH_ElementSearcherImpl.getTolerance(), StdMeshers_Import_1D.importMesh(), SMESH_Gen_i.Load(), DriverMED_W_SMESHDS_Mesh.Perform(), SMESH.Controls.ElementsOnShape.process(), SMESH.Controls.ElementsOnSurface.process(), SMESH_Gen_i.Save(), SMESH_NodeSearcherImpl.SMESH_NodeSearcherImpl(), SMESH_MeshEditor.Transform(), and ~SMDS_Mesh().

{
  typedef MYNode_Map_Iterator
    < SetOfNodes, const SMDS_MeshNode*, SMDS_NodeIterator > TIterator;
  return SMDS_NodeIteratorPtr( new TIterator(myNodes)); // naturally always sorted by ID

//  typedef IdSortedIterator< const SMDS_MeshNode* >          TSortedIterator;
//  return ( idInceasingOrder ?
//           SMDS_NodeIteratorPtr( new TSortedIterator( *myNodeIDFactory, SMDSAbs_Node, NbNodes())) :
//           SMDS_NodeIteratorPtr( new TIterator(myNodes)));
}
bool SMDS_Mesh::registerElement ( int  ID,
SMDS_MeshElement element 
) [protected]

Registers element with the given ID, maintains inverse connections.

Definition at line 1381 of file SMDS_Mesh.cxx.

References chunkSize, SMDS_MeshElement.getVtkId(), MESSAGE, MYASSERT, myCellIdVtkToSmds, myCells, myElementIDFactory, SMDS_MeshElement.myID, myMeshId, SMDS_MeshElement.myMeshId, SMDS_MeshElementIDFactory.SetInVtkGrid(), and SMDS_MeshElementIDFactory.updateMinMax().

Referenced by AddEdgeWithID(), AddFaceWithID(), AddVolumeFromVtkIdsWithID(), AddVolumeWithID(), SMDS_MeshElementIDFactory.BindID(), createQuadrangle(), createTriangle(), and FindEdgeOrCreate().

{
  //MESSAGE("registerElement " << ID);
  if ((ID >=0) && (ID < myCells.size()) && myCells[ID]) // --- already bound
  {
    MESSAGE(" ------------------ already bound "<< ID << " " << myCells[ID]->getVtkId());
    return false;
  }

  element->myID = ID;
  element->myMeshId = myMeshId;

  SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(element);
  MYASSERT(cell);
  int vtkId = cell->getVtkId();  
  if (vtkId == -1)
    vtkId = myElementIDFactory->SetInVtkGrid(element);

  if (vtkId >= myCellIdVtkToSmds.size()) // --- resize local vector
  {
    MESSAGE(" --------------------- resize myCellIdVtkToSmds " << vtkId << " --> " << vtkId + SMDS_Mesh::chunkSize);
    myCellIdVtkToSmds.resize(vtkId + SMDS_Mesh::chunkSize, -1);
  }
  myCellIdVtkToSmds[vtkId] = ID;

  myElementIDFactory->updateMinMax(ID);
  return true;
}
void SMDS_Mesh::Remove0DElement ( const SMDS_Mesh0DElement elem0d) [virtual]

Remove an edge and all the elements which own this edge.

Definition at line 1561 of file SMDS_Mesh.cxx.

References MESSAGE, and RemoveElement().

{
    MESSAGE("Remove0DElement");
  RemoveElement(elem0d,true);
}
void SMDS_Mesh::RemoveEdge ( const SMDS_MeshEdge edge) [virtual]

Remove an edge and all the elements which own this edge.

Definition at line 1571 of file SMDS_Mesh.cxx.

References MESSAGE, and RemoveElement().

{
    MESSAGE("RemoveEdge");
        RemoveElement(edge,true);
}
void SMDS_Mesh::RemoveElement ( const SMDS_MeshElement elem,
std::list< const SMDS_MeshElement * > &  removedElems,
std::list< const SMDS_MeshElement * > &  removedNodes,
const bool  removenodes = false 
) [virtual]
Parameters:
elemThe element to delete
removedElemsto be filled with all removed elements
removedNodesto be filled with all removed nodes
removenodesif true remaining nodes will be removed

Definition at line 2994 of file SMDS_Mesh.cxx.

References addChildrenWithNodes(), ObjectPool< X >.destroy(), getExclusiveNodes(), getFinitElements(), SMDS_MeshElement.GetType(), hasConstructionEdges(), hasConstructionFaces(), MYASSERT, myCells, myEdgePool, myElementIDFactory, myFacePool, myGrid, myInfo, SMDS_MeshInfo.myNbNodes, myNodeIDFactory, myNodePool, myNodes, myVolumePool, SMDS_SpacePosition.originSpacePosition(), SMDS_MeshNodeIDFactory.ReleaseID(), SMDS_MeshElementIDFactory.ReleaseID(), SMDS_MeshInfo.remove(), SMDS_MeshInfo.RemoveEdge(), SMDS_MeshInfo.RemoveFace(), SMDS_MeshNode.RemoveInverseElement(), SMDS_MeshInfo.RemoveVolume(), SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Node, and SMDSAbs_Volume.

Referenced by Remove0DElement(), RemoveEdge(), RemoveElement(), RemoveFace(), RemoveNode(), RemoveVolume(), and SMESH_Client.Update().

{
  //MESSAGE("SMDS_Mesh::RemoveElement " << elem->getVtkId() << " " << removenodes);
  // get finite elements built on elem
  set<const SMDS_MeshElement*> * s1;
  if (    (elem->GetType() == SMDSAbs_0DElement)
      || ((elem->GetType() == SMDSAbs_Edge) && !hasConstructionEdges())
      || ((elem->GetType() == SMDSAbs_Face) && !hasConstructionFaces())
      ||  (elem->GetType() == SMDSAbs_Volume) )
    {
      s1 = new set<const SMDS_MeshElement*> ();
      s1->insert(elem);
    }
  else
    s1 = getFinitElements(elem);

  // get exclusive nodes (which would become free afterwards)
  set<const SMDS_MeshElement*> * s2;
  if (elem->GetType() == SMDSAbs_Node) // a node is removed
    {
      // do not remove nodes except elem
      s2 = new set<const SMDS_MeshElement*> ();
      s2->insert(elem);
      removenodes = true;
    }
  else
    s2 = getExclusiveNodes(*s1);

  // form the set of finite and construction elements to remove
  set<const SMDS_MeshElement*> s3;
  set<const SMDS_MeshElement*>::iterator it = s1->begin();
  while (it != s1->end())
    {
      addChildrenWithNodes(s3, *it, *s2);
      s3.insert(*it);
      it++;
    }
  if (elem->GetType() != SMDSAbs_Node)
    s3.insert(elem);

  // remove finite and construction elements
  it = s3.begin();
  while (it != s3.end())
    {
      // Remove element from <InverseElements> of its nodes
      SMDS_ElemIteratorPtr itn = (*it)->nodesIterator();
      while (itn->more())
        {
          SMDS_MeshNode * n = static_cast<SMDS_MeshNode *> (const_cast<SMDS_MeshElement *> (itn->next()));
          n->RemoveInverseElement((*it));
        }
      int IdToRemove = (*it)->GetID();
      int vtkid = (*it)->getVtkId();
      //MESSAGE("elem Id to remove " << IdToRemove << " vtkid " << vtkid <<
      //        " vtktype " << (*it)->GetVtkType() << " type " << (*it)->GetType());
      switch ((*it)->GetType())
      {
        case SMDSAbs_Node:
          MYASSERT("Internal Error: This should not happen")
          ;
          break;
        case SMDSAbs_0DElement:
          if (IdToRemove >= 0)
            {
              myCells[IdToRemove] = 0; // -PR- ici ou dans myElementIDFactory->ReleaseID ?
              myInfo.remove(*it);
            }
          removedElems.push_back((*it));
          myElementIDFactory->ReleaseID(IdToRemove, vtkid);
          delete (*it);
          break;
        case SMDSAbs_Edge:
          if (IdToRemove >= 0)
            {
              myCells[IdToRemove] = 0;
              myInfo.RemoveEdge(*it);
            }
          removedElems.push_back((*it));
          myElementIDFactory->ReleaseID(IdToRemove, vtkid);
          if (const SMDS_VtkEdge* vtkElem = dynamic_cast<const SMDS_VtkEdge*>(*it))
            myEdgePool->destroy((SMDS_VtkEdge*) vtkElem);
          else
            delete (*it);
          break;
        case SMDSAbs_Face:
          if (IdToRemove >= 0)
            {
              myCells[IdToRemove] = 0;
              myInfo.RemoveFace(*it);
            }
          removedElems.push_back((*it));
          myElementIDFactory->ReleaseID(IdToRemove, vtkid);
          if (const SMDS_VtkFace* vtkElem = dynamic_cast<const SMDS_VtkFace*>(*it))
            myFacePool->destroy((SMDS_VtkFace*) vtkElem);
          else
            delete (*it);
          break;
        case SMDSAbs_Volume:
          if (IdToRemove >= 0)
            {
              myCells[IdToRemove] = 0;
              myInfo.RemoveVolume(*it);
            }
          removedElems.push_back((*it));
          myElementIDFactory->ReleaseID(IdToRemove, vtkid);
          if (const SMDS_VtkVolume* vtkElem = dynamic_cast<const SMDS_VtkVolume*>(*it))
            myVolumePool->destroy((SMDS_VtkVolume*) vtkElem);
          else
            delete (*it);
          break;
      }
      if (vtkid >= 0)
        {
          //MESSAGE("VTK_EMPTY_CELL in " << vtkid);
          this->myGrid->GetCellTypesArray()->SetValue(vtkid, VTK_EMPTY_CELL);
        }
      it++;
    }

  // remove exclusive (free) nodes
  if (removenodes)
    {
      it = s2->begin();
      while (it != s2->end())
        {
          int IdToRemove = (*it)->GetID();
          //MESSAGE( "SMDS: RM node " << IdToRemove);
          if (IdToRemove >= 0)
            {
              myNodes[IdToRemove] = 0;
              myInfo.myNbNodes--;
            }
          myNodeIDFactory->ReleaseID((*it)->GetID(), (*it)->getVtkId());
          removedNodes.push_back((*it));
          if (const SMDS_MeshNode* vtkElem = dynamic_cast<const SMDS_MeshNode*>(*it))
          {
            ((SMDS_MeshNode*)vtkElem)->SetPosition(SMDS_SpacePosition::originSpacePosition());
            myNodePool->destroy((SMDS_MeshNode*) vtkElem);
          }
          else
            delete (*it);
          it++;
        }
    }

  delete s2;
  delete s1;
}
void SMDS_Mesh::RemoveElement ( const SMDS_MeshElement elem,
bool  removenodes = false 
) [virtual]
Parameters:
elemThe element to delete
removenodesif true remaining nodes will be removed

Definition at line 2980 of file SMDS_Mesh.cxx.

References RemoveElement().

{
  list<const SMDS_MeshElement *> removedElems;
  list<const SMDS_MeshElement *> removedNodes;
  RemoveElement( elem, removedElems, removedNodes, removenodes );
}
void SMDS_Mesh::RemoveFace ( const SMDS_MeshFace face) [virtual]

Remove an face and all the elements which own this face.

Definition at line 1581 of file SMDS_Mesh.cxx.

References MESSAGE, and RemoveElement().

{
    MESSAGE("RemoveFace");
        RemoveElement(face, true);
}
void SMDS_Mesh::RemoveFreeElement ( const SMDS_MeshElement elem) [virtual]

Remove only the given element and only if it is free.

Method does not work for meshes with descendants. Implemented for fast cleaning of meshes.

Parameters:
elemThe element to delete

Definition at line 3150 of file SMDS_Mesh.cxx.

References ObjectPool< X >.destroy(), SMDS_MeshElement.GetID(), SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.GetType(), SMDS_MeshElement.getVtkId(), hasConstructionEdges(), hasConstructionFaces(), myCells, myEdgePool, myElementIDFactory, myFacePool, myGrid, myInfo, SMDS_MeshInfo.myNbNodes, myNodeIDFactory, myNodePool, myNodes, myVolumePool, SMDS_MeshElement.nodesIterator(), SMDS_SpacePosition.originSpacePosition(), SMDS_MeshElementIDFactory.ReleaseID(), SMDS_MeshNodeIDFactory.ReleaseID(), SMDS_MeshInfo.remove(), SMDS_MeshInfo.RemoveEdge(), SMDS_MeshInfo.RemoveFace(), SMDS_MeshNode.RemoveInverseElement(), SMDS_MeshInfo.RemoveVolume(), SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Node, and SMDSAbs_Volume.

{
  int elemId = elem->GetID();
  int vtkId = elem->getVtkId();
  //MESSAGE("RemoveFreeElement " << elemId);
  SMDSAbs_ElementType aType = elem->GetType();
  SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem);
  if (aType == SMDSAbs_Node) {
    //MESSAGE("Remove free node " << elemId);
    // only free node can be removed by this method
    const SMDS_MeshNode* n = static_cast<SMDS_MeshNode*>(todest);
    SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
    if (!itFe->more()) { // free node
      myNodes[elemId] = 0;
      myInfo.myNbNodes--;
      ((SMDS_MeshNode*) n)->SetPosition(SMDS_SpacePosition::originSpacePosition());
      myNodePool->destroy(static_cast<SMDS_MeshNode*>(todest));
      myNodeIDFactory->ReleaseID(elemId, vtkId);
    }
  } else {
    if (hasConstructionEdges() || hasConstructionFaces())
      // this methods is only for meshes without descendants
      return;

    //MESSAGE("Remove free element " << elemId);
    // Remove element from <InverseElements> of its nodes
    SMDS_ElemIteratorPtr itn = elem->nodesIterator();
    while (itn->more()) {
      SMDS_MeshNode * n = static_cast<SMDS_MeshNode *>
        (const_cast<SMDS_MeshElement *>(itn->next()));
      n->RemoveInverseElement(elem);
    }

    // in meshes without descendants elements are always free
     switch (aType) {
    case SMDSAbs_0DElement:
      myCells[elemId] = 0;
      myInfo.remove(elem);
      delete elem;
      break;
    case SMDSAbs_Edge:
      myCells[elemId] = 0;
      myInfo.RemoveEdge(elem);
      myEdgePool->destroy(static_cast<SMDS_VtkEdge*>(todest));
      break;
    case SMDSAbs_Face:
      myCells[elemId] = 0;
      myInfo.RemoveFace(elem);
      myFacePool->destroy(static_cast<SMDS_VtkFace*>(todest));
      break;
    case SMDSAbs_Volume:
      myCells[elemId] = 0;
      myInfo.RemoveVolume(elem);
      myVolumePool->destroy(static_cast<SMDS_VtkVolume*>(todest));
      break;
    default:
      break;
    }
    myElementIDFactory->ReleaseID(elemId, vtkId);

    this->myGrid->GetCellTypesArray()->SetValue(vtkId, VTK_EMPTY_CELL);
    // --- to do: keep vtkid in a list of reusable cells
  }
}
bool SMDS_Mesh::RemoveFromParent ( ) [virtual]

Definition at line 1602 of file SMDS_Mesh.cxx.

References myParent, and RemoveSubMesh().

{
        if (myParent==NULL) return false;
        else return (myParent->RemoveSubMesh(this));
}
void SMDS_Mesh::RemoveNode ( const SMDS_MeshNode node) [virtual]

Remove a node and all the elements which own this node.

Reimplemented in SMESHDS_Mesh.

Definition at line 1551 of file SMDS_Mesh.cxx.

References MESSAGE, and RemoveElement().

Referenced by SMDS_VolumeTool.GetSize(), and SMESH_Client.Update().

{
    MESSAGE("RemoveNode");
        RemoveElement(node, true);
}
bool SMDS_Mesh::RemoveSubMesh ( const SMDS_Mesh aMesh) [virtual]

Definition at line 1613 of file SMDS_Mesh.cxx.

References myChildren, and SMESH_test4.submesh.

Referenced by RemoveFromParent().

{
        bool found = false;

        list<SMDS_Mesh *>::iterator itmsh=myChildren.begin();
        for (; itmsh!=myChildren.end() && !found; itmsh++)
        {
                SMDS_Mesh * submesh = *itmsh;
                if (submesh == aMesh)
                {
                        found = true;
                        myChildren.erase(itmsh);
                }
        }

        return found;
}
void SMDS_Mesh::RemoveVolume ( const SMDS_MeshVolume volume) [virtual]

Remove a volume.

Definition at line 1591 of file SMDS_Mesh.cxx.

References MESSAGE, and RemoveElement().

{
    MESSAGE("RemoveVolume");
        RemoveElement(volume, true);
}
void SMDS_Mesh::Renumber ( const bool  isNodes,
const int  startID = 1,
const int  deltaID = 1 
) [virtual]

Reimplemented in SMESHDS_Mesh.

Definition at line 3291 of file SMDS_Mesh.cxx.

References SMDS_MeshNodeIDFactory.BindID(), SMDS_MeshNodeIDFactory.Clear(), SMDS_MeshNodeIDFactory.elementsIterator(), SMDS_MeshElement.GetID(), MESSAGE, myElementIDFactory, and myNodeIDFactory.

Referenced by SMESH_Client.Update().

{
    MESSAGE("Renumber");
  if ( deltaID == 0 )
    return;

  SMDS_MeshNodeIDFactory * idFactory =
    isNodes ? myNodeIDFactory : myElementIDFactory;

  // get existing elements in the order of ID increasing
  map<int,SMDS_MeshElement*> elemMap;
  SMDS_ElemIteratorPtr idElemIt = idFactory->elementsIterator();
  while ( idElemIt->more() ) {
    SMDS_MeshElement* elem = const_cast<SMDS_MeshElement*>(idElemIt->next());
    int id = elem->GetID();
    elemMap.insert(map<int,SMDS_MeshElement*>::value_type(id, elem));
  }
  // release their ids
  map<int,SMDS_MeshElement*>::iterator elemIt = elemMap.begin();
  idFactory->Clear();
//   for ( ; elemIt != elemMap.end(); elemIt++ )
//   {
//     int id = (*elemIt).first;
//     idFactory->ReleaseID( id );
//   }
  // set new IDs
  int ID = startID;
  elemIt = elemMap.begin();
  for ( ; elemIt != elemMap.end(); elemIt++ )
  {
    idFactory->BindID( ID, (*elemIt).second );
    ID += deltaID;
  }
}
void SMDS_Mesh::setConstructionEdges ( bool  b)

Make this mesh creating construction edges (see hasConstructionEdges)

Parameters:
btrue to have construction edges, else false.

Definition at line 2558 of file SMDS_Mesh.cxx.

References myHasConstructionEdges.

void SMDS_Mesh::setConstructionFaces ( bool  b)

Make this mesh creating construction faces (see hasConstructionFaces)

Parameters:
btrue to have construction faces, else false.

Definition at line 2567 of file SMDS_Mesh.cxx.

References myHasConstructionFaces.

void SMDS_Mesh::setInverseElements ( bool  b)

Make this mesh creating link from nodes to elements (see hasInverseElements)

Parameters:
btrue to link nodes to elements, else false.

Definition at line 2576 of file SMDS_Mesh.cxx.

References MESSAGE, and myHasInverseElements.

{
  if(!b) MESSAGE("Error : inverseElement=false not implemented");
  myHasInverseElements=b;
}
void SMDS_Mesh.setMyModified ( )
void SMDS_Mesh::updateBoundingBox ( )

Definition at line 4195 of file SMDS_Mesh.cxx.

References SMDS_UnstructuredGrid.GetPoints(), myGrid, myNodes, xmax, xmin, ymax, ymin, zmax, and zmin.

{
  xmin = 0; xmax = 0;
  ymin = 0; ymax = 0;
  zmin = 0; zmax = 0;
  vtkPoints *points = myGrid->GetPoints();
  int myNodesSize = this->myNodes.size();
  for (int i = 0; i < myNodesSize; i++)
    {
      if (SMDS_MeshNode *n = myNodes[i])
        {
          double coords[3];
          points->GetPoint(n->myVtkID, coords);
          if (coords[0] < xmin) xmin = coords[0];
          else if (coords[0] > xmax) xmax = coords[0];
          if (coords[1] < ymin) ymin = coords[1];
          else if (coords[1] > ymax) ymax = coords[1];
          if (coords[2] < zmin) zmin = coords[2];
          else if (coords[2] > zmax) zmax = coords[2];
        }
    }
}
void SMDS_Mesh::updateNodeMinMax ( )

Definition at line 4092 of file SMDS_Mesh.cxx.

References myNodeMax, myNodeMin, and myNodes.

Referenced by SMDS_MeshNodeIDFactory.updateMinMax().

{
  myNodeMin = 0;
  if (myNodes.size() == 0)
  {
        myNodeMax=0;
        return;
  }
  while (!myNodes[myNodeMin] && (myNodeMin<myNodes.size()))
    myNodeMin++;
  myNodeMax=myNodes.size()-1;
  while (!myNodes[myNodeMax] && (myNodeMin>=0))
    myNodeMin--;
}
SMDS_VolumeIteratorPtr SMDS_Mesh::volumesIterator ( bool  idInceasingOrder = false) const

Return an iterator on volumes of the current mesh.

Definition at line 2780 of file SMDS_Mesh.cxx.

References myCells, and SMDSAbs_Volume.

Referenced by SMESH_MEDMesh_i.calculeNbElts(), Contains(), SMESH_MeshEditor.ConvertToQuadratic(), DumpVolumes(), DriverSTL_W_SMDS_Mesh.findVolumeTriangles(), SMESH.Controls.Filter.GetElementsId(), SMESH.Filter_i.GetMeshInfo(), SMESH.SMESH_MeshEditor.Make2DMeshFrom3D(), DriverMED_W_SMESHDS_Mesh.Perform(), and SMESH.Controls.ElementsOnShape.process().

{
  typedef MYElem_Map_Iterator
    < SetOfCells, const SMDS_MeshVolume*, SMDS_VolumeIterator > TIterator;
  return SMDS_VolumeIteratorPtr(new TIterator(myCells, SMDSAbs_Volume)); // naturally always sorted by ID

  //  typedef MYNCollection_Map_Iterator
//    < SetOfVolumes, const SMDS_MeshVolume*, SMDS_VolumeIterator > TIterator;
//  typedef IdSortedIterator< const SMDS_MeshVolume* >              TSortedIterator;
//  return ( idInceasingOrder ?
//           SMDS_VolumeIteratorPtr( new TSortedIterator( *myElementIDFactory,
//                                                        SMDSAbs_Volume,
//                                                        NbVolumes() )) :
//           SMDS_VolumeIteratorPtr(new TIterator(myVolumes)));
}

Friends And Related Function Documentation

friend class SMDS_MeshElementIDFactory [friend]

Definition at line 62 of file SMDS_Mesh.hxx.

friend class SMDS_MeshIDFactory [friend]

Definition at line 60 of file SMDS_Mesh.hxx.

friend class SMDS_MeshNode [friend]

Definition at line 64 of file SMDS_Mesh.hxx.

friend class SMDS_MeshNodeIDFactory [friend]

Definition at line 61 of file SMDS_Mesh.hxx.

friend class SMDS_MeshVolumeVtkNodes [friend]

Definition at line 63 of file SMDS_Mesh.hxx.


Field Documentation

vector< SMDS_Mesh * > SMDS_Mesh::_meshList = vector<SMDS_Mesh*>() [static]

to retreive this SMDS_Mesh instance from its elements (index stored in SMDS_Elements)

Definition at line 69 of file SMDS_Mesh.hxx.

Referenced by SMDS_MeshNode.AddInverseElement(), SMDS_VtkFace.ChangeApex(), SMDS_VtkVolume.ChangeNodes(), SMDS_VtkFace.ChangeNodes(), SMDS_VtkEdge.ChangeNodes(), SMDS_MeshNode.ClearInverseElements(), SMDS_VtkVolume.elementsIterator(), SMDS_VtkFace.elementsIterator(), SMDS_VtkEdge.elementsIterator(), SMDS_MeshNode.elementsIterator(), SMDS_MeshNode.emptyInverseElements(), SMDS_MeshNode.getCoord(), SMDS_VtkVolume.GetEntityType(), SMDS_VtkFace.GetEntityType(), SMDS_VtkVolume.GetFaceNode(), SMDS_MeshNode.GetInverseElementIterator(), SMDS_VtkVolume.GetQuantities(), SMDS_VolumeTool.GetSize(), SMESH.Controls.AspectRatio3D.GetValue(), SMDS_VtkVolume.GetVtkType(), SMDS_VtkFace.GetVtkType(), SMDS_MeshNode.init(), SMDS_VtkVolume.interlacedNodesElemIterator(), SMDS_VtkFace.interlacedNodesElemIterator(), SMDS_VtkEdge.interlacedNodesElemIterator(), SMDS_VtkVolume.IsMediumNode(), SMDS_VtkFace.IsMediumNode(), SMDS_VtkEdge.IsMediumNode(), SMDS_VtkVolume.IsPoly(), SMDS_VtkFace.IsPoly(), SMDS_VtkVolume.IsQuadratic(), SMDS_VtkFace.IsQuadratic(), SMDS_VtkVolume.NbEdges(), SMDS_VtkFace.NbEdges(), SMDS_VtkVolume.NbFaceNodes(), SMDS_VtkVolume.NbFaces(), SMDS_MeshNode.NbInverseElements(), SMDS_VtkVolume.NbNodes(), SMDS_VtkFace.NbNodes(), SMDS_VtkEdge.NbNodes(), SMDS_VtkVolume.NbUniqueNodes(), SMDS_VtkVolume.nodesIteratorToUNV(), SMDS_VtkFace.nodesIteratorToUNV(), SMDS_VtkEdge.nodesIteratorToUNV(), SMDS_MeshNode.RemoveInverseElement(), SMDS_MeshNode.setXYZ(), SMDS_Mesh(), SMESH_Gen.SMESH_Gen(), SMDS_VtkVolume.uniqueNodesIterator(), and SMDS_VtkVolume.vtkOrder().

int SMDS_Mesh::chunkSize = 1024 [static]
std::vector<int> SMDS_Mesh.myCellIdVtkToSmds [protected]

for cells only: index = ID for SMDS users, value = ID in vtkUnstructuredGrid

for cells only: index = ID in vtkUnstructuredGrid, value = ID for SMDS users

Definition at line 669 of file SMDS_Mesh.hxx.

Referenced by SMDS_MeshElementIDFactory.Clear(), Clear(), SMESHDS_Mesh.compactMesh(), fromVtkToSmds(), incrementCellsCapacity(), registerElement(), SMDS_MeshElementIDFactory.ReleaseID(), and SMDS_Mesh().

std::list<SMDS_Mesh *> SMDS_Mesh.myChildren [protected]

Definition at line 672 of file SMDS_Mesh.hxx.

Referenced by AddSubMesh(), Clear(), NbSubMesh(), RemoveSubMesh(), and ~SMDS_Mesh().

unsigned long SMDS_Mesh.myCompactTime [protected]

Definition at line 678 of file SMDS_Mesh.hxx.

Referenced by isCompacted().

Definition at line 683 of file SMDS_Mesh.hxx.

Referenced by hasConstructionEdges(), and setConstructionEdges().

Definition at line 684 of file SMDS_Mesh.hxx.

Referenced by hasConstructionFaces(), and setConstructionFaces().

Definition at line 685 of file SMDS_Mesh.hxx.

Referenced by hasInverseElements(), and setInverseElements().

int SMDS_Mesh.myMeshId [protected]

index of this SMDS_mesh in the static vector<SMDS_Mesh*> _meshList

Definition at line 646 of file SMDS_Mesh.hxx.

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

any add, remove or change of node or cell

Definition at line 688 of file SMDS_Mesh.hxx.

Referenced by AddNodeWithID(), Clear(), and Modified().

unsigned long SMDS_Mesh.myModifTime [protected]

use a counter to keep track of modifications

Definition at line 678 of file SMDS_Mesh.hxx.

Referenced by GetMTime(), isCompacted(), and Modified().

int SMDS_Mesh.myNodeMax [protected]

Definition at line 681 of file SMDS_Mesh.hxx.

Referenced by MaxNodeID(), and updateNodeMinMax().

int SMDS_Mesh.myNodeMin [protected]

Definition at line 680 of file SMDS_Mesh.hxx.

Referenced by MinNodeID(), and updateNodeMinMax().

Small objects like SMDS_MeshNode are allocated by chunks to limit memory costs of new.

Definition at line 652 of file SMDS_Mesh.hxx.

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

SMDS_MeshNodes refer to vtk nodes (vtk id = index in myNodes),store reference to this mesh, and subshape.

Definition at line 660 of file SMDS_Mesh.hxx.

Referenced by AddNodeWithID(), Clear(), SMESHDS_Mesh.compactMesh(), elementsIterator(), FindNode(), FindNodeVtk(), incrementCellsCapacity(), incrementNodesCapacity(), nodesIterator(), RemoveElement(), RemoveFreeElement(), SMDS_Mesh(), updateBoundingBox(), and updateNodeMinMax().

Definition at line 671 of file SMDS_Mesh.hxx.

Referenced by Clear(), RemoveFromParent(), and ~SMDS_Mesh().

Small objects like SMDS_VtkVolume are allocated by chunks to limit memory costs of new.

Definition at line 655 of file SMDS_Mesh.hxx.

Referenced by AddVolumeFromVtkIdsWithID(), AddVolumeWithID(), Clear(), RemoveElement(), RemoveFreeElement(), and SMDS_Mesh().

double SMDS_Mesh.xmax [protected]

Definition at line 691 of file SMDS_Mesh.hxx.

Referenced by Clear(), getMaxDim(), and updateBoundingBox().

double SMDS_Mesh.xmin [protected]

Definition at line 690 of file SMDS_Mesh.hxx.

Referenced by Clear(), getMaxDim(), and updateBoundingBox().

double SMDS_Mesh.ymax [protected]

Definition at line 693 of file SMDS_Mesh.hxx.

Referenced by Clear(), getMaxDim(), and updateBoundingBox().

double SMDS_Mesh.ymin [protected]

Definition at line 692 of file SMDS_Mesh.hxx.

Referenced by Clear(), getMaxDim(), and updateBoundingBox().

double SMDS_Mesh.zmax [protected]

Definition at line 695 of file SMDS_Mesh.hxx.

Referenced by Clear(), getMaxDim(), and updateBoundingBox().

double SMDS_Mesh.zmin [protected]

Definition at line 694 of file SMDS_Mesh.hxx.

Referenced by Clear(), getMaxDim(), and updateBoundingBox().

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