Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/med.git] / src / MEDMEM / MEDMEM_Grid.hxx
index ac48377829079cbf0c158ae390985b88620107b6..fd79c098aa685216ec41ae12e98f755b8c5e728f 100644 (file)
 #ifndef MEDMEM_Grid_HeaderFile
 #define MEDMEM_Grid_HeaderFile
 
+#include <MEDMEM.hxx>
+
 #include "MEDMEM_Mesh.hxx"
 
 // class containing structured mesh data
 
 namespace MEDMEM {
-class GRID: public MESH
+class MEDMEM_EXPORT GRID: public MESH
 {
  protected:
   //-----------------------//
@@ -61,6 +63,9 @@ class GRID: public MESH
   bool              _is_coordinates_filled;
   bool              _is_connectivity_filled;
 
+  // 4. is _gridType a true value or just a default one
+  bool              _is_default_gridType;
+
   //-----------------------//
   //   Protected Methods
   //-----------------------//
@@ -245,6 +250,9 @@ class GRID: public MESH
   inline bool existConnectivity(MED_EN::medConnectivity ConnectivityType,
                                MED_EN::medEntityMesh Entity) const;
 
+  inline bool existConnectivityWithPoly(MED_EN::medConnectivity ConnectivityType,
+                                        MED_EN::medEntityMesh Entity) const;
+
   inline MED_EN::medGeometryElement getElementType(MED_EN::medEntityMesh Entity,
                                           int Number) const;
 
@@ -418,11 +426,26 @@ inline int GRID::getNumberOfElements(MED_EN::medEntityMesh entity, MED_EN::medGe
     
     // Cas où le nombre d'éléments n'est pas nul
     if (entity==MED_EN::MED_FACE && (Type==MED_EN::MED_QUAD4 || Type==MED_EN::MED_ALL_ELEMENTS) && _spaceDimension>2)
+      if ( _meshDimension == 2 )
        numberOfElements=(_iArrayLength-1)*(_jArrayLength-1);
-    
+      else
+       numberOfElements=
+          (_iArrayLength-1)*(_jArrayLength-1)*_kArrayLength +
+          (_jArrayLength-1)*(_kArrayLength-1)*_iArrayLength +
+          (_iArrayLength-1)*(_kArrayLength-1)*_jArrayLength;
+
     else if (entity==MED_EN::MED_EDGE && (Type==MED_EN::MED_SEG2 || Type==MED_EN::MED_ALL_ELEMENTS) && _spaceDimension>1)
+      if ( _meshDimension == 1 )
        numberOfElements=_iArrayLength-1;
-    
+      else if ( _meshDimension == 2 )
+       numberOfElements=
+          (_iArrayLength-1)*_jArrayLength + (_jArrayLength-1)*_iArrayLength;
+      else
+       numberOfElements=
+          (_iArrayLength-1)*_jArrayLength*_kArrayLength +
+          (_jArrayLength-1)*_kArrayLength*_iArrayLength +
+          (_kArrayLength-1)*_iArrayLength*_jArrayLength;
+
     else if (entity==MED_EN::MED_NODE && (Type==MED_EN::MED_NONE || Type==MED_EN::MED_ALL_ELEMENTS) && _spaceDimension>0)
        numberOfElements=_numberOfNodes;
     
@@ -460,6 +483,15 @@ inline bool GRID::existConnectivity(MED_EN::medConnectivity connectivityType, ME
   return _connectivity->existConnectivity(connectivityType,entity);
 }
 
+/*!
+  Same as the previous
+ */
+inline bool GRID::existConnectivityWithPoly(MED_EN::medConnectivity ConnectivityType,
+                                            MED_EN::medEntityMesh Entity) const
+{
+  return existConnectivity(ConnectivityType,Entity);
+}
+
 /*!
   Return the geometric type of global element Number of entity Entity.