Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/smesh.git] / src / DriverUNV / UNV_Test.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #include "UNV2411_Structure.hxx"
23 #include "UNV2412_Structure.hxx"
24 #include "UNV_Utilities.hxx"
25
26 #include "DriverUNV_R_SMDS_Mesh.h"
27 #include "DriverUNV_W_SMDS_Mesh.h"
28
29 using namespace std;
30
31 #ifdef DEBUG
32 static int MYDEBUG = 1;
33 #else
34 static int MYDEBUG = 0;
35 #endif
36
37
38 void ReadMed(const char* theFileName){
39   std::ifstream in_stream(theFileName);
40
41   UNV2411::TDataSet aDataSet2411;
42   UNV2411::Read(in_stream,aDataSet2411);
43
44   in_stream.seekg(0);
45   UNV2412::TDataSet aDataSet2412;
46   UNV2412::Read(in_stream,aDataSet2412);
47
48   string aFileName(theFileName);
49   aFileName += "-";
50   std::ofstream out_stream(aFileName.c_str());
51
52   UNV2411::Write(out_stream,aDataSet2411);
53   UNV2412::Write(out_stream,aDataSet2412);
54 }
55
56
57 int main(int argc, char** argv){ 
58   DriverUNV_R_SMDS_Mesh aR;
59   DriverUNV_W_SMDS_Mesh aW;
60   try{
61     if(argc > 1){
62       ReadMed(argv[1]);
63     }
64     return 0;
65   }catch(std::exception& exc){
66     MESSAGE("Follow exception was accured :\n"<<exc.what());
67   }catch(...){
68     MESSAGE("Unknown exception was accured !!!");
69   } 
70   return 1;
71 }