Salome HOME
update from the MedMemory V1.0.1
[modules/med.git] / src / MEDMEM / duplicateMED.cxx
1 using namespace std;
2 #include<string>
3
4 #include "MEDMEM_Exception.hxx"
5 #include "MEDMEM_Med.hxx"
6
7 void usage(char * name)
8 {
9   cout << "  " << name << " <input med file> <output med file> " <<endl ;
10   cout << "    " << "(the two file name are mandatory)" << endl ;
11   exit(-1);
12 }
13
14 int main (int argc, char ** argv) {
15   
16   if (argc != 3) usage(argv[0]);
17   
18   string filenameIN = argv[1] ;
19   string filenameOUT = argv[2] ;
20   
21   try {
22     
23     MED myMed(MED_DRIVER,filenameIN) ; // do readFilestruct !
24
25     // we read all meshes and fields in filenameIN
26     myMed.read() ;
27
28     // we write all in file filenameOUT :
29     int id = myMed.addDriver(MED_DRIVER,filenameOUT) ;
30     myMed.write(id);
31
32   } catch (MEDEXCEPTION& ex) {
33     MESSAGE(ex.what()) ;
34   }
35
36 }