X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMDS%2FSMDS_MeshInfo.hxx;h=250442335d971018fa26b457b03c10410504d036;hp=6196645c7aee159ad6884903936c5fd4a2403f8d;hb=ccb5e3c25bf204e839c0094f50f543eacedba5e6;hpb=6bac08c1a81f34d3f21c550bd92f83654b2546a5 diff --git a/src/SMDS/SMDS_MeshInfo.hxx b/src/SMDS/SMDS_MeshInfo.hxx index 6196645c7..250442335 100644 --- a/src/SMDS/SMDS_MeshInfo.hxx +++ b/src/SMDS/SMDS_MeshInfo.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -25,11 +25,11 @@ #define SMDS_MeshInfo_HeaderFile #include -using namespace std; #include "SMESH_SMDS.hxx" #include "SMDS_MeshElement.hxx" +#include class SMDS_EXPORT SMDS_MeshInfo { @@ -56,7 +56,7 @@ public: inline int NbQuadrangles(SMDSAbs_ElementOrder order = ORDER_ANY) const; int NbBiQuadTriangles() const { return myNbBiQuadTriangles; } int NbBiQuadQuadrangles() const { return myNbBiQuadQuadrangles; } - int NbPolygons() const { return myNbPolygons; } + inline int NbPolygons(SMDSAbs_ElementOrder order = ORDER_ANY) const; inline int NbVolumes (SMDSAbs_ElementOrder order = ORDER_ANY) const; inline int NbTetras (SMDSAbs_ElementOrder order = ORDER_ANY) const; @@ -65,6 +65,8 @@ public: inline int NbPrisms (SMDSAbs_ElementOrder order = ORDER_ANY) const; inline int NbHexPrisms(SMDSAbs_ElementOrder order = ORDER_ANY) const; int NbTriQuadHexas() const { return myNbTriQuadHexas; } + int NbQuadPrisms() const { return myNbQuadPrisms; } + int NbBiQuadPrisms() const { return myNbBiQuadPrisms; } int NbPolyhedrons() const { return myNbPolyhedrons; } protected: @@ -90,12 +92,12 @@ private: int myNbEdges , myNbQuadEdges ; int myNbTriangles , myNbQuadTriangles, myNbBiQuadTriangles ; int myNbQuadrangles, myNbQuadQuadrangles, myNbBiQuadQuadrangles; - int myNbPolygons; + int myNbPolygons , myNbQuadPolygons; int myNbTetras , myNbQuadTetras ; int myNbHexas , myNbQuadHexas, myNbTriQuadHexas; int myNbPyramids, myNbQuadPyramids; - int myNbPrisms , myNbQuadPrisms ; + int myNbPrisms , myNbQuadPrisms, myNbBiQuadPrisms; int myNbHexPrism; int myNbPolyhedrons; @@ -110,11 +112,11 @@ inline SMDS_MeshInfo::SMDS_MeshInfo(): myNbEdges (0), myNbQuadEdges (0), myNbTriangles (0), myNbQuadTriangles (0), myNbBiQuadTriangles(0), myNbQuadrangles(0), myNbQuadQuadrangles(0), myNbBiQuadQuadrangles(0), - myNbPolygons (0), + myNbPolygons (0), myNbQuadPolygons (0), myNbTetras (0), myNbQuadTetras (0), myNbHexas (0), myNbQuadHexas (0), myNbTriQuadHexas(0), myNbPyramids (0), myNbQuadPyramids(0), - myNbPrisms (0), myNbQuadPrisms (0), + myNbPrisms (0), myNbQuadPrisms (0), myNbBiQuadPrisms(0), myNbHexPrism (0), myNbPolyhedrons(0) { @@ -128,48 +130,52 @@ inline SMDS_MeshInfo::SMDS_MeshInfo(): // 0 ------------------ - DON't USE 0!!! // 1 . * . // 2 . * - // 3 . * - // 4 * . . + // 3 . . * + // 4 * . // 5 * // 6 * . - // 7 . * + // 7 . // 8 * . - // 9 . * + // 9 . // 10 * // 11 // 12 * // 13 * // 14 // 15 * - // 16 - // 17 - // 18 * - // 19 * + // 16 * + // 17 * + // 18 * + // 19 // 20 * - // 21 * - // 22 * - // 23 * - // 24 * - // 25 - // 26 + // 21 + // 22 + // 23 + // 24 + // 25 * + // 26 * // 27 * + // 28 * + // 29 * + // 30 * + // 31 * // // 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 ] = +15;// 3->18, 4->19, etc. - myShift[ SMDSAbs_Edge ] = +5; // 2->7, 4->9 + myShift[ SMDSAbs_Face ] = +22;// 3->25, 4->26, etc. + myShift[ SMDSAbs_Edge ] = +14;// 2->16, 3->17 myShift[ SMDSAbs_0DElement ] = +2; // 1->3 myShift[ SMDSAbs_Ball ] = +1; // 1->2 - myNb.resize( index( SMDSAbs_Volume,27 ) + 1, NULL); + myNb.resize( index( SMDSAbs_Face,9 ) + 1, NULL); myNb[ index( SMDSAbs_Node,1 )] = & myNbNodes; myNb[ index( SMDSAbs_0DElement,1 )] = & myNb0DElements; myNb[ index( SMDSAbs_Ball,1 )] = & myNbBalls; myNb[ index( SMDSAbs_Edge,2 )] = & myNbEdges; - myNb[ index( SMDSAbs_Edge,4 )] = & myNbQuadEdges; + myNb[ index( SMDSAbs_Edge,3 )] = & myNbQuadEdges; myNb[ index( SMDSAbs_Face,3 )] = & myNbTriangles; myNb[ index( SMDSAbs_Face,4 )] = & myNbQuadrangles; @@ -186,22 +192,24 @@ inline SMDS_MeshInfo::SMDS_MeshInfo(): myNb[ index( SMDSAbs_Volume, 12)] = & myNbHexPrism; myNb[ index( SMDSAbs_Volume, 13)] = & myNbQuadPyramids; myNb[ index( SMDSAbs_Volume, 15)] = & myNbQuadPrisms; + myNb[ index( SMDSAbs_Volume, 18)] = & myNbBiQuadPrisms; myNb[ index( SMDSAbs_Volume, 20)] = & myNbQuadHexas; myNb[ index( SMDSAbs_Volume, 27)] = & myNbTriQuadHexas; } inline SMDS_MeshInfo& // operator= SMDS_MeshInfo::operator=(const SMDS_MeshInfo& other) -{ for ( int i=0; iGetType(), el->NbNodes()) ]); } inline void // addWithPoly -SMDS_MeshInfo::addWithPoly(const SMDS_MeshElement* el) -{ - if ( el->IsPoly() ) - ++( el->GetType()==SMDSAbs_Face ? myNbPolygons : myNbPolyhedrons ); - else - add(el); +SMDS_MeshInfo::addWithPoly(const SMDS_MeshElement* el) { + switch ( el->GetEntityType() ) { + case SMDSEntity_Polygon: ++myNbPolygons; break; + case SMDSEntity_Quad_Polygon: ++myNbQuadPolygons; break; + case SMDSEntity_Polyhedra: ++myNbPolyhedrons; break; + default: add(el); + } } inline void // RemoveEdge SMDS_MeshInfo::RemoveEdge(const SMDS_MeshElement* el) { if ( el->IsQuadratic() ) --myNbQuadEdges; else --myNbEdges; } inline void // RemoveFace -SMDS_MeshInfo::RemoveFace(const SMDS_MeshElement* el) -{ if ( el->IsPoly() ) --myNbPolygons; else remove( el ); } +SMDS_MeshInfo::RemoveFace(const SMDS_MeshElement* el) { + switch ( el->GetEntityType() ) { + case SMDSEntity_Polygon: --myNbPolygons; break; + case SMDSEntity_Quad_Polygon: --myNbQuadPolygons; break; + default: remove(el); + } +} inline void // RemoveVolume SMDS_MeshInfo::RemoveVolume(const SMDS_MeshElement* el) @@ -242,7 +256,7 @@ SMDS_MeshInfo::NbEdges (SMDSAbs_ElementOrder order) const inline int // NbFaces SMDS_MeshInfo::NbFaces (SMDSAbs_ElementOrder order) const -{ return NbTriangles(order)+NbQuadrangles(order)+(order == ORDER_QUADRATIC ? 0 : myNbPolygons); } +{ return NbTriangles(order)+NbQuadrangles(order)+(order == ORDER_ANY ? myNbPolygons+myNbQuadPolygons : order == ORDER_LINEAR ? myNbPolygons : myNbQuadPolygons ); } inline int // NbTriangles SMDS_MeshInfo::NbTriangles (SMDSAbs_ElementOrder order) const @@ -252,6 +266,10 @@ inline int // NbQuadrangles SMDS_MeshInfo::NbQuadrangles(SMDSAbs_ElementOrder order) const { return order == ORDER_ANY ? myNbQuadrangles+myNbQuadQuadrangles+myNbBiQuadQuadrangles : order == ORDER_LINEAR ? myNbQuadrangles : myNbQuadQuadrangles+myNbBiQuadQuadrangles; } +inline int // NbPolygons +SMDS_MeshInfo::NbPolygons(SMDSAbs_ElementOrder order) const +{ return order == ORDER_ANY ? myNbPolygons+myNbQuadPolygons : order == ORDER_LINEAR ? myNbPolygons : myNbQuadPolygons; } + inline int // NbVolumes SMDS_MeshInfo::NbVolumes (SMDSAbs_ElementOrder order) const { return NbTetras(order) + NbHexas(order) + NbPyramids(order) + NbPrisms(order) + NbHexPrisms(order) + (order == ORDER_QUADRATIC ? 0 : myNbPolyhedrons); } @@ -270,7 +288,7 @@ SMDS_MeshInfo::NbPyramids(SMDSAbs_ElementOrder order) const inline int // NbPrisms SMDS_MeshInfo::NbPrisms (SMDSAbs_ElementOrder order) const -{ return order == ORDER_ANY ? myNbPrisms+myNbQuadPrisms : order == ORDER_LINEAR ? myNbPrisms : myNbQuadPrisms; } +{ return order == ORDER_ANY ? myNbPrisms+myNbQuadPrisms+myNbBiQuadPrisms: order == ORDER_LINEAR ? myNbPrisms : myNbQuadPrisms+myNbBiQuadPrisms; } inline int // NbHexPrisms SMDS_MeshInfo::NbHexPrisms (SMDSAbs_ElementOrder order) const @@ -282,18 +300,18 @@ SMDS_MeshInfo::NbElements(SMDSAbs_ElementType type) const int nb = 0; switch (type) { case SMDSAbs_All: - for ( int i=1+index( SMDSAbs_Node,1 ); i