Salome HOME
Update French translation file
[modules/smesh.git] / src / SMDS / SMDS_MeshInfo.hxx
index 09e6d58637ea5d9a2e42a15640d57461c3a30857..87a096f038ab90d75f7f472b8a0aef57c856fb4d 100644 (file)
@@ -35,6 +35,7 @@ class SMDS_EXPORT SMDS_MeshInfo
 public:
 
   inline SMDS_MeshInfo();
+  inline SMDS_MeshInfo& operator=(const SMDS_MeshInfo& other);
   inline void Clear();
 
   int NbNodes() const { return myNbNodes; }
@@ -55,6 +56,9 @@ public:
   inline int NbPrisms  (SMDSAbs_ElementOrder order = ORDER_ANY) const;
   int NbPolyhedrons() const { return myNbPolyhedrons; }
 
+protected:
+  inline void addWithPoly(const SMDS_MeshElement* el);
+
 private:
   friend class SMDS_Mesh;
 
@@ -98,23 +102,23 @@ inline SMDS_MeshInfo::SMDS_MeshInfo():
   myNbPrisms  (0), myNbQuadPrisms  (0),
   myNbPolyhedrons(0)
 {
-  // Number of nodes in standard element types
+  // Number of nodes in standard element types (. - actual nb, * - after the shift)
   // n   v  f  e  0  n
   // o   o  a  d  d  o
   // d   l  c  g     d
   // e      e  e     e
   // s
   // -----------------
-  // 0         *
+  // 0                  - DON't USE 0!!!
   // 1            .  *
-  // 2         *
+  // 2         .
   // 3      .     *
   // 4   *  .  .
   // 5   *
   // 6   *  .
-  // 7
+  // 7         *
   // 8   *  .
-  // 9
+  // 9         *
   // 10  *
   // 11     *
   // 12     *
@@ -131,7 +135,7 @@ inline SMDS_MeshInfo::SMDS_MeshInfo():
   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_Edge      ] = +5; // 2->7, 4->9
   myShift[ SMDSAbs_0DElement ] = +2; // 1->3
 
   myNb.resize( index( SMDSAbs_Volume,20 ) + 1, NULL);
@@ -158,6 +162,14 @@ inline SMDS_MeshInfo::SMDS_MeshInfo():
   myNb[ index( SMDSAbs_Volume, 20)] = & myNbQuadHexas;   
 }
 
+inline SMDS_MeshInfo& // operator=
+SMDS_MeshInfo::operator=(const SMDS_MeshInfo& other)
+{ for ( int i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=(*other.myNb[i]);
+  myNbPolygons = other.myNbPolygons;
+  myNbPolyhedrons = other.myNbPolyhedrons;
+  return *this;
+}
+
 inline void // Clear
 SMDS_MeshInfo::Clear()
 { for ( int i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=0;
@@ -176,6 +188,14 @@ inline void // add
 SMDS_MeshInfo::add(const SMDS_MeshElement* el)
 { ++(*myNb[ index(el->GetType(), el->NbNodes()) ]); }
 
+inline void // addWithPoly
+SMDS_MeshInfo::addWithPoly(const SMDS_MeshElement* el)
+{
+  if ( el->IsPoly() )
+    ++( el->GetType()==SMDSAbs_Face ? myNbPolygons : myNbPolyhedrons );
+  else
+    add(el);
+}
 inline void // RemoveEdge
 SMDS_MeshInfo::RemoveEdge(const SMDS_MeshElement* el)
 { if ( el->IsQuadratic() ) --myNbQuadEdges; else --myNbEdges; }