Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / MEDMEM / MEDMEM_MedMedDriver22.cxx
index c039eeaf66593225ef6a4c1e6c66907e1a10716f..5ecd9b11811d8f85c6483c69091d37e865cd6724 100644 (file)
@@ -1,21 +1,23 @@
-// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either 
-// version 2.1 of the License.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-// Lesser General Public License for more details.
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 #include "MEDMEM_Compatibility21_22.hxx"
 # include "MEDMEM_MedMedDriver22.hxx"
@@ -58,7 +60,7 @@ MED_MED_DRIVER22::MED_MED_DRIVER22(const MED_MED_DRIVER22 & driver):
 
 MED_MED_DRIVER22::~MED_MED_DRIVER22()
 {
-  MESSAGE("MED_MED_DRIVER22::~MED_MED_DRIVER22() has been destroyed");
+  MESSAGE_MED("MED_MED_DRIVER22::~MED_MED_DRIVER22() has been destroyed");
 }
 
 //  GENDRIVER * MED_MED_DRIVER::copy(void) const
@@ -89,7 +91,7 @@ void MED_MED_DRIVER22::open()
 {
 
   const char * LOC ="MED_MED_DRIVER22::open() : ";
-  BEGIN_OF(LOC);
+  BEGIN_OF_MED(LOC);
 
   // REFLECHIR SUR CE TEST PAR RAPPORT A L'OUVERTURE/FERMETURE
 //    if ( _medIdt != MED_INVALID ) 
@@ -113,10 +115,10 @@ void MED_MED_DRIVER22::open()
                           );
 
   int accessMode = getMedAccessMode( _accessMode, MED_EN::V22 );
-  MESSAGE(LOC<<"_fileName.c_str : "<< _fileName.c_str()<<",mode : "<< accessMode);
+  MESSAGE_MED(LOC<<"_fileName.c_str : "<< _fileName.c_str()<<",mode : "<< accessMode);
 
   _medIdt = med_2_3::MEDouvrir( (const_cast <char *> (_fileName.c_str())), (med_2_3::med_mode_acces) accessMode);
-  MESSAGE(LOC<<" _medIdt = "<<_medIdt);
+  MESSAGE_MED(LOC<<" _medIdt = "<<_medIdt);
   
   if (_medIdt > 0) 
     _status=MED_OPENED; 
@@ -130,14 +132,13 @@ void MED_MED_DRIVER22::open()
                          );
   }
 
-  END_OF(LOC);
+  END_OF_MED(LOC);
 }
 
 
 void MED_MED_DRIVER22::close()
 {
   med_2_3::med_int err = 0;
-  const char * LOC = "MED_MED_DRIVER22::close() : ";
   
   
 //    if ( _status == MED_CLOSED)
@@ -164,7 +165,7 @@ void MED_MED_DRIVER22::close()
   _status = MED_CLOSED;
   _medIdt = MED_INVALID;
     
-  END_OF(LOC);
+  //END_OF_MED();
 }
 
 
@@ -172,12 +173,15 @@ void MED_MED_DRIVER22::close()
 
 MED_MED_RDONLY_DRIVER22::MED_MED_RDONLY_DRIVER22()
 {
+  this->GENDRIVER::_accessMode = MED_EN::RDONLY;
 }
 
 MED_MED_RDONLY_DRIVER22::MED_MED_RDONLY_DRIVER22(const string & fileName,  MED * const ptrMed):
-  IMED_MED_RDONLY_DRIVER(fileName,ptrMed),MED_MED_DRIVER22(fileName,ptrMed,MED_EN::MED_RDONLY),MED_MED_DRIVER(fileName,ptrMed,MED_EN::MED_RDONLY)
+  IMED_MED_RDONLY_DRIVER(fileName,ptrMed),
+  MED_MED_DRIVER22(fileName,ptrMed,MED_EN::RDONLY),
+  MED_MED_DRIVER(fileName,ptrMed,MED_EN::RDONLY)
 {
-  MESSAGE("MED_MED_RDONLY_DRIVER22::MED_MED_RDONLY_DRIVER22(const string & fileName,  MED * const ptrMed) Constructeur read only");
+  MESSAGE_MED("MED_MED_RDONLY_DRIVER22::MED_MED_RDONLY_DRIVER22(const string & fileName,  MED * const ptrMed) Constructeur read only");
 }
 
 MED_MED_RDONLY_DRIVER22::MED_MED_RDONLY_DRIVER22(const MED_MED_RDONLY_DRIVER22 & driver):
@@ -187,7 +191,7 @@ MED_MED_RDONLY_DRIVER22::MED_MED_RDONLY_DRIVER22(const MED_MED_RDONLY_DRIVER22 &
 
 MED_MED_RDONLY_DRIVER22::~MED_MED_RDONLY_DRIVER22()
 {
-  MESSAGE("MED_MED_RDONLY_DRIVER22::~MED_MED_RDONLY_DRIVER22() has been destroyed");
+  MESSAGE_MED("MED_MED_RDONLY_DRIVER22::~MED_MED_RDONLY_DRIVER22() has been destroyed");
 } 
 
 GENDRIVER * MED_MED_RDONLY_DRIVER22::copy(void) const
@@ -217,7 +221,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
   else
     IMED_MED_RDONLY_DRIVER::_fileStructIsRead = true;
 
-  BEGIN_OF(LOC);
+  BEGIN_OF_MED(LOC);
 
   if ( _medIdt == MED_INVALID ) 
     throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) 
@@ -239,7 +243,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
     
     numberOfMeshes = med_2_3::MEDnMaa(_medIdt) ;
     if ( numberOfMeshes <= 0 ) 
-      MESSAGE(LOC << "Be careful there is no mesh in file |"<<_fileName<<"| !");
+      MESSAGE_MED(LOC << "Be careful there is no mesh in file |"<<_fileName<<"| !");
 
     MESH_ENTITIES::const_iterator currentEntity; 
     for (i=1;i<=numberOfMeshes;i++)
@@ -255,7 +259,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
        switch (meshType)
          {
          case med_2_3::MED_STRUCTURE:
-           MESSAGE(LOC<<": Mesh n°"<< i <<" nammed "<< meshName << " with the description " << meshDescription << " is structured");
+           MESSAGE_MED(LOC<<": Mesh n°"<< i <<" nammed "<< meshName << " with the description " << meshDescription << " is structured");
 
            med_2_3::med_type_grille type;
 
@@ -267,7 +271,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
            ptrMesh = new GRID((MED_EN::med_grid_type) type);
            break;
          case med_2_3::MED_NON_STRUCTURE:
-           MESSAGE(LOC<<": Mesh n°"<< i <<" nammed "<< meshName << " with the description " << meshDescription << " is not structured");
+           MESSAGE_MED(LOC<<": Mesh n°"<< i <<" nammed "<< meshName << " with the description " << meshDescription << " is not structured");
 
            ptrMesh = new MESH();
            break;
@@ -310,16 +314,16 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
 
       //       _ptrMed->_meshes[meshName] = ptrMesh;
 
-       ptrMesh->setName(meshName);
+       ptrMesh->setName( healName( meshName ));
 
        ptrMesh->setDescription(meshDescription);
 
        // add by B. Secher for filter module
        ptrMesh->setMeshDimension(meshDim);
 
-       SCRUTE(ptrMesh);
+       SCRUTE_MED(ptrMesh);
 
-       MESSAGE(LOC<<"is" << (isAGrid ? "" : " NOT") << " a GRID and its name is "<<ptrMesh->getName());
+       MESSAGE_MED(LOC<<"is" << (isAGrid ? "" : " NOT") << " a GRID and its name is "<<ptrMesh->getName());
 
       // we create all global support (for each entity type :
       int index = 0;
@@ -332,10 +336,10 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
        mySupport->setEntity((MED_EN::medEntityMesh) (*currentEntity).first);
        mySupport->setAll(true);
        (_ptrMed->_support)[meshName][(MED_EN::medEntityMesh)(*currentEntity).first] = mySupport ;
-       MESSAGE(LOC<< "The support " << supportName.c_str() << " on entity " << (*currentEntity).first << " is built");
+       MESSAGE_MED(LOC<< "The support " << supportName.c_str() << " on entity " << (*currentEntity).first << " is built");
        index++;
       }
-       MESSAGE(LOC <<"The mesh " <<ptrMesh->getName() << " has " << index << " support(s)");
+       MESSAGE_MED(LOC <<"The mesh " <<ptrMesh->getName() << " has " << index << " support(s)");
       }
 
     map<MESH_NAME_, map<MED_EN::medEntityMesh,SUPPORT *> >::iterator itSupportOnMesh ;
@@ -356,7 +360,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
          }
       }
 
-    MESSAGE(LOC << "In this MED object there is(are) " << index << " support(s):");
+    MESSAGE_MED(LOC << "In this MED object there is(are) " << index << " support(s):");
 
     vectSupp.resize(index);
 
@@ -371,8 +375,8 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
             const_itSupport!=(*const_itSupportOnMesh).second.end();const_itSupport++)
          {
            vectSupp[index] = (*const_itSupport).second;
-           SCRUTE(vectSupp[index]);
-           MESSAGE(LOC << "Support number " << index << " is "<< *vectSupp[index]);
+           SCRUTE_MED(vectSupp[index]);
+           MESSAGE_MED(LOC << "Support number " << index << " is "<< *vectSupp[index]);
            index++;
          }
       }
@@ -416,7 +420,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
 
     numberOfFields = med_2_3::MEDnChamp(_medIdt,0) ;
     if ( numberOfFields <= 0 ) 
-      MESSAGE(LOC << "Be careful there is no field in file |"<<
+      MESSAGE_MED(LOC << "Be careful there is no field in file |"<<
              _fileName<<"| !");
 
     for (i=1;i<=numberOfFields;i++)
@@ -433,14 +437,14 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
        err = MEDchampInfo(_medIdt, i, fieldName, &type, componentName, 
                           unitName, numberOfComponents) ;
 
-       MESSAGE("Field n°" << i << " nammed " << fieldName << endl
+       MESSAGE_MED("Field n°" << i << " nammed " << fieldName << endl
                 << "Name real length = " << strlen(fieldName)
                 << ", while reserved " << MED_TAILLE_NOM);
 
        if (err != MED_VALID)
          throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << ": can't get information about the field n°" << i <<" of the file |" << _fileName << "| !")); 
 
-       MESSAGE(LOC << "Field n°"<<i<<" nammed "<< fieldName 
+       MESSAGE_MED(LOC << "Field n°"<<i<<" nammed "<< fieldName 
                << " ,component(s)  : " << componentName 
                <<" ,unit(s) : "        << unitName);
 
@@ -458,7 +462,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
                 currentGeometry != (*currentEntity).second.end();
                 currentGeometry++)
              {
-               MESSAGE("Field information with Entity,Geom = "<<
+               MESSAGE_MED("Field information with Entity,Geom = "<<
                        (*currentEntity).first<<","<<(*currentGeometry));
 
                numberOfTimeSteps =
@@ -466,7 +470,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
                                 (med_2_3::med_entite_maillage)(*currentEntity).first,
                                 (med_2_3::med_geometrie_element) (*currentGeometry) );
 
-               MESSAGE("Field information 2 : NumberOfTimeStep :"<<
+               MESSAGE_MED("Field information 2 : NumberOfTimeStep :"<<
                        numberOfTimeSteps);
 /*
          if ( numberOfTimeSteps > MED_VALID ) 
@@ -480,11 +484,11 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
                   currentGeometry != (*currentEntity).second.end();
                   currentGeometry++)
                {*/
-                MESSAGE("Field information 3 : Geom : "<<(*currentGeometry));
+                MESSAGE_MED("Field information 3 : Geom : "<<(*currentGeometry));
              
                 for (j=1;j <= numberOfTimeSteps; j++)
                    {
-                     MESSAGE("Field information 4 : time step j = "<<j);
+                     MESSAGE_MED("Field information 4 : time step j = "<<j);
                
                      // err = MEDpasdetempsInfo( _medIdt, fieldName,
                      // (med_2_3::med_entite_maillage) (*currentEntity).first, 
@@ -505,7 +509,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
                      if (err == MED_VALID)
                        { // we have found for (*currentEntity).first and
                          // (*currentGeometry)
-                         MESSAGE("Field information 5 ;: NumberOfGaussPoint : " << NbOfGaussPts << ", timeStepNumber : " << timeStepNumber << ", orderNumber : " << orderNumber);
+                         MESSAGE_MED("Field information 5 ;: NumberOfGaussPoint : " << NbOfGaussPts << ", timeStepNumber : " << timeStepNumber << ", orderNumber : " << orderNumber);
                          // CORRECT a bug in MEDpasdetempsInfo :
                          // we get a value n'importe quoi in NbOfGaussPts !!!!
                
@@ -516,7 +520,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
                            {
                              NbOfGaussPts = 1;
                              numberOfRefMesh=1;
-                             MESSAGE("This field is Med Memory compliant because NumberOfGaussPoint : " << NbOfGaussPts << ", or  numberOfRefMesh : " << numberOfRefMesh << ", or meshLink : " << meshLink);
+                             MESSAGE_MED("This field is Med Memory compliant because NumberOfGaussPoint : " << NbOfGaussPts << ", or  numberOfRefMesh : " << numberOfRefMesh << ", or meshLink : " << meshLink);
                            }
                
                          // ATTENTION TRAITER L'EXCEPTION CI DESSUS !!!!!!!!
@@ -534,7 +538,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
                            _meshes.find(meshName);
 
                          if ( _meshesIt == _meshes.end() ) {
-                           MESSAGE(LOC << "There is no mesh |" << meshName <<
+                           MESSAGE_MED(LOC << "There is no mesh |" << meshName <<
                                    "| in the file |" << _fileName <<
                                    "|, but  |" << meshName <<
                                    "| is referenced by field |" <<
@@ -545,7 +549,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
                                    geoNames [(*currentGeometry)]     <<"|"); 
                          }
                          // POURQUOI SI JE NE MET PAS DE BLOCK J'AI UN PARSE
-                         // ERROR : PG : c'est la macro MESSAGE qui fait ca !
+                         // ERROR : PG : c'est la macro MESSAGE_MED qui fait ca !
                          else 
                            ptrMesh = _meshes[meshName];
                
@@ -575,7 +579,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
                            ((FIELD<int>*)
                             ptrField)->setName(fieldName) ;
                            //provisoire, pour debug
-                           MESSAGE("#### SET NAME in FIELD : "<<fieldName);
+                           MESSAGE_MED("#### SET NAME in FIELD : "<<fieldName);
 
                            MED_EN::med_mode_acces myMode = getAccessMode();
 //                         switch (myMode) {
@@ -603,7 +607,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
 
                            ptrDriver = DRIVERFACTORY::buildConcreteMedDriverForField<int>(_fileName, (FIELD<int> *)ptrField, myMode, V22);
 
-                           SCRUTE(ptrDriver);
+                           SCRUTE_MED(ptrDriver);
 
 
                            break;
@@ -619,7 +623,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
                            ((FIELD<double>*)
                             ptrField)->setName(fieldName) ;
                            //provisoire, pour debug
-                           MESSAGE("#### SET NAME in FIELD : "<<fieldName);
+                           MESSAGE_MED("#### SET NAME in FIELD : "<<fieldName);
 
                            MED_EN::med_mode_acces myMode = getAccessMode();
 //                         switch (myMode) {
@@ -646,7 +650,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
 //                         }
 
                            ptrDriver = DRIVERFACTORY::buildConcreteMedDriverForField<double>(_fileName, (FIELD<double> *)ptrField, myMode, V22);
-                           SCRUTE(ptrDriver);
+                           SCRUTE_MED(ptrDriver);
 
                            break;
                          }
@@ -658,7 +662,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
                          }
                          // need to write field !
                
-                         MESSAGE("timeStepNumber :"<<timeStepNumber<<
+                         MESSAGE_MED("timeStepNumber :"<<timeStepNumber<<
                                  ",orderNumber :"<<orderNumber);
                          ptrField->setIterationNumber ( timeStepNumber);
                          // A ajouter dans la classe FIELD
@@ -667,7 +671,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
                
                          // Create a driver for this (field n°dt,n°it)
                          ptrDriver->setId            ( getId() );
-                         MESSAGE("###### ptrDriver->setFieldName : #"<<
+                         MESSAGE_MED("###### ptrDriver->setFieldName : #"<<
                                  fieldName<<"#");
                          ptrDriver->setFieldName(fieldName);
                          ptrField->addDriver(*ptrDriver);
@@ -694,7 +698,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
   // il faut lire les champs pour avoir les profils stockes !!!
   // il faudrait implémenter la lecture des profils dans med !!!
   
-  END_OF(LOC);
+  END_OF_MED(LOC);
   
 }
 
@@ -703,9 +707,9 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
 void MED_MED_RDONLY_DRIVER22::read( void )
   throw (MEDEXCEPTION) // from objects method read !
 {
-  const char * LOC = "MED_MED_DRIVER22::read() : ";
  
-  BEGIN_OF(LOC);
+  const char* LOC = "MED_MED_DRIVER22::read() : ";
+  BEGIN_OF_MED(LOC);
 
   // For PAL12192: assure that file structure is already read
   this->open();
@@ -719,36 +723,41 @@ void MED_MED_RDONLY_DRIVER22::read( void )
   map<FIELD_ *, MESH_NAME_>::const_iterator currentField;
   
   for ( currentMesh=_meshes.begin();currentMesh != _meshes.end(); currentMesh++ ) 
-    (*currentMesh).second->read(*this); 
-  //(*currentMesh).second->read(); // default reader, from readFileStruct
+    //(*currentMesh).second->read(*this); -> crash in MEDMEMTest_TopLevel.cxx
+    (*currentMesh).second->read(); // default reader, from readFileStruct
     
   // PROVISOIRE
   _ptrMed->updateSupport() ;
 
   for ( currentField =_meshName.begin(); currentField != _meshName.end(); currentField++ )
-    (*currentField).first->read(*this);
-  //(*currentField).first->read(); // default reader, from readFileStruct
+    //(*currentField).first->read(*this);
+    (*currentField).first->read(); // default reader, from readFileStruct
 
-  END_OF(LOC);
+  END_OF_MED(LOC);
 }
 
 // ------------- Write Only Part --------------
 
 MED_MED_WRONLY_DRIVER22::MED_MED_WRONLY_DRIVER22()
 {
+  this->GENDRIVER::_accessMode = MED_EN::WRONLY;
 }
 
 MED_MED_WRONLY_DRIVER22::MED_MED_WRONLY_DRIVER22(const string & fileName,  MED * const ptrMed):
-  IMED_MED_WRONLY_DRIVER(fileName,ptrMed),MED_MED_DRIVER22(fileName,ptrMed),MED_MED_DRIVER(fileName,ptrMed,MED_EN::MED_WRONLY)
+  IMED_MED_WRONLY_DRIVER(fileName,ptrMed),
+  MED_MED_DRIVER22(fileName,ptrMed),
+  MED_MED_DRIVER(fileName,ptrMed,MED_EN::WRONLY)
 {}
 
 MED_MED_WRONLY_DRIVER22::MED_MED_WRONLY_DRIVER22(const MED_MED_WRONLY_DRIVER22 & driver):
-  IMED_MED_WRONLY_DRIVER(driver),MED_MED_DRIVER(driver),MED_MED_DRIVER22(driver)
+  IMED_MED_WRONLY_DRIVER(driver),
+  MED_MED_DRIVER(driver),
+  MED_MED_DRIVER22(driver)
 {}
 
 MED_MED_WRONLY_DRIVER22::~MED_MED_WRONLY_DRIVER22()
 {
-  MESSAGE("MED_MED_WRONLY_DRIVER22::~MED_MED_WRONLY_DRIVER22() has been destroyed");
+  MESSAGE_MED("MED_MED_WRONLY_DRIVER22::~MED_MED_WRONLY_DRIVER22() has been destroyed");
 } 
 
 GENDRIVER * MED_MED_WRONLY_DRIVER22::copy(void) const
@@ -773,9 +782,9 @@ void MED_MED_WRONLY_DRIVER22::readFileStruct(void)
 void MED_MED_WRONLY_DRIVER22::writeFrom( void) const
   throw (MEDEXCEPTION) //from object method write !
 {
-  const char * LOC = "MED_MED_DRIVER22::writeFrom() : ";
 
-  BEGIN_OF(LOC);
+  const char* LOC = "MED_MED_DRIVER22::writeFrom() : ";
+  BEGIN_OF_MED(LOC);
 
   const map<MESH_NAME_, MESH*> & _meshes = const_cast<const map<MESH_NAME_, MESH*>& > (_ptrMed->_meshes); 
   map<MESH_NAME_,MESH*>::const_iterator  currentMesh;
@@ -802,17 +811,17 @@ void MED_MED_WRONLY_DRIVER22::writeFrom( void) const
     }
   }
 
-  END_OF(LOC);
+  END_OF_MED(LOC);
 
 }
 
 void MED_MED_WRONLY_DRIVER22::write(void ) const
   throw (MEDEXCEPTION) // from object method write !
 {
-  const char * LOC = "MED_MED_DRIVER22::write() : ";
   int current;
 
-  BEGIN_OF(LOC);
+  const char* LOC = "MED_MED_DRIVER22::write() : ";
+  BEGIN_OF_MED(LOC);
 
   // BCLE SUR LES OBJETS AVEC AJOUT DE DRIVER ET APPELS write
 
@@ -824,6 +833,7 @@ void MED_MED_WRONLY_DRIVER22::write(void ) const
   
   for ( currentMesh=_meshes.begin();currentMesh != _meshes.end(); currentMesh++ ) {
     //current = (*currentMesh).second->addDriver(MED_DRIVER,_fileName);
+    MESSAGE_MED((*currentMesh).second->getName());
     current = (*currentMesh).second->addDriver(MED_DRIVER,_fileName,(*currentMesh).second->getName());
     // put right _id in Mesh driver (same as this._id)
     (*currentMesh).second->_drivers[current]->setId( getId() );
@@ -831,8 +841,10 @@ void MED_MED_WRONLY_DRIVER22::write(void ) const
   }
 
   for ( currentField=_meshName.begin();currentField != _meshName.end(); currentField++ ) {
-    //current = (*currentField).first->addDriver(MED_DRIVER,_fileName);
-    current = (*currentField).first->addDriver(MED_DRIVER,_fileName,(*currentField).first->getName());
+    //current = (*currentField).first->addDriver(MED_DRIVER,_fileName);getName())
+    MESSAGE_MED((*currentField).first->getName());
+    FIELD_* myField = (*currentField).first;
+    current = (*currentField).first->addDriver(MED_DRIVER,_fileName,myField->getName());
     // put right _id in Field driver (same as this._id)
     (*currentField).first->_drivers[current]->setId( getId() );
     (*currentField).first->write(current) ;
@@ -841,23 +853,25 @@ void MED_MED_WRONLY_DRIVER22::write(void ) const
   // that's work, but it is more efficenty to write directly when we had driver, no ?
   //writeFrom();
   
-  END_OF(LOC);
+  END_OF_MED(LOC);
 
 }
 
 // ------------- Read Write Part --------------
 
 MED_MED_RDWR_DRIVER22::MED_MED_RDWR_DRIVER22()
-{}
+{
+  this->GENDRIVER::_accessMode = MED_EN::RDWR;
+}
 
 MED_MED_RDWR_DRIVER22::MED_MED_RDWR_DRIVER22(const string & fileName,  MED * const ptrMed):
   MED_MED_RDONLY_DRIVER22(fileName,ptrMed),
   MED_MED_WRONLY_DRIVER22(fileName,ptrMed),
   IMED_MED_RDWR_DRIVER(fileName,ptrMed),
-  MED_MED_DRIVER22(fileName,ptrMed,MED_REMP),
+  MED_MED_DRIVER22(fileName,ptrMed,RDWR),
   IMED_MED_WRONLY_DRIVER(fileName,ptrMed),
   IMED_MED_RDONLY_DRIVER(fileName,ptrMed),
-  MED_MED_DRIVER(fileName,ptrMed,MED_REMP)
+  MED_MED_DRIVER(fileName,ptrMed,RDWR)
 {}
 
 MED_MED_RDWR_DRIVER22::MED_MED_RDWR_DRIVER22(const MED_MED_RDWR_DRIVER22 & driver):
@@ -871,7 +885,7 @@ MED_MED_RDWR_DRIVER22::MED_MED_RDWR_DRIVER22(const MED_MED_RDWR_DRIVER22 & drive
 {}
 
 MED_MED_RDWR_DRIVER22::~MED_MED_RDWR_DRIVER22() { 
-  MESSAGE("MED_MED_RDWR_DRIVER22::~MED_MED_RDWR_DRIVER22() has been destroyed");
+  MESSAGE_MED("MED_MED_RDWR_DRIVER22::~MED_MED_RDWR_DRIVER22() has been destroyed");
 }
 
 GENDRIVER * MED_MED_RDWR_DRIVER22::copy(void) const
@@ -882,31 +896,35 @@ GENDRIVER * MED_MED_RDWR_DRIVER22::copy(void) const
 void MED_MED_RDWR_DRIVER22::read(void)
   throw (MEDEXCEPTION) // from MED_MED_RDONLY_DRIVER::read()
 {
-  BEGIN_OF("MED_MED_RDWR_DRIVER22::read(void)");
+  const char* LOC = "MED_MED_RDWR_DRIVER22::read(void)";
+  BEGIN_OF_MED(LOC);
   MED_MED_RDONLY_DRIVER22::read();
-  END_OF("MED_MED_RDWR_DRIVER22::read(void)");
+  END_OF_MED(LOC);
 }
 
 void MED_MED_RDWR_DRIVER22::readFileStruct(void)
   throw (MEDEXCEPTION) // from MED_MED_RDONLY_DRIVER::readFileStruct()
 {
-  BEGIN_OF("MED_MED_RDWR_DRIVER22::readFileStruct(void)");
+  const char* LOC = "MED_MED_RDWR_DRIVER22::readFileStruct(void)";
+  BEGIN_OF_MED(LOC);
   MED_MED_RDONLY_DRIVER22::readFileStruct();
-  END_OF("MED_MED_RDWR_DRIVER22::readFileStruct(void)");
+  END_OF_MED(LOC);
 }
 
 void MED_MED_RDWR_DRIVER22::write(void) const
   throw (MEDEXCEPTION) // from MED_MED_WRONLY_DRIVER::write()
 {
-  BEGIN_OF("MED_MED_RDWR_DRIVER22::write(void) const");
+  const char* LOC = "MED_MED_RDWR_DRIVER22::write(void) const";
+  BEGIN_OF_MED(LOC);
   MED_MED_WRONLY_DRIVER22::write();
-  END_OF("MED_MED_RDWR_DRIVER22::write(void) const");
+  END_OF_MED(LOC);
 }
 
 void MED_MED_RDWR_DRIVER22::writeFrom(void) const
   throw (MEDEXCEPTION) // from MED_MED_WRONLY_DRIVER::writeFrom();
 {
-  BEGIN_OF("MED_MED_RDWR_DRIVER22::writeFrom(void) const");
+  const char* LOC = "MED_MED_RDWR_DRIVER22::writeFrom(void) const";
+  BEGIN_OF_MED(LOC);
   MED_MED_WRONLY_DRIVER22::writeFrom();
-  END_OF("MED_MED_RDWR_DRIVER22::writeFrom(void) const");
+  END_OF_MED(LOC);
 }