Version: 6.3.1
Public Member Functions | Private Member Functions | Private Attributes | Friends

SMDS_MeshInfo Class Reference

#include <SMDS_MeshInfo.hxx>

Public Member Functions

 SMDS_MeshInfo ()
void Clear ()
int NbNodes () const
int NbElements (SMDSAbs_ElementType type=SMDSAbs_All) const
int NbEntities (SMDSAbs_EntityType type) const
int Nb0DElements () const
int NbEdges (SMDSAbs_ElementOrder order=ORDER_ANY) const
int NbFaces (SMDSAbs_ElementOrder order=ORDER_ANY) const
int NbTriangles (SMDSAbs_ElementOrder order=ORDER_ANY) const
int NbQuadrangles (SMDSAbs_ElementOrder order=ORDER_ANY) const
int NbPolygons () const
int NbVolumes (SMDSAbs_ElementOrder order=ORDER_ANY) const
int NbTetras (SMDSAbs_ElementOrder order=ORDER_ANY) const
int NbHexas (SMDSAbs_ElementOrder order=ORDER_ANY) const
int NbPyramids (SMDSAbs_ElementOrder order=ORDER_ANY) const
int NbPrisms (SMDSAbs_ElementOrder order=ORDER_ANY) const
int NbPolyhedrons () const

Private Member Functions

void remove (const SMDS_MeshElement *el)
void add (const SMDS_MeshElement *el)
int index (SMDSAbs_ElementType type, int nbNodes) const
void RemoveEdge (const SMDS_MeshElement *el)
void RemoveFace (const SMDS_MeshElement *el)
void RemoveVolume (const SMDS_MeshElement *el)

Private Attributes

int myNbNodes
int myNb0DElements
int myNbEdges
int myNbQuadEdges
int myNbTriangles
int myNbQuadTriangles
int myNbQuadrangles
int myNbQuadQuadrangles
int myNbPolygons
int myNbTetras
int myNbQuadTetras
int myNbHexas
int myNbQuadHexas
int myNbPyramids
int myNbQuadPyramids
int myNbPrisms
int myNbQuadPrisms
int myNbPolyhedrons
std::vector< int * > myNb
std::vector< intmyShift

Friends

class SMDS_Mesh

Detailed Description

Definition at line 33 of file SMDS_MeshInfo.hxx.


Constructor & Destructor Documentation

SMDS_MeshInfo::SMDS_MeshInfo ( )

Definition at line 88 of file SMDS_MeshInfo.hxx.

References index(), myNb, myNb0DElements, myNbEdges, myNbHexas, myNbNodes, myNbPrisms, myNbPyramids, myNbQuadEdges, myNbQuadHexas, myNbQuadPrisms, myNbQuadPyramids, myNbQuadQuadrangles, myNbQuadrangles, myNbQuadTetras, myNbQuadTriangles, myNbTetras, myNbTriangles, myShift, SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_NbElementTypes, SMDSAbs_Node, and SMDSAbs_Volume.

                                   :
  myNbNodes(0),
  myNb0DElements(0),
  myNbEdges      (0), myNbQuadEdges      (0),
  myNbTriangles  (0), myNbQuadTriangles  (0),
  myNbQuadrangles(0), myNbQuadQuadrangles(0),
  myNbPolygons(0),
  myNbTetras  (0), myNbQuadTetras  (0),
  myNbHexas   (0), myNbQuadHexas   (0),
  myNbPyramids(0), myNbQuadPyramids(0),
  myNbPrisms  (0), myNbQuadPrisms  (0),
  myNbPolyhedrons(0)
{
  // Number of nodes in standard element types
  // n   v  f  e  0  n
  // o   o  a  d  d  o
  // d   l  c  g     d
  // e      e  e     e
  // s
  // -----------------
  // 0         *
  // 1            .  *
  // 2         *
  // 3      .     *
  // 4   *  .  .
  // 5   *
  // 6   *  .
  // 7
  // 8   *  .
  // 9
  // 10  *
  // 11     *
  // 12     *
  // 13  *
  // 14     *
  // 15  *
  // 16     *
  // 17
  // 18
  // 19
  // 20  *
  //
  // So to have a unique index for each type basing on nb of nodes, we use a shift:
  myShift.resize(SMDSAbs_NbElementTypes, 0);

  myShift[ SMDSAbs_Face      ] = +8; // 3->11, 4->12, 6->14, 8->16
  myShift[ SMDSAbs_Edge      ] = -2; // 2->0, 4->2
  myShift[ SMDSAbs_0DElement ] = +2; // 1->3

  myNb.resize( index( SMDSAbs_Volume,20 ) + 1, NULL);

  myNb[ index( SMDSAbs_Node,1 )] = & myNbNodes;

  myNb[ index( SMDSAbs_0DElement,1 )] = & myNb0DElements;

  myNb[ index( SMDSAbs_Edge,2 )] = & myNbEdges;
  myNb[ index( SMDSAbs_Edge,4 )] = & myNbQuadEdges;

  myNb[ index( SMDSAbs_Face,3 )] = & myNbTriangles;
  myNb[ index( SMDSAbs_Face,4 )] = & myNbQuadrangles;
  myNb[ index( SMDSAbs_Face,6 )] = & myNbQuadTriangles;
  myNb[ index( SMDSAbs_Face,8 )] = & myNbQuadQuadrangles;

  myNb[ index( SMDSAbs_Volume, 4)]  = & myNbTetras;
  myNb[ index( SMDSAbs_Volume, 5)]  = & myNbPyramids;
  myNb[ index( SMDSAbs_Volume, 6)]  = & myNbPrisms;
  myNb[ index( SMDSAbs_Volume, 8)]  = & myNbHexas;
  myNb[ index( SMDSAbs_Volume, 10)] = & myNbQuadTetras;  
  myNb[ index( SMDSAbs_Volume, 13)] = & myNbQuadPyramids;
  myNb[ index( SMDSAbs_Volume, 15)] = & myNbQuadPrisms;  
  myNb[ index( SMDSAbs_Volume, 20)] = & myNbQuadHexas;   
}

Member Function Documentation

void SMDS_MeshInfo::add ( const SMDS_MeshElement el) [private]

Definition at line 176 of file SMDS_MeshInfo.hxx.

References SMDS_MeshElement.GetType(), index(), myNb, and SMDS_MeshElement.NbNodes().

{ ++(*myNb[ index(el->GetType(), el->NbNodes()) ]); }
void SMDS_MeshInfo::Clear ( )

Definition at line 162 of file SMDS_MeshInfo.hxx.

References myNb, myNbPolygons, and myNbPolyhedrons.

Referenced by SMDS_Mesh.Clear().

{ for ( int i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=0;
  myNbPolygons=myNbPolyhedrons=0;
}
int SMDS_MeshInfo::index ( SMDSAbs_ElementType  type,
int  nbNodes 
) const [private]

Definition at line 168 of file SMDS_MeshInfo.hxx.

References myShift.

Referenced by add(), NbElements(), remove(), and SMDS_MeshInfo().

{ return nbNodes + myShift[ type ]; }
int SMDS_MeshInfo.Nb0DElements ( ) const

Definition at line 44 of file SMDS_MeshInfo.hxx.

Referenced by SMDS_Mesh.Nb0DElements(), and DriverMED_W_SMESHDS_Mesh.Perform().

{ return myNb0DElements; }
int SMDS_MeshInfo::NbEdges ( SMDSAbs_ElementOrder  order = ORDER_ANY) const
int SMDS_MeshInfo::NbElements ( SMDSAbs_ElementType  type = SMDSAbs_All) const
int SMDS_MeshInfo::NbEntities ( SMDSAbs_EntityType  type) const

Definition at line 258 of file SMDS_MeshInfo.hxx.

References myNb0DElements, myNbEdges, myNbHexas, myNbNodes, myNbPolygons, myNbPolyhedrons, myNbPrisms, myNbPyramids, myNbQuadEdges, myNbQuadHexas, myNbQuadPrisms, myNbQuadPyramids, myNbQuadQuadrangles, myNbQuadrangles, myNbQuadTetras, myNbQuadTriangles, myNbTetras, myNbTriangles, SMDSEntity_0D, SMDSEntity_Edge, SMDSEntity_Hexa, SMDSEntity_Node, SMDSEntity_Penta, SMDSEntity_Polygon, SMDSEntity_Polyhedra, SMDSEntity_Pyramid, SMDSEntity_Quad_Edge, SMDSEntity_Quad_Hexa, SMDSEntity_Quad_Penta, SMDSEntity_Quad_Polygon, SMDSEntity_Quad_Polyhedra, SMDSEntity_Quad_Pyramid, SMDSEntity_Quad_Quadrangle, SMDSEntity_Quad_Tetra, SMDSEntity_Quad_Triangle, SMDSEntity_Quadrangle, SMDSEntity_Tetra, and SMDSEntity_Triangle.

Referenced by SMESH_Mesh_i.GetMeshInfo(), and SMESH_ProxyMesh.NbFaces().

{
  switch (type) {
  case SMDSEntity_Node:
    return myNbNodes;
    break;
  case SMDSEntity_0D:
    return myNb0DElements;
    break;
  case SMDSEntity_Edge:
    return myNbEdges;
    break;
  case SMDSEntity_Quad_Edge:
    return myNbQuadEdges;
    break;
  case SMDSEntity_Triangle:
    return myNbTriangles;
    break;
  case SMDSEntity_Quad_Triangle:
    return myNbQuadTriangles;
    break;
  case SMDSEntity_Quadrangle:
    return myNbQuadrangles;
    break;
  case SMDSEntity_Quad_Quadrangle:
    return myNbQuadQuadrangles;
    break;
  case SMDSEntity_Polygon:
    return myNbPolygons;
    break;
  case SMDSEntity_Tetra:
    return myNbTetras;
    break;
  case SMDSEntity_Quad_Tetra:
    return myNbQuadTetras;
    break;
  case SMDSEntity_Pyramid:
    return myNbPyramids;
    break;
  case SMDSEntity_Quad_Pyramid:
    return myNbQuadPyramids;
    break;
  case SMDSEntity_Hexa:
    return myNbHexas;
    break;
  case SMDSEntity_Quad_Hexa:
    return myNbQuadHexas;
    break;
  case SMDSEntity_Penta:
    return myNbPrisms;
    break;
  case SMDSEntity_Quad_Penta:
    return myNbQuadPrisms;
    break;
  case SMDSEntity_Polyhedra:
    return myNbPolyhedrons;
    break;
  case SMDSEntity_Quad_Polygon:
  case SMDSEntity_Quad_Polyhedra:
  default:
  break;
  }
  return 0;
}
int SMDS_MeshInfo::NbFaces ( SMDSAbs_ElementOrder  order = ORDER_ANY) const

Definition at line 196 of file SMDS_MeshInfo.hxx.

References myNbPolygons, NbQuadrangles(), NbTriangles(), and ORDER_QUADRATIC.

Referenced by SMDS_Mesh.NbFaces().

{ return NbTriangles(order)+NbQuadrangles(order)+(order == ORDER_QUADRATIC ? 0 : myNbPolygons); }
int SMDS_MeshInfo::NbHexas ( SMDSAbs_ElementOrder  order = ORDER_ANY) const
int SMDS_MeshInfo.NbNodes ( ) const

Definition at line 40 of file SMDS_MeshInfo.hxx.

Referenced by SMESH_ElementSearcherImpl.getTolerance(), and SMDS_Mesh.NbNodes().

{ return myNbNodes; }
int SMDS_MeshInfo.NbPolygons ( ) const
int SMDS_MeshInfo.NbPolyhedrons ( ) const

Definition at line 56 of file SMDS_MeshInfo.hxx.

Referenced by DriverMED_W_SMESHDS_Mesh.Perform().

{ return myNbPolyhedrons; }
int SMDS_MeshInfo::NbPrisms ( SMDSAbs_ElementOrder  order = ORDER_ANY) const
int SMDS_MeshInfo::NbPyramids ( SMDSAbs_ElementOrder  order = ORDER_ANY) const
int SMDS_MeshInfo::NbQuadrangles ( SMDSAbs_ElementOrder  order = ORDER_ANY) const
int SMDS_MeshInfo::NbTetras ( SMDSAbs_ElementOrder  order = ORDER_ANY) const
int SMDS_MeshInfo::NbTriangles ( SMDSAbs_ElementOrder  order = ORDER_ANY) const
int SMDS_MeshInfo::NbVolumes ( SMDSAbs_ElementOrder  order = ORDER_ANY) const

Definition at line 208 of file SMDS_MeshInfo.hxx.

References myNbPolyhedrons, NbHexas(), NbPrisms(), NbPyramids(), NbTetras(), and ORDER_QUADRATIC.

Referenced by SMDS_Mesh.NbVolumes().

{ return NbTetras(order) + NbHexas(order) + NbPyramids(order) + NbPrisms(order) + (order == ORDER_QUADRATIC ? 0 : myNbPolyhedrons); }
void SMDS_MeshInfo::remove ( const SMDS_MeshElement el) [private]

Definition at line 172 of file SMDS_MeshInfo.hxx.

References SMDS_MeshElement.GetType(), index(), myNb, and SMDS_MeshElement.NbNodes().

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

{ --(*myNb[ index(el->GetType(), el->NbNodes()) ]); }
void SMDS_MeshInfo::RemoveEdge ( const SMDS_MeshElement el) [private]
void SMDS_MeshInfo::RemoveFace ( const SMDS_MeshElement el) [private]

Definition at line 184 of file SMDS_MeshInfo.hxx.

References SMDS_MeshElement.IsPoly(), and myNbPolygons.

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

{ if ( el->IsPoly() ) --myNbPolygons; else remove( el ); }
void SMDS_MeshInfo::RemoveVolume ( const SMDS_MeshElement el) [private]

Definition at line 188 of file SMDS_MeshInfo.hxx.

References SMDS_MeshElement.IsPoly(), and myNbPolyhedrons.

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

{ if ( el->IsPoly() ) --myNbPolyhedrons; else remove( el ); }

Friends And Related Function Documentation

friend class SMDS_Mesh [friend]

Definition at line 59 of file SMDS_MeshInfo.hxx.


Field Documentation

std::vector<int*> SMDS_MeshInfo.myNb [private]

Definition at line 84 of file SMDS_MeshInfo.hxx.

Referenced by add(), Clear(), NbElements(), remove(), and SMDS_MeshInfo().

Definition at line 76 of file SMDS_MeshInfo.hxx.

Referenced by Clear(), NbElements(), NbEntities(), NbFaces(), and RemoveFace().

std::vector<int> SMDS_MeshInfo.myShift [private]

Definition at line 85 of file SMDS_MeshInfo.hxx.

Referenced by index(), and SMDS_MeshInfo().

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