Salome HOME
SALOME PAL V1_4_1
[modules/smesh.git] / src / DriverUNV / UNV_Test.cxx
diff --git a/src/DriverUNV/UNV_Test.cxx b/src/DriverUNV/UNV_Test.cxx
new file mode 100644 (file)
index 0000000..f9d9172
--- /dev/null
@@ -0,0 +1,69 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#include "UNV2411_Structure.hxx"
+#include "UNV2412_Structure.hxx"
+#include "UNV_Utilities.hxx"
+
+#include "DriverUNV_R_SMDS_Mesh.h"
+#include "DriverUNV_W_SMDS_Mesh.h"
+
+using namespace std;
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+void ReadMed(const char* theFileName){
+  std::ifstream in_stream(theFileName);
+
+  UNV2411::TDataSet aDataSet2411;
+  UNV2411::Read(in_stream,aDataSet2411);
+
+  in_stream.seekg(0);
+  UNV2412::TDataSet aDataSet2412;
+  UNV2412::Read(in_stream,aDataSet2412);
+
+  string aFileName(theFileName);
+  aFileName += "-";
+  std::ofstream out_stream(aFileName.c_str());
+
+  UNV2411::Write(out_stream,aDataSet2411);
+  UNV2412::Write(out_stream,aDataSet2412);
+}
+
+
+int main(int argc, char** argv){ 
+  DriverUNV_R_SMDS_Mesh aR;
+  DriverUNV_W_SMDS_Mesh aW;
+  try{
+    if(argc > 1){
+      ReadMed(argv[1]);
+    }
+    return 0;
+  }catch(std::exception& exc){
+    cout<<"Follow exception was accured :\n"<<exc.what()<<endl;
+  }catch(...){
+    cout<<"Unknown exception was accured !!!"<<endl;
+  } 
+  return 1;
+}