Salome HOME
Copyrights update
[tools/medcoupling.git] / doc / MEDMEM / MEDMEM_MedAddingAnExistingObject.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 "MEDMEM_Exception.hxx"
21 #include "MEDMEM_define.hxx"
22
23 #include "MEDMEM_Field.hxx"
24 #include "MEDMEM_Mesh.hxx"
25 #include "MEDMEM_Med.hxx"
26
27 main () {
28   
29   const char * fileName   = "pointe.med";
30   const char * fileName2  = "Field&MeshGeneratedPointe.med";
31   const char * fileName3  = "MedGeneratedPointe.med";
32   const char * fieldName1  = "fieldcelldouble";
33   const char * fieldName2  = "fieldcelldoublebis";
34   const char * meshName1   = "maa1";
35   const char * meshName2   = "maa1bis";
36
37   try {
38
39     // FAIRE LE TEST AVEC LES CHAMPS AUSSI !.
40
41     MESH myMesh(MED_DRIVER,fileName,meshName1);
42     myMesh.setName(meshName2);
43     myMesh.rmDriver();
44
45     MED  myMed(MED_DRIVER,fileName);
46     myMed.read();
47     myMed.addMesh(&myMesh);
48     int myMedDriver = myMed.addDriver(MED_DRIVER,fileName3);
49     myMed.write(myMedDriver);
50
51     // FAIRE LE TEST AVEC LES CHAMPS AUSSI !.
52
53   } catch (MEDEXCEPTION& ex){
54     MESSAGE(ex.what()) ;
55   }
56 }