]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/duplicateMED.cxx
Salome HOME
remove a reference to the $MED_ROOT_DIR in the Makefile.in wich is useless
[modules/med.git] / src / MEDMEM / duplicateMED.cxx
1 #include<string>
2
3 #include "MEDMEM_Exception.hxx"
4 #include "MEDMEM_Med.hxx"
5
6 #ifdef _DEBUG_
7 #include "LocalTraceCollector.hxx"
8 #endif /* ifdef _DEBUG_*/
9
10 using namespace std;
11 using namespace MEDMEM;
12 void usage(char * name)
13 {
14   cout << "  " << name << " <input med file> <output med file> " <<endl ;
15   cout << "    " << "(the two file name are mandatory)" << endl ;
16   exit(-1);
17 }
18
19 int main (int argc, char ** argv) {
20 #ifdef _DEBUG_
21   LocalTraceCollector::instance();
22 #endif /* ifdef _DEBUG_*/
23
24   if (argc != 3) usage(argv[0]);
25   
26   string filenameIN = argv[1] ;
27   string filenameOUT = argv[2] ;
28   
29   try {
30     
31     MED myMed(MED_DRIVER,filenameIN) ; // do readFilestruct !
32
33     // we read all meshes and fields in filenameIN
34     myMed.read() ;
35
36     // we write all in file filenameOUT :
37     int id = myMed.addDriver(MED_DRIVER,filenameOUT) ;
38     myMed.write(id);
39
40   } catch (MEDEXCEPTION& ex) {
41     MESSAGE(ex.what()) ;
42   }
43
44 }