Back to index

salome-med  6.5.0
test_copie_mesh.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 #include<string>
00023 
00024 #include <math.h>
00025 #include <stdlib.h>
00026 
00027 #include "MEDMEM_Exception.hxx"
00028 #include "MEDMEM_Mesh.hxx"
00029 #include "MEDMEM_Family.hxx"
00030 #include "MEDMEM_Group.hxx"
00031 
00032 #include "MEDMEM_MedMeshDriver.hxx"
00033 #include "MEDMEM_MedFieldDriver.hxx"
00034 #include "MEDMEM_Support.hxx"
00035 #include "MEDMEM_Field.hxx"
00036 #include "MEDMEM_define.hxx"
00037 
00038 using namespace std;
00039 using namespace MEDMEM;
00040 
00041 int main (int argc, char ** argv) {
00042 
00043   if (argc <3) { // after 3, ignored !
00044     cerr << "Usage : " << argv[0] 
00045          << " filename meshname" << endl << endl;
00046     exit(-1);
00047   }
00048 
00049   string filename = argv[1] ;
00050   string meshname = argv[2] ;
00051 
00052   MESH * myMesh= new MESH;
00053   myMesh->setName(meshname);
00054   MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
00055   myMeshDriver.setMeshName(meshname);
00056   myMeshDriver.open() ;
00057   myMeshDriver.read() ;
00058   myMeshDriver.close() ;
00059 
00060   cout << * myMesh << endl;
00061   MESH * myMesh2 = new MESH(* myMesh);
00062   myMesh->removeReference();
00063   cout << * myMesh2 << endl;
00064   myMesh2->removeReference();
00065 
00066   return 0;
00067 }