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