Salome HOME
correct small problem from the version in the MedFileV2_2 branch.
authornadir <nadir>
Wed, 28 Apr 2004 14:26:10 +0000 (14:26 +0000)
committernadir <nadir>
Wed, 28 Apr 2004 14:26:10 +0000 (14:26 +0000)
src/MEDMEM/MEDMEM_MedMeshDriver.cxx
src/MEDMEM/MEDMEM_PointerOf.hxx
src/MEDMEM_SWIG/med_test_grid.py
src/MEDMEM_SWIG/testMedMemGeneral.py

index 71a351db2e2486c37c32b79199746fae0c87f384..5ab0ffca77b602de61add1c9a00d2156572f0577 100644 (file)
@@ -372,10 +372,7 @@ void MED_MESH_RDONLY_DRIVER::getGRID()
       if (gridType == MED_EN::MED_GRILLE_CARTESIENNE)
        rep = MED_FR::MED_CART;
       else if (gridType == MED_EN::MED_GRILLE_POLAIRE)
-       {
-         if (SpaceDimension == 2) rep = MED_FR::MED_CYL;
-         else if (SpaceDimension == 3) rep = MED_FR::MED_SPHER;
-       }
+       rep = MED_FR::MED_CYL;
     }
   else
     throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<" bad grid type : " << gridType));
index be3201043b2a4ffd0c656516744a4e4b54dedf64..a5f0bdce3eb329856020f8d7171a148fc23f7f47 100644 (file)
 #include "MEDMEM_Exception.hxx"
 
 /*!
-       The template class PointerOf embedding a standard pointer (_pointer) is in charge of
-       managing the pointed memory.\n
-       
-        the object PointerOf is the memory owner if a size is given at object construction.
-        In these cases, memory will be desallocated at object destruction. In all other cases,
-       the desallocator will only nullify pointers.
+  The template class PointerOf embedding a standard pointer (_pointer) is in
+  charge of managing the pointed memory.\n
+
+  the object PointerOf is the memory owner if a size is given at object
+  construction. In these cases, memory will be desallocated at object
+  destruction. In all other cases, the desallocator will only nullify pointers.
 */
 namespace MEDMEM {
 
 template <typename T> class PointerOf
 {
 protected :
-                       /*! pointer to the pointed memory */
-       T* _pointer ;
-                       /*! boolean setted to true if memory has to be desallocated */
-       bool _done ;
+  /*!
+    pointer to the pointed memory
+  */
+
+  T* _pointer ;
+
+  /*!
+    boolean setted to true if memory has to be desallocated
+  */
+
+  bool _done ;
 
 public :
-       PointerOf() ;
-       ~PointerOf() ;
-       PointerOf( const int &size ) ;
-       PointerOf( const T *pointer ) ;
-       PointerOf( const int &size, const T *pointer ) ;
-       PointerOf( const PointerOf<T> & pointerOf ) ;
-       PointerOf( const int &size, const PointerOf<T> & pointerOf ) ;
-       operator T*() ;
-       operator const T*() const ;
-       void set( const int &size ) ;
-       void set( const T *pointer ) ;
-       void set( const int &size, const T *pointer ) ;
-       PointerOf<T>& operator=( const PointerOf<T> &pointer ) ;
+  PointerOf() ;
+  ~PointerOf() ;
+  PointerOf( const int &size ) ;
+  PointerOf( const T *pointer ) ;
+  PointerOf( const int &size, const T *pointer ) ;
+  PointerOf( const PointerOf<T> & pointerOf ) ;
+  PointerOf( const int &size, const PointerOf<T> & pointerOf ) ;
+  operator T*() ;
+  operator const T*() const ;
+  void set( const int &size ) ;
+  void set( const T *pointer ) ;
+  void set( const int &size, const T *pointer ) ;
+  PointerOf<T>& operator=( const PointerOf<T> &pointer ) ;
 } ;
 } ;
 
-// ------------------------------------------------------------ //
-//                                                             //
-//                     Implementation                          //
-//                                                             //
-// ------------------------------------------------------------ //
+/*
+  Implementation
+*/
 
 using namespace MEDMEM;
 
-/*! Creates a null T* pointer and sets the boolean (for desallocation) to false. */
+/*!
+  Creates a null T* pointer and sets the boolean (for desallocation) to false.
+*/
+
 template <typename T> PointerOf<T>::PointerOf() : _pointer(0), _done(false)
 {
+  BEGIN_OF("PointerOf<T>::PointerOf() empty constructor");
+  END_OF("PointerOf<T>::PointerOf() empty constructor");
 }
 
-/*! Creates a standard T* pointer to the pointed memory. \n
-    The boolean for desallocation is setted to false. \n
-    Be aware : \n
-    - The "old" PointerOf always has propriety of the pointed memory. \n
-    - If the "old" PointerOf is detroyed, the "new" PointerOf points
-      a desallocated memory zone. */
+/* !
+   Creates a standard T* pointer to the pointed memory. \n
+   The boolean for desallocation is setted to false. \n
+   Be aware : \n
+   - The "old" PointerOf always has propriety of the pointed memory. \n
+   - If the "old" PointerOf is detroyed, the "new" PointerOf points
+   a desallocated memory zone.
+*/
+
 template <typename T> PointerOf<T>::PointerOf(const PointerOf<T> & pointerOf) :
   _pointer((T*)(const T* const)pointerOf), _done(false)
 {
-       BEGIN_OF("PointerOf<T>::PointerOf(const PointerOf<T> & pointerOf)");
-       MESSAGE("Warning ! No Propriety Transfer");
-       END_OF  ("PointerOf<T>::PointerOf(const PointerOf<T> & pointerOf)");
+  BEGIN_OF("PointerOf<T>::PointerOf(const PointerOf<T> & pointerOf)");
+  MESSAGE("Warning ! No Propriety Transfer");
+  END_OF  ("PointerOf<T>::PointerOf(const PointerOf<T> & pointerOf)");
 }
 
 /*! 
   Duplicate array of size size pointed in pointerOf.
 */
+
 template <typename T> PointerOf<T>::PointerOf( const int &size, const PointerOf<T> & pointerOf) : 
   _pointer((size,(T*)pointerOf))
 {
 }
 
-/*! If size <= 0, creates a null "T*" pointer\n
-    Else allocates memory and sets desallocation boolean to true./n
-    Memory will be desallocated  when erasing this PointerOf*/
+/*!
+  If size <= 0, creates a null "T*" pointer\n
+  Else allocates memory and sets desallocation boolean to true./n
+  Memory will be desallocated  when erasing this PointerOf
+*/
+
 template <typename T> PointerOf<T>::PointerOf( const int &size )
 {
-        if (size <= 0)
-        {
-                _pointer=(T*)NULL;
-               _done=false;
-        }
-        else
-        {
-                _pointer = new T[ size ] ;
-               _done=true;
-        }
+  if (size <= 0)
+    {
+      _pointer=(T*)NULL;
+      _done=false;
+    }
+  else
+    {
+      _pointer = new T[ size ] ;
+      _done=true;
+    }
 }
 
 /*! Creates a standard pointer to the memory zone pointed by T*. /n
-   T* owner is in charged of memory desallocation. /n
-   Memory will not be released when erasing this PointerOf*/
+  T* owner is in charged of memory desallocation. /n
+  Memory will not be released when erasing this PointerOf
+*/
+
 template <typename T> PointerOf<T>::PointerOf( const T* pointer ) : _pointer( (T*)pointer ), _done(false)
 {
 }
 
-/*! If size <= 0, return an exception\n
-    Else duplicate array and sets desallocation boolean to true./n
-    Memory will be desallocated  when erasing this PointerOf*/
+/*!
+  If size <= 0, return an exception\n
+  Else duplicate array and sets desallocation boolean to true./n
+  Memory will be desallocated  when erasing this PointerOf
+*/
+
 template <typename T> PointerOf<T>::PointerOf( const int &size, const T* pointer)
 {
   if (size <= 0)
     throw MEDEXCEPTION("PointerOf( const int,const T*) : array size <= 0");
-
+  
   _pointer = new T[ size ] ;
   memcpy(_pointer,pointer,size*sizeof(T));
   _done=true;
 }
 
-/*! The destuctor desallocates memory if necessary (that is if the attribute _done equals true).\n
-    The attribute _pointer is nullified */
+/*!
+  The destuctor desallocates memory if necessary (that is if the attribute
+  _done equals true).\n
+  The attribute _pointer is nullified
+*/
+
 template <typename T> PointerOf<T>::~PointerOf()
 {
-       if ( _pointer )
+  if ( _pointer )
+    {
+      if( _done )
+       {
+         MESSAGE("PointerOf<T>::~PointerOf() --> deleting _pointer") ;
+         delete [] _pointer ;
+         _done = false ;
+       }
+      else
        {
-               if( _done )
-               {
-                       MESSAGE("PointerOf<T>::~PointerOf() --> deleting _pointer") ;
-                       delete [] _pointer ;
-                       _done = false ;
-               }
-               else
-               {
-                       MESSAGE("_pointer is only nullified") ;
-               }
-               _pointer = 0 ;
+         MESSAGE("_pointer is only nullified") ;
        }
+      _pointer = 0 ;
+    }
 }
 
-/*! Creates a standard pointer (T*) to the pointed memory. \n
-    The boolean for desallocation is setted to false. \n
-    Be aware : \n
-    - The "right" PointerOf always has propriety of the pointed memory. \n
-    - If the "right" PointerOf is detroyed, the "left" PointerOf points
-      a desallocated memory zone.
-    - it works the same way as PointerOf(const PointerOf<T> & pointerOf) */
+/*!
+  Creates a standard pointer (T*) to the pointed memory. \n
+  The boolean for desallocation is setted to false. \n
+  Be aware : \n
+  - The "right" PointerOf always has propriety of the pointed memory. \n
+  - If the "right" PointerOf is detroyed, the "left" PointerOf points
+  a desallocated memory zone.
+  - it works the same way as PointerOf(const PointerOf<T> & pointerOf)
+*/
+
 template <typename T> PointerOf<T>& PointerOf<T>::operator=( const PointerOf<T> &pointer )
 {
-       BEGIN_OF("PointerOf<T>::operator=( const PointerOf<T> &pointer )") ;
-       if ( &pointer != this )
-       {
-               this->set( pointer._pointer ) ;
-       }
-       END_OF("PointerOf<T>::operator=( const PointerOf<T> &pointer )") ;
-       return *this ;
+  BEGIN_OF("PointerOf<T>::operator=( const PointerOf<T> &pointer )") ;
+  if ( &pointer != this )
+    {
+      this->set( pointer._pointer ) ;
+    }
+  END_OF("PointerOf<T>::operator=( const PointerOf<T> &pointer )") ;
+  return *this ;
 }
 
-/*! Returns _pointer.*/
+/*!
+  Returns _pointer.
+*/
+
 template <typename T> PointerOf<T>::operator T*()
 {
-       return _pointer ;
+  return _pointer ;
 }
 
+/*!
+  Returns _pointer.
+*/
 
-/*! Returns _pointer.*/
 template <typename T> PointerOf<T>::operator const T*() const
 {
-       return _pointer ;
+  return _pointer ;
 }
 
+/*!
+  If necessary, released memory holded by PointerOf/n.
+  Else allocates memory and sets desallocation boolean to true./n
+  Can be used in order to "nullify" an existing PointerOf/n
+  Memory will be desallocated  when erasing this PointerOf
+*/
 
-/*! If necessary, released memory holded by PointerOf/n.
-    Else allocates memory and sets desallocation boolean to true./n
-    Can be used in order to "nullify" an existing PointerOf/n
-    Memory will be desallocated  when erasing this PointerOf*/
 template <typename T> void PointerOf<T>::set( const int &size )
 {
-       if ( _pointer && _done )
-       {
-               delete [] _pointer ;
-               _pointer=0 ;
-       }
-       if (size <= 0)
-       {
-               _pointer=(T*)NULL;
-       }
-       else
-       {
-               _pointer = new T[ size ] ;
-       }
-       _done = true ;
-       return ;
+  if ( _pointer && _done )
+    {
+      delete [] _pointer ;
+      _pointer=0 ;
+    }
+  if (size <= 0)
+    {
+      _pointer=(T*)NULL;
+    }
+  else
+    {
+      _pointer = new T[ size ] ;
+    }
+  _done = true ;
 }
 
 /*! If necessary, released memory holded by PointerOf/n.
     Then, sets _pointer to the memory zone pointed by T*. /n
     T* owner is in charged of memory desallocation. /n
     memory will not be released when erasing this PointerOf*/
+
 template <typename T> void PointerOf<T>::set( const T *pointer )
 {
-       MESSAGE( "BEGIN PointerOf<T>::set( const T *pointer )" ) ;
-       SCRUTE(pointer) ;
-       SCRUTE(_done) ;
-       if ( _pointer && _done )
-       {
-               MESSAGE("PointerOf<T>::set --> deleting _pointer") ;
-               delete [] _pointer ;
-               _pointer=0 ;
-               _done=false ;
-       }
-       _pointer=(T*)pointer ;
-       _done=false ;
-       MESSAGE( "END PointerOf<T>::set( const T *pointer )" ) ;
-       return ;
+  MESSAGE( "BEGIN PointerOf<T>::set( const T *pointer )" ) ;
+  SCRUTE(pointer) ;
+  SCRUTE(_done) ;
+  if ( _pointer && _done )
+    {
+      MESSAGE("PointerOf<T>::set --> deleting _pointer") ;
+      delete [] _pointer ;
+      _pointer=0 ;
+      _done=false ;
+    }
+  _pointer=(T*)pointer ;
+  _done=false ;
+  MESSAGE( "END PointerOf<T>::set( const T *pointer )" ) ;
 }
 
-/*! If necessary, released memory holded by PointerOf/n.
-    If size <= 0, return an exception\n.
-    Else allocates memory and sets desallocation boolean to true./n
-    Can be used in order to "nullify" an existing PointerOf/n
-    Memory will be desallocated  when erasing this PointerOf*/
+/*!
+  If necessary, released memory holded by PointerOf/n.
+  If size <= 0, return an exception\n.
+  Else allocates memory and sets desallocation boolean to true./n
+  Can be used in order to "nullify" an existing PointerOf/n
+  Memory will be desallocated  when erasing this PointerOf
+*/
+
 template <typename T> void PointerOf<T>::set( const int &size, const T *pointer)
 {
   if ( _pointer && _done )
@@ -227,8 +265,6 @@ template <typename T> void PointerOf<T>::set( const int &size, const T *pointer)
   _pointer = new T[ size ] ;
   memcpy(_pointer,pointer,size*sizeof(T));
   _done=true;
-
-  return ;
 }
 
 # endif                /* # if ! defined( __PointerOf_HXX__ ) */
index 437d72dadd930aa6bbc0606aeb4248df5b1cd8f7..53c29d804f7e98022227c3786417eaba68cceaf6 100755 (executable)
@@ -61,7 +61,7 @@ if K != 0:
 
 grid_type = grid.getGridType()
 print "grid_type =", grid_type
-if grid_type != MED_CARTESIAN:
+if grid_type != MED_GRILLE_CARTESIENNE:
   raise  RuntimeError, "Wrong grid type"
 
 spaceDim = grid.getSpaceDimension()
@@ -256,7 +256,7 @@ if K != 0:
 
 grid_type = grid.getGridType()
 print "grid_type =", grid_type
-if grid_type != MED_BODY_FITTED:
+if grid_type != MED_GRILLE_STANDARD:
   raise  RuntimeError, "Wrong grid type"
 
 spaceDim = grid.getSpaceDimension()
index e5db5c69363fc91114d3785616e36b003eafefd5..9d64fec29820e0dbdd184bc126ce92eec404ee70 100755 (executable)
@@ -237,8 +237,8 @@ for i in range(nbOfFiles):
         meshDriver.close()
         print "The mesh stored in the file ",file," is perhaps a GRID."
         try:
-            print "... of MED_CARTESIAN type ?"
-            type = MED_CARTESIAN
+            print "... of MED_GRILLE_CARTESIENNE type ?"
+            type = MED_GRILLE_CARTESIENNE
             mesh = GRID()
             mesh.setGridType(type)
             if (extensionFile == "med"):
@@ -258,9 +258,9 @@ for i in range(nbOfFiles):
         except:
             meshDriver.close()
             try:
-                print "... of MED_POLAR type ?"
+                print "... of MED_GRILLE_POLAIRE type ?"
                 mesh = GRID()
-                type = MED_POLAR
+                type = MED_GRILLE_POLAIRE
                 mesh.setGridType(type)
                 if (extensionFile == "med"):
                     meshDriver = MED_MESH_RDONLY_DRIVER(file,mesh)
@@ -275,9 +275,9 @@ for i in range(nbOfFiles):
                 meshDriver.read()
             except:
                 meshDriver.close()
-                print "... of MED_BODY_FITTED type ?"
+                print "... of MED_GRILLE_STANDARD type ?"
                 mesh = GRID()
-                type = MED_BODY_FITTED
+                type = MED_GRILLE_STANDARD
                 mesh.setGridType(type)
                 if (extensionFile == "med"):
                     meshDriver = MED_MESH_RDONLY_DRIVER(file,mesh)