Salome HOME
Copyrights update
[modules/med.git] / src / MEDMEM / test_copie_mesh.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/
19 //
20 #include<string>
21
22 #include <math.h>
23 #include <stdlib.h>
24
25 #include "MEDMEM_Exception.hxx"
26 #include "MEDMEM_Mesh.hxx"
27 #include "MEDMEM_Family.hxx"
28 #include "MEDMEM_Group.hxx"
29
30 #include "MEDMEM_MedMeshDriver.hxx"
31 #include "MEDMEM_MedFieldDriver.hxx"
32 #include "MEDMEM_Support.hxx"
33 #include "MEDMEM_Field.hxx"
34 #include "MEDMEM_define.hxx"
35
36 using namespace std;
37 using namespace MEDMEM;
38
39 int main (int argc, char ** argv) {
40   int read;
41
42   if (argc <3) { // after 3, ignored !
43     cerr << "Usage : " << argv[0] 
44          << " filename meshname" << endl << endl;
45     exit(-1);
46   }
47
48   string filename = argv[1] ;
49   string meshname = argv[2] ;
50
51   MESH * myMesh= new MESH() ;
52   myMesh->setName(meshname);
53   MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
54   myMeshDriver.setMeshName(meshname);
55   myMeshDriver.open() ;
56   myMeshDriver.read() ;
57   myMeshDriver.close() ;
58
59   cout << * myMesh << endl;
60   MESH * myMesh2 = new MESH(* myMesh);
61   delete myMesh;
62   cout << * myMesh2 << endl;
63   delete myMesh2;
64
65   return 0;
66 }