Salome HOME
Update to match the changes in SMDS
[modules/smesh.git] / src / DriverDAT / DriverDAT_W_SMESHDS_Document.cxx
index 399188e2456d29c393a6929cc0edbcefae019ba2..b6c6195aaa405bbf1c89c8756635ea1364044320 100644 (file)
@@ -30,19 +30,22 @@ using namespace std;
 
 #include "utilities.h"
 
-extern "C" 
+extern "C"
 {
-  Document_Writer* Wmaker() {
-    return new DriverDAT_W_SMESHDS_Document;
-  }
+       Document_Writer *Wmaker()
+       {
+               return new DriverDAT_W_SMESHDS_Document;
+       }
 }
 
-DriverDAT_W_SMESHDS_Document::DriverDAT_W_SMESHDS_Document() {
-;
+DriverDAT_W_SMESHDS_Document::DriverDAT_W_SMESHDS_Document()
+{
+       ;
 }
 
-DriverDAT_W_SMESHDS_Document::~DriverDAT_W_SMESHDS_Document() {
-;
+DriverDAT_W_SMESHDS_Document::~DriverDAT_W_SMESHDS_Document()
+{
+       ;
 }
 
 //void DriverDAT_W_SMESHDS_Document::SetFile(string aFile) {
@@ -53,52 +56,54 @@ DriverDAT_W_SMESHDS_Document::~DriverDAT_W_SMESHDS_Document() {
 //myDocument = aDocument;
 //}
 
-void DriverDAT_W_SMESHDS_Document::Write() {
+void DriverDAT_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("DAT");
-
-  //while (numero<nb_of_meshes) {
-  //numero++;
-  //myMesh = myDocument->GetMesh(numero);
-  myDocument->InitMeshesIterator();
-  for (;myDocument->MoreMesh();myDocument->NextMesh()) {
-    numero++;
-    myMesh = myDocument->CurrentMesh();
-
-    DriverDAT_W_SMESHDS_Mesh* myWriter = new DriverDAT_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("DAT");
+
+       //while (numero<nb_of_meshes) {
+       //numero++;
+       //myMesh = myDocument->GetMesh(numero);
+       myDocument->InitMeshesIterator();
+       while(myDocument->MoreMesh())
+       {
+               numero++;
+               myMesh = myDocument->NextMesh();
+
+               DriverDAT_W_SMESHDS_Mesh *myWriter = new DriverDAT_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();
+       }
 
 }