Salome HOME
Update to match the changes in SMDS
[modules/smesh.git] / src / DriverUNV / DriverUNV_W_SMESHDS_Document.cxx
index 7fb740cdded603b3522ce6b68a6429158ac8bf23..97e6d6d21c020f1a2bfd3c8bd91d4e5c67393c6a 100644 (file)
@@ -4,19 +4,22 @@ using namespace std;
 
 #include "utilities.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) {
 }
 
 //void DriverUNV_W_SMESHDS_Document::SetFile(string aFile) {
@@ -27,52 +30,54 @@ DriverUNV_W_SMESHDS_Document::~DriverUNV_W_SMESHDS_Document() {
 //myDocument = aDocument;
 //}
 
 //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                      *
   ****************************************************************************/
 
   /****************************************************************************
   *                      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                                 *
   ****************************************************************************/
 
 
   /****************************************************************************
   *                      FERMETURE DU FICHIER                                 *
   ****************************************************************************/
 
-  fclose(fid);
+       fclose(fid);
 
   /******** Nombre de maillages ********/
 
   /******** 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();
+       }
 
 }
 
 }