Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/med.git] / src / MEDMEMBinTest / test_gibi_driver.cxx
index ff88bed4254f8868e83dbd8f6893f6b9972a9e1f..9ec5c2388af46b88ea977bd280f93e1993d00fe4 100644 (file)
@@ -1,23 +1,23 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 #include "MEDMEM_GibiMeshDriver.hxx"
 #include "MEDMEM_Mesh.hxx"
@@ -33,10 +33,10 @@ int main (int argc, char ** argv)
     /* process the arguments */
     if (argc != 2) 
     {
-       cerr << "Usage : " << argv[0] 
-       << "Gibifilename" << endl << endl
-       << "-> lit le fichier gibi filename ,crée 3 fichiers : MED 2.1, 2.2 et VTK" << endl;
-       exit(-1);
+        cerr << "Usage : " << argv[0] 
+        << " Gibifilename" << endl << endl
+        << "-> lit le fichier gibi filename ,crée 2 fichiers : MED et VTK" << endl;
+        exit(-1);
     }
 
     string gibifilename  = argv[1];
@@ -54,7 +54,7 @@ int main (int argc, char ** argv)
 
     // lecture du fichier gibi
     // MESH * myMesh= new MESH(GIBI_DRIVER,gibifilename);
-    MESH * myMesh= new MESH() 
+    MESH * myMesh= new MESH; 
     GIBI_MESH_RDONLY_DRIVER myGibiMeshDriver(gibifilename, myMesh) ;
     myGibiMeshDriver.open() ;
     myGibiMeshDriver.read() ;
@@ -63,19 +63,6 @@ int main (int argc, char ** argv)
     cout << "Impression de MESH : " << endl;
     cout << *myMesh;
 
-    // creation des fichiers med 2.1 et 2.2
-    medFileVersion version = getMedFileVersionForWriting();
-    if (version == V22)
-      setMedFileVersionForWriting(V21);
-
-    cout << "creation du fichier med 21 : " << endl;
-    int idMed21 = myMesh->addDriver(MED_DRIVER, medfile21, meshName);
-    myMesh->write(idMed21) ;
-
-    version = getMedFileVersionForWriting();
-    if (version == V21)
-      setMedFileVersionForWriting(V22);
-
     cout << "creation du fichier med 22 : " << endl;
     int idMed22 = myMesh->addDriver(MED_DRIVER, medfile22, meshName);
     myMesh->write(idMed22) ;
@@ -84,23 +71,10 @@ int main (int argc, char ** argv)
     cout << "creation d'un fichier vtk : " << endl;
     int idVtk = myMesh->addDriver(VTK_DRIVER, vtkfile, meshName);
     myMesh->write(idVtk) ;
-    delete myMesh;
-
-    // remontée mémoire du fichier med 21
-    myMesh= new MESH(MED_DRIVER,medfile21,meshName);
-    //myMesh= new MESH() ;
-    //myMesh->setName(meshName);
-    //MED_MESH_RDONLY_DRIVER myMeshDriver(medfile,myMesh) ;
-    //myMeshDriver.setMeshName(meshName);
-    //myMeshDriver.open() ;
-    //myMeshDriver.read() ;
-    //myMeshDriver.close() ;
-    //cout << "Impression 2 de MESH : " << endl;
-    //cout << *myMesh;
-    delete myMesh;
+    myMesh->removeReference();
 
     // remontée mémoire du fichier med 22
     myMesh= new MESH(MED_DRIVER,medfile22,meshName);
 
-    delete myMesh;
+    myMesh->removeReference();
 }