Back to index

salome-smesh  6.5.0
UNV_Test.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 
00023 #include "UNV2411_Structure.hxx"
00024 #include "UNV2412_Structure.hxx"
00025 #include "UNV_Utilities.hxx"
00026 
00027 #include "DriverUNV_R_SMDS_Mesh.h"
00028 #include "DriverUNV_W_SMDS_Mesh.h"
00029 
00030 using namespace std;
00031 
00032 void ReadMed(const char* theFileName){
00033   std::ifstream in_stream(theFileName);
00034 
00035   UNV2411::TDataSet aDataSet2411;
00036   UNV2411::Read(in_stream,aDataSet2411);
00037 
00038   in_stream.seekg(0);
00039   UNV2412::TDataSet aDataSet2412;
00040   UNV2412::Read(in_stream,aDataSet2412);
00041 
00042   string aFileName(theFileName);
00043   aFileName += "-";
00044   std::ofstream out_stream(aFileName.c_str());
00045 
00046   UNV2411::Write(out_stream,aDataSet2411);
00047   UNV2412::Write(out_stream,aDataSet2412);
00048 }
00049 
00050 
00051 int main(int argc, char** argv){ 
00052   DriverUNV_R_SMDS_Mesh aR;
00053   DriverUNV_W_SMDS_Mesh aW;
00054   try{
00055     if(argc > 1){
00056       ReadMed(argv[1]);
00057     }
00058     return 0;
00059   }catch(std::exception& exc){
00060     MESSAGE("Follow exception was accured :\n"<<exc.what());
00061   }catch(...){
00062     MESSAGE("Unknown exception was accured !!!");
00063   } 
00064   return 1;
00065 }