X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMDS%2FSMDS_MeshInfo.hxx;h=91613bb5dec9062ebdf39cbb08f3467c6399bf53;hb=02846fd083f6f2d93a8ef3553cbd37f33a6e33b3;hp=b92c857dbabee8b2370944b39995f1a0c7d50666;hpb=167a4d4243de3f9e93d4e66b78d23d284b338a85;p=modules%2Fsmesh.git diff --git a/src/SMDS/SMDS_MeshInfo.hxx b/src/SMDS/SMDS_MeshInfo.hxx index b92c857db..91613bb5d 100644 --- a/src/SMDS/SMDS_MeshInfo.hxx +++ b/src/SMDS/SMDS_MeshInfo.hxx @@ -40,6 +40,7 @@ public: inline void Clear(); int NbNodes() const { return myNbNodes; } + inline int NbElements(SMDSAbs_ElementType type=SMDSAbs_All) const; inline int NbEdges (SMDSAbs_ElementOrder order = ORDER_ANY) const; inline int NbFaces (SMDSAbs_ElementOrder order = ORDER_ANY) const; @@ -60,7 +61,7 @@ private: // methods to count NOT POLY elements inline void remove(const SMDS_MeshElement* el); inline void add (const SMDS_MeshElement* el); - inline int index(SMDSAbs_ElementType type, int nbNodes); + inline int index(SMDSAbs_ElementType type, int nbNodes) const; // methods to remove elements of ANY kind inline void RemoveEdge(const SMDS_MeshElement* el); inline void RemoveFace(const SMDS_MeshElement* el); @@ -153,7 +154,7 @@ SMDS_MeshInfo::Clear() myNbPolygons=myNbPolyhedrons=0; } inline int // index -SMDS_MeshInfo::index(SMDSAbs_ElementType type, int nbNodes) +SMDS_MeshInfo::index(SMDSAbs_ElementType type, int nbNodes) const { return nbNodes + myShift[ type ]; } inline void // remove @@ -212,4 +213,29 @@ inline int // NbPrisms SMDS_MeshInfo::NbPrisms (SMDSAbs_ElementOrder order) const { return order == ORDER_ANY ? myNbPrisms+myNbQuadPrisms : order == ORDER_LINEAR ? myNbPrisms : myNbQuadPrisms; } +inline int // NbElements +SMDS_MeshInfo::NbElements(SMDSAbs_ElementType type) const +{ + int nb = 0; + switch (type) { + case SMDSAbs_All: + for ( int i=1+index( SMDSAbs_Node,1 ); i