Salome HOME
Update to match the changes in SMDS
[modules/smesh.git] / src / DriverUNV / DriverUNV_W_SMESHDS_Document.cxx
index b9d226ac1bdf91b36dc439bc6eed6bc92ae46508..97e6d6d21c020f1a2bfd3c8bd91d4e5c67393c6a 100644 (file)
@@ -1,48 +1,25 @@
-//  SMESH DriverUNV : driver to read and write 'unv' files
-//
-//  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 
-//
-//
-//
-//  File   : DriverUNV_W_SMESHDS_Document.cxx
-//  Module : SMESH
-
 using namespace std;
 #include "DriverUNV_W_SMESHDS_Document.h"
 #include "DriverUNV_W_SMESHDS_Mesh.h"
 
 #include "utilities.h"
 
-extern "C" 
+extern "C"
 {
-  Document_Writer* Wmaker() {
-    return new DriverUNV_W_SMESHDS_Document;
-  }
+       Document_Writer *Wmaker()
+       {
+               return new DriverUNV_W_SMESHDS_Document;
+       }
 }
 
-DriverUNV_W_SMESHDS_Document::DriverUNV_W_SMESHDS_Document() {
-;
+DriverUNV_W_SMESHDS_Document::DriverUNV_W_SMESHDS_Document()
+{
+       ;
 }
 
-DriverUNV_W_SMESHDS_Document::~DriverUNV_W_SMESHDS_Document() {
-;
+DriverUNV_W_SMESHDS_Document::~DriverUNV_W_SMESHDS_Document()
+{
+       ;
 }
 
 //void DriverUNV_W_SMESHDS_Document::SetFile(string aFile) {
@@ -53,52 +30,54 @@ DriverUNV_W_SMESHDS_Document::~DriverUNV_W_SMESHDS_Document() {
 //myDocument = aDocument;
 //}
 
-void DriverUNV_W_SMESHDS_Document::Write() {
+void DriverUNV_W_SMESHDS_Document::Write()
+{
 
-  Handle(SMESHDS_Mesh) myMesh;
+       SMESHDS_Mesh * myMesh;
 
   /****************************************************************************
   *                      OUVERTURE DU FICHIER EN ECRITURE                      *
   ****************************************************************************/
-  char* file2Write = (char*)myFile.c_str();
-  FILE* fid = fopen(file2Write,"w+");
-  if (fid < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Write);
-      exit(EXIT_FAILURE);
-    }
+       char *file2Write = (char *)myFile.c_str();
+       FILE *fid = fopen(file2Write, "w+");
+       if (fid < 0)
+       {
+               fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Write);
+               exit(EXIT_FAILURE);
+       }
 
   /****************************************************************************
   *                      FERMETURE DU FICHIER                                 *
   ****************************************************************************/
 
-  fclose(fid);
+       fclose(fid);
 
   /******** Nombre de maillages ********/
-  int nb_of_meshes = myDocument->NbMeshes(); //voir avec Yves
-  //nb_of_meshes = 1;
-  int numero = 0;
-
-  string myClass = string("SMESHDS_Mesh");
-  string myExtension = string("UNV");
-
-  //while (numero<nb_of_meshes) {
-  //numero++;
-  //myMesh = myDocument->GetMesh(numero);
-  myDocument->InitMeshesIterator();
-  for (;myDocument->MoreMesh();myDocument->NextMesh()) {
-    numero++;
-    myMesh = myDocument->CurrentMesh();
-
-    DriverUNV_W_SMESHDS_Mesh* myWriter = new DriverUNV_W_SMESHDS_Mesh;
-    //Mesh_Writer* myWriter = Driver::GetMeshWriter(myExtension, myClass);
-
-    myWriter->SetMesh(myMesh);
-    myWriter->SetFile(myFile);
-  SCRUTE(myMesh);
-    //myWriter->SetFileId(fid);
-    myWriter->SetMeshId(numero);
-    myWriter->Write();
-  }
+       int nb_of_meshes = myDocument->NbMeshes();      //voir avec Yves
+       //nb_of_meshes = 1;
+       int numero = 0;
+
+       string myClass = string("SMESHDS_Mesh");
+       string myExtension = string("UNV");
+
+       //while (numero<nb_of_meshes) {
+       //numero++;
+       //myMesh = myDocument->GetMesh(numero);
+       myDocument->InitMeshesIterator();
+       while(myDocument->MoreMesh())
+       {
+               numero++;
+               myMesh = myDocument->NextMesh();
+
+               DriverUNV_W_SMESHDS_Mesh *myWriter = new DriverUNV_W_SMESHDS_Mesh;
+               //Mesh_Writer* myWriter = Driver::GetMeshWriter(myExtension, myClass);
+
+               myWriter->SetMesh(myMesh);
+               myWriter->SetFile(myFile);
+               SCRUTE(myMesh);
+               //myWriter->SetFileId(fid);
+               myWriter->SetMeshId(numero);
+               myWriter->Write();
+       }
 
 }