Salome HOME
update after merging trhe branches CEA_V3_0_x, OCC_V3_1_0_a1_x, and the main
[modules/med.git] / src / MEDMEM / tests / testUCellModel.cxx
index d8119e65c83eb0bb6fff4ea69c95864a9238721c..04ec6df9f0aac3031be3179cdad9f43deea42b47 100755 (executable)
 //  File   : testUCellModel.cxx
 //  Module : MED
 
-using namespace std;
 #include <set>
 #include <cstdlib> 
-#include "utilities.h"
+#include "MEDMEM_Utilities.hxx"
 
 #include "MEDMEM_CellModel.hxx"
 #include "MEDMEM_define.hxx"
 #include "MEDMEM_DriversDef.hxx"
 
+using namespace std;
+using namespace MEDMEM;
+using namespace MED_EN;
+
+#define MED_NBR_GEOMETRIE_MAILLE 15
+
 void usage(char * name)
 {
   cout << "    " << name << endl;
@@ -45,140 +50,140 @@ int main (int argc, char ** argv)
   cout << "CELLMODEL Test" << endl ;
   cout << "--------------" << endl;
 
-/*     -----------------------------------------------------
+  /*   -----------------------------------------------------
        Construction de tous les types de cellmodel possibles
        -----------------------------------------------------
-*/
+  */
 
-   CELLMODEL * tous  =new CELLMODEL[MED_NBR_GEOMETRIE_MAILLE ];
-   const medGeometryElement  allCellType[MED_NBR_GEOMETRIE_MAILLE ]=
-            {MED_POINT1, MED_SEG2,    MED_SEG3,   MED_TRIA3,
-              MED_QUAD4,  MED_TRIA6,   MED_QUAD8,  MED_TETRA4,
-              MED_PYRA5,  MED_PENTA6,  MED_HEXA8,  MED_TETRA10,
-              MED_PYRA13, MED_PENTA15, MED_HEXA20 };
+  CELLMODEL * tous  =new CELLMODEL[MED_NBR_GEOMETRIE_MAILLE ];
+  const medGeometryElement  allCellType[MED_NBR_GEOMETRIE_MAILLE ]=
+    {MED_POINT1, MED_SEG2,    MED_SEG3,   MED_TRIA3,
+     MED_QUAD4,  MED_TRIA6,   MED_QUAD8,  MED_TETRA4,
+     MED_PYRA5,  MED_PENTA6,  MED_HEXA8,  MED_TETRA10,
+     MED_PYRA13, MED_PENTA15, MED_HEXA20 };
 
   for (int i=0; i<MED_NBR_GEOMETRIE_MAILLE ; i++)
-  {
-       tous[i]=CELLMODEL(allCellType[i]);
-  }
+    {
+      tous[i]=CELLMODEL(allCellType[i]);
+    }
 
-/*     -----------------------------------------------------
+  /*   -----------------------------------------------------
        Boucle sur  tous les types de cellmodel possibles
        - Chaque Méthode de cellmodel est appelee
        -----------------------------------------------------
-*/
+  */
   for (int i=0; i<MED_NBR_GEOMETRIE_MAILLE ; i++)
-  {
-       cout << endl;
-       cout << MED_FR::geoNames[(MED_FR::med_geometrie_element)tous[i].getType()] << endl;
-        cout << "__________________"  << endl;
+    {
+      cout << endl;
+      cout << geoNames[tous[i].getType()] << endl;
+      cout << "__________________"  << endl;
 
-       try 
+      try 
        {
-               cout << "CellModel de Nom : " << tous[i].getName() << endl;
+         cout << "CellModel de Nom : " << tous[i].getName() << endl;
        }
-       catch ( const std::exception &e )
+      catch ( const std::exception &e )
        {
-                       cout << "-------------------------------" << endl;
-               cout << "       Pb au getName()         " << endl;
-               cout << "-------------------------------" << endl;
-               MESSAGE( "catched exception : " << e.what() ) ;
-               return EXIT_FAILURE ;
+         cout << "-------------------------------" << endl;
+         cout << "     Pb au getName()         " << endl;
+         cout << "-------------------------------" << endl;
+         MESSAGE( "catched exception : " << e.what() ) ;
+         return EXIT_FAILURE ;
        }
-       catch (...)
+      catch (...)
        {
-               cout << "-------------------------------" << endl;
-               cout << "       Pb au getName()         " << endl;
-               cout << "-------------------------------" << endl;
-               return EXIT_FAILURE ;
+         cout << "-------------------------------" << endl;
+         cout << "     Pb au getName()         " << endl;
+         cout << "-------------------------------" << endl;
+         return EXIT_FAILURE ;
        };
 
-       try 
+      try 
        {
-               cout << "Nb de Vertexes   : " << tous[i].getNumberOfVertexes() << endl;
+         cout << "Nb de Vertexes   : " << tous[i].getNumberOfVertexes() << endl;
        }
-       catch ( const std::exception &e )
+      catch ( const std::exception &e )
        {
-                       cout << "-------------------------------" << endl;
-               cout << "       Pb au getNumberOfVertexes()     " << endl;
-               cout << "-------------------------------" << endl;
-               MESSAGE( "catched exception : " << e.what() ) ;
-               return EXIT_FAILURE ;
+         cout << "-------------------------------" << endl;
+         cout << "     Pb au getNumberOfVertexes()     " << endl;
+         cout << "-------------------------------" << endl;
+         MESSAGE( "catched exception : " << e.what() ) ;
+         return EXIT_FAILURE ;
        }
-       catch (...)
+      catch (...)
        {
-               cout << "---------------------------------------" << endl;
-               cout << "       Pb au getNumberOfVertexes()     " << endl;
-               cout << "---------------------------------------" << endl;
-               return EXIT_FAILURE ;
+         cout << "---------------------------------------" << endl;
+         cout << "     Pb au getNumberOfVertexes()     " << endl;
+         cout << "---------------------------------------" << endl;
+         return EXIT_FAILURE ;
        };
 
-       try 
+      try 
        {
-               cout << "Nb de Noeuds     : " << tous[i].getNumberOfNodes() << endl;
+         cout << "Nb de Noeuds     : " << tous[i].getNumberOfNodes() << endl;
        }
-       catch ( const std::exception &e )
+      catch ( const std::exception &e )
        {
-                       cout << "-------------------------------" << endl;
-               cout << "       Pb au getNumberOfNodes()  " << endl;
-               cout << "-------------------------------" << endl;
-               MESSAGE( "catched exception : " << e.what() ) ;
-               return EXIT_FAILURE ;
+         cout << "-------------------------------" << endl;
+         cout << "     Pb au getNumberOfNodes()  " << endl;
+         cout << "-------------------------------" << endl;
+         MESSAGE( "catched exception : " << e.what() ) ;
+         return EXIT_FAILURE ;
        }
-       catch (...)
+      catch (...)
        {
-               cout << "---------------------------------" << endl;
-               cout << "       Pb au getNumberOfNodes()  " << endl;
-               cout << "---------------------------------" << endl;
-               return EXIT_FAILURE ;
+         cout << "---------------------------------" << endl;
+         cout << "     Pb au getNumberOfNodes()  " << endl;
+         cout << "---------------------------------" << endl;
+         return EXIT_FAILURE ;
        };
 
-       int dimension;
-       try 
+      int dimension;
+      try 
        {
-               dimension=tous[i].getDimension();
-               cout << "Dimension        : " << dimension << endl;     
+         dimension=tous[i].getDimension();
+         cout << "Dimension        : " << dimension << endl;   
        }
-       catch ( const std::exception &e )
+      catch ( const std::exception &e )
        {
-                       cout << "-------------------------------" << endl;
-               cout << "       Pb au getDimension()    " << endl;
-               cout << "-------------------------------" << endl;
-               MESSAGE( "catched exception : " << e.what() ) ;
-               return EXIT_FAILURE ;
+         cout << "-------------------------------" << endl;
+         cout << "     Pb au getDimension()    " << endl;
+         cout << "-------------------------------" << endl;
+         MESSAGE( "catched exception : " << e.what() ) ;
+         return EXIT_FAILURE ;
        }
-       catch (...)
+      catch (...)
        {
-               cout << "-------------------------------" << endl;
-               cout << "       Pb au getDimension()    " << endl;
-               cout << "-------------------------------" << endl;
-               return EXIT_FAILURE ;
+         cout << "-------------------------------" << endl;
+         cout << "     Pb au getDimension()    " << endl;
+         cout << "-------------------------------" << endl;
+         return EXIT_FAILURE ;
        }
 
-       for (int dim=1; dim< dimension; dim++)
+      for (int dim=1; dim< dimension; dim++)
        {
-               int dim2=dimension - dim;
-               cout << "Nb d elements de dimension " << dim << " : ";
+         int dim2=dimension - dim;
+         cout << "Nb d elements de dimension " << dim << " : ";
 
-               try
-               {
-                       cout << tous[i].getNumberOfConstituents(dim)<< endl;
-               }
-               catch ( const std::exception &e )
-               {
-                               cout << "------------------------------------" << endl;
-                       cout << "  Pb au getNumberOfConstituents()   " << endl;
-                       cout << "------------------------------------" << endl;
-                       MESSAGE( "catched exception : " << e.what() ) ;
-                       return EXIT_FAILURE ;
-               }
-               catch (...)
-               {
-                       cout << "------------------------------------" << endl;
-                       cout << "  Pb au getNumberOfConstituents()   " << endl;
-                       cout << "------------------------------------" << endl;
-                       return EXIT_FAILURE ;
-               };
+         try
+           {
+             cout << tous[i].getNumberOfConstituents(dim)<< endl;
+           }
+         catch ( const std::exception &e )
+           {
+             cout << "------------------------------------" << endl;
+             cout << "  Pb au getNumberOfConstituents()   " << endl;
+             cout << "------------------------------------" << endl;
+             MESSAGE( "catched exception : " << e.what() ) ;
+             return EXIT_FAILURE ;
+           }
+         catch (...)
+           {
+             cout << "------------------------------------" << endl;
+             cout << "  Pb au getNumberOfConstituents()   " << endl;
+             cout << "------------------------------------" << endl;
+             return EXIT_FAILURE ;
+           };
        }
 /*
 
@@ -262,12 +267,12 @@ int main (int argc, char ** argv)
                                return EXIT_FAILURE ;
                        }
                }
-
+*/
 /*
                set <medGeometryElement>::iterator iter_s;
                for (iter_s=setGeomElt.begin() ;iter_s!=setGeomElt.end();iter_s++)
                {
-                       cout << MED_FR::geoNames[(MED_FR::med_geometrie_element)(*iter_s)] << endl;     
+                       cout << geoNames[(*iter_s)] << endl;    
                }
                
                cout << "Impression des coordonnées du 1er Element de ce type" << endl;
@@ -322,7 +327,7 @@ int main (int argc, char ** argv)
                }
 */
 
-       cout << endl;
+      cout << endl;
 /*
        if ( dimension > 1 )
        {
@@ -333,7 +338,7 @@ int main (int argc, char ** argv)
                        for (iter_s=tous[i].getAllConstituentsType().begin() ;
                        iter_s!=tous[i].getAllConstituentsType().end();iter_s++)
                        {
-                               cout << MED_FR::geoNames[(MED_FR::med_geometrie_element)(*iter_s)] << endl;     
+                               cout << geoNames[*iter_s] << endl;      
                        }
                }
                catch ( const std::exception &e )
@@ -354,13 +359,13 @@ int main (int argc, char ** argv)
        }
 */
 
-  }
+    }
 
   delete[] tous ;
 
   return EXIT_SUCCESS ;
 /*
-Reste a Tester
+  Reste a Tester
   // Return number of constituents foreach type (which dimension is _dimension-1).
   map <medGeometryElement,int>  getNumberOfConstituentsForeachType() const; 
 */