Salome HOME
Update to match the changes in SMDS
authorjrt <jrt>
Thu, 4 Sep 2003 12:03:27 +0000 (12:03 +0000)
committerjrt <jrt>
Thu, 4 Sep 2003 12:03:27 +0000 (12:03 +0000)
30 files changed:
src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx
src/DriverDAT/DriverDAT_R_SMDS_Mesh.h
src/DriverDAT/DriverDAT_R_SMESHDS_Document.cxx
src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx
src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h
src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx
src/DriverDAT/DriverDAT_W_SMDS_Mesh.h
src/DriverDAT/DriverDAT_W_SMESHDS_Document.cxx
src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx
src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h
src/DriverMED/DriverMED_R_SMDS_Mesh.cxx
src/DriverMED/DriverMED_R_SMDS_Mesh.h
src/DriverMED/DriverMED_R_SMESHDS_Document.cxx
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_R_SMESHDS_Mesh.h
src/DriverMED/DriverMED_W_SMDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMDS_Mesh.h
src/DriverMED/DriverMED_W_SMESHDS_Document.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.h
src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx
src/DriverUNV/DriverUNV_R_SMDS_Mesh.h
src/DriverUNV/DriverUNV_R_SMESHDS_Document.cxx
src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx
src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h
src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx
src/DriverUNV/DriverUNV_W_SMDS_Mesh.h
src/DriverUNV/DriverUNV_W_SMESHDS_Document.cxx
src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx
src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h

index 37127238e4eff5442d19689028a4f4823236a57f..bd95f49fbd4f2aacab5b5efe63391fc47e1a321e 100644 (file)
@@ -29,173 +29,197 @@ using namespace std;
 
 #include "utilities.h"
 
-DriverDAT_R_SMDS_Mesh::DriverDAT_R_SMDS_Mesh() {
-;
+DriverDAT_R_SMDS_Mesh::DriverDAT_R_SMDS_Mesh()
+{
+       ;
 }
 
-DriverDAT_R_SMDS_Mesh::~DriverDAT_R_SMDS_Mesh() {
-;
+DriverDAT_R_SMDS_Mesh::~DriverDAT_R_SMDS_Mesh()
+{
+       ;
 }
 
-void DriverDAT_R_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  myMesh = aMesh;
+void DriverDAT_R_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       myMesh = aMesh;
 }
 
-void DriverDAT_R_SMDS_Mesh::SetFile(string aFile) {
-  myFile = aFile;
+void DriverDAT_R_SMDS_Mesh::SetFile(string aFile)
+{
+       myFile = aFile;
 }
 
-void DriverDAT_R_SMDS_Mesh::SetFileId(FILE* aFileId) {
-  myFileId = aFileId;
+void DriverDAT_R_SMDS_Mesh::SetFileId(FILE * aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverDAT_R_SMDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverDAT_R_SMDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverDAT_R_SMDS_Mesh::Add() {
-  ;
+void DriverDAT_R_SMDS_Mesh::Add()
+{
+       ;
 }
 
-void DriverDAT_R_SMDS_Mesh::Read() {
+void DriverDAT_R_SMDS_Mesh::Read()
+{
 
-  int i,j;
-  int nbNodes,nbCells;
-  int intNumPoint;
-  float coordX, coordY, coordZ;
-  int nbNoeuds;
+       int i, j;
+       int nbNodes, nbCells;
+       int intNumPoint;
+       float coordX, coordY, coordZ;
+       int nbNoeuds;
 
-  int intNumMaille,Degre;
-  int ValElement;
-  int ValDegre;
-  int NoeudsMaille[20];
-  int NoeudMaille;
+       int intNumMaille, Degre;
+       int ValElement;
+       int ValDegre;
+       int NoeudsMaille[20];
+       int NoeudMaille;
 
-  bool ok;
+       bool ok;
 
-  MESSAGE("in DriverDAT_R_SMDS_Mesh::Read()");
+       MESSAGE("in DriverDAT_R_SMDS_Mesh::Read()");
   /****************************************************************************
   *                      OUVERTURE DU FICHIER EN LECTURE                      *
   ****************************************************************************/
-  char* file2Read = (char*)myFile.c_str();
-  myFileId = fopen(file2Read,"r");
-  if (myFileId < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-      exit(EXIT_FAILURE);
-    }
+       char *file2Read = (char *)myFile.c_str();
+       myFileId = fopen(file2Read, "r");
+       if (myFileId < 0)
+       {
+               fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+               exit(EXIT_FAILURE);
+       }
 
-  fscanf(myFileId,"%d %d\n",&nbNodes,&nbCells);
+       fscanf(myFileId, "%d %d\n", &nbNodes, &nbCells);
 
   /****************************************************************************
   *                       LECTURE DES NOEUDS                                  *
   ****************************************************************************/
-  fprintf(stdout,"\n(************************)\n");
-  fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(************************)\n");
-
-  for (i=0;i<nbNodes;i++) {
-    fscanf(myFileId,"%d %e %e %e\n",&intNumPoint,&coordX,&coordY,&coordZ);
-    ok = myMesh->AddNodeWithID(coordX,coordY,coordZ,intNumPoint);
-  }
-
-  fprintf(stdout,"%d noeuds\n",myMesh->NbNodes());
+       fprintf(stdout, "\n(************************)\n");
+       fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(************************)\n");
+
+       for (i = 0; i < nbNodes; i++)
+       {
+               fscanf(myFileId, "%d %e %e %e\n", &intNumPoint, &coordX, &coordY,
+                       &coordZ);
+               ok = myMesh->AddNodeWithID(coordX, coordY, coordZ, intNumPoint);
+       }
+
+       fprintf(stdout, "%d noeuds\n", myMesh->NbNodes());
   /****************************************************************************
   *                       LECTURE DES ELEMENTS                                *
   ****************************************************************************/
-  fprintf(stdout,"\n(**************************)\n");
-  fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(**************************)");
-
-  fprintf(stdout,"%d elements\n",nbCells);
-
-  for (i=0; i<nbCells; i++) {
-    fscanf(myFileId,"%d %d",&intNumMaille,&ValElement);
-    Degre=abs(ValElement/100);
-    nbNoeuds=ValElement-(Degre*100);
-    
-    // Recuperation des noeuds de la maille
-    for (j=0; j<nbNoeuds; j++) {
-      fscanf(myFileId,"%d",&NoeudMaille);
-      NoeudsMaille[j]=NoeudMaille;
-    }
-    
-    // Analyse des cas de cellules
-    switch (ValElement) {
-    case 102 : ;
-    case 103 : ;
-      {
-      ValDegre=3;
-      nbNoeuds=2;
-      ok = myMesh->AddEdgeWithID(NoeudsMaille[0],NoeudsMaille[1],intNumMaille);
-      break;
-    }
-    case 204 : ;
-    case 208 : ;
-      {
-      ValDegre=9;
-      nbNoeuds=4;
-      ok = myMesh->AddFaceWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],intNumMaille);
-      break;
-    }
-    case 203 : ;
-    case 206 : ;
-      {
-      ValDegre=5;
-      nbNoeuds=3;
-      ok = myMesh->AddFaceWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],intNumMaille);
-      break;
-    }
-    case 308 : ;
-    case 320 : ;
-      {
-      ValDegre=12;
-      nbNoeuds=8;
-      if (ValElement==320) {
-       //A voir, correspondance VTK
-       NoeudsMaille[4]=NoeudsMaille[8];
-       NoeudsMaille[5]=NoeudsMaille[9];
-       NoeudsMaille[6]=NoeudsMaille[10];
-       NoeudsMaille[7]=NoeudsMaille[11];
-      }
-      ok = myMesh->AddVolumeWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],NoeudsMaille[4],NoeudsMaille[5],NoeudsMaille[6],NoeudsMaille[7],intNumMaille);
-     break;
-    }
-    case 304 : ;
-    case 310 : ;
-      {
-      ValDegre=10;
-      nbNoeuds=4;
-      if (ValElement==310)
-       NoeudsMaille[3]=NoeudsMaille[6];
-      ok = myMesh->AddVolumeWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],intNumMaille);
-     break;
-    }
-    case 306 : ;
-    case 315 : ;
-      {
-      ValDegre=12;
-      nbNoeuds=8;
-      if (ValElement==315) {
-       NoeudsMaille[3]=NoeudsMaille[6];
-       NoeudsMaille[4]=NoeudsMaille[7];
-       NoeudsMaille[5]=NoeudsMaille[8];
-      }
-      NoeudsMaille[7]=NoeudsMaille[5];
-      NoeudsMaille[6]=NoeudsMaille[5];
-      NoeudsMaille[5]=NoeudsMaille[4];
-      NoeudsMaille[4]=NoeudsMaille[3];
-      NoeudsMaille[3]=NoeudsMaille[2];
-      ok = myMesh->AddVolumeWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],NoeudsMaille[4],NoeudsMaille[5],intNumMaille);
-      break;
-    }
-
-    }
-  }
+       fprintf(stdout, "\n(**************************)\n");
+       fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(**************************)");
+
+       fprintf(stdout, "%d elements\n", nbCells);
+
+       for (i = 0; i < nbCells; i++)
+       {
+               fscanf(myFileId, "%d %d", &intNumMaille, &ValElement);
+               Degre = abs(ValElement / 100);
+               nbNoeuds = ValElement - (Degre * 100);
+
+               // Recuperation des noeuds de la maille
+               for (j = 0; j < nbNoeuds; j++)
+               {
+                       fscanf(myFileId, "%d", &NoeudMaille);
+                       NoeudsMaille[j] = NoeudMaille;
+               }
+
+               // Analyse des cas de cellules
+               switch (ValElement)
+               {
+               case 102:;
+               case 103:;
+                       {
+                               ValDegre = 3;
+                               nbNoeuds = 2;
+                               ok = myMesh->AddEdgeWithID(NoeudsMaille[0], NoeudsMaille[1],
+                                       intNumMaille);
+                               break;
+                       }
+               case 204:;
+               case 208:;
+                       {
+                               ValDegre = 9;
+                               nbNoeuds = 4;
+                               ok = myMesh->AddFaceWithID(NoeudsMaille[0], NoeudsMaille[1],
+                                       NoeudsMaille[2], NoeudsMaille[3], intNumMaille);
+                               break;
+                       }
+               case 203:;
+               case 206:;
+                       {
+                               ValDegre = 5;
+                               nbNoeuds = 3;
+                               ok = myMesh->AddFaceWithID(NoeudsMaille[0], NoeudsMaille[1],
+                                       NoeudsMaille[2], intNumMaille);
+                               break;
+                       }
+               case 308:;
+               case 320:;
+                       {
+                               ValDegre = 12;
+                               nbNoeuds = 8;
+                               if (ValElement == 320)
+                               {
+                                       //A voir, correspondance VTK
+                                       NoeudsMaille[4] = NoeudsMaille[8];
+                                       NoeudsMaille[5] = NoeudsMaille[9];
+                                       NoeudsMaille[6] = NoeudsMaille[10];
+                                       NoeudsMaille[7] = NoeudsMaille[11];
+                               }
+                               ok = myMesh->AddVolumeWithID(NoeudsMaille[0], NoeudsMaille[1],
+                                       NoeudsMaille[2], NoeudsMaille[3], NoeudsMaille[4],
+                                       NoeudsMaille[5], NoeudsMaille[6], NoeudsMaille[7],
+                                       intNumMaille);
+                               break;
+                       }
+               case 304:;
+               case 310:;
+                       {
+                               ValDegre = 10;
+                               nbNoeuds = 4;
+                               if (ValElement == 310)
+                                       NoeudsMaille[3] = NoeudsMaille[6];
+                               ok = myMesh->AddVolumeWithID(NoeudsMaille[0], NoeudsMaille[1],
+                                       NoeudsMaille[2], NoeudsMaille[3], intNumMaille);
+                               break;
+                       }
+               case 306:;
+               case 315:;
+                       {
+                               ValDegre = 12;
+                               nbNoeuds = 8;
+                               if (ValElement == 315)
+                               {
+                                       NoeudsMaille[3] = NoeudsMaille[6];
+                                       NoeudsMaille[4] = NoeudsMaille[7];
+                                       NoeudsMaille[5] = NoeudsMaille[8];
+                               }
+                               NoeudsMaille[7] = NoeudsMaille[5];
+                               NoeudsMaille[6] = NoeudsMaille[5];
+                               NoeudsMaille[5] = NoeudsMaille[4];
+                               NoeudsMaille[4] = NoeudsMaille[3];
+                               NoeudsMaille[3] = NoeudsMaille[2];
+                               ok = myMesh->AddVolumeWithID(NoeudsMaille[0], NoeudsMaille[1],
+                                       NoeudsMaille[2], NoeudsMaille[3], NoeudsMaille[4],
+                                       NoeudsMaille[5], intNumMaille);
+                               break;
+                       }
+
+               }
+       }
 
   /****************************************************************************
   *                      FERMETURE DU FICHIER                      *
   ****************************************************************************/
-  fclose(myFileId);
+       fclose(myFileId);
 
 }
index 818918e63dd58a46f1ff1c73560198a4ce7c0d2d..63811bd3458ba27f7530f56be16876334a4d5c68 100644 (file)
 #include "SMDS_Mesh.hxx"
 #include "Mesh_Reader.h"
 
-class DriverDAT_R_SMDS_Mesh : public Mesh_Reader {
+class DriverDAT_R_SMDS_Mesh:public Mesh_Reader
+{
 
-  public :
-    DriverDAT_R_SMDS_Mesh();
-    ~DriverDAT_R_SMDS_Mesh();
+  public:DriverDAT_R_SMDS_Mesh();
+       ~DriverDAT_R_SMDS_Mesh();
 
-    void Add();
-    void Read();
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
+       void Add();
+       void Read();
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
 
-    void SetFileId(FILE*);
-    void SetMeshId(int);
+       void SetFileId(FILE *);
+       void SetMeshId(int);
 
-  private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    FILE* myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       FILE *myFileId;
+       int myMeshId;
 
 };
 #endif
index 421c6c95ca1fa3fa7671bbd3d767bbc12dee062b..fe360369795ae63a7e109f2a2c18380c4596c62b 100644 (file)
@@ -30,25 +30,30 @@ using namespace std;
 
 #include "utilities.h"
 
-int getOne() {
-  printf("in getOne");
-  return (1);
+int getOne()
+{
+       printf("in getOne");
+       return (1);
 }
 
-extern "C" {
-  //  Document_Reader* maker() {
-  DriverDAT_R_SMESHDS_Document* maker() {
-    fprintf(stdout,"here in maker\n");
-    return new DriverDAT_R_SMESHDS_Document;
-  }
+extern "C"
+{
+       //  Document_Reader* maker() {
+       DriverDAT_R_SMESHDS_Document *maker()
+       {
+               fprintf(stdout, "here in maker\n");
+               return new DriverDAT_R_SMESHDS_Document;
+       }
 }
 
-DriverDAT_R_SMESHDS_Document::DriverDAT_R_SMESHDS_Document() {
-  myFile = string("");
+DriverDAT_R_SMESHDS_Document::DriverDAT_R_SMESHDS_Document()
+{
+       myFile = string("");
 }
 
-DriverDAT_R_SMESHDS_Document::~DriverDAT_R_SMESHDS_Document() {
-;
+DriverDAT_R_SMESHDS_Document::~DriverDAT_R_SMESHDS_Document()
+{
+       ;
 }
 
 //void DriverDAT_R_SMESHDS_Document::SetFile(string aFile) {
@@ -59,54 +64,54 @@ DriverDAT_R_SMESHDS_Document::~DriverDAT_R_SMESHDS_Document() {
 //myDocument = aDoc;
 //}
 
-void DriverDAT_R_SMESHDS_Document::Read() {
+void DriverDAT_R_SMESHDS_Document::Read()
+{
 
-  int myMeshId;
-  MESSAGE("in read");
-  SCRUTE(myFile);
-  //Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1);
+       int myMeshId;
+       MESSAGE("in read");
+       SCRUTE(myFile);
+       //Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1);
 
   /****************************************************************************
   *                      OUVERTURE DU FICHIER EN LECTURE                      *
   ****************************************************************************/
-  char* file2Read = (char*)myFile.c_str();
-  FILE* fid = fopen(file2Read,"r");
-  if (fid < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-      exit(EXIT_FAILURE);
-    }
+       char *file2Read = (char *)myFile.c_str();
+       FILE *fid = fopen(file2Read, "r");
+       if (fid < 0)
+       {
+               fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+               exit(EXIT_FAILURE);
+       }
 
   /****************************************************************************
   *                      COMBIEN DE MAILLAGES ?                               *
   ****************************************************************************/
-  int nmaa = 1;
+       int nmaa = 1;
 
   /****************************************************************************
   *                      FERMETURE DU FICHIER                                 *
   ****************************************************************************/
-  fclose(fid);
-  
-  printf("Nombre de maillages = %d\n",nmaa);
+       fclose(fid);
 
-  string myClass = string("SMESHDS_Mesh");
-  string myExtension = string("DAT");
+       printf("Nombre de maillages = %d\n", nmaa);
 
-  for (int meshIt=1;meshIt<=nmaa;meshIt++) {
-    myMeshId = myDocument->NewMesh();
+       string myClass = string("SMESHDS_Mesh");
+       string myExtension = string("DAT");
 
-    Handle(SMDS_Mesh) myMesh = myDocument->GetMesh(myMeshId);
+       for (int meshIt = 1; meshIt <= nmaa; meshIt++)
+       {
+               myMeshId = myDocument->NewMesh();
 
-    DriverDAT_R_SMESHDS_Mesh* myReader = new DriverDAT_R_SMESHDS_Mesh;
+               SMDS_Mesh * myMesh = myDocument->GetMesh(myMeshId);
 
+               DriverDAT_R_SMESHDS_Mesh *myReader = new DriverDAT_R_SMESHDS_Mesh;
 
-    myReader->SetMesh(myMesh);
-    myReader->SetFile(myFile);
-    //myReader->SetFileId(fid);
+               myReader->SetMesh(myMesh);
+               myReader->SetFile(myFile);
+               //myReader->SetFileId(fid);
 
-    myReader->Read();
-
-  }
+               myReader->Read();
 
+       }
 
 }
index 5102aaaad22f22fd4dd03f4b8a0e6926ce307152..65151a2a067282befb778210400c360a092031b2 100644 (file)
@@ -30,49 +30,57 @@ using namespace std;
 
 #include "utilities.h"
 
-DriverDAT_R_SMESHDS_Mesh::DriverDAT_R_SMESHDS_Mesh() {
-;
+DriverDAT_R_SMESHDS_Mesh::DriverDAT_R_SMESHDS_Mesh()
+{
+       ;
 }
 
-DriverDAT_R_SMESHDS_Mesh::~DriverDAT_R_SMESHDS_Mesh() {
-;
+DriverDAT_R_SMESHDS_Mesh::~DriverDAT_R_SMESHDS_Mesh()
+{
+       ;
 }
 
-void DriverDAT_R_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh);
-  myMesh = aMesh;
+void DriverDAT_R_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       //myMesh = SMESHDS_Mesh *::DownCast(aMesh);
+       myMesh = aMesh;
 }
 
-void DriverDAT_R_SMESHDS_Mesh::SetFile(string aFile) {
-  myFile = aFile;
+void DriverDAT_R_SMESHDS_Mesh::SetFile(string aFile)
+{
+       myFile = aFile;
 }
 
-void DriverDAT_R_SMESHDS_Mesh::SetFileId(FILE* aFileId) {
-  myFileId = aFileId;
+void DriverDAT_R_SMESHDS_Mesh::SetFileId(FILE * aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverDAT_R_SMESHDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverDAT_R_SMESHDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverDAT_R_SMESHDS_Mesh::Add() {
-  ;
+void DriverDAT_R_SMESHDS_Mesh::Add()
+{
+       ;
 }
 
-void DriverDAT_R_SMESHDS_Mesh::Read() {
-  string myClass = string("SMDS_Mesh");
-  string myExtension = string("DAT");
+void DriverDAT_R_SMESHDS_Mesh::Read()
+{
+       string myClass = string("SMDS_Mesh");
+       string myExtension = string("DAT");
 
-  MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 1");
-  DriverDAT_R_SMDS_Mesh* myReader = new DriverDAT_R_SMDS_Mesh;
+       MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 1");
+       DriverDAT_R_SMDS_Mesh *myReader = new DriverDAT_R_SMDS_Mesh;
 
-  MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 2");
-  myReader->SetMesh(myMesh);
-  MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 3");
-  myReader->SetFile(myFile);
-  //myReader->SetFileId(myFileId);
+       MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 2");
+       myReader->SetMesh(myMesh);
+       MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 3");
+       myReader->SetFile(myFile);
+       //myReader->SetFileId(myFileId);
 
-  MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 4");
-  myReader->Read();
+       MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 4");
+       myReader->Read();
 
 }
index 6044efc32bfee9d3fbff0e6b18ed6f7933be67c0..f9f2654946d395bc3f79cad69b704e44841c7d83 100644 (file)
 #include "SMESHDS_Mesh.hxx"
 #include "Mesh_Reader.h"
 
-class DriverDAT_R_SMESHDS_Mesh : public Mesh_Reader {
+class DriverDAT_R_SMESHDS_Mesh:public Mesh_Reader
+{
 
-  public :
-    DriverDAT_R_SMESHDS_Mesh();
-    ~DriverDAT_R_SMESHDS_Mesh();
+  public:DriverDAT_R_SMESHDS_Mesh();
+       ~DriverDAT_R_SMESHDS_Mesh();
 
-    void Add();
-    void Read();
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
+       void Add();
+       void Read();
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
 
-    void SetFileId(FILE*);
-    void SetMeshId(int);
+       void SetFileId(FILE *);
+       void SetMeshId(int);
 
-private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    FILE* myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       FILE *myFileId;
+       int myMeshId;
 
 };
 #endif
index e087bf63bb8695731382e7c7e4fdd1923100f798..9ebe754b3ddb52ff9586b2b4c74cbc337cacde8a 100644 (file)
@@ -29,162 +29,178 @@ using namespace std;
 
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
-#include "SMDS_MeshEdgesIterator.hxx"
-#include "SMDS_MeshFacesIterator.hxx"
-#include "SMDS_MeshNodesIterator.hxx"
-#include "SMDS_MeshVolumesIterator.hxx"
 
 #include "utilities.h"
 
-DriverDAT_W_SMDS_Mesh::DriverDAT_W_SMDS_Mesh() {
-;
+DriverDAT_W_SMDS_Mesh::DriverDAT_W_SMDS_Mesh()
+{
+       ;
 }
 
-DriverDAT_W_SMDS_Mesh::~DriverDAT_W_SMDS_Mesh() {
-;
+DriverDAT_W_SMDS_Mesh::~DriverDAT_W_SMDS_Mesh()
+{
+       ;
 }
 
-void DriverDAT_W_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  myMesh = aMesh;
+void DriverDAT_W_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       myMesh = aMesh;
 }
 
-void DriverDAT_W_SMDS_Mesh::SetFile(string aFile) {
-  myFile = aFile;
+void DriverDAT_W_SMDS_Mesh::SetFile(string aFile)
+{
+       myFile = aFile;
 }
 
-void DriverDAT_W_SMDS_Mesh::SetFileId(FILE* aFileId) {
-  myFileId = aFileId;
+void DriverDAT_W_SMDS_Mesh::SetFileId(FILE * aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverDAT_W_SMDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverDAT_W_SMDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverDAT_W_SMDS_Mesh::Add() {
-  ;
+void DriverDAT_W_SMDS_Mesh::Add()
+{
+       ;
 }
 
-void DriverDAT_W_SMDS_Mesh::Write() {
+void DriverDAT_W_SMDS_Mesh::Write()
+{
 
-  int nbNodes,nbCells;
-  int i;
+       int nbNodes, nbCells;
+       int i;
 
-  char* file2Read = (char*)myFile.c_str();
-  myFileId = fopen(file2Read,"w+");
-  if (myFileId < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-      exit(EXIT_FAILURE);
-    }
-  SCRUTE(myMesh);
+       char *file2Read = (char *)myFile.c_str();
+       myFileId = fopen(file2Read, "w+");
+       if (myFileId < 0)
+       {
+               fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+               exit(EXIT_FAILURE);
+       }
+       SCRUTE(myMesh);
   /****************************************************************************
   *                       NOMBRES D'OBJETS                                    *
   ****************************************************************************/
-  fprintf(stdout,"\n(****************************)\n");
-  fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
-  fprintf(stdout,"(****************************)\n");
-
-  /* Combien de noeuds ? */
-  nbNodes = myMesh->NbNodes();
-
-  /* Combien de mailles, faces ou aretes ? */
-  Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes;
-  nb_of_edges = myMesh->NbEdges();
-  nb_of_faces = myMesh->NbFaces();
-  nb_of_volumes = myMesh->NbVolumes();
-  nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
-  SCRUTE(nb_of_edges);
-  SCRUTE(nb_of_faces);
-  SCRUTE(nb_of_volumes);
-
-  fprintf(stdout,"%d %d\n",nbNodes,nbCells);
-  fprintf(myFileId,"%d %d\n",nbNodes,nbCells);
+       fprintf(stdout, "\n(****************************)\n");
+       fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
+       fprintf(stdout, "(****************************)\n");
+
+       /* Combien de noeuds ? */
+       nbNodes = myMesh->NbNodes();
+
+       /* Combien de mailles, faces ou aretes ? */
+       int nb_of_nodes, nb_of_edges, nb_of_faces, nb_of_volumes;
+       nb_of_edges = myMesh->NbEdges();
+       nb_of_faces = myMesh->NbFaces();
+       nb_of_volumes = myMesh->NbVolumes();
+       nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
+       SCRUTE(nb_of_edges);
+       SCRUTE(nb_of_faces);
+       SCRUTE(nb_of_volumes);
+
+       fprintf(stdout, "%d %d\n", nbNodes, nbCells);
+       fprintf(myFileId, "%d %d\n", nbNodes, nbCells);
 
   /****************************************************************************
   *                       ECRITURE DES NOEUDS                                 *
   ****************************************************************************/
-  fprintf(stdout,"\n(************************)\n");
-  fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(************************)\n");
-
-  SMDS_MeshNodesIterator itNodes(myMesh);
-  for (;itNodes.More();itNodes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itNodes.Value();
-    const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem);
-    fprintf(myFileId,"%d %e %e %e\n",node->GetID(),node->X(),node->Y(),node->Z());
-  }
-
+       fprintf(stdout, "\n(************************)\n");
+       fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(************************)\n");
+
+       SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator();
+       while(itNodes->more())
+       {               
+               const SMDS_MeshNode * node = itNodes->next();
+               fprintf(myFileId, "%d %e %e %e\n", node->GetID(), node->X(),
+                       node->Y(), node->Z());
+       }
+       
   /****************************************************************************
   *                       ECRITURE DES ELEMENTS                                *
   ****************************************************************************/
-  fprintf(stdout,"\n(**************************)\n");
-  fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(**************************)");
-  /* Ecriture des connectivites, noms, numeros des mailles */
-
-  SMDS_MeshEdgesIterator itEdges(myMesh);
-  for (;itEdges.More();itEdges.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itEdges.Value();
-
-    switch (elem->NbNodes()) {
-    case 2 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),102);
-      break;
-    } 
-    case 3 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),103);
-      break;
-    }
-    }
-
-    for (i=0;i<elem->NbNodes();i++)
-      fprintf(myFileId,"%d ",elem->GetConnection(i+1));
-    
-    fprintf(myFileId,"\n");
-  }
-
-  SMDS_MeshFacesIterator itFaces(myMesh);
-  for (;itFaces.More();itFaces.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itFaces.Value();
-
-    switch (elem->NbNodes()) {
-    case 3 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),203);
-      break;
-    }
-    case 4 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),204);
-      break;
-    }
-    case 6 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),206);
-      break;
-    }
-    }
-
-    for (i=0;i<elem->NbNodes();i++)
-      fprintf(myFileId,"%d ",elem->GetConnection(i+1));
-    
-    fprintf(myFileId,"\n");
-  }
-
-  SMDS_MeshVolumesIterator itVolumes(myMesh);
-  for (;itVolumes.More();itVolumes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itVolumes.Value();
-
-    switch (elem->NbNodes()) {
-    case 8 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),308);
-      break;
-    }
-    }
-
-    for (i=0;i<elem->NbNodes();i++)
-      fprintf(myFileId,"%d ",elem->GetConnection(i+1));
-    
-    fprintf(myFileId,"\n");
-  }
-
-  fclose (myFileId);
+       fprintf(stdout, "\n(**************************)\n");
+       fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(**************************)");
+       /* Ecriture des connectivites, noms, numeros des mailles */
+
+       SMDS_Iterator<const SMDS_MeshEdge *> * itEdges=myMesh->edgesIterator();
+       while(itEdges->more())
+       {
+               const SMDS_MeshElement * elem = itEdges->next();
+
+               switch (elem->NbNodes())
+               {
+               case 2:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 102);
+                       break;
+               }
+               case 3:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 103);
+                       break;
+               }
+               }
+
+               SMDS_Iterator<const SMDS_MeshElement *> * it=elem->nodesIterator();
+               while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID());
+
+               fprintf(myFileId, "\n");
+       }
+
+       SMDS_Iterator<const SMDS_MeshFace *> * itFaces=myMesh->facesIterator();
+       while(itFaces->more())
+       {
+               const SMDS_MeshElement * elem = itFaces->next();
+
+               switch (elem->NbNodes())
+               {
+               case 3:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 203);
+                       break;
+               }
+               case 4:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 204);
+                       break;
+               }
+               case 6:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 206);
+                       break;
+               }
+               }
+
+               SMDS_Iterator<const SMDS_MeshElement *> * it=elem->nodesIterator();
+               while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID());
+
+               fprintf(myFileId, "\n");
+       }
+
+       SMDS_Iterator<const SMDS_MeshVolume *> * itVolumes=myMesh->volumesIterator();
+       while(itVolumes->more())
+       {
+               const SMDS_MeshElement * elem = itVolumes->next();
+               
+               switch (elem->NbNodes())
+               {
+               case 8:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 308);
+                       break;
+               }
+               }
+
+               SMDS_Iterator<const SMDS_MeshElement *> * it=elem->nodesIterator();
+               while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID());
+
+               fprintf(myFileId, "\n");
+       }
+
+       fclose(myFileId);
 }
index bf588823b1e53659d46efa31b51b717931c16ca3..9acabe8c80c818ff84a1a989d8858fd3fb841f2c 100644 (file)
 #include "SMDS_Mesh.hxx"
 #include "Mesh_Writer.h"
 
-class DriverDAT_W_SMDS_Mesh : public Mesh_Writer {
+class DriverDAT_W_SMDS_Mesh:public Mesh_Writer
+{
 
-  public :
-    DriverDAT_W_SMDS_Mesh();
-    ~DriverDAT_W_SMDS_Mesh();
+  public:DriverDAT_W_SMDS_Mesh();
+       ~DriverDAT_W_SMDS_Mesh();
 
-    void Add();
-    void Write();
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
+       void Add();
+       void Write();
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
 
-    void SetFileId(FILE*);
-    void SetMeshId(int);
+       void SetFileId(FILE *);
+       void SetMeshId(int);
 
-private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    FILE* myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       FILE *myFileId;
+       int myMeshId;
 
 };
 #endif
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();
+       }
 
 }
index 10c4accd2424685e0729fb6d0c63d0cf8be6e67e..adcbd218dd4a74ba898b8542c721a05b6d994ec5 100644 (file)
@@ -30,172 +30,198 @@ using namespace std;
 
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
-#include "SMDS_MeshEdgesIterator.hxx"
-#include "SMDS_MeshFacesIterator.hxx"
-#include "SMDS_MeshNodesIterator.hxx"
-#include "SMDS_MeshVolumesIterator.hxx"
+
+
+
+
 
 #include "utilities.h"
 
-DriverDAT_W_SMESHDS_Mesh::DriverDAT_W_SMESHDS_Mesh() {
-;
+DriverDAT_W_SMESHDS_Mesh::DriverDAT_W_SMESHDS_Mesh()
+{
+       ;
 }
 
-DriverDAT_W_SMESHDS_Mesh::~DriverDAT_W_SMESHDS_Mesh() {
-;
+DriverDAT_W_SMESHDS_Mesh::~DriverDAT_W_SMESHDS_Mesh()
+{
+       ;
 }
 
-void DriverDAT_W_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh);
-  myMesh = aMesh;
+void DriverDAT_W_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       //myMesh = SMESHDS_Mesh *::DownCast(aMesh);
+       myMesh = aMesh;
 }
 
-void DriverDAT_W_SMESHDS_Mesh::SetFile(string aFile) {
-  myFile = aFile;
+void DriverDAT_W_SMESHDS_Mesh::SetFile(string aFile)
+{
+       myFile = aFile;
 }
 
-void DriverDAT_W_SMESHDS_Mesh::SetFileId(FILE* aFileId) {
-  myFileId = aFileId;
+void DriverDAT_W_SMESHDS_Mesh::SetFileId(FILE * aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverDAT_W_SMESHDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverDAT_W_SMESHDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverDAT_W_SMESHDS_Mesh::Write() {
-
-  string myClass = string("SMDS_Mesh");
-  string myExtension = string("DAT");
+void DriverDAT_W_SMESHDS_Mesh::Write()
+{
 
-  DriverDAT_W_SMDS_Mesh* myWriter = new DriverDAT_W_SMDS_Mesh;
+       string myClass = string("SMDS_Mesh");
+       string myExtension = string("DAT");
 
-  myWriter->SetMesh(myMesh);
-  myWriter->SetFile(myFile);
-  myWriter->SetMeshId(myMeshId);
-  //myWriter->SetFileId(myFileId);
+       DriverDAT_W_SMDS_Mesh *myWriter = new DriverDAT_W_SMDS_Mesh;
 
-  myWriter->Write();
+       myWriter->SetMesh(myMesh);
+       myWriter->SetFile(myFile);
+       myWriter->SetMeshId(myMeshId);
+       //myWriter->SetFileId(myFileId);
 
+       myWriter->Write();
 
 }
-void DriverDAT_W_SMESHDS_Mesh::Add() {
-  int nbNodes,nbCells;
-  int i;
-
-  char* file2Read = (char*)myFile.c_str();
-  myFileId = fopen(file2Read,"w+");
-  if (myFileId < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-      exit(EXIT_FAILURE);
-    }
-  
+
+void DriverDAT_W_SMESHDS_Mesh::Add()
+{
+       int nbNodes, nbCells;
+       int i;
+
+       char *file2Read = (char *)myFile.c_str();
+       myFileId = fopen(file2Read, "w+");
+       if (myFileId < 0)
+       {
+               fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+               exit(EXIT_FAILURE);
+       }
+
   /****************************************************************************
   *                       NOMBRES D'OBJETS                                    *
   ****************************************************************************/
-  fprintf(stdout,"\n(****************************)\n");
-  fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
-  fprintf(stdout,"(****************************)\n");
+       fprintf(stdout, "\n(****************************)\n");
+       fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
+       fprintf(stdout, "(****************************)\n");
 
-  /* Combien de noeuds ? */
-  nbNodes = myMesh->NbNodes();
+       /* Combien de noeuds ? */
+       nbNodes = myMesh->NbNodes();
 
-  /* Combien de mailles, faces ou aretes ? */
-  Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes;
-  nb_of_edges = myMesh->NbEdges();
-  nb_of_faces = myMesh->NbFaces();
-  nb_of_volumes = myMesh->NbVolumes();
-  nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
+       /* Combien de mailles, faces ou aretes ? */
+       int nb_of_nodes, nb_of_edges, nb_of_faces, nb_of_volumes;
+       nb_of_edges = myMesh->NbEdges();
+       nb_of_faces = myMesh->NbFaces();
+       nb_of_volumes = myMesh->NbVolumes();
+       nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
 
-  fprintf(stdout,"%d %d\n",nbNodes,nbCells);
-  fprintf(myFileId,"%d %d\n",nbNodes,nbCells);
+       fprintf(stdout, "%d %d\n", nbNodes, nbCells);
+       fprintf(myFileId, "%d %d\n", nbNodes, nbCells);
 
   /****************************************************************************
   *                       ECRITURE DES NOEUDS                                 *
   ****************************************************************************/
-  fprintf(stdout,"\n(************************)\n");
-  fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(************************)\n");
-
-  SMDS_MeshNodesIterator itNodes(myMesh);
-  for (;itNodes.More();itNodes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itNodes.Value();
-    const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem);
-    fprintf(myFileId,"%d %e %e %e\n",node->GetID(),node->X(),node->Y(),node->Z());
-  }
+       fprintf(stdout, "\n(************************)\n");
+       fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(************************)\n");
+
+       SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator();
+       while(itNodes->more())
+       {               
+               const SMDS_MeshNode * node = itNodes->next();
+               fprintf(myFileId, "%d %e %e %e\n", node->GetID(), node->X(),
+                       node->Y(), node->Z());
+       }
+       delete itNodes;
 
   /****************************************************************************
   *                       ECRITURE DES ELEMENTS                                *
   ****************************************************************************/
-  fprintf(stdout,"\n(**************************)\n");
-  fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(**************************)");
-  /* Ecriture des connectivites, noms, numeros des mailles */
-
-  SMDS_MeshEdgesIterator itEdges(myMesh);
-  for (;itEdges.More();itEdges.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itEdges.Value();
-
-    switch (elem->NbNodes()) {
-    case 2 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),102);
-      break;
-    } 
-    case 3 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),103);
-      break;
-    }
-    }
-
-    for (i=0;i<elem->NbNodes();i++)
-      fprintf(myFileId,"%d ",elem->GetConnection(i+1));
-    
-    fprintf(myFileId,"\n");
-  }
-
-  SMDS_MeshFacesIterator itFaces(myMesh);
-  for (;itFaces.More();itFaces.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itFaces.Value();
-
-    switch (elem->NbNodes()) {
-    case 3 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),203);
-      break;
-    }
-    case 4 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),204);
-      break;
-    }
-    case 6 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),206);
-      break;
-    }
-    }
-
-    for (i=0;i<elem->NbNodes();i++)
-      fprintf(myFileId,"%d ",elem->GetConnection(i+1));
-    
-    fprintf(myFileId,"\n");
-  }
-
-  SMDS_MeshVolumesIterator itVolumes(myMesh);
-  for (;itVolumes.More();itVolumes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itVolumes.Value();
-
-    switch (elem->NbNodes()) {
-    case 8 : {
-      fprintf(myFileId,"%d %d ",elem->GetID(),308);
-      break;
-    }
-    }
-
-    for (i=0;i<elem->NbNodes();i++)
-      fprintf(myFileId,"%d ",elem->GetConnection(i+1));
-    
-    fprintf(myFileId,"\n");
-  }
-
-  fclose (myFileId);
+       fprintf(stdout, "\n(**************************)\n");
+       fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(**************************)");
+       /* Ecriture des connectivites, noms, numeros des mailles */
+
+       SMDS_Iterator<const SMDS_MeshEdge*> * itEdges=myMesh->edgesIterator();
+       while(itEdges->more())
+       {
+               const SMDS_MeshEdge * elem = itEdges->next();
+
+               switch (elem->NbNodes())
+               {
+               case 2:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 102);
+                       break;
+               }
+               case 3:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 103);
+                       break;
+               }
+               }
+
+               SMDS_Iterator<const SMDS_MeshElement *> * itNodes=elem->nodesIterator();
+               while(itNodes->more())
+                       fprintf(myFileId, "%d ", itNodes->next()->GetID());
+               
+               fprintf(myFileId, "\n");
+       }
+       delete itEdges;
+
+       SMDS_Iterator<const SMDS_MeshFace *> * itFaces=myMesh->facesIterator();
+       while(itFaces->more())
+       {
+               const SMDS_MeshElement * elem = itFaces->next();
+
+               switch (elem->NbNodes())
+               {
+               case 3:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 203);
+                       break;
+               }
+               case 4:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 204);
+                       break;
+               }
+               case 6:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 206);
+                       break;
+               }
+               }
+
+               SMDS_Iterator<const SMDS_MeshElement *> * itNodes=elem->nodesIterator();
+               while(itNodes->more())
+                       fprintf(myFileId, "%d ", itNodes->next()->GetID());
+       
+               fprintf(myFileId, "\n");
+       }
+       delete itFaces;
+
+       SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=myMesh->volumesIterator();
+       while(itVolumes->more())
+       {
+               const SMDS_MeshElement * elem = itVolumes->next();
+               
+               switch (elem->NbNodes())
+               {
+               case 8:
+               {
+                       fprintf(myFileId, "%d %d ", elem->GetID(), 308);
+                       break;
+               }
+               }
+
+               SMDS_Iterator<const SMDS_MeshElement *> * itNodes=elem->nodesIterator();
+               while(itNodes->more())
+                       fprintf(myFileId, "%d ", itNodes->next()->GetID());
+               
+               fprintf(myFileId, "\n");
+       }
+       delete itVolumes;
+
+       fclose(myFileId);
 }
-
index 1af2b6eedb42df5225049c16c1d3b4bc4c728d98..af13808fb75c37734f7d60e9fb64edcd35c88bfa 100644 (file)
 #include "SMESHDS_Mesh.hxx"
 #include "Mesh_Writer.h"
 
-class DriverDAT_W_SMESHDS_Mesh : public Mesh_Writer {
+class DriverDAT_W_SMESHDS_Mesh:public Mesh_Writer
+{
 
-  public :
-    DriverDAT_W_SMESHDS_Mesh();
-    ~DriverDAT_W_SMESHDS_Mesh();
+  public:DriverDAT_W_SMESHDS_Mesh();
+       ~DriverDAT_W_SMESHDS_Mesh();
 
-    void Add();
-    void Write();
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
+       void Add();
+       void Write();
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
 
-    void SetFileId(FILE*);
-    void SetMeshId(int);
+       void SetFileId(FILE *);
+       void SetMeshId(int);
 
-private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    FILE* myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       FILE *myFileId;
+       int myMeshId;
 
 };
 #endif
index c36dbdc6e7a6d513bd14376bad57524ae087566b..1d7bff21b60078ea62070846c715cb2efcb38c1c 100644 (file)
@@ -28,477 +28,563 @@ using namespace std;
 #include "DriverMED_R_SMDS_Mesh.h"
 #include "utilities.h"
 
-DriverMED_R_SMDS_Mesh::DriverMED_R_SMDS_Mesh() {
+DriverMED_R_SMDS_Mesh::DriverMED_R_SMDS_Mesh()
+{
 }
 
-DriverMED_R_SMDS_Mesh::~DriverMED_R_SMDS_Mesh() {
-;
+DriverMED_R_SMDS_Mesh::~DriverMED_R_SMDS_Mesh()
+{
+       ;
 }
 
-void DriverMED_R_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  myMesh = aMesh;
+void DriverMED_R_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       myMesh = aMesh;
 }
 
-void DriverMED_R_SMDS_Mesh::SetFile(string aFile) {
-  myFileId = -1;
-  myFile = aFile;
+void DriverMED_R_SMDS_Mesh::SetFile(string aFile)
+{
+       myFileId = -1;
+       myFile = aFile;
 }
 
-void DriverMED_R_SMDS_Mesh::SetFileId(med_idt aFileId) {
-  myFileId = aFileId;
+void DriverMED_R_SMDS_Mesh::SetFileId(med_idt aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverMED_R_SMDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverMED_R_SMDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverMED_R_SMDS_Mesh::Add() {
-  ;
+void DriverMED_R_SMDS_Mesh::Add()
+{
+       ;
 }
 
-void DriverMED_R_SMDS_Mesh::Read() {
-
-  med_err ret = 0;
-  int i,j,k,l;
-  int numero;
-  char message[200];
-  Standard_Boolean ok;
-  /* nombre d'objets MED */
-  char nom_universel[MED_TAILLE_LNOM+1];
-  med_int long_fichier_en_tete; 
-  char *fichier_en_tete;
-  char version_hdf[10];
-  char version_med[10];
-  med_int nmaa,mdim,nnoe;
-  med_int nmai[MED_NBR_GEOMETRIE_MAILLE],nfac[MED_NBR_GEOMETRIE_FACE];
-  med_int nare[MED_NBR_GEOMETRIE_ARETE];
-  /* nom du maillage */
-  char nommaa[MED_TAILLE_NOM+1];
-  /* noeuds */
-  med_float *coo;
-  char nomcoo[3*MED_TAILLE_PNOM+1];
-  char unicoo[3*MED_TAILLE_PNOM+1];
-  char *nomnoe;
-  med_int *numnoe;
-  med_int *nufano; 
-  med_repere rep;
-  med_booleen inonoe,inunoe;
-  med_mode_switch mode_coo;
-  char str[MED_TAILLE_PNOM+1];
-  /* elements */
-  med_int nsup;
-  med_int edim;
-  med_int taille;
-  med_int elem_id;
-  med_int cmpt = 0;
-  med_int *connectivite;
-  char *nomele;
-  med_int *numele;
-  med_int *nufael;
-  med_booleen inoele, inuele;
-  med_connectivite typ_con;
-  med_geometrie_element typgeo;
-  med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2, 
-                                                  MED_SEG3,MED_TRIA3,
-                                                  MED_TRIA6,MED_QUAD4,
-                                                  MED_QUAD8,MED_TETRA4,
-                                                  MED_TETRA10,MED_HEXA8,
-                                                  MED_HEXA20,MED_PENTA6,
-                                                  MED_PENTA15,MED_PYRA5,
-                                                  MED_PYRA13};
-  med_int desmai[MED_NBR_GEOMETRIE_MAILLE] = {0,2,3,3,3,4,4,4,4,6,6,5,5,5,5};
-  med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
-  char nommai[MED_NBR_GEOMETRIE_MAILLE] [MED_TAILLE_NOM+1] = {"MED_POINT1",
-                                                         "MED_SEG2", 
-                                                         "MED_SEG3",
-                                                         "MED_TRIA3",
-                                                         "MED_TRIA6",
-                                                         "MED_QUAD4",
-                                                         "MED_QUAD8",
-                                                         "MED_TETRA4",
-                                                         "MED_TETRA10",
-                                                         "MED_HEXA8",
-                                                         "MED_HEXA20",
-                                                         "MED_PENTA6",
-                                                         "MED_PENTA15",
-                                                         "MED_PYRA5",
-                                                         "MED_PYRA13"};
-  med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
-                                                MED_QUAD4,MED_QUAD8};
-  med_int desfac[MED_NBR_GEOMETRIE_FACE] = {3,3,4,4};
-  med_int nfaces[MED_NBR_GEOMETRIE_FACE];
-  char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM+1] = {"MED_TRIA3","MED_TRIA6",
-                                                      "MED_QUAD4","MED_QUAD8"};
-  med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
-  med_int desare[MED_NBR_GEOMETRIE_ARETE] = {2,3};
-  med_int naretes[MED_NBR_GEOMETRIE_ARETE];
-  char nomare[MED_NBR_GEOMETRIE_ARETE] [MED_TAILLE_NOM+1] = {"MED_SEG2","MED_SEG3"};
-  /* familles */
-  med_int nfam;
-  med_int natt,ngro;
-  char *attdes,*gro;
-  med_int *attval,*attide;
-  char nomfam[MED_TAILLE_NOM+1];
-  med_int numfam;
-  char str1[MED_TAILLE_DESC+1];
-  char str2[MED_TAILLE_LNOM+1];
-  
-  char* file2Read;
-  bool locally_managed;
-  SCRUTE(myFileId);
-  if (myFileId==-1) 
-    locally_managed = true;
-  else
-    locally_managed = false;
-
-  if (locally_managed)
-    { 
-    file2Read = (char*)myFile.c_str();
-    myFileId = MEDouvrir(file2Read,MED_LECT);
-    if (myFileId < 0)
-      {
-       fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-       exit(EXIT_FAILURE);
-      }
-    numero = 1;
-    }
-  else
-    numero = myMeshId;
-    
-  typ_con = MED_NOD;
-  mode_coo = MED_FULL_INTERLACE;
-  
+void DriverMED_R_SMDS_Mesh::Read()
+{
+
+       med_err ret = 0;
+       int i, j, k, l;
+       int numero;
+       char message[200];
+       bool ok;
+       /* nombre d'objets MED */
+       char nom_universel[MED_TAILLE_LNOM + 1];
+       med_int long_fichier_en_tete;
+       char *fichier_en_tete;
+       char version_hdf[10];
+       char version_med[10];
+       med_int nmaa, mdim, nnoe;
+       med_int nmai[MED_NBR_GEOMETRIE_MAILLE], nfac[MED_NBR_GEOMETRIE_FACE];
+       med_int nare[MED_NBR_GEOMETRIE_ARETE];
+       /* nom du maillage */
+       char nommaa[MED_TAILLE_NOM + 1];
+       /* noeuds */
+       med_float *coo;
+       char nomcoo[3 * MED_TAILLE_PNOM + 1];
+       char unicoo[3 * MED_TAILLE_PNOM + 1];
+       char *nomnoe;
+       med_int *numnoe;
+       med_int *nufano;
+       med_repere rep;
+       med_booleen inonoe, inunoe;
+       med_mode_switch mode_coo;
+       char str[MED_TAILLE_PNOM + 1];
+       /* elements */
+       med_int nsup;
+       med_int edim;
+       med_int taille;
+       med_int elem_id;
+       med_int cmpt = 0;
+       med_int *connectivite;
+       char *nomele;
+       med_int *numele;
+       med_int *nufael;
+       med_booleen inoele, inuele;
+       med_connectivite typ_con;
+       med_geometrie_element typgeo;
+       med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] =
+               { MED_POINT1, MED_SEG2,
+               MED_SEG3, MED_TRIA3,
+               MED_TRIA6, MED_QUAD4,
+               MED_QUAD8, MED_TETRA4,
+               MED_TETRA10, MED_HEXA8,
+               MED_HEXA20, MED_PENTA6,
+               MED_PENTA15, MED_PYRA5,
+               MED_PYRA13
+       };
+       med_int desmai[MED_NBR_GEOMETRIE_MAILLE] =
+               { 0, 2, 3, 3, 3, 4, 4, 4, 4, 6, 6, 5, 5, 5, 5 };
+       med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
+       char nommai[MED_NBR_GEOMETRIE_MAILLE][MED_TAILLE_NOM + 1] = { "MED_POINT1",
+               "MED_SEG2",
+               "MED_SEG3",
+               "MED_TRIA3",
+               "MED_TRIA6",
+               "MED_QUAD4",
+               "MED_QUAD8",
+               "MED_TETRA4",
+               "MED_TETRA10",
+               "MED_HEXA8",
+               "MED_HEXA20",
+               "MED_PENTA6",
+               "MED_PENTA15",
+               "MED_PYRA5",
+               "MED_PYRA13"
+       };
+       med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] =
+               { MED_TRIA3, MED_TRIA6,
+               MED_QUAD4, MED_QUAD8
+       };
+       med_int desfac[MED_NBR_GEOMETRIE_FACE] = { 3, 3, 4, 4 };
+       med_int nfaces[MED_NBR_GEOMETRIE_FACE];
+       char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM + 1] =
+               { "MED_TRIA3", "MED_TRIA6",
+               "MED_QUAD4", "MED_QUAD8"
+       };
+       med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] =
+               { MED_SEG2, MED_SEG3 };
+       med_int desare[MED_NBR_GEOMETRIE_ARETE] = { 2, 3 };
+       med_int naretes[MED_NBR_GEOMETRIE_ARETE];
+       char nomare[MED_NBR_GEOMETRIE_ARETE][MED_TAILLE_NOM + 1] =
+               { "MED_SEG2", "MED_SEG3" };
+       /* familles */
+       med_int nfam;
+       med_int natt, ngro;
+       char *attdes, *gro;
+       med_int *attval, *attide;
+       char nomfam[MED_TAILLE_NOM + 1];
+       med_int numfam;
+       char str1[MED_TAILLE_DESC + 1];
+       char str2[MED_TAILLE_LNOM + 1];
+
+       char *file2Read;
+       bool locally_managed;
+       SCRUTE(myFileId);
+       if (myFileId == -1)
+               locally_managed = true;
+       else
+               locally_managed = false;
+
+       if (locally_managed)
+       {
+               file2Read = (char *)myFile.c_str();
+               myFileId = MEDouvrir(file2Read, MED_LECT);
+               if (myFileId < 0)
+               {
+                       fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n",
+                               file2Read);
+                       exit(EXIT_FAILURE);
+               }
+               numero = 1;
+       }
+       else
+               numero = myMeshId;
+
+       typ_con = MED_NOD;
+       mode_coo = MED_FULL_INTERLACE;
 
   /****************************************************************************
   *                       NOMBRES D'OBJETS MED                                *
   ****************************************************************************/
-  fprintf(stdout,"\n(****************************)\n");
-  fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
-  fprintf(stdout,"(****************************)\n");
-
-  /* lecture du nom et de la dimension du maillage */
-  fprintf(stdout,"%d %d\n",myFileId,numero);
-  ret = MEDmaaInfo(myFileId,numero,nommaa,&mdim);
-  fprintf(stdout,"%d\n",ret);
-  if (ret < 0)
-    {
-      fprintf(stderr,">> ERREUR : lecture du nom du maillage \n");
-      exit(EXIT_FAILURE);
-    }
-  fprintf(stdout,"- Nom du maillage : <<%s>>\n",nommaa);
-  fprintf(stdout,"- Dimension du maillage : %d\n",mdim);
-
-  /* Combien de noeuds ? */
-  nnoe = MEDnEntMaa(myFileId,nommaa,MED_COOR,MED_NOEUD,MED_POINT1,typ_con);
-  if (nnoe < 0)
-    {
-      fprintf(stderr,">> ERREUR : lecture du nombre de noeuds \n");
-      exit(EXIT_FAILURE);
-    }
-  fprintf(stdout,"- Nombre de noeuds : %d \n",nnoe);
-
-  /* Combien de mailles, faces ou aretes ? */
-  for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
-    {
-      nmailles[i] = MEDnEntMaa(myFileId,nommaa,MED_CONN,MED_MAILLE,typmai[i],
-                              typ_con);
-      if (nmailles[i] < 0)
+       fprintf(stdout, "\n(****************************)\n");
+       fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
+       fprintf(stdout, "(****************************)\n");
+
+       /* lecture du nom et de la dimension du maillage */
+       fprintf(stdout, "%d %d\n", myFileId, numero);
+       ret = MEDmaaInfo(myFileId, numero, nommaa, &mdim);
+       fprintf(stdout, "%d\n", ret);
+       if (ret < 0)
+       {
+               fprintf(stderr, ">> ERREUR : lecture du nom du maillage \n");
+               exit(EXIT_FAILURE);
+       }
+       fprintf(stdout, "- Nom du maillage : <<%s>>\n", nommaa);
+       fprintf(stdout, "- Dimension du maillage : %d\n", mdim);
+
+       /* Combien de noeuds ? */
+       nnoe =
+               MEDnEntMaa(myFileId, nommaa, MED_COOR, MED_NOEUD, MED_POINT1, typ_con);
+       if (nnoe < 0)
+       {
+               fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds \n");
+               exit(EXIT_FAILURE);
+       }
+       fprintf(stdout, "- Nombre de noeuds : %d \n", nnoe);
+
+       /* Combien de mailles, faces ou aretes ? */
+       for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
        {
-         fprintf(stderr,">> ERREUR : lecture du nombre de mailles \n");
-         exit(EXIT_FAILURE);
+               nmailles[i] =
+                       MEDnEntMaa(myFileId, nommaa, MED_CONN, MED_MAILLE, typmai[i],
+                       typ_con);
+               if (nmailles[i] < 0)
+               {
+                       fprintf(stderr, ">> ERREUR : lecture du nombre de mailles \n");
+                       exit(EXIT_FAILURE);
+               }
+               fprintf(stdout, "- Nombre de mailles de type %s : %d \n", nommai[i],
+                       nmailles[i]);
+       }
+
+       for (i = 0; i < MED_NBR_GEOMETRIE_FACE; i++)
+       {
+               nfaces[i] = MEDnEntMaa(myFileId, nommaa, MED_CONN, MED_FACE, typfac[i],
+                       typ_con);
+               if (nfaces[i] < 0)
+               {
+                       fprintf(stderr, ">> ERREUR : lecture du nombre de faces \n");
+                       exit(EXIT_FAILURE);
+               }
+               fprintf(stdout, "- Nombre de faces de type %s : %d \n", nomfac[i],
+                       nfaces[i]);
        }
-      fprintf (stdout,"- Nombre de mailles de type %s : %d \n",nommai[i],nmailles[i]);
-    }
-
-  for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
-    {
-      nfaces[i] = MEDnEntMaa(myFileId,nommaa,MED_CONN,MED_FACE,typfac[i],
-                            typ_con);
-      if (nfaces[i] < 0)
+
+       for (i = 0; i < MED_NBR_GEOMETRIE_ARETE; i++)
        {
-         fprintf(stderr,">> ERREUR : lecture du nombre de faces \n");
-         exit(EXIT_FAILURE);
+               naretes[i] =
+                       MEDnEntMaa(myFileId, nommaa, MED_CONN, MED_ARETE, typare[i],
+                       typ_con);
+               if (naretes[i] < 0)
+               {
+                       fprintf(stderr, ">> ERREUR : lecture du nombre d'aretes \n");
+                       exit(EXIT_FAILURE);
+               }
+               fprintf(stdout, "- Nombre d'aretes de type %s : %d \n", nomare[i],
+                       naretes[i]);
        }
-      fprintf (stdout,"- Nombre de faces de type %s : %d \n",nomfac[i],nfaces[i]);
-    }    
-
-  for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
-    {
-      naretes[i] = MEDnEntMaa(myFileId,nommaa,MED_CONN,MED_ARETE,typare[i],
-                             typ_con); 
-      if (naretes[i] < 0)
+
+       /* nombre de familles */
+       nfam = MEDnFam(myFileId, nommaa, 0, MED_FAMILLE);
+       if (nfam < 0)
        {
-         fprintf(stderr,">> ERREUR : lecture du nombre d'aretes \n");
-         exit(EXIT_FAILURE);
+               fprintf(stderr, ">> ERREUR : lecture du nombre de familles \n");
+               exit(EXIT_FAILURE);
        }
-      fprintf (stdout,"- Nombre d'aretes de type %s : %d \n",nomare[i],naretes[i]);
-    }
-
-  /* nombre de familles */
-  nfam = MEDnFam(myFileId,nommaa,0,MED_FAMILLE);
-  if (nfam < 0)
-    {
-      fprintf(stderr,">> ERREUR : lecture du nombre de familles \n");
-      exit(EXIT_FAILURE);
-    }  
-  fprintf(stdout,"- Nombre de familles : %d \n",nfam);
+       fprintf(stdout, "- Nombre de familles : %d \n", nfam);
 
   /****************************************************************************
   *                       LECTURE DES NOEUDS                                  *
   ****************************************************************************/
-  fprintf(stdout,"\n(************************)\n");
-  fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(************************)\n");
-
-  /* Allocations memoires */
-  /* table des coordonnees 
-     profil : (dimension * nombre de noeuds ) */
-  coo = (med_float*) malloc(sizeof(med_float)*nnoe*mdim);
-  /* table  des numeros, des numeros de familles des noeuds
-     profil : (nombre de noeuds) */
-  numnoe = (med_int*) malloc(sizeof(med_int)*nnoe);
-  nufano = (med_int*) malloc(sizeof(med_int)*nnoe);
-  /* table des noms des noeuds 
-     profil : (nnoe*MED_TAILLE_PNOM+1) */
-  nomnoe = (char*) malloc(MED_TAILLE_PNOM*nnoe+1);
-
-  /* lecture des noeuds : 
-     - coordonnees
-     - noms (optionnel dans un fichier MED) 
-     - numeros (optionnel dans un fichier MED) 
-     - numeros des familles */
-  ret = MEDnoeudsLire(myFileId,nommaa,mdim,coo,mode_coo,&rep,
-                     nomcoo,unicoo,nomnoe,&inonoe,numnoe,&inunoe,
-                     nufano,nnoe);
-  if (ret < 0)
-    strcpy(message,">> ERREUR : lecture des noeuds \n");
-
-  if (inunoe) {
-    for (int i=0;i<nnoe;i++) {
-      ok = myMesh->AddNodeWithID(coo[i*3],coo[i*3+1],coo[i*3+2],numnoe[i]);
-      //fprintf(Out,"%d %f %f %f\n",numnoe[i],coo[i*3],coo[i*3+1],coo[i*3+2]);
-    }
-  }
-  else {
-    for (int i=0;i<nnoe;i++) {
-      ok = myMesh->AddNodeWithID(coo[i*3],coo[i*3+1],coo[i*3+2],i+1);
-      //fprintf(Out,"%d %f %f %f\n",numnoe[i],coo[i*3],coo[i*3+1],i);
-    }
-  }
-
-  //fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
-  //for (i=0;i<nnoe;i++)
-  //fprintf(stdout," %d ",*(nufano+i));
-  //fprintf(stdout,"\n");
-
-  SCRUTE(myMesh->NbNodes());
-
-  /* liberation memoire */
-  free(coo);
-  free(nomnoe);
-  free(numnoe);
-  free(nufano);
+       fprintf(stdout, "\n(************************)\n");
+       fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(************************)\n");
+
+       /* Allocations memoires */
+       /* table des coordonnees 
+        * profil : (dimension * nombre de noeuds ) */
+       coo = (med_float *) malloc(sizeof(med_float) * nnoe * mdim);
+       /* table  des numeros, des numeros de familles des noeuds
+        * profil : (nombre de noeuds) */
+       numnoe = (med_int *) malloc(sizeof(med_int) * nnoe);
+       nufano = (med_int *) malloc(sizeof(med_int) * nnoe);
+       /* table des noms des noeuds 
+        * profil : (nnoe*MED_TAILLE_PNOM+1) */
+       nomnoe = (char *)malloc(MED_TAILLE_PNOM * nnoe + 1);
+
+       /* lecture des noeuds : 
+        * - coordonnees
+        * - noms (optionnel dans un fichier MED) 
+        * - numeros (optionnel dans un fichier MED) 
+        * - numeros des familles */
+       ret = MEDnoeudsLire(myFileId, nommaa, mdim, coo, mode_coo, &rep,
+               nomcoo, unicoo, nomnoe, &inonoe, numnoe, &inunoe, nufano, nnoe);
+       if (ret < 0)
+               strcpy(message, ">> ERREUR : lecture des noeuds \n");
+
+       if (inunoe)
+       {
+               for (int i = 0; i < nnoe; i++)
+               {
+                       ok = myMesh->AddNodeWithID(coo[i * 3], coo[i * 3 + 1],
+                               coo[i * 3 + 2], numnoe[i]);
+                       //fprintf(Out,"%d %f %f %f\n",numnoe[i],coo[i*3],coo[i*3+1],coo[i*3+2]);
+               }
+       }
+       else
+       {
+               for (int i = 0; i < nnoe; i++)
+               {
+                       ok = myMesh->AddNodeWithID(coo[i * 3], coo[i * 3 + 1],
+                               coo[i * 3 + 2], i + 1);
+                       //fprintf(Out,"%d %f %f %f\n",numnoe[i],coo[i*3],coo[i*3+1],i);
+               }
+       }
+
+       //fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
+       //for (i=0;i<nnoe;i++)
+       //fprintf(stdout," %d ",*(nufano+i));
+       //fprintf(stdout,"\n");
+
+       SCRUTE(myMesh->NbNodes());
+
+       /* liberation memoire */
+       free(coo);
+       free(nomnoe);
+       free(numnoe);
+       free(nufano);
 
   /****************************************************************************
   *                       LECTURE DES ELEMENTS                                *
   ****************************************************************************/
-  fprintf(stdout,"\n(**************************)\n");
-  fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(**************************)");
-  //fprintf(Out,"CELLS\n");
-  /* Lecture des connectivites, noms, numeros des mailles */
-  //printf("%d %d %d %d\n",nmailles[3],nmailles[4],nmailles[5],nmailles[9]);
-
-  if (ret == 0)
-    for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
-      {
-       if (nmailles[i] > 0 && ret == 0)
-         {
-           /* dimension de la maille */
-           edim = typmai[i] / 100;
-           nsup = 0;
-           if (mdim  == 2 || mdim == 3)
-             if (edim == 1)
-               nsup = 1;
-           if (mdim == 3)
-             if (edim == 2)
-               nsup = 1;
-
-           taille = nsup+typmai[i]%100;
-           //taille = typmai[i]%100;
-           
-           /* allocation memoire */
-           connectivite = (med_int*)malloc(sizeof(med_int)*
-                                           taille*nmailles[i]);
-           nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
-                                  nmailles[i]+1);
-           numele = (med_int*)malloc(sizeof(med_int)*
-                                     nmailles[i]);
-           nufael = (med_int*)malloc(sizeof(med_int)*
-                                     nmailles[i]);
-           
-           /* lecture des données */
-           ret = MEDelementsLire(myFileId,nommaa,mdim,connectivite,mode_coo,
-                                 nomele,&inoele,numele,&inuele,nufael,
-                                 nmailles[i],MED_MAILLE,typmai[i],
-                                 typ_con);
-           SCRUTE(typmai[i]);
-           switch (typmai[i])
-             {
-             case MED_SEG2  : {
-               if (inuele) {
-                 for (j=0;j<nmailles[i];j++) {
-                   elem_id=*(numele+j);
-                   ok = myMesh->AddEdgeWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),elem_id);
-                 }
-               }
-               else {
-                 for (j=0;j<nmailles[i];j++) {
-                   cmpt++;
-                   ok = myMesh->AddEdgeWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),cmpt);
-                 }
-               }
+       fprintf(stdout, "\n(**************************)\n");
+       fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(**************************)");
+       //fprintf(Out,"CELLS\n");
+       /* Lecture des connectivites, noms, numeros des mailles */
+       //printf("%d %d %d %d\n",nmailles[3],nmailles[4],nmailles[5],nmailles[9]);
 
-               break;
-             }
-             case MED_TRIA3  : {
-               if (inuele) {
-                 for (j=0;j<nmailles[i];j++) {
-                   elem_id=*(numele+j);
-                   ok = myMesh->AddFaceWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),elem_id);
-                   //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2));
-                 }
-               }
-               else {
-                 for (j=0;j<nmailles[i];j++) {
-                   cmpt++;
-                   ok = myMesh->AddFaceWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),cmpt);
-                   //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2));
-                 }
+       if (ret == 0)
+               for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
+               {
+                       if (nmailles[i] > 0 && ret == 0)
+                       {
+                               /* dimension de la maille */
+                               edim = typmai[i] / 100;
+                               nsup = 0;
+                               if (mdim == 2 || mdim == 3)
+                                       if (edim == 1)
+                                               nsup = 1;
+                               if (mdim == 3)
+                                       if (edim == 2)
+                                               nsup = 1;
+
+                               taille = nsup + typmai[i] % 100;
+                               //taille = typmai[i]%100;
+
+                               /* allocation memoire */
+                               connectivite = (med_int *) malloc(sizeof(med_int) *
+                                       taille * nmailles[i]);
+                               nomele = (char *)malloc(sizeof(char) * MED_TAILLE_PNOM *
+                                       nmailles[i] + 1);
+                               numele = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
+                               nufael = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
+
+                               /* lecture des données */
+                               ret =
+                                       MEDelementsLire(myFileId, nommaa, mdim, connectivite,
+                                       mode_coo, nomele, &inoele, numele, &inuele, nufael,
+                                       nmailles[i], MED_MAILLE, typmai[i], typ_con);
+                               SCRUTE(typmai[i]);
+                               switch (typmai[i])
+                               {
+                               case MED_SEG2:
+                               {
+                                       if (inuele)
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       elem_id = *(numele + j);
+                                                       ok = myMesh->AddEdgeWithID(*(connectivite +
+                                                                       j * (taille)),
+                                                               *(connectivite + j * (taille) + 1), elem_id);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       cmpt++;
+                                                       ok = myMesh->AddEdgeWithID(*(connectivite +
+                                                                       j * (taille)),
+                                                               *(connectivite + j * (taille) + 1), cmpt);
+                                               }
+                                       }
+
+                                       break;
+                               }
+                               case MED_TRIA3:
+                               {
+                                       if (inuele)
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       elem_id = *(numele + j);
+                                                       ok = myMesh->AddFaceWithID(*(connectivite +
+                                                                       j * (taille)),
+                                                               *(connectivite + j * (taille) + 1),
+                                                               *(connectivite + j * (taille) + 2), elem_id);
+                                                       //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2));
+                                               }
+                                       }
+                                       else
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       cmpt++;
+                                                       ok = myMesh->AddFaceWithID(*(connectivite +
+                                                                       j * (taille)),
+                                                               *(connectivite + j * (taille) + 1),
+                                                               *(connectivite + j * (taille) + 2), cmpt);
+                                                       //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2));
+                                               }
+                                       }
+
+                                       break;
+                               }
+                               case MED_QUAD4:
+                               {
+                                       if (inuele)
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       elem_id = *(numele + j);
+                                                       ok = myMesh->AddFaceWithID(*(connectivite +
+                                                                       j * (taille)),
+                                                               *(connectivite + j * (taille) + 1),
+                                                               *(connectivite + j * (taille) + 2),
+                                                               *(connectivite + j * (taille) + 3), elem_id);
+                                                       //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3));
+                                               }
+                                       }
+                                       else
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       cmpt++;
+                                                       ok = myMesh->AddFaceWithID(*(connectivite +
+                                                                       j * (taille)),
+                                                               *(connectivite + j * (taille) + 1),
+                                                               *(connectivite + j * (taille) + 2),
+                                                               *(connectivite + j * (taille) + 3), cmpt);
+                                                       //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3));
+                                               }
+                                       }
+                                       break;
+                               }
+                               case MED_HEXA8:
+                               {
+                                       if (inuele)
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       elem_id = *(numele + j);
+                                                       ok = myMesh->AddVolumeWithID(*(connectivite +
+                                                                       j * (taille)),
+                                                               *(connectivite + j * (taille) + 1),
+                                                               *(connectivite + j * (taille) + 2),
+                                                               *(connectivite + j * (taille) + 3),
+                                                               *(connectivite + j * (taille) + 4),
+                                                               *(connectivite + j * (taille) + 5),
+                                                               *(connectivite + j * (taille) + 6),
+                                                               *(connectivite + j * (taille) + 7), elem_id);
+                                                       //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3),*(connectivite+j*(taille-nsup)+4),*(connectivite+j*(taille-nsup)+5),*(connectivite+j*(taille-nsup)+6),*(connectivite+j*(taille-nsup)+7));
+                                               }
+                                       }
+                                       else
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       cmpt++;
+                                                       ok = myMesh->AddVolumeWithID(*(connectivite +
+                                                                       j * (taille)),
+                                                               *(connectivite + j * (taille) + 1),
+                                                               *(connectivite + j * (taille) + 2),
+                                                               *(connectivite + j * (taille) + 3),
+                                                               *(connectivite + j * (taille) + 4),
+                                                               *(connectivite + j * (taille) + 5),
+                                                               *(connectivite + j * (taille) + 6),
+                                                               *(connectivite + j * (taille) + 7), cmpt);
+                                                       //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),*(connectivite+j*(taille)+4),*(connectivite+j*(taille)+5),*(connectivite+j*(taille)+6),*(connectivite+j*(taille)+7));
+                                               }
+                                       }
+                                       break;
+                               }
+                               default:
+                               {
+                                       break;
+                               }
+                               }
+
+                               //fprintf(stdout,"\n  - Numéros de familles : \n");
+                               //for (j=0;j<nmailles[i];j++)
+                               //fprintf(stdout," %d ",*(nufael+j));
+
+                               /* liberation memoire */
+                               free(connectivite);
+                               free(nomele);
+                               free(numele);
+                               free(nufael);
+                       }
                }
 
-               break;
-             }
-             case MED_QUAD4  : {
-               if (inuele) {
-                 for (j=0;j<nmailles[i];j++) {
-                   elem_id=*(numele+j);
-                   ok = myMesh->AddFaceWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),elem_id);
-                   //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3));
-                 }
-               }
-               else {
-                 for (j=0;j<nmailles[i];j++) {
-                   cmpt++;
-                   ok = myMesh->AddFaceWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),cmpt);
-                   //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3));
-                 }
-               }
-               break;
-             }
-             case MED_HEXA8  : {
-               if (inuele) {
-                 for (j=0;j<nmailles[i];j++) {
-                   elem_id=*(numele+j);
-                   ok = myMesh->AddVolumeWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),*(connectivite+j*(taille)+4),*(connectivite+j*(taille)+5),*(connectivite+j*(taille)+6),*(connectivite+j*(taille)+7),elem_id);
-                   //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3),*(connectivite+j*(taille-nsup)+4),*(connectivite+j*(taille-nsup)+5),*(connectivite+j*(taille-nsup)+6),*(connectivite+j*(taille-nsup)+7));
-                 }
-               }
-               else {
-                 for (j=0;j<nmailles[i];j++) {
-                   cmpt++;
-                   ok = myMesh->AddVolumeWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),*(connectivite+j*(taille)+4),*(connectivite+j*(taille)+5),*(connectivite+j*(taille)+6),*(connectivite+j*(taille)+7),cmpt);
-                   //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),*(connectivite+j*(taille)+4),*(connectivite+j*(taille)+5),*(connectivite+j*(taille)+6),*(connectivite+j*(taille)+7));
-                 }
-               }
-               break;
-             }
-             default : {
-               break ;
-             }
-             }
-
-           //fprintf(stdout,"\n  - Numéros de familles : \n");
-           //for (j=0;j<nmailles[i];j++)
-           //fprintf(stdout," %d ",*(nufael+j));
-           
-           /* liberation memoire */
-           free(connectivite);
-           free(nomele);
-           free(numele);
-           free(nufael);
-         }
-      }
-
-  SCRUTE(myMesh->NbEdges());
-  SCRUTE(myMesh->NbFaces());
+       SCRUTE(myMesh->NbEdges());
+       SCRUTE(myMesh->NbFaces());
   /****************************************************************************
    *                       LECTURE DES FAMILLES                                *
    ****************************************************************************/
-  printf("\n(*************************)\n");
-  printf("(* FAMILLES DU MAILLAGE : *)\n");
-  printf("(*************************)\n");
-  if (ret == 0)
-    for (i=0;i<nfam;i++)
-      {
-       
-       /* nombre de groupes */
-       ngro = MEDnFam(myFileId,nommaa,i+1,MED_GROUPE);
-       if (ngro < 0)  
-         {
-           ret = -1;
-           strcpy(message,
-                  ">> ERREUR : lecture du nombre de groupes d'une famille \n");
-         }
-       
-       /* nombre d'attributs */
+       printf("\n(*************************)\n");
+       printf("(* FAMILLES DU MAILLAGE : *)\n");
+       printf("(*************************)\n");
        if (ret == 0)
-         {
-           natt = MEDnFam(myFileId,nommaa,i+1,MED_ATTR);
-           if (natt < 0)
-             {
-               ret = -1;
-               strcpy(message,
-                  ">> ERREUR : lecture du nombre d'attributs d'une famille\n");
-             }
-         }
-
-       if (ret == 0)
-         fprintf(stdout,"- Famille %d a %d attributs et %d groupes \n",i+1,natt,ngro); 
+               for (i = 0; i < nfam; i++)
+               {
+
+                       /* nombre de groupes */
+                       ngro = MEDnFam(myFileId, nommaa, i + 1, MED_GROUPE);
+                       if (ngro < 0)
+                       {
+                               ret = -1;
+                               strcpy(message,
+                                       ">> ERREUR : lecture du nombre de groupes d'une famille \n");
+                       }
+
+                       /* nombre d'attributs */
+                       if (ret == 0)
+                       {
+                               natt = MEDnFam(myFileId, nommaa, i + 1, MED_ATTR);
+                               if (natt < 0)
+                               {
+                                       ret = -1;
+                                       strcpy(message,
+                                               ">> ERREUR : lecture du nombre d'attributs d'une famille\n");
+                               }
+                       }
+
+                       if (ret == 0)
+                               fprintf(stdout, "- Famille %d a %d attributs et %d groupes \n",
+                                       i + 1, natt, ngro);
+
+                       /* nom,numero,attributs,groupes */
+                       if (ret == 0)
+                       {
+                               attide = (med_int *) malloc(sizeof(med_int) * natt);
+                               attval = (med_int *) malloc(sizeof(med_int) * natt);
+                               attdes = (char *)malloc(MED_TAILLE_DESC * natt + 1);
+                               gro = (char *)malloc(MED_TAILLE_LNOM * ngro + 1);
+                               ret =
+                                       MEDfamInfo(myFileId, nommaa, i + 1, nomfam, &numfam, attide,
+                                       attval, attdes, &natt, gro, &ngro);
+                               fprintf(stdout, "  - Famille de nom %s et de numero %d : \n",
+                                       nomfam, numfam);
+                               fprintf(stdout, "  - Attributs : \n");
+                               for (j = 0; j < natt; j++)
+                               {
+                                       strncpy(str1, attdes + j * MED_TAILLE_DESC,
+                                               MED_TAILLE_DESC);
+                                       str1[MED_TAILLE_DESC] = '\0';
+                                       fprintf(stdout, "   ide = %d - val = %d - des = %s\n",
+                                               *(attide + j), *(attval + j), str1);
+                               }
+                               free(attide);
+                               free(attval);
+                               free(attdes);
+                               fprintf(stdout, "  - Groupes :\n");
+                               for (j = 0; j < ngro; j++)
+                               {
+                                       strncpy(str2, gro + j * MED_TAILLE_LNOM, MED_TAILLE_LNOM);
+                                       str2[MED_TAILLE_LNOM] = '\0';
+                                       fprintf(stdout, "   gro = %s\n", str2);
+                               }
+                               free(gro);
+                       }
+               }
 
-       /* nom,numero,attributs,groupes */
-       if (ret == 0)
-         {
-           attide = (med_int*) malloc(sizeof(med_int)*natt);
-           attval = (med_int*) malloc(sizeof(med_int)*natt);       
-           attdes = (char *) malloc(MED_TAILLE_DESC*natt+1);
-           gro = (char*) malloc(MED_TAILLE_LNOM*ngro+1);
-           ret = MEDfamInfo(myFileId,nommaa,i+1,nomfam,&numfam,attide,attval,
-                            attdes,&natt,gro,&ngro);
-           fprintf(stdout,"  - Famille de nom %s et de numero %d : \n",nomfam,numfam);
-           fprintf(stdout,"  - Attributs : \n");
-           for (j=0;j<natt;j++)
-             {
-               strncpy(str1,attdes+j*MED_TAILLE_DESC,MED_TAILLE_DESC);
-               str1[MED_TAILLE_DESC] = '\0';
-               fprintf(stdout,"   ide = %d - val = %d - des = %s\n",*(attide+j),
-                      *(attval+j),str1);
-             }
-            free(attide);
-           free(attval);
-            free(attdes);
-            fprintf(stdout,"  - Groupes :\n");
-           for (j=0;j<ngro;j++)
-             {
-               strncpy(str2,gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
-               str2[MED_TAILLE_LNOM] = '\0';
-               fprintf(stdout,"   gro = %s\n",str2);
-             }
-            free(gro);
-         }
-      }
-
-  if (locally_managed)
-    ret = MEDfermer(myFileId);
+       if (locally_managed)
+               ret = MEDfermer(myFileId);
 
 }
index 46141c05d5107752d912bb1ccf27cc64de5f30ce..4f9bb7d4ef5bec4c83140cbb28fa79cf15954844 100644 (file)
@@ -35,25 +35,24 @@ extern "C"
 #include <med.h>
 }
 
-class DriverMED_R_SMDS_Mesh : public Mesh_Reader {
+class DriverMED_R_SMDS_Mesh:public Mesh_Reader
+{
 
-  public :
-    DriverMED_R_SMDS_Mesh();
-    ~DriverMED_R_SMDS_Mesh();
+  public:DriverMED_R_SMDS_Mesh();
+       ~DriverMED_R_SMDS_Mesh();
 
-    void Add();
-    void Read();
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
+       void Add();
+       void Read();
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
 
-    void SetFileId(med_idt);
-    void SetMeshId(int);
+       void SetFileId(med_idt);
+       void SetMeshId(int);
 
-private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    med_idt myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       med_idt myFileId;
+       int myMeshId;
 
 };
 #endif
index 23e03ae040c4210d609263dc01114ec88e78abf1..ca50c550e1b9299c6034850f4a241212e22743fd 100644 (file)
@@ -29,90 +29,95 @@ using namespace std;
 #include "DriverMED_R_SMESHDS_Mesh.h"
 #include "utilities.h"
 
-extern "C" {
-  Document_Reader* maker() {
-    return new DriverMED_R_SMESHDS_Document;
-  }
+extern "C"
+{
+       Document_Reader *maker()
+       {
+               return new DriverMED_R_SMESHDS_Document;
+       }
 }
 
-DriverMED_R_SMESHDS_Document::DriverMED_R_SMESHDS_Document() {
-;
+DriverMED_R_SMESHDS_Document::DriverMED_R_SMESHDS_Document()
+{
+       ;
 }
 
-DriverMED_R_SMESHDS_Document::~DriverMED_R_SMESHDS_Document() {
-;
+DriverMED_R_SMESHDS_Document::~DriverMED_R_SMESHDS_Document()
+{
+       ;
 }
 
 //void DriverMED_R_SMESHDS_Document::SetFile(string aFile) {
 //  myFile = aFile;
 //}
 
-void DriverMED_R_SMESHDS_Document::Read() {
+void DriverMED_R_SMESHDS_Document::Read()
+{
 
-  med_err ret = 0;
-  med_idt fid;
-  med_int nmaa;
+       med_err ret = 0;
+       med_idt fid;
+       med_int nmaa;
 
-  Standard_Integer myMeshId;
+       int myMeshId;
 
-  //string myFile = string("/home/home_users/cai/projects/salome_prev04/SALOME_ROOT/data/fra1.med");
+       //string myFile = string("/home/home_users/cai/projects/salome_prev04/SALOME_ROOT/data/fra1.med");
 
 /****************************************************************************
   *                      OUVERTURE DU FICHIER EN LECTURE                      *
   ****************************************************************************/
-  char* file2Read = (char*)myFile.c_str();
-  fid = MEDouvrir(file2Read,MED_LECT);
-  if (fid < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-      exit(EXIT_FAILURE);
-    }
+       char *file2Read = (char *)myFile.c_str();
+       fid = MEDouvrir(file2Read, MED_LECT);
+       if (fid < 0)
+       {
+               fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+               exit(EXIT_FAILURE);
+       }
 
   /****************************************************************************
   *                      COMBIEN DE MAILLAGES ?                               *
   ****************************************************************************/
-  nmaa = MEDnMaa(fid);
-  if (nmaa < 0)
-    {
-      fprintf(stderr,">> ERREUR : lecture du nombre de maillages \n");
-      exit(EXIT_FAILURE);
-    }
-  printf("Nombre de maillages = %d\n",nmaa);
+       nmaa = MEDnMaa(fid);
+       if (nmaa < 0)
+       {
+               fprintf(stderr, ">> ERREUR : lecture du nombre de maillages \n");
+               exit(EXIT_FAILURE);
+       }
+       printf("Nombre de maillages = %d\n", nmaa);
 
-  string myClass = string("SMESHDS_Mesh");
-  string myExtension = string("MED");
+       string myClass = string("SMESHDS_Mesh");
+       string myExtension = string("MED");
 
+       for (int meshIt = 1; meshIt <= nmaa; meshIt++)
+       {
+               myMeshId = myDocument->NewMesh();
+               printf("MeshId = %d\n", myMeshId);
 
-  for (int meshIt=1;meshIt<=nmaa;meshIt++) {
-    myMeshId = myDocument->NewMesh();
-    printf("MeshId = %d\n",myMeshId);
+               SMDS_Mesh * myMesh = myDocument->GetMesh(myMeshId);
+               SCRUTE(myMesh);
 
-    Handle(SMDS_Mesh) myMesh = myDocument->GetMesh(myMeshId);
-  SCRUTE(myMesh);
+               // Handle (SMDS_Mesh) MMM =.........
+               //ex SMESHDS_Mesh * myMesh2 =SMESHDS_Mesh *::DownCast(MMM);
 
-    // Handle (SMDS_Mesh) MMM =.........
-    //ex Handle(SMESHDS_Mesh) myMesh2 =Handle(SMESHDS_Mesh)::DownCast(MMM);
+               DriverMED_R_SMESHDS_Mesh *myReader = new DriverMED_R_SMESHDS_Mesh;
 
-    DriverMED_R_SMESHDS_Mesh* myReader = new DriverMED_R_SMESHDS_Mesh;
+               myReader->SetMesh(myMesh);
+               myReader->SetMeshId(myMeshId);
 
-    myReader->SetMesh(myMesh);
-    myReader->SetMeshId(myMeshId);
+               //myReader->SetFile(myFile);
+               SCRUTE(fid);
+               myReader->SetFileId(fid);
 
-    //myReader->SetFile(myFile);
-  SCRUTE(fid);
-    myReader->SetFileId(fid);
+               myReader->Add();
 
-    myReader->Add();
-
-  }
+       }
 
   /****************************************************************************
   *                      FERMETURE DU FICHIER                                 *
   ****************************************************************************/
-  ret = MEDfermer(fid);
-  
-  if (ret != 0)
-    fprintf(stderr,">> ERREUR : erreur a la fermeture du fichier %s\n",file2Read);
+       ret = MEDfermer(fid);
 
+       if (ret != 0)
+               fprintf(stderr, ">> ERREUR : erreur a la fermeture du fichier %s\n",
+                       file2Read);
 
 }
index 2e7e0d5b021bcd8c50d967f575abd3b0fc9db7fd..72739a95917229ffad88ad2446a696ef8029922e 100644 (file)
@@ -31,541 +31,626 @@ using namespace std;
 
 #include <stdlib.h>
 
-DriverMED_R_SMESHDS_Mesh::DriverMED_R_SMESHDS_Mesh() {
-  myFileId=-1;
+DriverMED_R_SMESHDS_Mesh::DriverMED_R_SMESHDS_Mesh()
+{
+       myFileId = -1;
 }
 
-DriverMED_R_SMESHDS_Mesh::~DriverMED_R_SMESHDS_Mesh() {
-;
+DriverMED_R_SMESHDS_Mesh::~DriverMED_R_SMESHDS_Mesh()
+{
+       ;
 }
 
-void DriverMED_R_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh);
-  myMesh = aMesh;
+void DriverMED_R_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       //myMesh = SMESHDS_Mesh *::DownCast(aMesh);
+       myMesh = aMesh;
 }
 
-void DriverMED_R_SMESHDS_Mesh::SetFile(string aFile) {
-  myFile = aFile;
+void DriverMED_R_SMESHDS_Mesh::SetFile(string aFile)
+{
+       myFile = aFile;
 }
 
-void DriverMED_R_SMESHDS_Mesh::SetFileId(med_idt aFileId) {
-  myFileId = aFileId;
+void DriverMED_R_SMESHDS_Mesh::SetFileId(med_idt aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverMED_R_SMESHDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverMED_R_SMESHDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverMED_R_SMESHDS_Mesh::Read() {
+void DriverMED_R_SMESHDS_Mesh::Read()
+{
 
-  string myClass = string("SMDS_Mesh");
-  string myExtension = string("MED");
+       string myClass = string("SMDS_Mesh");
+       string myExtension = string("MED");
 
-  DriverMED_R_SMDS_Mesh* myReader = new DriverMED_R_SMDS_Mesh;
+       DriverMED_R_SMDS_Mesh *myReader = new DriverMED_R_SMDS_Mesh;
 
-  myReader->SetMesh(myMesh);
-  myReader->SetMeshId(myMeshId);
-  myReader->SetFile(myFile);
-  myReader->SetFileId(-1);
+       myReader->SetMesh(myMesh);
+       myReader->SetMeshId(myMeshId);
+       myReader->SetFile(myFile);
+       myReader->SetFileId(-1);
 
-  myReader->Read();
+       myReader->Read();
 
 }
 
-void DriverMED_R_SMESHDS_Mesh::Add() {
+void DriverMED_R_SMESHDS_Mesh::Add()
+{
 
-  string myClass = string("SMDS_Mesh");
-  string myExtension = string("MED");
+       string myClass = string("SMDS_Mesh");
+       string myExtension = string("MED");
 
-  DriverMED_R_SMDS_Mesh* myReader = new DriverMED_R_SMDS_Mesh;
+       DriverMED_R_SMDS_Mesh *myReader = new DriverMED_R_SMDS_Mesh;
 
-  myReader->SetMesh(myMesh);
-  myReader->SetMeshId(myMeshId);
+       myReader->SetMesh(myMesh);
+       myReader->SetMeshId(myMeshId);
 
-  SCRUTE(myFileId);
-  myReader->SetFileId(myFileId);
+       SCRUTE(myFileId);
+       myReader->SetFileId(myFileId);
 
-  myReader->Read();
+       myReader->Read();
 
 }
 
-void DriverMED_R_SMESHDS_Mesh::ReadMySelf() {
-
-  med_err ret = 0;
-  int i,j,k,l;
-  int numero;
-  char message[200];
-  Standard_Boolean ok;
-  /* nombre d'objets MED */
-  char nom_universel[MED_TAILLE_LNOM+1];
-  med_int long_fichier_en_tete; 
-  char *fichier_en_tete;
-  char version_hdf[10];
-  char version_med[10];
-  med_int nmaa,mdim,nnoe;
-  med_int nmai[MED_NBR_GEOMETRIE_MAILLE],nfac[MED_NBR_GEOMETRIE_FACE];
-  med_int nare[MED_NBR_GEOMETRIE_ARETE];
-  /* nom du maillage */
-  char nommaa[MED_TAILLE_NOM+1];
-  /* noeuds */
-  med_float *coo;
-  char nomcoo[3*MED_TAILLE_PNOM+1];
-  char unicoo[3*MED_TAILLE_PNOM+1];
-  char *nomnoe;
-  med_int *numnoe;
-  med_int *nufano; 
-  med_repere rep;
-  med_booleen inonoe,inunoe;
-  med_mode_switch mode_coo;
-  char str[MED_TAILLE_PNOM+1];
-  /* elements */
-  med_int nsup;
-  med_int edim;
-  med_int taille;
-  med_int elem_id;
-  med_int cmpt = 0;
-  med_int *connectivite;
-  char *nomele;
-  med_int *numele;
-  med_int *nufael;
-  med_booleen inoele, inuele;
-  med_connectivite typ_con;
-  med_geometrie_element typgeo;
-  med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2, 
-                                                  MED_SEG3,MED_TRIA3,
-                                                  MED_TRIA6,MED_QUAD4,
-                                                  MED_QUAD8,MED_TETRA4,
-                                                  MED_TETRA10,MED_HEXA8,
-                                                  MED_HEXA20,MED_PENTA6,
-                                                  MED_PENTA15,MED_PYRA5,
-                                                  MED_PYRA13};
-  med_int desmai[MED_NBR_GEOMETRIE_MAILLE] = {0,2,3,3,3,4,4,4,4,6,6,5,5,5,5};
-  med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
-  char nommai[MED_NBR_GEOMETRIE_MAILLE] [MED_TAILLE_NOM+1] = {"MED_POINT1",
-                                                         "MED_SEG2", 
-                                                         "MED_SEG3",
-                                                         "MED_TRIA3",
-                                                         "MED_TRIA6",
-                                                         "MED_QUAD4",
-                                                         "MED_QUAD8",
-                                                         "MED_TETRA4",
-                                                         "MED_TETRA10",
-                                                         "MED_HEXA8",
-                                                         "MED_HEXA20",
-                                                         "MED_PENTA6",
-                                                         "MED_PENTA15",
-                                                         "MED_PYRA5",
-                                                         "MED_PYRA13"};
-  med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
-                                                MED_QUAD4,MED_QUAD8};
-  med_int desfac[MED_NBR_GEOMETRIE_FACE] = {3,3,4,4};
-  med_int nfaces[MED_NBR_GEOMETRIE_FACE];
-  char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM+1] = {"MED_TRIA3","MED_TRIA6",
-                                                      "MED_QUAD4","MED_QUAD8"};
-  med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
-  med_int desare[MED_NBR_GEOMETRIE_ARETE] = {2,3};
-  med_int naretes[MED_NBR_GEOMETRIE_ARETE];
-  char nomare[MED_NBR_GEOMETRIE_ARETE] [MED_TAILLE_NOM+1] = {"MED_SEG2","MED_SEG3"};
-  /* familles */
-  med_int nfam;
-  med_int natt,ngro;
-  char *attdes,*gro;
-  med_int *attval,*attide;
-  char nomfam[MED_TAILLE_NOM+1];
-  med_int numfam;
-  char str1[MED_TAILLE_DESC+1];
-  char str2[MED_TAILLE_LNOM+1];
-  string fam;
-  string fam_type;
-  string fam_id;
-  
-  char* file2Read;
-  bool locally_managed;
-
-  if (myFileId==-1) 
-    locally_managed = true;
-  else
-    locally_managed = false;
-
-  if (locally_managed)
-    { 
-    file2Read = (char*)myFile.c_str();
-    myFileId = MEDouvrir(file2Read,MED_LECT);
-    if (myFileId < 0)
-      {
-       fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-       exit(EXIT_FAILURE);
-      }
-    numero = 1;
-    }
-  else
-    numero = myMeshId;
-  sprintf(nommaa,"Mesh %d",myMeshId);//pour load
-  SCRUTE(nommaa);
-    
-  typ_con = MED_NOD;
-  mode_coo = MED_FULL_INTERLACE;
-  mdim = 3;
-
-  Handle(SMESHDS_Mesh) mySMESHDSMesh = Handle(SMESHDS_Mesh)::DownCast(myMesh);
-
-  //TopoDS_Shape myShape = mySMESHDSMesh->ShapeToMesh();
+void DriverMED_R_SMESHDS_Mesh::ReadMySelf()
+{
+
+       med_err ret = 0;
+       int i, j, k, l;
+       int numero;
+       char message[200];
+       bool ok;
+       /* nombre d'objets MED */
+       char nom_universel[MED_TAILLE_LNOM + 1];
+       med_int long_fichier_en_tete;
+       char *fichier_en_tete;
+       char version_hdf[10];
+       char version_med[10];
+       med_int nmaa, mdim, nnoe;
+       med_int nmai[MED_NBR_GEOMETRIE_MAILLE], nfac[MED_NBR_GEOMETRIE_FACE];
+       med_int nare[MED_NBR_GEOMETRIE_ARETE];
+       /* nom du maillage */
+       char nommaa[MED_TAILLE_NOM + 1];
+       /* noeuds */
+       med_float *coo;
+       char nomcoo[3 * MED_TAILLE_PNOM + 1];
+       char unicoo[3 * MED_TAILLE_PNOM + 1];
+       char *nomnoe;
+       med_int *numnoe;
+       med_int *nufano;
+       med_repere rep;
+       med_booleen inonoe, inunoe;
+       med_mode_switch mode_coo;
+       char str[MED_TAILLE_PNOM + 1];
+       /* elements */
+       med_int nsup;
+       med_int edim;
+       med_int taille;
+       med_int elem_id;
+       med_int cmpt = 0;
+       med_int *connectivite;
+       char *nomele;
+       med_int *numele;
+       med_int *nufael;
+       med_booleen inoele, inuele;
+       med_connectivite typ_con;
+       med_geometrie_element typgeo;
+       med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] =
+               { MED_POINT1, MED_SEG2,
+               MED_SEG3, MED_TRIA3,
+               MED_TRIA6, MED_QUAD4,
+               MED_QUAD8, MED_TETRA4,
+               MED_TETRA10, MED_HEXA8,
+               MED_HEXA20, MED_PENTA6,
+               MED_PENTA15, MED_PYRA5,
+               MED_PYRA13
+       };
+       med_int desmai[MED_NBR_GEOMETRIE_MAILLE] =
+               { 0, 2, 3, 3, 3, 4, 4, 4, 4, 6, 6, 5, 5, 5, 5 };
+       med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
+       char nommai[MED_NBR_GEOMETRIE_MAILLE][MED_TAILLE_NOM + 1] = { "MED_POINT1",
+               "MED_SEG2",
+               "MED_SEG3",
+               "MED_TRIA3",
+               "MED_TRIA6",
+               "MED_QUAD4",
+               "MED_QUAD8",
+               "MED_TETRA4",
+               "MED_TETRA10",
+               "MED_HEXA8",
+               "MED_HEXA20",
+               "MED_PENTA6",
+               "MED_PENTA15",
+               "MED_PYRA5",
+               "MED_PYRA13"
+       };
+       med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] =
+               { MED_TRIA3, MED_TRIA6,
+               MED_QUAD4, MED_QUAD8
+       };
+       med_int desfac[MED_NBR_GEOMETRIE_FACE] = { 3, 3, 4, 4 };
+       med_int nfaces[MED_NBR_GEOMETRIE_FACE];
+       char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM + 1] =
+               { "MED_TRIA3", "MED_TRIA6",
+               "MED_QUAD4", "MED_QUAD8"
+       };
+       med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] =
+               { MED_SEG2, MED_SEG3 };
+       med_int desare[MED_NBR_GEOMETRIE_ARETE] = { 2, 3 };
+       med_int naretes[MED_NBR_GEOMETRIE_ARETE];
+       char nomare[MED_NBR_GEOMETRIE_ARETE][MED_TAILLE_NOM + 1] =
+               { "MED_SEG2", "MED_SEG3" };
+       /* familles */
+       med_int nfam;
+       med_int natt, ngro;
+       char *attdes, *gro;
+       med_int *attval, *attide;
+       char nomfam[MED_TAILLE_NOM + 1];
+       med_int numfam;
+       char str1[MED_TAILLE_DESC + 1];
+       char str2[MED_TAILLE_LNOM + 1];
+       string fam;
+       string fam_type;
+       string fam_id;
+
+       char *file2Read;
+       bool locally_managed;
+
+       if (myFileId == -1)
+               locally_managed = true;
+       else
+               locally_managed = false;
+
+       if (locally_managed)
+       {
+               file2Read = (char *)myFile.c_str();
+               myFileId = MEDouvrir(file2Read, MED_LECT);
+               if (myFileId < 0)
+               {
+                       fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n",
+                               file2Read);
+                       exit(EXIT_FAILURE);
+               }
+               numero = 1;
+       }
+       else
+               numero = myMeshId;
+       sprintf(nommaa, "Mesh %d", myMeshId);   //pour load
+       SCRUTE(nommaa);
+
+       typ_con = MED_NOD;
+       mode_coo = MED_FULL_INTERLACE;
+       mdim = 3;
+
+       SMESHDS_Mesh * mySMESHDSMesh = dynamic_cast<SMESHDS_Mesh *>(myMesh);
+
+       //TopoDS_Shape myShape = mySMESHDSMesh->ShapeToMesh();
 
   /****************************************************************************
   *                       NOMBRES D'OBJETS MED                                *
   ****************************************************************************/
-  fprintf(stdout,"\n(****************************)\n");
-  fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
-  fprintf(stdout,"(****************************)\n");
-
-  /* lecture du nom et de la dimension du maillage */
-  /*!  fprintf(stdout,"%d %d\n",myFileId,numero);
-  ret = MEDmaaInfo(myFileId,numero,nommaa,&mdim);
-  fprintf(stdout,"%d\n",ret);
-  if (ret < 0)
-    {
-      fprintf(stderr,">> ERREUR : lecture du nom du maillage \n");
-      exit(EXIT_FAILURE);
-    }
-  fprintf(stdout,"- Nom du maillage : <<%s>>\n",nommaa);
-  fprintf(stdout,"- Dimension du maillage : %d\n",mdim);
-  */
-  /* Combien de noeuds ? */
-  nnoe = MEDnEntMaa(myFileId,nommaa,MED_COOR,MED_NOEUD,MED_POINT1,typ_con);
-  if (nnoe < 0)
-    {
-      fprintf(stderr,">> ERREUR : lecture du nombre de noeuds \n");
-      exit(EXIT_FAILURE);
-    }
-  fprintf(stdout,"- Nombre de noeuds : %d \n",nnoe);
-
-  /* Combien de mailles, faces ou aretes ? */
-  for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
-    {
-      nmailles[i] = MEDnEntMaa(myFileId,nommaa,MED_CONN,MED_MAILLE,typmai[i],
-                              typ_con);
-      if (nmailles[i] < 0)
+       fprintf(stdout, "\n(****************************)\n");
+       fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
+       fprintf(stdout, "(****************************)\n");
+
+       /* lecture du nom et de la dimension du maillage */
+       /*!  fprintf(stdout,"%d %d\n",myFileId,numero);
+        * ret = MEDmaaInfo(myFileId,numero,nommaa,&mdim);
+        * fprintf(stdout,"%d\n",ret);
+        * if (ret < 0)
+        * {
+        * fprintf(stderr,">> ERREUR : lecture du nom du maillage \n");
+        * exit(EXIT_FAILURE);
+        * }
+        * fprintf(stdout,"- Nom du maillage : <<%s>>\n",nommaa);
+        * fprintf(stdout,"- Dimension du maillage : %d\n",mdim);
+        */
+       /* Combien de noeuds ? */
+       nnoe =
+               MEDnEntMaa(myFileId, nommaa, MED_COOR, MED_NOEUD, MED_POINT1, typ_con);
+       if (nnoe < 0)
        {
-         fprintf(stderr,">> ERREUR : lecture du nombre de mailles \n");
-         exit(EXIT_FAILURE);
+               fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds \n");
+               exit(EXIT_FAILURE);
        }
-      fprintf (stdout,"- Nombre de mailles de type %s : %d \n",nommai[i],nmailles[i]);
-    }
-
-  for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
-    {
-      nfaces[i] = MEDnEntMaa(myFileId,nommaa,MED_CONN,MED_FACE,typfac[i],
-                            typ_con);
-      if (nfaces[i] < 0)
+       fprintf(stdout, "- Nombre de noeuds : %d \n", nnoe);
+
+       /* Combien de mailles, faces ou aretes ? */
+       for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
+       {
+               nmailles[i] =
+                       MEDnEntMaa(myFileId, nommaa, MED_CONN, MED_MAILLE, typmai[i],
+                       typ_con);
+               if (nmailles[i] < 0)
+               {
+                       fprintf(stderr, ">> ERREUR : lecture du nombre de mailles \n");
+                       exit(EXIT_FAILURE);
+               }
+               fprintf(stdout, "- Nombre de mailles de type %s : %d \n", nommai[i],
+                       nmailles[i]);
+       }
+
+       for (i = 0; i < MED_NBR_GEOMETRIE_FACE; i++)
        {
-         fprintf(stderr,">> ERREUR : lecture du nombre de faces \n");
-         exit(EXIT_FAILURE);
+               nfaces[i] = MEDnEntMaa(myFileId, nommaa, MED_CONN, MED_FACE, typfac[i],
+                       typ_con);
+               if (nfaces[i] < 0)
+               {
+                       fprintf(stderr, ">> ERREUR : lecture du nombre de faces \n");
+                       exit(EXIT_FAILURE);
+               }
+               fprintf(stdout, "- Nombre de faces de type %s : %d \n", nomfac[i],
+                       nfaces[i]);
        }
-      fprintf (stdout,"- Nombre de faces de type %s : %d \n",nomfac[i],nfaces[i]);
-    }    
-
-  for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
-    {
-      naretes[i] = MEDnEntMaa(myFileId,nommaa,MED_CONN,MED_ARETE,typare[i],
-                             typ_con); 
-      if (naretes[i] < 0)
+
+       for (i = 0; i < MED_NBR_GEOMETRIE_ARETE; i++)
        {
-         fprintf(stderr,">> ERREUR : lecture du nombre d'aretes \n");
-         exit(EXIT_FAILURE);
+               naretes[i] =
+                       MEDnEntMaa(myFileId, nommaa, MED_CONN, MED_ARETE, typare[i],
+                       typ_con);
+               if (naretes[i] < 0)
+               {
+                       fprintf(stderr, ">> ERREUR : lecture du nombre d'aretes \n");
+                       exit(EXIT_FAILURE);
+               }
+               fprintf(stdout, "- Nombre d'aretes de type %s : %d \n", nomare[i],
+                       naretes[i]);
        }
-      fprintf (stdout,"- Nombre d'aretes de type %s : %d \n",nomare[i],naretes[i]);
-    }
 
-  /* nombre de familles */
-  nfam = MEDnFam(myFileId,nommaa,0,MED_FAMILLE);
-  if (nfam < 0)
-    {
-      fprintf(stderr,">> ERREUR : lecture du nombre de familles \n");
-      exit(EXIT_FAILURE);
-    }  
-  fprintf(stdout,"- Nombre de familles : %d \n",nfam);
+       /* nombre de familles */
+       nfam = MEDnFam(myFileId, nommaa, 0, MED_FAMILLE);
+       if (nfam < 0)
+       {
+               fprintf(stderr, ">> ERREUR : lecture du nombre de familles \n");
+               exit(EXIT_FAILURE);
+       }
+       fprintf(stdout, "- Nombre de familles : %d \n", nfam);
 
-  vector<int> family[nfam];
+       vector < int >family[nfam];
 
   /****************************************************************************
   *                       LECTURE DES NOEUDS                                  *
   ****************************************************************************/
-  fprintf(stdout,"\n(************************)\n");
-  fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(************************)\n");
-
-  /* Allocations memoires */
-  /* table des coordonnees 
-     profil : (dimension * nombre de noeuds ) */
-  coo = (med_float*) malloc(sizeof(med_float)*nnoe*mdim);
-  /* table  des numeros, des numeros de familles des noeuds
-     profil : (nombre de noeuds) */
-  numnoe = (med_int*) malloc(sizeof(med_int)*nnoe);
-  nufano = (med_int*) malloc(sizeof(med_int)*nnoe);
-  /* table des noms des noeuds 
-     profil : (nnoe*MED_TAILLE_PNOM+1) */
-  nomnoe = (char*) malloc(MED_TAILLE_PNOM*nnoe+1);
-
-  /* lecture des noeuds : 
-     - coordonnees
-     - noms (optionnel dans un fichier MED) 
-     - numeros (optionnel dans un fichier MED) 
-     - numeros des familles */
-  ret = MEDnoeudsLire(myFileId,nommaa,mdim,coo,mode_coo,&rep,
-                     nomcoo,unicoo,nomnoe,&inonoe,numnoe,&inunoe,
-                     nufano,nnoe);
-  if (ret < 0)
-    strcpy(message,">> ERREUR : lecture des noeuds \n");
-
-  if (inunoe) {
-    for (int i=0;i<nnoe;i++) {
-      ok = mySMESHDSMesh->AddNodeWithID(coo[i*3],coo[i*3+1],coo[i*3+2],numnoe[i]);
-      //fprintf(Out,"%d %f %f %f\n",numnoe[i],coo[i*3],coo[i*3+1],coo[i*3+2]);
-    }
-  }
-  else {
-    for (int i=0;i<nnoe;i++) {
-      ok = mySMESHDSMesh->AddNodeWithID(coo[i*3],coo[i*3+1],coo[i*3+2],i+1);
-      //fprintf(Out,"%d %f %f %f\n",numnoe[i],coo[i*3],coo[i*3+1],i);
-      family[*(nufano+i)].push_back(numnoe[i]);
-    }
-  }
-
-  fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
-  for (i=0;i<nnoe;i++)
-    fprintf(stdout," %d ",*(nufano+i));
-  fprintf(stdout,"\n");
-
-  /* liberation memoire */
-  free(coo);
-  free(nomnoe);
-  free(numnoe);
-  free(nufano);
+       fprintf(stdout, "\n(************************)\n");
+       fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(************************)\n");
+
+       /* Allocations memoires */
+       /* table des coordonnees 
+        * profil : (dimension * nombre de noeuds ) */
+       coo = (med_float *) malloc(sizeof(med_float) * nnoe * mdim);
+       /* table  des numeros, des numeros de familles des noeuds
+        * profil : (nombre de noeuds) */
+       numnoe = (med_int *) malloc(sizeof(med_int) * nnoe);
+       nufano = (med_int *) malloc(sizeof(med_int) * nnoe);
+       /* table des noms des noeuds 
+        * profil : (nnoe*MED_TAILLE_PNOM+1) */
+       nomnoe = (char *)malloc(MED_TAILLE_PNOM * nnoe + 1);
+
+       /* lecture des noeuds : 
+        * - coordonnees
+        * - noms (optionnel dans un fichier MED) 
+        * - numeros (optionnel dans un fichier MED) 
+        * - numeros des familles */
+       ret = MEDnoeudsLire(myFileId, nommaa, mdim, coo, mode_coo, &rep,
+               nomcoo, unicoo, nomnoe, &inonoe, numnoe, &inunoe, nufano, nnoe);
+       if (ret < 0)
+               strcpy(message, ">> ERREUR : lecture des noeuds \n");
+
+       if (inunoe)
+       {
+               for (int i = 0; i < nnoe; i++)
+               {
+                       ok = mySMESHDSMesh->AddNodeWithID(coo[i * 3], coo[i * 3 + 1],
+                               coo[i * 3 + 2], numnoe[i]);
+                       //fprintf(Out,"%d %f %f %f\n",numnoe[i],coo[i*3],coo[i*3+1],coo[i*3+2]);
+               }
+       }
+       else
+       {
+               for (int i = 0; i < nnoe; i++)
+               {
+                       ok = mySMESHDSMesh->AddNodeWithID(coo[i * 3], coo[i * 3 + 1],
+                               coo[i * 3 + 2], i + 1);
+                       //fprintf(Out,"%d %f %f %f\n",numnoe[i],coo[i*3],coo[i*3+1],i);
+                       family[*(nufano + i)].push_back(numnoe[i]);
+               }
+       }
+
+       fprintf(stdout, "\n- Numeros des familles des noeuds : \n");
+       for (i = 0; i < nnoe; i++)
+               fprintf(stdout, " %d ", *(nufano + i));
+       fprintf(stdout, "\n");
+
+       /* liberation memoire */
+       free(coo);
+       free(nomnoe);
+       free(numnoe);
+       free(nufano);
 
   /****************************************************************************
   *                       LECTURE DES ELEMENTS                                *
   ****************************************************************************/
-  fprintf(stdout,"\n(**************************)\n");
-  fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(**************************)");
-  //fprintf(Out,"CELLS\n");
-  /* Lecture des connectivites, noms, numeros des mailles */
-  //printf("%d %d %d %d\n",nmailles[3],nmailles[4],nmailles[5],nmailles[9]);
-
-  if (ret == 0)
-    for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
-      {
-       if (nmailles[i] > 0 && ret == 0)
-         {
-           /* dimension de la maille */
-           edim = typmai[i] / 100;
-           nsup = 0;
-           if (mdim  == 2 || mdim == 3)
-             if (edim == 1)
-               nsup = 1;
-           if (mdim == 3)
-             if (edim == 2)
-               nsup = 1;
-
-           taille = nsup+typmai[i]%100;
-           //taille = typmai[i]%100;
-           
-           /* allocation memoire */
-           connectivite = (med_int*)malloc(sizeof(med_int)*
-                                           taille*nmailles[i]);
-           nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
-                                  nmailles[i]+1);
-           numele = (med_int*)malloc(sizeof(med_int)*
-                                     nmailles[i]);
-           nufael = (med_int*)malloc(sizeof(med_int)*
-                                     nmailles[i]);
-           
-           /* lecture des données */
-           ret = MEDelementsLire(myFileId,nommaa,mdim,connectivite,mode_coo,
-                                 nomele,&inoele,numele,&inuele,nufael,
-                                 nmailles[i],MED_MAILLE,typmai[i],
-                                 typ_con);
-
-           switch (typmai[i])
-             {
-             case MED_TRIA3  : {
-               if (inuele) {
-                 for (j=0;j<nmailles[i];j++) {
-                   elem_id=*(numele+j);
-                   ok = mySMESHDSMesh->AddFaceWithID(*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),elem_id);
-                   //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2));
-                 }
-               }
-               else {
-                 for (j=0;j<nmailles[i];j++) {
-                   cmpt++;
-                   ok = mySMESHDSMesh->AddFaceWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),cmpt);
-                   //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2));
-                 }
-               }
+       fprintf(stdout, "\n(**************************)\n");
+       fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(**************************)");
+       //fprintf(Out,"CELLS\n");
+       /* Lecture des connectivites, noms, numeros des mailles */
+       //printf("%d %d %d %d\n",nmailles[3],nmailles[4],nmailles[5],nmailles[9]);
 
-               break;
-             }
-             case MED_QUAD4  : {
-               if (inuele) {
-                 for (j=0;j<nmailles[i];j++) {
-                   elem_id=*(numele+j);
-                   ok = mySMESHDSMesh->AddFaceWithID(*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3),elem_id);
-                   //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3));
-                 }
-               }
-               else {
-                 for (j=0;j<nmailles[i];j++) {
-                   cmpt++;
-                   ok = myMesh->AddFaceWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),cmpt);
-                   //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3));
-                 }
-               }
-               break;
-             }
-             case MED_HEXA8  : {
-               if (inuele) {
-                 for (j=0;j<nmailles[i];j++) {
-                   elem_id=*(numele+j);
-                   ok = mySMESHDSMesh->AddVolumeWithID(*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3),*(connectivite+j*(taille-nsup)+4),*(connectivite+j*(taille-nsup)+5),*(connectivite+j*(taille-nsup)+6),*(connectivite+j*(taille-nsup)+7),elem_id);
-                   //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3),*(connectivite+j*(taille-nsup)+4),*(connectivite+j*(taille-nsup)+5),*(connectivite+j*(taille-nsup)+6),*(connectivite+j*(taille-nsup)+7));
-                 }
-               }
-               else {
-                 for (j=0;j<nmailles[i];j++) {
-                   cmpt++;
-                   ok = mySMESHDSMesh->AddVolumeWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),*(connectivite+j*(taille)+4),*(connectivite+j*(taille)+5),*(connectivite+j*(taille)+6),*(connectivite+j*(taille)+7),cmpt);
-                   //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),*(connectivite+j*(taille)+4),*(connectivite+j*(taille)+5),*(connectivite+j*(taille)+6),*(connectivite+j*(taille)+7));
-                 }
+       if (ret == 0)
+               for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
+               {
+                       if (nmailles[i] > 0 && ret == 0)
+                       {
+                               /* dimension de la maille */
+                               edim = typmai[i] / 100;
+                               nsup = 0;
+                               if (mdim == 2 || mdim == 3)
+                                       if (edim == 1)
+                                               nsup = 1;
+                               if (mdim == 3)
+                                       if (edim == 2)
+                                               nsup = 1;
+
+                               taille = nsup + typmai[i] % 100;
+                               //taille = typmai[i]%100;
+
+                               /* allocation memoire */
+                               connectivite = (med_int *) malloc(sizeof(med_int) *
+                                       taille * nmailles[i]);
+                               nomele = (char *)malloc(sizeof(char) * MED_TAILLE_PNOM *
+                                       nmailles[i] + 1);
+                               numele = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
+                               nufael = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
+
+                               /* lecture des données */
+                               ret =
+                                       MEDelementsLire(myFileId, nommaa, mdim, connectivite,
+                                       mode_coo, nomele, &inoele, numele, &inuele, nufael,
+                                       nmailles[i], MED_MAILLE, typmai[i], typ_con);
+
+                               switch (typmai[i])
+                               {
+                               case MED_TRIA3:
+                               {
+                                       if (inuele)
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       elem_id = *(numele + j);
+                                                       ok = mySMESHDSMesh->AddFaceWithID(*(connectivite +
+                                                                       j * (taille - nsup)),
+                                                               *(connectivite + j * (taille - nsup) + 1),
+                                                               *(connectivite + j * (taille - nsup) + 2),
+                                                               elem_id);
+                                                       //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2));
+                                               }
+                                       }
+                                       else
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       cmpt++;
+                                                       ok = mySMESHDSMesh->AddFaceWithID(*(connectivite +
+                                                                       j * (taille)),
+                                                               *(connectivite + j * (taille) + 1),
+                                                               *(connectivite + j * (taille) + 2), cmpt);
+                                                       //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2));
+                                               }
+                                       }
+
+                                       break;
+                               }
+                               case MED_QUAD4:
+                               {
+                                       if (inuele)
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       elem_id = *(numele + j);
+                                                       ok = mySMESHDSMesh->AddFaceWithID(*(connectivite +
+                                                                       j * (taille - nsup)),
+                                                               *(connectivite + j * (taille - nsup) + 1),
+                                                               *(connectivite + j * (taille - nsup) + 2),
+                                                               *(connectivite + j * (taille - nsup) + 3),
+                                                               elem_id);
+                                                       //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3));
+                                               }
+                                       }
+                                       else
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       cmpt++;
+                                                       ok = myMesh->AddFaceWithID(*(connectivite +
+                                                                       j * (taille)),
+                                                               *(connectivite + j * (taille) + 1),
+                                                               *(connectivite + j * (taille) + 2),
+                                                               *(connectivite + j * (taille) + 3), cmpt);
+                                                       //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3));
+                                               }
+                                       }
+                                       break;
+                               }
+                               case MED_HEXA8:
+                               {
+                                       if (inuele)
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       elem_id = *(numele + j);
+                                                       ok = mySMESHDSMesh->AddVolumeWithID(*(connectivite +
+                                                                       j * (taille - nsup)),
+                                                               *(connectivite + j * (taille - nsup) + 1),
+                                                               *(connectivite + j * (taille - nsup) + 2),
+                                                               *(connectivite + j * (taille - nsup) + 3),
+                                                               *(connectivite + j * (taille - nsup) + 4),
+                                                               *(connectivite + j * (taille - nsup) + 5),
+                                                               *(connectivite + j * (taille - nsup) + 6),
+                                                               *(connectivite + j * (taille - nsup) + 7),
+                                                               elem_id);
+                                                       //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3),*(connectivite+j*(taille-nsup)+4),*(connectivite+j*(taille-nsup)+5),*(connectivite+j*(taille-nsup)+6),*(connectivite+j*(taille-nsup)+7));
+                                               }
+                                       }
+                                       else
+                                       {
+                                               for (j = 0; j < nmailles[i]; j++)
+                                               {
+                                                       cmpt++;
+                                                       ok = mySMESHDSMesh->AddVolumeWithID(*(connectivite +
+                                                                       j * (taille)),
+                                                               *(connectivite + j * (taille) + 1),
+                                                               *(connectivite + j * (taille) + 2),
+                                                               *(connectivite + j * (taille) + 3),
+                                                               *(connectivite + j * (taille) + 4),
+                                                               *(connectivite + j * (taille) + 5),
+                                                               *(connectivite + j * (taille) + 6),
+                                                               *(connectivite + j * (taille) + 7), cmpt);
+                                                       //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),*(connectivite+j*(taille)+4),*(connectivite+j*(taille)+5),*(connectivite+j*(taille)+6),*(connectivite+j*(taille)+7));
+                                               }
+                                       }
+                                       break;
+                               }
+                               default:
+                               {
+                                       break;
+                               }
+                               }
+
+                               fprintf(stdout, "\n  - Numéros de familles : \n");
+                               for (j = 0; j < nmailles[i]; j++)
+                                       fprintf(stdout, " %d ", *(nufael + j));
+
+                               /* liberation memoire */
+                               free(connectivite);
+                               free(nomele);
+                               free(numele);
+                               free(nufael);
+                       }
                }
-               break;
-             }
-             default : {
-               break ;
-             }
-             }
-
-           fprintf(stdout,"\n  - Numéros de familles : \n");
-           for (j=0;j<nmailles[i];j++)
-             fprintf(stdout," %d ",*(nufael+j));
-           
-           /* liberation memoire */
-           free(connectivite);
-           free(nomele);
-           free(numele);
-           free(nufael);
-         }
-      }
 
   /****************************************************************************
    *                       LECTURE DES FAMILLES                                *
    ****************************************************************************/
-  printf("\n(*************************)\n");
-  printf("(* FAMILLES DU MAILLAGE : *)\n");
-  printf("(*************************)\n");
-  if (ret == 0)
-    for (i=0;i<nfam;i++)
-      {
-       
-       /* nombre de groupes */
-       ngro = MEDnFam(myFileId,nommaa,i+1,MED_GROUPE);
-       if (ngro < 0)  
-         {
-           ret = -1;
-           strcpy(message,
-                  ">> ERREUR : lecture du nombre de groupes d'une famille \n");
-         }
-       
-       /* nombre d'attributs */
+       printf("\n(*************************)\n");
+       printf("(* FAMILLES DU MAILLAGE : *)\n");
+       printf("(*************************)\n");
        if (ret == 0)
-         {
-           natt = MEDnFam(myFileId,nommaa,i+1,MED_ATTR);
-           if (natt < 0)
-             {
-               ret = -1;
-               strcpy(message,
-                  ">> ERREUR : lecture du nombre d'attributs d'une famille\n");
-             }
-         }
+               for (i = 0; i < nfam; i++)
+               {
+
+                       /* nombre de groupes */
+                       ngro = MEDnFam(myFileId, nommaa, i + 1, MED_GROUPE);
+                       if (ngro < 0)
+                       {
+                               ret = -1;
+                               strcpy(message,
+                                       ">> ERREUR : lecture du nombre de groupes d'une famille \n");
+                       }
+
+                       /* nombre d'attributs */
+                       if (ret == 0)
+                       {
+                               natt = MEDnFam(myFileId, nommaa, i + 1, MED_ATTR);
+                               if (natt < 0)
+                               {
+                                       ret = -1;
+                                       strcpy(message,
+                                               ">> ERREUR : lecture du nombre d'attributs d'une famille\n");
+                               }
+                       }
+
+                       if (ret == 0)
+                               fprintf(stdout, "- Famille %d a %d attributs et %d groupes \n",
+                                       i + 1, natt, ngro);
+
+                       /* nom,numero,attributs,groupes */
+                       if (ret == 0)
+                       {
+                               attide = (med_int *) malloc(sizeof(med_int) * natt);
+                               attval = (med_int *) malloc(sizeof(med_int) * natt);
+                               attdes = (char *)malloc(MED_TAILLE_DESC * natt + 1);
+                               gro = (char *)malloc(MED_TAILLE_LNOM * ngro + 1);
+                               ret =
+                                       MEDfamInfo(myFileId, nommaa, i + 1, nomfam, &numfam, attide,
+                                       attval, attdes, &natt, gro, &ngro);
+
+                               fam = string(nomfam);
+                               fam_type = fam.substr(1, 1);
+                               fam_id = fam.substr(2, 1);
+                               if ((fam_type == string("V")) || (fam_type == string("A")) ||
+                                       (fam_type == string("F")))
+                                       LinkMeshToShape(fam_type, fam_id, family[i]);
+
+                               fprintf(stdout, "  - Famille de nom %s et de numero %d : \n",
+                                       nomfam, numfam);
+                               fprintf(stdout, "  - Attributs : \n");
+                               for (j = 0; j < natt; j++)
+                               {
+                                       strncpy(str1, attdes + j * MED_TAILLE_DESC,
+                                               MED_TAILLE_DESC);
+                                       str1[MED_TAILLE_DESC] = '\0';
+                                       fprintf(stdout, "   ide = %d - val = %d - des = %s\n",
+                                               *(attide + j), *(attval + j), str1);
+                               }
+                               free(attide);
+                               free(attval);
+                               free(attdes);
+                               fprintf(stdout, "  - Groupes :\n");
+                               for (j = 0; j < ngro; j++)
+                               {
+                                       strncpy(str2, gro + j * MED_TAILLE_LNOM, MED_TAILLE_LNOM);
+                                       str2[MED_TAILLE_LNOM] = '\0';
+                                       fprintf(stdout, "   gro = %s\n", str2);
+                               }
+                               free(gro);
+                       }
+               }
 
-       if (ret == 0)
-         fprintf(stdout,"- Famille %d a %d attributs et %d groupes \n",i+1,natt,ngro); 
-
-       /* nom,numero,attributs,groupes */
-       if (ret == 0)
-         {
-           attide = (med_int*) malloc(sizeof(med_int)*natt);
-           attval = (med_int*) malloc(sizeof(med_int)*natt);       
-           attdes = (char *) malloc(MED_TAILLE_DESC*natt+1);
-           gro = (char*) malloc(MED_TAILLE_LNOM*ngro+1);
-           ret = MEDfamInfo(myFileId,nommaa,i+1,nomfam,&numfam,attide,attval,
-                            attdes,&natt,gro,&ngro);
-
-           fam = string(nomfam);
-           fam_type = fam.substr(1,1);
-           fam_id = fam.substr(2,1);
-           if ((fam_type==string("V"))||(fam_type==string("A"))||(fam_type==string("F")))
-             LinkMeshToShape(fam_type, fam_id, family[i]);
-
-           fprintf(stdout,"  - Famille de nom %s et de numero %d : \n",nomfam,numfam);
-           fprintf(stdout,"  - Attributs : \n");
-           for (j=0;j<natt;j++)
-             {
-               strncpy(str1,attdes+j*MED_TAILLE_DESC,MED_TAILLE_DESC);
-               str1[MED_TAILLE_DESC] = '\0';
-               fprintf(stdout,"   ide = %d - val = %d - des = %s\n",*(attide+j),
-                      *(attval+j),str1);
-             }
-            free(attide);
-           free(attval);
-            free(attdes);
-            fprintf(stdout,"  - Groupes :\n");
-           for (j=0;j<ngro;j++)
-             {
-               strncpy(str2,gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
-               str2[MED_TAILLE_LNOM] = '\0';
-               fprintf(stdout,"   gro = %s\n",str2);
-             }
-            free(gro);
-         }
-      }
-
-  if (locally_managed)
-    ret = MEDfermer(myFileId);
+       if (locally_managed)
+               ret = MEDfermer(myFileId);
 
 }
 
-void DriverMED_R_SMESHDS_Mesh::LinkMeshToShape(string fam_type, string fam_id, vector<int> myNodes) {
-
-  Handle(SMESHDS_Mesh) mySMESHDSMesh = Handle(SMESHDS_Mesh)::DownCast(myMesh);
-
-  int id = atoi(fam_id.c_str());
-  if (fam_type==string("V")) { //Linked to a vertex
-    for (int i=0;i<myNodes.size();i++) {
-      Handle(SMDS_MeshElement) elem = mySMESHDSMesh->FindNode(myNodes[i]);
-      const Handle(SMDS_MeshNode)& node = mySMESHDSMesh->GetNode(1,elem);
-      //const TopoDS_Vertex& S;//le recuperer !!!
-      //mySMESHDSMesh->SetNodeOnVertex (node,S);
-    }
-  }
-  else 
-  if (fam_type==string("E")) { //Linked to an edge
-    for (int i=0;i<myNodes.size();i++) {
-      Handle(SMDS_MeshElement) elem = mySMESHDSMesh->FindNode(myNodes[i]);
-      const Handle(SMDS_MeshNode)& node = mySMESHDSMesh->GetNode(1,elem);
-      //const TopoDS_Edge& S;//le recuperer !!!
-      //mySMESHDSMesh->SetNodeOnEdge (node,S);
-    }
-  }
-  else 
-  if (fam_type==string("F")) { //Linked to a face
-    for (int i=0;i<myNodes.size();i++) {
-      Handle(SMDS_MeshElement) elem = mySMESHDSMesh->FindNode(myNodes[i]);
-      const Handle(SMDS_MeshNode)& node = mySMESHDSMesh->GetNode(1,elem);
-      //const TopoDS_Face& S;//le recuperer !!!
-      //mySMESHDSMesh->SetNodeOnFace (node,S);
-    }
-  }
+void DriverMED_R_SMESHDS_Mesh::LinkMeshToShape(string fam_type, string fam_id,
+       vector < int >myNodes)
+{
 
-}
+       SMESHDS_Mesh * mySMESHDSMesh = dynamic_cast<SMESHDS_Mesh *>(myMesh);
+
+       int id = atoi(fam_id.c_str());
+       if (fam_type == string("V"))
+       {                                                       //Linked to a vertex
+               for (int i = 0; i < myNodes.size(); i++)
+               {
+                       const SMDS_MeshNode * node = mySMESHDSMesh->FindNode(myNodes[i]);
+                       //const TopoDS_Vertex& S;//le recuperer !!!
+                       //mySMESHDSMesh->SetNodeOnVertex (node,S);
+               }
+       }
+       else if (fam_type == string("E"))
+       {                                                       //Linked to an edge
+               for (int i = 0; i < myNodes.size(); i++)
+               {
+                       const SMDS_MeshNode * node = mySMESHDSMesh->FindNode(myNodes[i]);
+                       //const TopoDS_Edge& S;//le recuperer !!!
+                       //mySMESHDSMesh->SetNodeOnEdge (node,S);
+               }
+       }
+       else if (fam_type == string("F"))
+       {                                                       //Linked to a face
+               for (int i = 0; i < myNodes.size(); i++)
+               {
+                       const SMDS_MeshNode * node = mySMESHDSMesh->FindNode(myNodes[i]);
+                       //const TopoDS_Face& S;//le recuperer !!!
+                       //mySMESHDSMesh->SetNodeOnFace (node,S);
+               }
+       }
 
+}
index 6074843118dfa9ab1a9f788f663248c42e316e81..88ae5037c38682b51d8baa0a99296ab99ab65b5d 100644 (file)
@@ -36,28 +36,27 @@ extern "C"
 #include <med.h>
 }
 
-class DriverMED_R_SMESHDS_Mesh : public Mesh_Reader {
+class DriverMED_R_SMESHDS_Mesh:public Mesh_Reader
+{
 
-  public :
-    DriverMED_R_SMESHDS_Mesh();
-    ~DriverMED_R_SMESHDS_Mesh();
+  public:DriverMED_R_SMESHDS_Mesh();
+       ~DriverMED_R_SMESHDS_Mesh();
 
-    void Read();
-    void ReadMySelf();
-    void Add();
+       void Read();
+       void ReadMySelf();
+       void Add();
 
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
-    void SetFileId(med_idt);
-    void SetMeshId(int);
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
+       void SetFileId(med_idt);
+       void SetMeshId(int);
 
-    void LinkMeshToShape(string , string , vector<int>);
+       void LinkMeshToShape(string, string, vector < int >);
 
-private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    med_idt myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       med_idt myFileId;
+       int myMeshId;
 
 };
 #endif
index d12aeeaa0b0f4bff6d8c72e706384ecef31b62b2..a8497e95c1fdcf433f888e6ee06523ee1e1e5865 100644 (file)
@@ -29,351 +29,382 @@ using namespace std;
 
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
-#include "SMDS_MeshFacesIterator.hxx"
-#include "SMDS_MeshNodesIterator.hxx"
-#include "SMDS_MeshVolumesIterator.hxx"
+
+
+
 
 #include "utilities.h"
 #include <vector>
 
-DriverMED_W_SMDS_Mesh::DriverMED_W_SMDS_Mesh() {
-;
+DriverMED_W_SMDS_Mesh::DriverMED_W_SMDS_Mesh()
+{
+       ;
 }
 
-DriverMED_W_SMDS_Mesh::~DriverMED_W_SMDS_Mesh() {
-;
+DriverMED_W_SMDS_Mesh::~DriverMED_W_SMDS_Mesh()
+{
+       ;
 }
 
-void DriverMED_W_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  myMesh = aMesh;
+void DriverMED_W_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       myMesh = aMesh;
 }
 
-void DriverMED_W_SMDS_Mesh::SetFile(string aFile) {
-  myFile = aFile;
+void DriverMED_W_SMDS_Mesh::SetFile(string aFile)
+{
+       myFile = aFile;
 }
 
-void DriverMED_W_SMDS_Mesh::SetFileId(med_idt aFileId) {
-  myFileId = aFileId;
+void DriverMED_W_SMDS_Mesh::SetFileId(med_idt aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverMED_W_SMDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverMED_W_SMDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverMED_W_SMDS_Mesh::Add() {
-  ;
+void DriverMED_W_SMDS_Mesh::Add()
+{
+       ;
 }
 
-void DriverMED_W_SMDS_Mesh::Write() {
-
-  med_err ret = 0;
-  int i,j,k,l;
-  int numero;
-  char message[200];
-  Standard_Boolean ok;
-  /* nombre d'objets MED */
-  char nom_universel[MED_TAILLE_LNOM+1];
-  med_int long_fichier_en_tete; 
-  char *fichier_en_tete;
-  char version_hdf[10];
-  char version_med[10];
-  med_int nmaa,mdim,nnoe;
-  med_int nmai[MED_NBR_GEOMETRIE_MAILLE],nfac[MED_NBR_GEOMETRIE_FACE];
-  med_int nare[MED_NBR_GEOMETRIE_ARETE];
-  /* nom du maillage */
-  char nommaa[MED_TAILLE_NOM+1];
-  /* noeuds */
-  med_float *coo;
-  char nomcoo[3*MED_TAILLE_PNOM+1];
-  char unicoo[3*MED_TAILLE_PNOM+1];
-  char *nomnoe;
-  med_int *numnoe;
-  med_int *nufano; 
-  med_repere rep;
-  med_booleen inonoe,inunoe;
-  med_mode_switch mode_coo;
-  char str[MED_TAILLE_PNOM+1];
-  med_int nbNodes;
-  /* elements */
-  med_int nsup;
-  med_int edim;
-  med_int taille;
-  med_int elem_id,myId;
-  med_int *connectivite;
-  char *nomele;
-  med_int *numele;
-  med_int *nufael;
-  med_booleen inoele, inuele;
-  med_connectivite typ_con;
-  med_geometrie_element typgeo;
-  med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2, 
-                                                  MED_SEG3,MED_TRIA3,
-                                                  MED_TRIA6,MED_QUAD4,
-                                                  MED_QUAD8,MED_TETRA4,
-                                                  MED_TETRA10,MED_HEXA8,
-                                                  MED_HEXA20,MED_PENTA6,
-                                                  MED_PENTA15,MED_PYRA5,
-                                                  MED_PYRA13};
-  med_int desmai[MED_NBR_GEOMETRIE_MAILLE] = {0,2,3,3,3,4,4,4,4,6,6,5,5,5,5};
-  med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
-  char nommai[MED_NBR_GEOMETRIE_MAILLE] [MED_TAILLE_NOM+1] = {"MED_POINT1",
-                                                         "MED_SEG2", 
-                                                         "MED_SEG3",
-                                                         "MED_TRIA3",
-                                                         "MED_TRIA6",
-                                                         "MED_QUAD4",
-                                                         "MED_QUAD8",
-                                                         "MED_TETRA4",
-                                                         "MED_TETRA10",
-                                                         "MED_HEXA8",
-                                                         "MED_HEXA20",
-                                                         "MED_PENTA6",
-                                                         "MED_PENTA15",
-                                                         "MED_PYRA5",
-                                                         "MED_PYRA13"};
-  med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
-                                                MED_QUAD4,MED_QUAD8};
-  med_int desfac[MED_NBR_GEOMETRIE_FACE] = {3,3,4,4};
-  med_int nfaces[MED_NBR_GEOMETRIE_FACE];
-  char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM+1] = {"MED_TRIA3","MED_TRIA6",
-                                                      "MED_QUAD4","MED_QUAD8"};
-  med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
-  med_int desare[MED_NBR_GEOMETRIE_ARETE] = {2,3};
-  med_int naretes[MED_NBR_GEOMETRIE_ARETE];
-  char nomare[MED_NBR_GEOMETRIE_ARETE] [MED_TAILLE_NOM+1] = {"MED_SEG2","MED_SEG3"};
-  /* familles */
-  med_int nfam;
-  med_int natt,ngro;
-  char *attdes,*gro;
-  med_int *attval,*attide;
-  char nomfam[MED_TAILLE_NOM+1];
-  med_int numfam;
-  char str1[MED_TAILLE_DESC+1];
-  char str2[MED_TAILLE_LNOM+1];
+void DriverMED_W_SMDS_Mesh::Write()
+{
+
+       med_err ret = 0;
+       int i, j, k, l;
+       int numero;
+       char message[200];
+       bool ok;
+       /* nombre d'objets MED */
+       char nom_universel[MED_TAILLE_LNOM + 1];
+       med_int long_fichier_en_tete;
+       char *fichier_en_tete;
+       char version_hdf[10];
+       char version_med[10];
+       med_int nmaa, mdim, nnoe;
+       med_int nmai[MED_NBR_GEOMETRIE_MAILLE], nfac[MED_NBR_GEOMETRIE_FACE];
+       med_int nare[MED_NBR_GEOMETRIE_ARETE];
+       /* nom du maillage */
+       char nommaa[MED_TAILLE_NOM + 1];
+       /* noeuds */
+       med_float *coo;
+       char nomcoo[3 * MED_TAILLE_PNOM + 1];
+       char unicoo[3 * MED_TAILLE_PNOM + 1];
+       char *nomnoe;
+       med_int *numnoe;
+       med_int *nufano;
+       med_repere rep;
+       med_booleen inonoe, inunoe;
+       med_mode_switch mode_coo;
+       char str[MED_TAILLE_PNOM + 1];
+       med_int nbNodes;
+       /* elements */
+       med_int nsup;
+       med_int edim;
+       med_int taille;
+       med_int elem_id, myId;
+       med_int *connectivite;
+       char *nomele;
+       med_int *numele;
+       med_int *nufael;
+       med_booleen inoele, inuele;
+       med_connectivite typ_con;
+       med_geometrie_element typgeo;
+       med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] =
+               { MED_POINT1, MED_SEG2,
+               MED_SEG3, MED_TRIA3,
+               MED_TRIA6, MED_QUAD4,
+               MED_QUAD8, MED_TETRA4,
+               MED_TETRA10, MED_HEXA8,
+               MED_HEXA20, MED_PENTA6,
+               MED_PENTA15, MED_PYRA5,
+               MED_PYRA13
+       };
+       med_int desmai[MED_NBR_GEOMETRIE_MAILLE] =
+               { 0, 2, 3, 3, 3, 4, 4, 4, 4, 6, 6, 5, 5, 5, 5 };
+       med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
+       char nommai[MED_NBR_GEOMETRIE_MAILLE][MED_TAILLE_NOM + 1] = { "MED_POINT1",
+               "MED_SEG2",
+               "MED_SEG3",
+               "MED_TRIA3",
+               "MED_TRIA6",
+               "MED_QUAD4",
+               "MED_QUAD8",
+               "MED_TETRA4",
+               "MED_TETRA10",
+               "MED_HEXA8",
+               "MED_HEXA20",
+               "MED_PENTA6",
+               "MED_PENTA15",
+               "MED_PYRA5",
+               "MED_PYRA13"
+       };
+       med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] =
+               { MED_TRIA3, MED_TRIA6,
+               MED_QUAD4, MED_QUAD8
+       };
+       med_int desfac[MED_NBR_GEOMETRIE_FACE] = { 3, 3, 4, 4 };
+       med_int nfaces[MED_NBR_GEOMETRIE_FACE];
+       char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM + 1] =
+               { "MED_TRIA3", "MED_TRIA6",
+               "MED_QUAD4", "MED_QUAD8"
+       };
+       med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] =
+               { MED_SEG2, MED_SEG3 };
+       med_int desare[MED_NBR_GEOMETRIE_ARETE] = { 2, 3 };
+       med_int naretes[MED_NBR_GEOMETRIE_ARETE];
+       char nomare[MED_NBR_GEOMETRIE_ARETE][MED_TAILLE_NOM + 1] =
+               { "MED_SEG2", "MED_SEG3" };
+       /* familles */
+       med_int nfam;
+       med_int natt, ngro;
+       char *attdes, *gro;
+       med_int *attval, *attide;
+       char nomfam[MED_TAILLE_NOM + 1];
+       med_int numfam;
+       char str1[MED_TAILLE_DESC + 1];
+       char str2[MED_TAILLE_LNOM + 1];
 
   /****************************************************************************
   *                      OUVERTURE DU FICHIER EN ECRITURE                      *
   ****************************************************************************/
-  /*!  char* file2Read = (char*)myFile.c_str();
-  myFileId = MEDouvrir(file2Read,MED_REMP);
-  if (myFileId < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-      exit(EXIT_FAILURE);
-    }
-  */
-  typ_con = MED_NOD;
-  mode_coo = MED_FULL_INTERLACE;
-  numero = myMeshId;
+       /*!  char* file2Read = (char*)myFile.c_str();
+        * myFileId = MEDouvrir(file2Read,MED_REMP);
+        * if (myFileId < 0)
+        * {
+        * fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
+        * exit(EXIT_FAILURE);
+        * }
+        */
+       typ_con = MED_NOD;
+       mode_coo = MED_FULL_INTERLACE;
+       numero = myMeshId;
 
   /****************************************************************************
   *                       NOMBRES D'OBJETS MED                                *
   ****************************************************************************/
-  fprintf(stdout,"\n(****************************)\n");
-  fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
-  fprintf(stdout,"(****************************)\n");
-
-  /* creation du maillage */
-  mdim=3;
-  //nommaa = QString("Mesh "+myMeshId).latin1();
-  //nommaa = "";
-  //plutot recuperer le nom du maillage dans l'etude
-  if (ret == 0)
-    ret = MEDmaaCr(myFileId,nommaa,mdim);
-  printf("%d\n",ret);
-
-      
-  /* Combien de noeuds ? */
-  nnoe = myMesh->NbNodes();
-  //SCRUTE(nnoe);
-  /* Combien de mailles, faces ou aretes ? */
-  for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
-    nmailles[i]=0;
-
-  SMDS_MeshFacesIterator itFaces(myMesh);
-  Standard_Integer nb_of_nodes, nb_of_faces;
-  nb_of_faces = myMesh->NbFaces();
-  //SCRUTE(nb_of_faces);
-
-  //med_int elem_Id[MED_NBR_GEOMETRIE_FACE][nb_of_faces];
-  vector<int> elem_Id[MED_NBR_GEOMETRIE_MAILLE];
-  //typedef vector<int> Integer_vector;
-  //vector<Integer_vector> elem_Id;
-  //elem_Id.resize(MED_NBR_GEOMETRIE_MAILLE);
-   
-  for (;itFaces.More();itFaces.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itFaces.Value();
-
-    nb_of_nodes = elem->NbNodes();
-
-    switch (nb_of_nodes) {
-    case 3 : {
-      //elem_Id[3][nmailles[3]] = elem->GetID();
-      elem_Id[3].push_back(elem->GetID());
-      nmailles[3]++;
-      break;
-    }
-    case 4 : {
-      //elem_Id[5][nmailles[5]] = elem->GetID();
-      elem_Id[5].push_back(elem->GetID());
-      nmailles[5]++;
-      break;
-    }
-    case 6 : {
-      //elem_Id[4][nmailles[4]] = elem->GetID();
-      elem_Id[4].push_back(elem->GetID());
-      nmailles[4]++;
-      break;
-    }
-    }
-
-  }
-
-  SMDS_MeshVolumesIterator itVolumes(myMesh);
-   
-  for (;itVolumes.More();itVolumes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itVolumes.Value();
-
-    nb_of_nodes = elem->NbNodes();
-    switch (nb_of_nodes) {
-    case 8 : {
-      //elem_Id[9][nmailles[9]] = elem->GetID();
-      elem_Id[9].push_back(elem->GetID());
-      nmailles[9]++;
-      break;
-    }
-    }
-  }
+       fprintf(stdout, "\n(****************************)\n");
+       fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
+       fprintf(stdout, "(****************************)\n");
+
+       /* creation du maillage */
+       mdim = 3;
+       //nommaa = QString("Mesh "+myMeshId).latin1();
+       //nommaa = "";
+       //plutot recuperer le nom du maillage dans l'etude
+       if (ret == 0)
+               ret = MEDmaaCr(myFileId, nommaa, mdim);
+       printf("%d\n", ret);
+
+       /* Combien de noeuds ? */
+       nnoe = myMesh->NbNodes();
+       //SCRUTE(nnoe);
+       /* Combien de mailles, faces ou aretes ? */
+       for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
+               nmailles[i] = 0;
+
+       SMDS_Iterator<const SMDS_MeshFace *> * itFaces=myMesh->facesIterator();
+       int nb_of_nodes, nb_of_faces;
+       nb_of_faces = myMesh->NbFaces();
+       //SCRUTE(nb_of_faces);
+
+       //med_int elem_Id[MED_NBR_GEOMETRIE_FACE][nb_of_faces];
+       vector<int> elem_Id[MED_NBR_GEOMETRIE_MAILLE];
+       //typedef vector<int> Integer_vector;
+       //vector<Integer_vector> elem_Id;
+       //elem_Id.resize(MED_NBR_GEOMETRIE_MAILLE);
+
+       while(itFaces->more())
+       {
+               const SMDS_MeshFace * elem = itFaces->next();
+
+               nb_of_nodes = elem->NbNodes();
+
+               switch (nb_of_nodes)
+               {
+               case 3:
+               {
+                       //elem_Id[3][nmailles[3]] = elem->GetID();
+                       elem_Id[3].push_back(elem->GetID());
+                       nmailles[3]++;
+                       break;
+               }
+               case 4:
+               {
+                       //elem_Id[5][nmailles[5]] = elem->GetID();
+                       elem_Id[5].push_back(elem->GetID());
+                       nmailles[5]++;
+                       break;
+               }
+               case 6:
+               {
+                       //elem_Id[4][nmailles[4]] = elem->GetID();
+                       elem_Id[4].push_back(elem->GetID());
+                       nmailles[4]++;
+                       break;
+               }
+               }
+
+       }
+
+       SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=myMesh->volumesIterator();
+       while(itVolumes->more())
+       {
+               const SMDS_MeshVolume * elem = itVolumes->next();
+
+               nb_of_nodes = elem->NbNodes();
+               switch (nb_of_nodes)
+               {
+               case 8:
+               {
+                       //elem_Id[9][nmailles[9]] = elem->GetID();
+                       elem_Id[9].push_back(elem->GetID());
+                       nmailles[9]++;
+                       break;
+               }
+               }
+       }
 
   /****************************************************************************
   *                       ECRITURE DES NOEUDS                                  *
   ****************************************************************************/
-  fprintf(stdout,"\n(************************)\n");
-  fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(************************)\n");
-
-  /* Allocations memoires */
-  /* table des coordonnees 
-     profil : (dimension * nombre de noeuds ) */
-  coo = (med_float*) malloc(sizeof(med_float)*nnoe*mdim);
-  /* table  des numeros, des numeros de familles des noeuds
-     profil : (nombre de noeuds) */
-  numnoe = (med_int*) malloc(sizeof(med_int)*nnoe);
-  nufano = (med_int*) malloc(sizeof(med_int)*nnoe);
-  /* table des noms des noeuds 
-     profil : (nnoe*MED_TAILLE_PNOM+1) */
-  nomnoe ="";
-
-  i = 0;
-  SMDS_MeshNodesIterator itNodes(myMesh);
-  for (;itNodes.More();itNodes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itNodes.Value();
-    const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem);
-    coo[i*3]=node->X();
-    coo[i*3+1]=node->Y();
-    coo[i*3+2]=node->Z();
-    numnoe[i]=node->GetID();
-    nufano[i]=0;
-    i++;
-  }
-    
-  /* ecriture des noeuds : 
-     - coordonnees
-     - noms (optionnel dans un fichier MED) 
-     - numeros (optionnel dans un fichier MED) 
-     - numeros des familles */
-  ret = MEDnoeudsEcr(myFileId,nommaa,mdim,coo,mode_coo,MED_CART,
-                      nomcoo,unicoo,nomnoe,MED_FAUX,numnoe,MED_VRAI,
-                      nufano,nnoe,MED_REMP);
-
-  /* liberation memoire */
-  free(coo);
-  //free(nomnoe);
-  free(numnoe);
-  free(nufano);
+       fprintf(stdout, "\n(************************)\n");
+       fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(************************)\n");
+
+       /* Allocations memoires */
+       /* table des coordonnees 
+        * profil : (dimension * nombre de noeuds ) */
+       coo = (med_float *) malloc(sizeof(med_float) * nnoe * mdim);
+       /* table  des numeros, des numeros de familles des noeuds
+        * profil : (nombre de noeuds) */
+       numnoe = (med_int *) malloc(sizeof(med_int) * nnoe);
+       nufano = (med_int *) malloc(sizeof(med_int) * nnoe);
+       /* table des noms des noeuds 
+        * profil : (nnoe*MED_TAILLE_PNOM+1) */
+       nomnoe = "";
+
+       i = 0;
+       SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator();
+       while(itNodes->more())
+       {               
+               const SMDS_MeshNode * node = itNodes->next();
+               coo[i * 3] = node->X();
+               coo[i * 3 + 1] = node->Y();
+               coo[i * 3 + 2] = node->Z();
+               numnoe[i] = node->GetID();
+               nufano[i] = 0;
+               i++;
+       }
+
+       /* ecriture des noeuds : 
+        * - coordonnees
+        * - noms (optionnel dans un fichier MED) 
+        * - numeros (optionnel dans un fichier MED) 
+        * - numeros des familles */
+       ret = MEDnoeudsEcr(myFileId, nommaa, mdim, coo, mode_coo, MED_CART,
+               nomcoo, unicoo, nomnoe, MED_FAUX, numnoe, MED_VRAI,
+               nufano, nnoe, MED_REMP);
+
+       /* liberation memoire */
+       free(coo);
+       //free(nomnoe);
+       free(numnoe);
+       free(nufano);
 
   /****************************************************************************
   *                       ECRITURE DES ELEMENTS                                *
   ****************************************************************************/
-  fprintf(stdout,"\n(**************************)\n");
-  fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(**************************)");
-  //fprintf(Out,"CELLS\n");
-  /* Ecriture des connectivites, noms, numeros des mailles */
-
-  if (ret == 0)
-    for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
-      {
-       if (nmailles[i] > 0 && ret == 0)
-         {
-           MESSAGE ( " Start "<<typmai[i]);
-           /* dimension de la maille */
-           edim = typmai[i] / 100;
-           nsup = 0;
-           if (mdim  == 2 || mdim == 3)
-             if (edim == 1)
-               nsup = 1;
-           if (mdim == 3)
-             if (edim == 2)
-               nsup = 1;
-
-           taille = nsup+typmai[i]%100;
-           //taille = typmai[i]%100;
-           
-           /* allocation memoire */
-           connectivite = (med_int*)malloc(sizeof(med_int)*
-                                           taille*nmailles[i]);
-           nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
-                                  nmailles[i]+1);
-           numele = (med_int*)malloc(sizeof(med_int)*
-                                     nmailles[i]);
-           nufael = (med_int*)malloc(sizeof(med_int)*
-                                     nmailles[i]);
-           nomele="";
-           nbNodes=typmai[i]%100;
-
-           //penser a mater les (taille-nsup)
-           for (j=0;j<nmailles[i];j++) {
-             myId = elem_Id[i][j];
-             const Handle(SMDS_MeshElement)& elem = myMesh->FindElement(myId);
-             *(numele+j) = myId;
-             //elem_id=*(numele+j);
-             //fprintf(stdout,"%d \n",myId);
-
-             for (k=0; k<nbNodes; k++) {
-               //*(connectivite+j*(taille-1)+k)=cnx[k];
-               *(connectivite+j*(taille-nsup)+k) = elem->GetConnection(k+1);
-               //fprintf(stdout,"%d ",*(connectivite+j*(taille-nsup)+k));
-             }
-             nufael[j]=0;
-             //fprintf(stdout,"\n");
-           }
-
-           /* ecriture des données */
-
-           ret=MEDelementsEcr(myFileId,nommaa,mdim,connectivite,mode_coo,nomele,MED_FAUX,numele,MED_VRAI,nufael,nmailles[i],MED_MAILLE,typmai[i],typ_con,MED_REMP);
-
-           if (ret < 0)
-             MESSAGE(">> ERREUR : lecture des mailles \n");
-
-           /* liberation memoire */
-           free(connectivite);
-           //free(nomele);
-           free(numele);
-           free(nufael);
-           MESSAGE ( " End "<<typmai[i]);
-         }
-      }
+       fprintf(stdout, "\n(**************************)\n");
+       fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(**************************)");
+       //fprintf(Out,"CELLS\n");
+       /* Ecriture des connectivites, noms, numeros des mailles */
+
+       if (ret == 0)
+               for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
+               {
+                       if (nmailles[i] > 0 && ret == 0)
+                       {
+                               MESSAGE(" Start " << typmai[i]);
+                               /* dimension de la maille */
+                               edim = typmai[i] / 100;
+                               nsup = 0;
+                               if (mdim == 2 || mdim == 3)
+                                       if (edim == 1)
+                                               nsup = 1;
+                               if (mdim == 3)
+                                       if (edim == 2)
+                                               nsup = 1;
+
+                               taille = nsup + typmai[i] % 100;
+                               //taille = typmai[i]%100;
+
+                               /* allocation memoire */
+                               connectivite = (med_int *) malloc(sizeof(med_int) *
+                                       taille * nmailles[i]);
+                               nomele = (char *)malloc(sizeof(char) * MED_TAILLE_PNOM *
+                                       nmailles[i] + 1);
+                               numele = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
+                               nufael = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
+                               nomele = "";
+                               nbNodes = typmai[i] % 100;
+
+                               //penser a mater les (taille-nsup)
+                               for (j = 0; j < nmailles[i]; j++)
+                               {
+                                       myId = elem_Id[i][j];
+                                       const SMDS_MeshElement * elem =
+                                               myMesh->FindElement(myId);
+                                       *(numele + j) = myId;
+                                       //elem_id=*(numele+j);
+                                       //fprintf(stdout,"%d \n",myId);
+
+                                       SMDS_Iterator<const SMDS_MeshElement *> * itNode=
+                                               elem->nodesIterator();
+
+                                       while(itNode->more())
+                                       {
+                                               //*(connectivite+j*(taille-1)+k)=cnx[k];
+                                               *(connectivite + j * (taille - nsup) + k) =
+                                                       itNode->next()->GetID();
+                                               //fprintf(stdout,"%d ",*(connectivite+j*(taille-nsup)+k));
+                                       }
+                                       nufael[j] = 0;
+                                       //fprintf(stdout,"\n");
+                               }
+
+                               /* ecriture des données */
+
+                               ret =
+                                       MEDelementsEcr(myFileId, nommaa, mdim, connectivite,
+                                       mode_coo, nomele, MED_FAUX, numele, MED_VRAI, nufael,
+                                       nmailles[i], MED_MAILLE, typmai[i], typ_con, MED_REMP);
+
+                               if (ret < 0)
+                                       MESSAGE(">> ERREUR : lecture des mailles \n");
+
+                               /* liberation memoire */
+                               free(connectivite);
+                               //free(nomele);
+                               free(numele);
+                               free(nufael);
+                               MESSAGE(" End " << typmai[i]);
+                       }
+               }
 
   /****************************************************************************
   *                      FERMETURE DU FICHIER                                 *
   ****************************************************************************/
 
-           /*!  ret = MEDfermer(myFileId);
-
-  if (ret != 0)
-    fprintf(stderr,">> ERREUR : erreur a la fermeture du fichier %s\n",file2Read);
-           */
+       /*!  ret = MEDfermer(myFileId);
+        * 
+        * if (ret != 0)
+        * fprintf(stderr,">> ERREUR : erreur a la fermeture du fichier %s\n",file2Read);
+        */
 
 }
index 8a98c79f11ae485a4f99671a5aa8f24c6476814e..4610d6c533d8515970587a87eff3c413359fc957 100644 (file)
@@ -37,25 +37,24 @@ extern "C"
 #include <med.h>
 }
 
-class DriverMED_W_SMDS_Mesh : public Mesh_Writer {
+class DriverMED_W_SMDS_Mesh:public Mesh_Writer
+{
 
-  public :
-    DriverMED_W_SMDS_Mesh();
-    ~DriverMED_W_SMDS_Mesh();
+  public:DriverMED_W_SMDS_Mesh();
+       ~DriverMED_W_SMDS_Mesh();
 
-    void Add(); 
-    void Write();
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
+       void Add();
+       void Write();
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
 
-    void SetFileId(med_idt);
-    void SetMeshId(int);
+       void SetFileId(med_idt);
+       void SetMeshId(int);
 
-private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    med_idt myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       med_idt myFileId;
+       int myMeshId;
 
 };
 #endif
index be8b84a2b7a199b8d97279952eed12421945c408..e04bac2185397f93ac069be6a2a077d1abde28cb 100644 (file)
@@ -31,19 +31,22 @@ using namespace std;
 
 #include <stdio.h>
 
-extern "C" 
+extern "C"
 {
-  Document_Writer* Wmaker() {
-    return new DriverMED_W_SMESHDS_Document;
-  }
+       Document_Writer *Wmaker()
+       {
+               return new DriverMED_W_SMESHDS_Document;
+       }
 }
 
-DriverMED_W_SMESHDS_Document::DriverMED_W_SMESHDS_Document() {
-;
+DriverMED_W_SMESHDS_Document::DriverMED_W_SMESHDS_Document()
+{
+       ;
 }
 
-DriverMED_W_SMESHDS_Document::~DriverMED_W_SMESHDS_Document() {
-;
+DriverMED_W_SMESHDS_Document::~DriverMED_W_SMESHDS_Document()
+{
+       ;
 }
 
 //void DriverMED_W_SMESHDS_Document::SetFile(string aFile) {
@@ -54,47 +57,47 @@ DriverMED_W_SMESHDS_Document::~DriverMED_W_SMESHDS_Document() {
 //myDocument = aDocument;
 //}
 
-void DriverMED_W_SMESHDS_Document::Write() {
+void DriverMED_W_SMESHDS_Document::Write()
+{
 
-  med_err ret = 0;
-  med_idt fid;
-  med_int nmaa,numero,nb_of_meshes;
-  med_mode_switch mode_coo;
-  med_connectivite typ_con;
+       med_err ret = 0;
+       med_idt fid;
+       med_int nmaa, numero, nb_of_meshes;
+       med_mode_switch mode_coo;
+       med_connectivite typ_con;
 
-  SCRUTE(myFile);
-  Handle(SMESHDS_Mesh) myMesh;
+       SCRUTE(myFile);
+       SMESHDS_Mesh * myMesh;
 
   /******** Nombre de maillages ********/
-  nb_of_meshes = myDocument->NbMeshes(); //voir avec Yves
-  MESSAGE("nb_of_meshes = "<<nb_of_meshes<<"\n");
-  SCRUTE(nb_of_meshes);
-  //nb_of_meshes = 1;
-  numero = 0;
-
-  string myClass = string("SMESHDS_Mesh");
-  string myExtension = string("MED");
-
-  //while (numero<nb_of_meshes) {
-  //numero++;
-  //myMesh = myDocument->GetMesh(numero);
-
-  myDocument->InitMeshesIterator();
-  if (nb_of_meshes!=0)
-  for (;myDocument->MoreMesh();myDocument->NextMesh()) {
-    numero++;
-    myMesh = myDocument->CurrentMesh();
-
-    DriverMED_W_SMESHDS_Mesh* myWriter = new DriverMED_W_SMESHDS_Mesh;
-
-    myWriter->SetMesh(myMesh);
-    myWriter->SetFile(myFile);
-    //myWriter->SetFileId(fid);
-    myWriter->SetMeshId(numero);
-
-    //myWriter->Write();
-    myWriter->Add();
-  }
-
-
+       nb_of_meshes = myDocument->NbMeshes();  //voir avec Yves
+       MESSAGE("nb_of_meshes = " << nb_of_meshes << "\n");
+       SCRUTE(nb_of_meshes);
+       //nb_of_meshes = 1;
+       numero = 0;
+
+       string myClass = string("SMESHDS_Mesh");
+       string myExtension = string("MED");
+
+       //while (numero<nb_of_meshes) {
+       //numero++;
+       //myMesh = myDocument->GetMesh(numero);
+
+       myDocument->InitMeshesIterator();
+       if (nb_of_meshes != 0)
+               while(myDocument->MoreMesh())
+               {
+                       numero++;
+                       myMesh = myDocument->NextMesh();
+
+                       DriverMED_W_SMESHDS_Mesh *myWriter = new DriverMED_W_SMESHDS_Mesh;
+
+                       myWriter->SetMesh(myMesh);
+                       myWriter->SetFile(myFile);
+                       //myWriter->SetFileId(fid);
+                       myWriter->SetMeshId(numero);
+
+                       //myWriter->Write();
+                       myWriter->Add();
+               }
 }
index e17c1d84de34eac15bb18b20afb9c3af10fd7a29..14512530488dc0231408c3c4cd52286d304579d5 100644 (file)
 using namespace std;
 #include "DriverMED_W_SMESHDS_Mesh.h"
 #include "DriverMED_W_SMDS_Mesh.h"
-
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
-#include "SMDS_MeshFacesIterator.hxx"
-#include "SMDS_MeshEdgesIterator.hxx"
-#include "SMDS_MeshNodesIterator.hxx"
-#include "SMDS_MeshVolumesIterator.hxx"
-#include "SMESHDS_SubMesh.hxx"
-#include "SMDS_MapIteratorOfExtendedMap.hxx"
-#include "SMDS_MapOfMeshElement.hxx"
-#include "SMDS_Position.hxx"
-
 #include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_CompSolid.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-
-
-#include <map>
-#include <set>
 #include <vector>
 #include "utilities.h"
 
-DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh() {
-  ;
+DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh()
+{
+       ;
 }
 
-DriverMED_W_SMESHDS_Mesh::~DriverMED_W_SMESHDS_Mesh() {
-  ;
+DriverMED_W_SMESHDS_Mesh::~DriverMED_W_SMESHDS_Mesh()
+{
+       ;
 }
 
-void DriverMED_W_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  myMesh = aMesh;
+void DriverMED_W_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       myMesh = aMesh;
 }
 
-void DriverMED_W_SMESHDS_Mesh::SetFile(string aFile) {
-  myFile = aFile;
+void DriverMED_W_SMESHDS_Mesh::SetFile(string aFile)
+{
+       myFile = aFile;
 }
 
-void DriverMED_W_SMESHDS_Mesh::SetFileId(med_idt aFileId) {
-  myFileId = aFileId;
+void DriverMED_W_SMESHDS_Mesh::SetFileId(med_idt aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverMED_W_SMESHDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverMED_W_SMESHDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverMED_W_SMESHDS_Mesh::Write() {
+void DriverMED_W_SMESHDS_Mesh::Write()
+{
 
-  string myClass = string("SMDS_Mesh");
-  string myExtension = string("MED");
+       string myClass = string("SMDS_Mesh");
+       string myExtension = string("MED");
 
-  DriverMED_W_SMDS_Mesh* myWriter = new DriverMED_W_SMDS_Mesh;
+       DriverMED_W_SMDS_Mesh *myWriter = new DriverMED_W_SMDS_Mesh;
 
-  myWriter->SetMesh(myMesh);
-  //  myWriter->SetFile(myFile);
-  myWriter->SetMeshId(myMeshId);
-  myWriter->SetFileId(myFileId);
-
-  myWriter->Write();
+       myWriter->SetMesh(myMesh);
+       //  myWriter->SetFile(myFile);
+       myWriter->SetMeshId(myMeshId);
+       myWriter->SetFileId(myFileId);
 
+       myWriter->Write();
 
 }
 
-void DriverMED_W_SMESHDS_Mesh::Add() {
-
-  med_err ret = 0;
-  int i,j,k,l;
-  int numero;
-  char message[200];
-  Standard_Boolean ok;
-  /* nombre d'objets MED */
-  char nom_universel[MED_TAILLE_LNOM+1];
-  med_int long_fichier_en_tete;
-  char *fichier_en_tete;
-  char version_hdf[10];
-  char version_med[10];
-  med_int nmaa,mdim,nnoe;
-  med_int nmai[MED_NBR_GEOMETRIE_MAILLE],nfac[MED_NBR_GEOMETRIE_FACE];
-  med_int nare[MED_NBR_GEOMETRIE_ARETE];
-  /* nom du maillage */
-  char nommaa[MED_TAILLE_NOM+1];
-  /* noeuds */
-  med_float *coo;
-  // PN : Initilialisation de nomcoo et unicoo pour lisibilite du maillage
-  char nomcoo[3*MED_TAILLE_PNOM+1]="x       y        z      ";
-  char unicoo[3*MED_TAILLE_PNOM+1]="m       m        m     ";
-  char *nomnoe;
-  med_int *numnoe;
-  med_int *nufano;
-  med_repere rep;
-  med_booleen inonoe,inunoe;
-  med_mode_switch mode_coo;
-  char str[MED_TAILLE_PNOM+1];
-  med_int nbNodes;
-  /* elements */
-  med_int nsup;
-  med_int edim;
-  med_int taille;
-  med_int elem_id,myId;
-  med_int *connectivite;
-  char *nomele;
-  med_int *numele;
-  med_int *nufael;
-  med_booleen inoele, inuele;
-  med_connectivite typ_con;
-  med_geometrie_element typgeo;
-  med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2,
-                                                           MED_SEG3,MED_TRIA3,
-                                                           MED_TRIA6,MED_QUAD4,
-                                                           MED_QUAD8,MED_TETRA4,
-                                                           MED_TETRA10,MED_HEXA8,
-                                                           MED_HEXA20,MED_PENTA6,
-                                                           MED_PENTA15,MED_PYRA5,
-                                                           MED_PYRA13};
-  med_int desmai[MED_NBR_GEOMETRIE_MAILLE] = {0,2,3,3,3,4,4,4,4,6,6,5,5,5,5};
-  med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
-  char nommai[MED_NBR_GEOMETRIE_MAILLE] [MED_TAILLE_NOM+1] = {"MED_POINT1",
-                                                             "MED_SEG2",
-                                                             "MED_SEG3",
-                                                             "MED_TRIA3",
-                                                             "MED_TRIA6",
-                                                             "MED_QUAD4",
-                                                             "MED_QUAD8",
-                                                             "MED_TETRA4",
-                                                             "MED_TETRA10",
-                                                             "MED_HEXA8",
-                                                             "MED_HEXA20",
-                                                             "MED_PENTA6",
-                                                             "MED_PENTA15",
-                                                             "MED_PYRA5",
-                                                             "MED_PYRA13"};
-  med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
-                                                         MED_QUAD4,MED_QUAD8};
-  med_int desfac[MED_NBR_GEOMETRIE_FACE] = {3,3,4,4};
-  med_int nfaces[MED_NBR_GEOMETRIE_FACE];
-  char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM+1] = {"MED_TRIA3","MED_TRIA6",
-                                                          "MED_QUAD4","MED_QUAD8"};
-  med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
-  med_int desare[MED_NBR_GEOMETRIE_ARETE] = {2,3};
-  med_int naretes[MED_NBR_GEOMETRIE_ARETE];
-  char nomare[MED_NBR_GEOMETRIE_ARETE] [MED_TAILLE_NOM+1] = {"MED_SEG2","MED_SEG3"};
-
-  typ_con = MED_NOD;
-  mode_coo = MED_FULL_INTERLACE;
-  numero = myMeshId;
-
-  //---- provisoire : switch pour ecrire les familles de mailles
-  int besoinfamilledemaille=1;
-  //---- provisoire : switch pour ecrire les familles de mailles
+void DriverMED_W_SMESHDS_Mesh::Add()
+{
+
+       med_err ret = 0;
+       int i, j, k, l;
+       int numero;
+       char message[200];
+       bool ok;
+       /* nombre d'objets MED */
+       char nom_universel[MED_TAILLE_LNOM + 1];
+       med_int long_fichier_en_tete;
+       char *fichier_en_tete;
+       char version_hdf[10];
+       char version_med[10];
+       med_int nmaa, mdim, nnoe;
+       med_int nmai[MED_NBR_GEOMETRIE_MAILLE], nfac[MED_NBR_GEOMETRIE_FACE];
+       med_int nare[MED_NBR_GEOMETRIE_ARETE];
+       /* nom du maillage */
+       char nommaa[MED_TAILLE_NOM + 1];
+       /* noeuds */
+       med_float *coo;
+       // PN : Initilialisation de nomcoo et unicoo pour lisibilite du maillage
+       char nomcoo[3 * MED_TAILLE_PNOM + 1] = "x       y        z      ";
+       char unicoo[3 * MED_TAILLE_PNOM + 1] = "m       m        m     ";
+       char *nomnoe;
+       med_int *numnoe;
+       med_int *nufano;
+       med_repere rep;
+       med_booleen inonoe, inunoe;
+       med_mode_switch mode_coo;
+       char str[MED_TAILLE_PNOM + 1];
+       med_int nbNodes;
+       /* elements */
+       med_int nsup;
+       med_int edim;
+       med_int taille;
+       med_int elem_id, myId;
+       med_int *connectivite;
+       char *nomele;
+       med_int *numele;
+       med_int *nufael;
+       med_booleen inoele, inuele;
+       med_connectivite typ_con;
+       med_geometrie_element typgeo;
+       med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] =
+               { MED_POINT1, MED_SEG2,
+               MED_SEG3, MED_TRIA3,
+               MED_TRIA6, MED_QUAD4,
+               MED_QUAD8, MED_TETRA4,
+               MED_TETRA10, MED_HEXA8,
+               MED_HEXA20, MED_PENTA6,
+               MED_PENTA15, MED_PYRA5,
+               MED_PYRA13
+       };
+       med_int desmai[MED_NBR_GEOMETRIE_MAILLE] =
+               { 0, 2, 3, 3, 3, 4, 4, 4, 4, 6, 6, 5, 5, 5, 5 };
+       med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
+       char nommai[MED_NBR_GEOMETRIE_MAILLE][MED_TAILLE_NOM + 1] = { "MED_POINT1",
+               "MED_SEG2",
+               "MED_SEG3",
+               "MED_TRIA3",
+               "MED_TRIA6",
+               "MED_QUAD4",
+               "MED_QUAD8",
+               "MED_TETRA4",
+               "MED_TETRA10",
+               "MED_HEXA8",
+               "MED_HEXA20",
+               "MED_PENTA6",
+               "MED_PENTA15",
+               "MED_PYRA5",
+               "MED_PYRA13"
+       };
+       med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] =
+               { MED_TRIA3, MED_TRIA6,
+               MED_QUAD4, MED_QUAD8
+       };
+       med_int desfac[MED_NBR_GEOMETRIE_FACE] = { 3, 3, 4, 4 };
+       med_int nfaces[MED_NBR_GEOMETRIE_FACE];
+       char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM + 1] =
+               { "MED_TRIA3", "MED_TRIA6",
+               "MED_QUAD4", "MED_QUAD8"
+       };
+       med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] =
+               { MED_SEG2, MED_SEG3 };
+       med_int desare[MED_NBR_GEOMETRIE_ARETE] = { 2, 3 };
+       med_int naretes[MED_NBR_GEOMETRIE_ARETE];
+       char nomare[MED_NBR_GEOMETRIE_ARETE][MED_TAILLE_NOM + 1] =
+               { "MED_SEG2", "MED_SEG3" };
+
+       typ_con = MED_NOD;
+       mode_coo = MED_FULL_INTERLACE;
+       numero = myMeshId;
+
+       //---- provisoire : switch pour ecrire les familles de mailles
+       int besoinfamilledemaille = 1;
+       //---- provisoire : switch pour ecrire les familles de mailles
 
   /****************************************************************************
    *                      OUVERTURE DU FICHIER EN ECRITURE                    *
    ****************************************************************************/
-  char* file2Read = (char*)myFile.c_str();
-
-  MESSAGE ( " file2Read " << file2Read )
+       char *file2Read = (char *)myFile.c_str();
 
-    myFileId = MEDouvrir(file2Read,MED_REMP);
-  if (myFileId < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-      exit(EXIT_FAILURE);
-    }
+       MESSAGE(" file2Read " << file2Read)
+               myFileId = MEDouvrir(file2Read, MED_REMP);
+       if (myFileId < 0)
+       {
+               fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+               exit(EXIT_FAILURE);
+       }
 
   /****************************************************************************
    *                       NOMBRES D'OBJETS MED                               *
    ****************************************************************************/
-  MESSAGE("(****************************)");
-  MESSAGE("(* INFORMATIONS GENERALES : *)");
-  MESSAGE("(****************************)");
-
-  /* calcul de la dimension */
-  mdim=2;
-  double epsilon=0.00001;
-  double nodeRefX;
-  double nodeRefY;
-  double nodeRefZ;
-
-  bool dimX = true;
-  bool dimY = true;
-  bool dimZ = true;
-
-  SMDS_MeshNodesIterator myItNodes(myMesh);
-  int inode = 0;
-  for (;myItNodes.More();myItNodes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = myItNodes.Value();
-    const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem);
-    if ( inode == 0 ) {
-      nodeRefX = fabs(node->X());
-      nodeRefY = fabs(node->Y());
-      nodeRefZ = fabs(node->Z());
-    }
-    SCRUTE( inode );
-    SCRUTE( nodeRefX );
-    SCRUTE( nodeRefY );
-    SCRUTE( nodeRefZ );
-
-    if ( inode !=0 ) {
-      if ( (fabs(fabs(node->X()) - nodeRefX) > epsilon ) && dimX )
-       dimX = false;
-      if ( (fabs(fabs(node->Y()) - nodeRefY) > epsilon ) && dimY )
-       dimY = false;
-      if ( (fabs(fabs(node->Z()) - nodeRefZ) > epsilon ) && dimZ )
-       dimZ = false;
-    }
-    if ( !dimX && !dimY && !dimZ ) {
-      mdim = 3;
-      break;
-    }
-    inode++;
-  }
-
-  if ( mdim != 3 ) {
-    if ( dimX && dimY && dimZ )
-      mdim = 0;
-    else if ( !dimX ) {
-      if ( dimY && dimZ )
-       mdim = 1;
-      else if (( dimY && !dimZ ) || ( !dimY && dimZ ) )
-       mdim = 2;
-    } else if ( !dimY ) {
-      if ( dimX && dimZ )
-       mdim = 1;
-      else if (( dimX && !dimZ ) || ( !dimX && dimZ ) )
-       mdim = 2;
-    } else if ( !dimZ ) {
-      if ( dimY && dimX )
-       mdim = 1;
-      else if (( dimY && !dimX ) || ( !dimY && dimX ) )
+       MESSAGE("(****************************)");
+       MESSAGE("(* INFORMATIONS GENERALES : *)");
+       MESSAGE("(****************************)");
+
+       /* calcul de la dimension */
        mdim = 2;
-    }
-  }
-
-  MESSAGE ( " mdim " << mdim );
-
-  /* creation du maillage */
-  //mdim=3;
-  sprintf(nommaa,"Mesh %d",numero);
-  SCRUTE(nommaa);
-  ret = MEDmaaCr(myFileId,nommaa,mdim);
-
-  ASSERT(ret == 0);
-  SCRUTE( ret );
-
-  /* Combien de noeuds ? */
-  nnoe = myMesh->NbNodes();
-  //SCRUTE(nnoe);
-  /* Combien de mailles, faces ou aretes ? */
-  for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
-    nmailles[i]=0;
-
-  Standard_Integer nb_of_nodes, nb_of_faces, nb_of_edges;
-  vector<int> elem_Id[MED_NBR_GEOMETRIE_MAILLE];
-
-  SMDS_MeshEdgesIterator itEdges(myMesh);
-  nb_of_edges = myMesh->NbEdges();
-  for (;itEdges.More();itEdges.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itEdges.Value();
-
-    nb_of_nodes = elem->NbNodes();
-
-    switch (nb_of_nodes) {
-    case 2 : {
-      elem_Id[1].push_back(elem->GetID());
-      nmailles[1]++;
-      break;
-    }
-    case 3 : {
-      elem_Id[2].push_back(elem->GetID());
-      nmailles[2]++;
-      break;
-    }
-    }
-  }
-
-
-  SMDS_MeshFacesIterator itFaces(myMesh);
-  nb_of_faces = myMesh->NbFaces();
-  for (;itFaces.More();itFaces.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itFaces.Value();
-
-    nb_of_nodes = elem->NbNodes();
-
-    switch (nb_of_nodes) {
-    case 3 : {
-      elem_Id[3].push_back(elem->GetID());
-      nmailles[3]++;
-      break;
-    }
-    case 4 : {
-      elem_Id[5].push_back(elem->GetID());
-      nmailles[5]++;
-      break;
-    }
-    case 6 : {
-      elem_Id[4].push_back(elem->GetID());
-      nmailles[4]++;
-      break;
-    }
-    }
-
-  }
-
-  SMDS_MeshVolumesIterator itVolumes(myMesh);
-  for (;itVolumes.More();itVolumes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itVolumes.Value();
-
-    nb_of_nodes = elem->NbNodes();
-    switch (nb_of_nodes) {
-    case 8 : {
-      elem_Id[9].push_back(elem->GetID());
-      nmailles[9]++;
-      break;
-    }
-    }
-  }
+       double epsilon = 0.00001;
+       double nodeRefX;
+       double nodeRefY;
+       double nodeRefZ;
+
+       bool dimX = true;
+       bool dimY = true;
+       bool dimZ = true;
+
+       int inode = 0;
+       SMDS_Iterator<const SMDS_MeshNode *> * myItNodes=myMesh->nodesIterator();
+       while(myItNodes->more())
+       {
+               const SMDS_MeshNode * node = myItNodes->next();
+               if (inode == 0)
+               {
+                       nodeRefX = fabs(node->X());
+                       nodeRefY = fabs(node->Y());
+                       nodeRefZ = fabs(node->Z());
+               }
+               SCRUTE(inode);
+               SCRUTE(nodeRefX);
+               SCRUTE(nodeRefY);
+               SCRUTE(nodeRefZ);
 
+               if (inode != 0)
+               {
+                       if ((fabs(fabs(node->X()) - nodeRefX) > epsilon) && dimX)
+                               dimX = false;
+                       if ((fabs(fabs(node->Y()) - nodeRefY) > epsilon) && dimY)
+                               dimY = false;
+                       if ((fabs(fabs(node->Z()) - nodeRefZ) > epsilon) && dimZ)
+                               dimZ = false;
+               }
+               if (!dimX && !dimY && !dimZ)
+               {
+                       mdim = 3;
+                       break;
+               }
+               inode++;
+       }
 
+       if (mdim != 3)
+       {
+               if (dimX && dimY && dimZ)
+                       mdim = 0;
+               else if (!dimX)
+               {
+                       if (dimY && dimZ)
+                               mdim = 1;
+                       else if ((dimY && !dimZ) || (!dimY && dimZ))
+                               mdim = 2;
+               }
+               else if (!dimY)
+               {
+                       if (dimX && dimZ)
+                               mdim = 1;
+                       else if ((dimX && !dimZ) || (!dimX && dimZ))
+                               mdim = 2;
+               }
+               else if (!dimZ)
+               {
+                       if (dimY && dimX)
+                               mdim = 1;
+                       else if ((dimY && !dimX) || (!dimY && dimX))
+                               mdim = 2;
+               }
+       }
 
-  /****************************************************************************
-   *                       ECRITURE DES NOEUDS                                *
-   ****************************************************************************/
-  MESSAGE("(************************)");
-  MESSAGE("(* NOEUDS DU MAILLAGE : *)");
-  MESSAGE("(************************)");
-
-  /* Allocations memoires */
-  /* table des coordonnees
-     profil : (dimension * nombre de noeuds ) */
-  coo = (med_float*) malloc(sizeof(med_float)*nnoe*mdim);
-  /* table  des numeros, des numeros de familles des noeuds
-     profil : (nombre de noeuds) */
-  numnoe = (med_int*) malloc(sizeof(med_int)*nnoe);
-  nufano = (med_int*) malloc(sizeof(med_int)*nnoe);
-  /* table des noms des noeuds
-     profil : (nnoe*MED_TAILLE_PNOM+1) */
-  nomnoe ="";
-
-  /* PN  pour aster, il faut une famille 0 pour les noeuds et une autre pour les elements*/
-  /* PN : Creation de la famille 0 */
-  char * nomfam="FAMILLE_0";
-  char *attdes="";
-  char *gro=0;
-  med_int ngro=0;
-  med_int natt=1;
-  med_int attide = 0;
-  med_int attval=0;
-  med_int numfam = 0;
-  med_int attvalabs=1;
-  ret = MEDfamCr(myFileId,nommaa,nomfam,numfam, &attide,&attval,attdes,natt,gro,ngro);
-  ASSERT(ret == 0);
-
-
-  /* PN : FIN Creation de la famille 0 */
-
-  map < int, int > mapNoeud;
-  typedef pair<set<int>::iterator, bool> IsFamily;
-  int nbFamillesNoeud;
-
-
-  i = 0;
-  set<int> FamilySet;
-  nbFamillesNoeud = 0;
-  int verifienbnoeuds = 0;
-  med_int* rien=0;
-
-  SMDS_MeshNodesIterator itNodes(myMesh);
-  for (;itNodes.More();itNodes.Next())
-    {
-      const Handle(SMDS_MeshElement)& elem = itNodes.Value();
-      const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem);
-
-      if(mdim==3){
-       coo[i*3]=node->X();
-       coo[i*3+1]=node->Y();
-       coo[i*3+2]=node->Z();
-      } else if(mdim==2) {
-       if ( dimX ) {
-         coo[i*2]=node->Y();
-         coo[i*2+1]=node->Z();
-       } 
-       if ( dimY ) {
-         coo[i*2]=node->X();
-         coo[i*2+1]=node->Z();
-       } 
-       if ( dimZ ) {
-         coo[i*2]=node->X();
-         coo[i*2+1]=node->Y();
-       } 
-      } else {
-       if ( dimX ) {
-         coo[i*2]=node->Y();
-         coo[i*2+1]=node->Z();
-       } 
-       if ( dimY ) {
-         coo[i*2]=node->X();
-         coo[i*2+1]=node->Z();
-       } 
-       if ( dimZ ) {
-         coo[i*2]=node->X();
-         coo[i*2+1]=node->Y();
-       } 
-      }
-      mapNoeud[node->GetID()] = i+1;
-
-      // renvoie 0 pour les noeuds internes du volume
-      int numfamille=node->GetPosition()->GetShapeId();
-      nufano[i]=numfamille;
-
-      //SCRUTE(i);
-      //SCRUTE(nufano[i]);
-      //SCRUTE(coo[i*3]);
-      //SCRUTE(coo[i*3+1]);
-      //SCRUTE(coo[i*3+2]);
-      if ( nufano[i] != 0 )
+       MESSAGE(" mdim " << mdim);
+
+       /* creation du maillage */
+       //mdim=3;
+       sprintf(nommaa, "Mesh %d", numero);
+       SCRUTE(nommaa);
+       ret = MEDmaaCr(myFileId, nommaa, mdim);
+
+       ASSERT(ret == 0);
+       SCRUTE(ret);
+
+       /* Combien de noeuds ? */
+       nnoe = myMesh->NbNodes();
+       //SCRUTE(nnoe);
+       /* Combien de mailles, faces ou aretes ? */
+       for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
+               nmailles[i] = 0;
+
+       int nb_of_nodes, nb_of_faces, nb_of_edges;
+       vector < int >elem_Id[MED_NBR_GEOMETRIE_MAILLE];
+
+       nb_of_edges = myMesh->NbEdges();
+       SMDS_Iterator<const SMDS_MeshEdge *> * itEdges=myMesh->edgesIterator();
+       while(itEdges->more())
        {
-         IsFamily deja = FamilySet.insert(nufano[i]); // insert if new, or gives existant
-         if (deja.second)                                    // actually inserted
-           {
-             char famille[MED_TAILLE_NOM+1];
-             sprintf(famille,"F%d",nufano[i]);
-             //              CreateFamily(strdup(nommaa),strdup(famille),nufano[i],attvalabs++);
-             attvalabs++;
-             CreateFamily(strdup(nommaa),strdup(famille),nufano[i],numfamille);
-             //MESSAGE("---famille-noeud--- "<<nbFamillesNoeud<<" "<<nufano[i]);
-             nbFamillesNoeud++;
-           }
+               const SMDS_MeshEdge * elem = itEdges->next();
+
+               nb_of_nodes = elem->NbNodes();
+
+               switch (nb_of_nodes)
+               {
+               case 2:
+               {
+                       elem_Id[1].push_back(elem->GetID());
+                       nmailles[1]++;
+                       break;
+               }
+               case 3:
+               {
+                       elem_Id[2].push_back(elem->GetID());
+                       nmailles[2]++;
+                       break;
+               }
+               }
        }
 
-      i++;
-      verifienbnoeuds ++;
-    }
-  ret = MEDnoeudsEcr(myFileId,nommaa,mdim,coo,mode_coo,MED_CART,
-                    nomcoo,unicoo,nomnoe,MED_FAUX,rien,MED_FAUX,
-                    nufano,nnoe,MED_REMP);
-  ASSERT(ret == 0);
-  MESSAGE("--- Creation de " << verifienbnoeuds << " noeuds");
-  ASSERT(verifienbnoeuds == nnoe);
-  MESSAGE("--- Creation de " << nbFamillesNoeud << " familles de noeuds");
-
-  /* liberation memoire */
-  free(coo);
-  free(numnoe);
-  free(nufano);
+       nb_of_faces = myMesh->NbFaces();
+       SMDS_Iterator<const SMDS_MeshFace *> * itFaces=myMesh->facesIterator();
+       while(itFaces->more())
+       {
+               const SMDS_MeshElement * elem = itFaces->next();
 
-  /****************************************************************************
-   *                       ECRITURE DES ELEMENTS                              *
-   ****************************************************************************/
-  MESSAGE("(**************************)");
-  MESSAGE("(* ELEMENTS DU MAILLAGE : *)");
-  MESSAGE("(**************************)");
-  
-  /* Ecriture des connectivites, noms, numeros des mailles */
-
-  if (ret == 0)
-    {
-      int nbFamillesElts =0;
-      Handle(SMESHDS_Mesh) mySMESHDSMesh = Handle(SMESHDS_Mesh)::DownCast(myMesh);
-      TopTools_IndexedMapOfShape myIndexToShape;
-      TopExp::MapShapes(mySMESHDSMesh->ShapeToMesh(),myIndexToShape);
-
-      map < int, int > mapFamille;
-
-      if (besoinfamilledemaille == 1)
+               nb_of_nodes = elem->NbNodes();
+
+               switch (nb_of_nodes)
+               {
+               case 3:
+               {
+                       elem_Id[3].push_back(elem->GetID());
+                       nmailles[3]++;
+                       break;
+               }
+               case 4:
+               {
+                       elem_Id[5].push_back(elem->GetID());
+                       nmailles[5]++;
+                       break;
+               }
+               case 6:
+               {
+                       elem_Id[4].push_back(elem->GetID());
+                       nmailles[4]++;
+                       break;
+               }
+               }
+
+       }
+
+       SMDS_Iterator<const SMDS_MeshVolume *> * itVolumes=myMesh->volumesIterator();
+       while(itVolumes->more())
        {
-         int t;
-         for (t =1; t <= myIndexToShape.Extent(); t++)
-           {
-             const TopoDS_Shape S = myIndexToShape(t);
-             if (mySMESHDSMesh->HasMeshElements(S))
+               const SMDS_MeshElement * elem = itVolumes->next();
+
+               nb_of_nodes = elem->NbNodes();
+               switch (nb_of_nodes)
+               {
+               case 8:
                {
-                 //MESSAGE ("********* Traitement de la Famille "<<-t);
-               
-                 Handle(SMESHDS_SubMesh) SM = mySMESHDSMesh->MeshElements(S);
-                 const TColStd_ListOfInteger& indElt = SM->GetIDElements();
-                 TColStd_ListIteratorOfListOfInteger ite(indElt);
-               
-                 bool plein=false;
-                 for (; ite.More(); ite.Next())
-                   {
-                     int eltId = ite.Value();
-                     mapFamille [eltId] = - t;
-                     plein=true;
-                   }
-                 if (plein)
-                   {
-                     nbFamillesElts++;
-                     char famille[MED_TAILLE_NOM+1];
-                     sprintf(famille,"E%d",t);
-                     CreateFamily(strdup(nommaa),strdup(famille),-t,attvalabs++);
-                   }
+                       elem_Id[9].push_back(elem->GetID());
+                       nmailles[9]++;
+                       break;
+               }
                }
-           }
        }
 
-      int indice=1;
-      for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
+  /****************************************************************************
+   *                       ECRITURE DES NOEUDS                                *
+   ****************************************************************************/
+       MESSAGE("(************************)");
+       MESSAGE("(* NOEUDS DU MAILLAGE : *)");
+       MESSAGE("(************************)");
+
+       /* Allocations memoires */
+       /* table des coordonnees
+        * profil : (dimension * nombre de noeuds ) */
+       coo = (med_float *) malloc(sizeof(med_float) * nnoe * mdim);
+       /* table  des numeros, des numeros de familles des noeuds
+        * profil : (nombre de noeuds) */
+       numnoe = (med_int *) malloc(sizeof(med_int) * nnoe);
+       nufano = (med_int *) malloc(sizeof(med_int) * nnoe);
+       /* table des noms des noeuds
+        * profil : (nnoe*MED_TAILLE_PNOM+1) */
+       nomnoe = "";
+
+       /* PN  pour aster, il faut une famille 0 pour les noeuds et une autre pour les elements */
+       /* PN : Creation de la famille 0 */
+       char *nomfam = "FAMILLE_0";
+       char *attdes = "";
+       char *gro = 0;
+       med_int ngro = 0;
+       med_int natt = 1;
+       med_int attide = 0;
+       med_int attval = 0;
+       med_int numfam = 0;
+       med_int attvalabs = 1;
+       ret =
+               MEDfamCr(myFileId, nommaa, nomfam, numfam, &attide, &attval, attdes,
+               natt, gro, ngro);
+       ASSERT(ret == 0);
+
+       /* PN : FIN Creation de la famille 0 */
+
+       map < int, int >mapNoeud;
+       typedef pair < set < int >::iterator, bool > IsFamily;
+       int nbFamillesNoeud;
+
+       i = 0;
+       set < int >FamilySet;
+       nbFamillesNoeud = 0;
+       int verifienbnoeuds = 0;
+       med_int *rien = 0;
+
+       SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator();
+       while(itNodes->more())
        {
-         if (nmailles[i] > 0 && ret == 0)
-           {
-             MESSAGE ( " Start "<<typmai[i]);
-       
-             /* dimension de la maille */
-             edim = typmai[i] / 100;
-             nsup = 0;
-             if (mdim  == 2 || mdim == 3)
-               if (edim == 1) nsup = 1;
-             if (mdim == 3)
-               if (edim == 2) nsup = 1;
-             //SCRUTE(nsup);
-       
-             taille = nsup+typmai[i]%100;
-             //SCRUTE(taille);
-       
-             /* allocation memoire */
-             connectivite = (med_int*)malloc(sizeof(med_int)* taille*nmailles[i]);
-             nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM* nmailles[i]+1);
-             numele = (med_int*)malloc(sizeof(med_int)* nmailles[i]);
-             nufael = (med_int*)malloc(sizeof(med_int)* nmailles[i]);
-             nomele="";
-             nbNodes=typmai[i]%100;
-       
-             for (j=0;j<nmailles[i];j++)
+               const SMDS_MeshNode * node = itNodes->next();
+
+               if (mdim == 3)
+               {
+                       coo[i * 3] = node->X();
+                       coo[i * 3 + 1] = node->Y();
+                       coo[i * 3 + 2] = node->Z();
+               }
+               else if (mdim == 2)
                {
-                 myId = elem_Id[i][j];
-                 const Handle(SMDS_MeshElement)& elem = myMesh->FindElement(myId);
-                 //*(numele+j) = myId;
-                 *(numele+j) = indice ++;
-               
-                 for (k=0; k<nbNodes; k++)
-                   {
-                     *(connectivite+j*taille+k) = mapNoeud[elem->GetConnection(k+1)];
-                     //SCRUTE(*(connectivite+j*taille+k));
-                   }
-                 if (nsup) *(connectivite+j*taille + nbNodes) = 0;
-               
-                 if (besoinfamilledemaille == 1)
-                   {
-                     if (mapFamille.find(myId)!=mapFamille.end())
+                       if (dimX)
+                       {
+                               coo[i * 2] = node->Y();
+                               coo[i * 2 + 1] = node->Z();
+                       }
+                       if (dimY)
                        {
-                         nufael[j]=mapFamille[myId];
+                               coo[i * 2] = node->X();
+                               coo[i * 2 + 1] = node->Z();
                        }
-                     else
+                       if (dimZ)
                        {
-                         nufael[j]=0;
+                               coo[i * 2] = node->X();
+                               coo[i * 2 + 1] = node->Y();
+                       }
+               }
+               else
+               {
+                       if (dimX)
+                       {
+                               coo[i * 2] = node->Y();
+                               coo[i * 2 + 1] = node->Z();
+                       }
+                       if (dimY)
+                       {
+                               coo[i * 2] = node->X();
+                               coo[i * 2 + 1] = node->Z();
+                       }
+                       if (dimZ)
+                       {
+                               coo[i * 2] = node->X();
+                               coo[i * 2 + 1] = node->Y();
+                       }
+               }
+               mapNoeud[node->GetID()] = i + 1;
+
+               // renvoie 0 pour les noeuds internes du volume
+               int numfamille = node->GetPosition()->GetShapeId();
+               nufano[i] = numfamille;
+
+               //SCRUTE(i);
+               //SCRUTE(nufano[i]);
+               //SCRUTE(coo[i*3]);
+               //SCRUTE(coo[i*3+1]);
+               //SCRUTE(coo[i*3+2]);
+               if (nufano[i] != 0)
+               {
+                       IsFamily deja = FamilySet.insert(nufano[i]);    // insert if new, or gives existant
+                       if (deja.second)        // actually inserted
+                       {
+                               char famille[MED_TAILLE_NOM + 1];
+                               sprintf(famille, "F%d", nufano[i]);
+                               //          CreateFamily(strdup(nommaa),strdup(famille),nufano[i],attvalabs++);
+                               attvalabs++;
+                               CreateFamily(strdup(nommaa), strdup(famille), nufano[i],
+                                       numfamille);
+                               //MESSAGE("---famille-noeud--- "<<nbFamillesNoeud<<" "<<nufano[i]);
+                               nbFamillesNoeud++;
                        }
-                   }
-                 else
-                   {
-                     nufael[j]=0;
-                   }
-               
-                 //SCRUTE(myId);
-                 //SCRUTE(j);
-                 //SCRUTE(nufael[j]);
                }
-       
-             /* ecriture des données */
-               
-                   med_int* rien=0;
-                   ret=MEDelementsEcr( myFileId,nommaa,mdim,connectivite,mode_coo,nomele,MED_FAUX,numele,
-                                       MED_VRAI,nufael,nmailles[i],MED_MAILLE,typmai[i],typ_con,MED_REMP);
-                   ASSERT(ret == 0);
-                   //SCRUTE(ret);
-               
-                   if (ret < 0) MESSAGE(">> ERREUR : ecriture des mailles \n");
-               
-                   /* liberation memoire */
-                   free(connectivite);
-                   free(numele);
-                   free(nufael);
-                   MESSAGE ( " End "<<typmai[i]);
-           }
-      };
-         MESSAGE("--- Creation de " << nbFamillesElts << " familles d elements");
-
-    }
-
-      /****************************************************************************
-      *                      FERMETURE DU FICHIER                                *
-      ****************************************************************************/
 
-      ret = MEDfermer(myFileId);
+               i++;
+               verifienbnoeuds++;
+       }
+       ret = MEDnoeudsEcr(myFileId, nommaa, mdim, coo, mode_coo, MED_CART,
+               nomcoo, unicoo, nomnoe, MED_FAUX, rien, MED_FAUX,
+               nufano, nnoe, MED_REMP);
+       ASSERT(ret == 0);
+       MESSAGE("--- Creation de " << verifienbnoeuds << " noeuds");
+       ASSERT(verifienbnoeuds == nnoe);
+       MESSAGE("--- Creation de " << nbFamillesNoeud << " familles de noeuds");
+
+       /* liberation memoire */
+       free(coo);
+       free(numnoe);
+       free(nufano);
 
-      if (ret != 0)
-       fprintf(stderr,">> ERREUR : erreur a la fermeture du fichier %s\n",file2Read);
-      MESSAGE ("fichier ferme");
+  /****************************************************************************
+   *                       ECRITURE DES ELEMENTS                              *
+   ****************************************************************************/
+       MESSAGE("(**************************)");
+       MESSAGE("(* ELEMENTS DU MAILLAGE : *)");
+       MESSAGE("(**************************)");
 
+       /* Ecriture des connectivites, noms, numeros des mailles */
 
-}
+       if (ret == 0)
+       {
+               int nbFamillesElts = 0;
+               SMESHDS_Mesh * mySMESHDSMesh = dynamic_cast<SMESHDS_Mesh *>(myMesh);
+               TopTools_IndexedMapOfShape myIndexToShape;
+               TopExp::MapShapes(mySMESHDSMesh->ShapeToMesh(), myIndexToShape);
 
-void DriverMED_W_SMESHDS_Mesh::CreateFamily(char* nommaa, char* famille, int i,med_int k) {
+               map<int,int> mapFamille;
 
-  med_int ngro=0;
-  med_int natt;
+               if (besoinfamilledemaille == 1)
+               {
+                       int t;
+                       for (t = 1; t <= myIndexToShape.Extent(); t++)
+                       {
+                               const TopoDS_Shape S = myIndexToShape(t);
+                               if (mySMESHDSMesh->HasMeshElements(S))
+                               {
+                                       //MESSAGE ("********* Traitement de la Famille "<<-t);
+
+                                       SMESHDS_SubMesh * SM = mySMESHDSMesh->MeshElements(S);
+                                       const vector<int>& indElt = SM->GetIDElements();
+                                       vector<int>::const_iterator ite=indElt.begin();
+
+                                       bool plein = false;
+                                       for (; ite!=indElt.end(); ite++)
+                                       {
+                                               int eltId = *ite;
+                                               mapFamille[eltId] = -t;
+                                               plein = true;
+                                       }
+                                       if (plein)
+                                       {
+                                               nbFamillesElts++;
+                                               char famille[MED_TAILLE_NOM + 1];
+                                               sprintf(famille, "E%d", t);
+                                               CreateFamily(strdup(nommaa), strdup(famille), -t,
+                                                       attvalabs++);
+                                       }
+                               }
+                       }
+               }
 
-  natt=1;
-  char attdes[MED_TAILLE_DESC+1];
-  char gro[MED_TAILLE_LNOM+1];
-  char fam2[MED_TAILLE_LNOM+1];
+               int indice = 1;
+               for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
+               {
+                       if (nmailles[i] > 0 && ret == 0)
+                       {
+                               MESSAGE(" Start " << typmai[i]);
+
+                               /* dimension de la maille */
+                               edim = typmai[i] / 100;
+                               nsup = 0;
+                               if (mdim == 2 || mdim == 3)
+                                       if (edim == 1)
+                                               nsup = 1;
+                               if (mdim == 3)
+                                       if (edim == 2)
+                                               nsup = 1;
+                               //SCRUTE(nsup);
+
+                               taille = nsup + typmai[i] % 100;
+                               //SCRUTE(taille);
+
+                               /* allocation memoire */
+                               connectivite =
+                                       (med_int *) malloc(sizeof(med_int) * taille * nmailles[i]);
+                               nomele =
+                                       (char *)malloc(sizeof(char) * MED_TAILLE_PNOM *
+                                       nmailles[i] + 1);
+                               numele = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
+                               nufael = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
+                               nomele = "";
+                               nbNodes = typmai[i] % 100;
+
+                               for (j = 0; j < nmailles[i]; j++)
+                               {
+                                       myId = elem_Id[i][j];
+                                       const SMDS_MeshElement * elem =
+                                               myMesh->FindElement(myId);
+                                       //*(numele+j) = myId;
+                                       *(numele + j) = indice++;
+
+                                       SMDS_Iterator<const SMDS_MeshElement *> * itk=elem->nodesIterator();
+                                       for (k = 0; itk->more(); k++)
+                                       {
+                                               *(connectivite + j * taille + k) =
+                                                       mapNoeud[itk->next()->GetID()];
+                                       }
+                                       delete itk;
+
+                                       if (nsup)
+                                               *(connectivite + j * taille + nbNodes) = 0;
+
+                                       if (besoinfamilledemaille == 1)
+                                       {
+                                               if (mapFamille.find(myId) != mapFamille.end())
+                                               {
+                                                       nufael[j] = mapFamille[myId];
+                                               }
+                                               else
+                                               {
+                                                       nufael[j] = 0;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               nufael[j] = 0;
+                                       }
+
+                                       //SCRUTE(myId);
+                                       //SCRUTE(j);
+                                       //SCRUTE(nufael[j]);
+                               }
+
+                               /* ecriture des données */
+
+                               med_int *rien = 0;
+                               ret =
+                                       MEDelementsEcr(myFileId, nommaa, mdim, connectivite,
+                                       mode_coo, nomele, MED_FAUX, numele, MED_VRAI, nufael,
+                                       nmailles[i], MED_MAILLE, typmai[i], typ_con, MED_REMP);
+                               ASSERT(ret == 0);
+                               //SCRUTE(ret);
+
+                               if (ret < 0)
+                                       MESSAGE(">> ERREUR : ecriture des mailles \n");
+
+                               /* liberation memoire */
+                               free(connectivite);
+                               free(numele);
+                               free(nufael);
+                               MESSAGE(" End " << typmai[i]);
+                       }
+               };
+               MESSAGE("--- Creation de " << nbFamillesElts << " familles d elements");
 
-  strcpy(attdes,"");
-  strcpy(gro,"");
-  strcpy(fam2,famille);
+       }
 
-  med_int * attide=new med_int[1];
-  med_int * attval=new med_int[1];
-  attide[0] = k;
-  attval[0] = k;
+         /****************************************************************************
+      *                      FERMETURE DU FICHIER                                *
+      ****************************************************************************/
 
+       ret = MEDfermer(myFileId);
 
-  //MESSAGE("-------- Creation de la Famille : "<< famille << "numero " << i << " --------------");
-  med_int ret = MEDfamCr(myFileId, nommaa, fam2, i, attide, attval, attdes, natt, gro, ngro);
-  ASSERT(ret==0);
-  delete [] attide;
-  delete [] attval;
+       if (ret != 0)
+               fprintf(stderr, ">> ERREUR : erreur a la fermeture du fichier %s\n",
+                       file2Read);
+       MESSAGE("fichier ferme");
 
 }
 
+void DriverMED_W_SMESHDS_Mesh::CreateFamily(char *nommaa, char *famille, int i,
+       med_int k)
+{
+
+       med_int ngro = 0;
+       med_int natt;
+
+       natt = 1;
+       char attdes[MED_TAILLE_DESC + 1];
+       char gro[MED_TAILLE_LNOM + 1];
+       char fam2[MED_TAILLE_LNOM + 1];
 
+       strcpy(attdes, "");
+       strcpy(gro, "");
+       strcpy(fam2, famille);
 
+       med_int *attide = new med_int[1];
+       med_int *attval = new med_int[1];
+       attide[0] = k;
+       attval[0] = k;
+
+       //MESSAGE("-------- Creation de la Famille : "<< famille << "numero " << i << " --------------");
+       med_int ret =
+               MEDfamCr(myFileId, nommaa, fam2, i, attide, attval, attdes, natt, gro,
+               ngro);
+       ASSERT(ret == 0);
+       delete[]attide;
+       delete[]attval;
+
+}
index ec2ad8d862f4df6c44c1f5db5562542e31c0ab7f..6ce4b2afa4e67eaaabae45c7e9c0b30a39714bf3 100644 (file)
@@ -37,27 +37,26 @@ extern "C"
 #include <med.h>
 }
 
-class DriverMED_W_SMESHDS_Mesh : public Mesh_Writer {
+class DriverMED_W_SMESHDS_Mesh:public Mesh_Writer
+{
 
-  public :
-    DriverMED_W_SMESHDS_Mesh();
-    ~DriverMED_W_SMESHDS_Mesh();
+  public:DriverMED_W_SMESHDS_Mesh();
+       ~DriverMED_W_SMESHDS_Mesh();
 
-    void Add(); 
-    void Write();
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
+       void Add();
+       void Write();
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
 
-    void SetFileId(med_idt);
-    void SetMeshId(int);
+       void SetFileId(med_idt);
+       void SetMeshId(int);
 
-    void CreateFamily(char*, char*, int, med_int);
+       void CreateFamily(char *, char *, int, med_int);
 
-private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    med_idt myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       med_idt myFileId;
+       int myMeshId;
 
 };
 #endif
index b9de018aa527e1924b51caa26a54fbbe7b1c8d08..c6286a7b3fcdc1c065cce18ce17d6673f721e321 100644 (file)
@@ -3,151 +3,184 @@ using namespace std;
 
 #include "utilities.h"
 
-DriverUNV_R_SMDS_Mesh::DriverUNV_R_SMDS_Mesh() {
-;
+DriverUNV_R_SMDS_Mesh::DriverUNV_R_SMDS_Mesh()
+{
+       ;
 }
 
-DriverUNV_R_SMDS_Mesh::~DriverUNV_R_SMDS_Mesh() {
-;
+DriverUNV_R_SMDS_Mesh::~DriverUNV_R_SMDS_Mesh()
+{
+       ;
 }
 
-void DriverUNV_R_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  myMesh = aMesh;
+void DriverUNV_R_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       myMesh = aMesh;
 }
 
-void DriverUNV_R_SMDS_Mesh::SetFile(string aFile) {
-  myFile = aFile;
+void DriverUNV_R_SMDS_Mesh::SetFile(string aFile)
+{
+       myFile = aFile;
 }
 
-void DriverUNV_R_SMDS_Mesh::SetFileId(FILE* aFileId) {
-  myFileId = aFileId;
+void DriverUNV_R_SMDS_Mesh::SetFileId(FILE * aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverUNV_R_SMDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverUNV_R_SMDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverUNV_R_SMDS_Mesh::Add() {
-  ;
+void DriverUNV_R_SMDS_Mesh::Add()
+{
+       ;
 }
 
-void DriverUNV_R_SMDS_Mesh::Read() {
+void DriverUNV_R_SMDS_Mesh::Read()
+{
 
-  int cell=0,node=0,n1,n2,n3,n4,n_nodes,nodes[6],blockId,i;
-  char *s1,*s2,*s3;
-  string str1,str2,str3;
-  int i1=0;
-  bool ok, found_block2411, found_block2412;
+       int cell = 0, node = 0, n1, n2, n3, n4, n_nodes, nodes[6], blockId, i;
+       char *s1, *s2, *s3;
+       string str1, str2, str3;
+       int i1 = 0;
+       bool ok, found_block2411, found_block2412;
 
   /****************************************************************************
   *                      OUVERTURE DU FICHIER EN LECTURE                      *
   ****************************************************************************/
-  char* file2Read = (char*)myFile.c_str();
-  myFileId = fopen(file2Read,"r");
-  if (myFileId < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-      exit(EXIT_FAILURE);
-    }
-
-  s1 = (char*) malloc(sizeof(char)*100);
-  s2 = (char*) malloc(sizeof(char)*100);
-  s3 = (char*) malloc(sizeof(char)*100);
-
-  found_block2411 = false;
-  found_block2412 = false;
-
-  do {
-
-    while (i1==-1) {
-      fscanf(myFileId,"%d\n",&blockId);
-      switch (blockId) {
-      case 2411 : {
-      MESSAGE("BlockId "<<blockId);
-       fscanf(myFileId,"%d",&node);
-       //MESSAGE("Node "<<node);
-       while (node!=-1) {
-         fscanf(myFileId,"%d %d %d\n",&n1,&n2,&n3);
-         fscanf(myFileId,"%s %s %s\n",s1,s2,s3);
-         str1=string(s1);
-         str2=string(s2);
-         str3=string(s3);
-         if (str1.find("D")!=string::npos) str1.replace(str1.find("D"),1,"E");
-         if (str2.find("D")!=string::npos) str2.replace(str2.find("D"),1,"E");
-         if (str3.find("D")!=string::npos) str3.replace(str3.find("D"),1,"E");
-         ok = myMesh->AddNodeWithID(atof(str1.c_str()),atof(str2.c_str()),atof(str3.c_str()),node);
-         fscanf(myFileId,"%d",&node);
-       }
-       i1=0;
-       found_block2411 = true;
-       break;
-      }        
-      case 2412 : {
-      MESSAGE("BlockId "<<blockId);
-       fscanf(myFileId,"%d",&cell);
-       //MESSAGE("Cell "<<cell);
-       while (cell!=-1) {
-         fscanf(myFileId,"%d %d %d %d %d\n",&n1,&n2,&n3,&n4,&n_nodes);
-
-         if ((n1==71)||(n1==72)||(n1==74)||(n1==91)||(n1==92)) {//203
-           if (n_nodes==3) {
-             for (i=1;i<=n_nodes;i++)
-               fscanf(myFileId,"%d",&nodes[i-1]);
-             ok = myMesh->AddFaceWithID(nodes[0],nodes[1],nodes[2],cell);
-           }
-           else if (n_nodes==6) {//206
-             for (i=1;i<=n_nodes;i++)
-               fscanf(myFileId,"%d",&nodes[i-1]);
-             ok = myMesh->AddFaceWithID(nodes[0],nodes[2],nodes[4],cell);
-           }
-         }
-
-         else if ((n1==11)||(n1==21)||(n1==24)||(n1==25)) {//103
-           fgets(s2,100,myFileId);
-           if (n_nodes==3) {
-             for (i=1;i<=n_nodes;i++)
-               fscanf(myFileId,"%d",&nodes[i-1]);
-             ok = myMesh->AddEdgeWithID(nodes[0],nodes[1],cell);
-             //MESSAGE("in 103 "<<cell);
-           }
-           else if (n_nodes==2) {//102
-             for (i=1;i<=n_nodes;i++)
-               fscanf(myFileId,"%d",&nodes[i-1]);
-             ok = myMesh->AddEdgeWithID(nodes[0],nodes[1],cell);
-             //MESSAGE("in 102 "<<cell);
-           }
-         }
-
-         fscanf(myFileId,"\n");
-         fscanf(myFileId,"%d",&cell);
+       char *file2Read = (char *)myFile.c_str();
+       myFileId = fopen(file2Read, "r");
+       if (myFileId < 0)
+       {
+               fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+               exit(EXIT_FAILURE);
        }
 
-       i1=0;
-       found_block2412 = true;
-       break;
-      }
-      case -1 : {
-       break;
-      }
-      default:
-       MESSAGE("BlockId "<<blockId);
-       i1=0;
-       break;
-      }
-    }
-  
-    fscanf(myFileId,"%s\n",s1);
-    i1 = atoi(s1);
-
-  }
-  while ((!feof(myFileId))&&((!found_block2411)||(!found_block2412)));
+       s1 = (char *)malloc(sizeof(char) * 100);
+       s2 = (char *)malloc(sizeof(char) * 100);
+       s3 = (char *)malloc(sizeof(char) * 100);
+
+       found_block2411 = false;
+       found_block2412 = false;
+
+       do
+       {
+
+               while (i1 == -1)
+               {
+                       fscanf(myFileId, "%d\n", &blockId);
+                       switch (blockId)
+                       {
+                       case 2411:
+                       {
+                               MESSAGE("BlockId " << blockId);
+                               fscanf(myFileId, "%d", &node);
+                               //MESSAGE("Node "<<node);
+                               while (node != -1)
+                               {
+                                       fscanf(myFileId, "%d %d %d\n", &n1, &n2, &n3);
+                                       fscanf(myFileId, "%s %s %s\n", s1, s2, s3);
+                                       str1 = string(s1);
+                                       str2 = string(s2);
+                                       str3 = string(s3);
+                                       if (str1.find("D") != string::npos)
+                                               str1.replace(str1.find("D"), 1, "E");
+                                       if (str2.find("D") != string::npos)
+                                               str2.replace(str2.find("D"), 1, "E");
+                                       if (str3.find("D") != string::npos)
+                                               str3.replace(str3.find("D"), 1, "E");
+                                       ok = myMesh->AddNodeWithID(atof(str1.c_str()),
+                                               atof(str2.c_str()), atof(str3.c_str()), node);
+                                       fscanf(myFileId, "%d", &node);
+                               }
+                               i1 = 0;
+                               found_block2411 = true;
+                               break;
+                       }
+                       case 2412:
+                       {
+                               MESSAGE("BlockId " << blockId);
+                               fscanf(myFileId, "%d", &cell);
+                               //MESSAGE("Cell "<<cell);
+                               while (cell != -1)
+                               {
+                                       fscanf(myFileId, "%d %d %d %d %d\n", &n1, &n2, &n3, &n4,
+                                               &n_nodes);
+
+                                       if ((n1 == 71) || (n1 == 72) || (n1 == 74) || (n1 == 91) ||
+                                               (n1 == 92))
+                                       {                       //203
+                                               if (n_nodes == 3)
+                                               {
+                                                       for (i = 1; i <= n_nodes; i++)
+                                                               fscanf(myFileId, "%d", &nodes[i - 1]);
+                                                       ok = myMesh->AddFaceWithID(nodes[0], nodes[1],
+                                                               nodes[2], cell);
+                                               }
+                                               else if (n_nodes == 6)
+                                               {               //206
+                                                       for (i = 1; i <= n_nodes; i++)
+                                                               fscanf(myFileId, "%d", &nodes[i - 1]);
+                                                       ok = myMesh->AddFaceWithID(nodes[0], nodes[2],
+                                                               nodes[4], cell);
+                                               }
+                                       }
+
+                                       else if ((n1 == 11) || (n1 == 21) || (n1 == 24) ||
+                                               (n1 == 25))
+                                       {                       //103
+                                               fgets(s2, 100, myFileId);
+                                               if (n_nodes == 3)
+                                               {
+                                                       for (i = 1; i <= n_nodes; i++)
+                                                               fscanf(myFileId, "%d", &nodes[i - 1]);
+                                                       ok = myMesh->AddEdgeWithID(nodes[0], nodes[1],
+                                                               cell);
+                                                       //MESSAGE("in 103 "<<cell);
+                                               }
+                                               else if (n_nodes == 2)
+                                               {               //102
+                                                       for (i = 1; i <= n_nodes; i++)
+                                                               fscanf(myFileId, "%d", &nodes[i - 1]);
+                                                       ok = myMesh->AddEdgeWithID(nodes[0], nodes[1],
+                                                               cell);
+                                                       //MESSAGE("in 102 "<<cell);
+                                               }
+                                       }
+
+                                       fscanf(myFileId, "\n");
+                                       fscanf(myFileId, "%d", &cell);
+                               }
+
+                               i1 = 0;
+                               found_block2412 = true;
+                               break;
+                       }
+                       case -1:
+                       {
+                               break;
+                       }
+                       default:
+                               MESSAGE("BlockId " << blockId);
+                               i1 = 0;
+                               break;
+                       }
+               }
+
+               fscanf(myFileId, "%s\n", s1);
+               i1 = atoi(s1);
+
+       }
+       while ((!feof(myFileId)) && ((!found_block2411) || (!found_block2412)));
 
   /****************************************************************************
   *                      FERMETURE DU FICHIER                      *
   ****************************************************************************/
-  free(s1);
-  free(s2);
-  free(s3);
-  fclose(myFileId);
+       free(s1);
+       free(s2);
+       free(s3);
+       fclose(myFileId);
 
 }
index c612677df4484e786e62ff5bfcb75df2c5bb98ef..c47cf6be6ce2afe928321743db2245631c293df4 100644 (file)
@@ -6,25 +6,24 @@
 #include "SMDS_Mesh.hxx"
 #include "Mesh_Reader.h"
 
-class DriverUNV_R_SMDS_Mesh : public Mesh_Reader {
+class DriverUNV_R_SMDS_Mesh:public Mesh_Reader
+{
 
-  public :
-    DriverUNV_R_SMDS_Mesh();
-    ~DriverUNV_R_SMDS_Mesh();
+  public:DriverUNV_R_SMDS_Mesh();
+       ~DriverUNV_R_SMDS_Mesh();
 
-    void Add();
-    void Read();
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
+       void Add();
+       void Read();
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
 
-    void SetFileId(FILE*);
-    void SetMeshId(int);
+       void SetFileId(FILE *);
+       void SetMeshId(int);
 
-  private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    FILE* myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       FILE *myFileId;
+       int myMeshId;
 
 };
 #endif
index 8debd497b777b763fa0bc1a7573c7693dc8ea107..8b904cf4c6a155921e4fc4d4ae493120b592ba21 100644 (file)
@@ -4,25 +4,30 @@ using namespace std;
 
 #include "utilities.h"
 
-int getOne() {
-  printf("in getOne");
-  return (1);
+int getOne()
+{
+       printf("in getOne");
+       return (1);
 }
 
-extern "C" {
-  //  Document_Reader* maker() {
-  DriverUNV_R_SMESHDS_Document* maker() {
-    fprintf(stdout,"here in maker\n");
-    return new DriverUNV_R_SMESHDS_Document;
-  }
+extern "C"
+{
+       //  Document_Reader* maker() {
+       DriverUNV_R_SMESHDS_Document *maker()
+       {
+               fprintf(stdout, "here in maker\n");
+               return new DriverUNV_R_SMESHDS_Document;
+       }
 }
 
-DriverUNV_R_SMESHDS_Document::DriverUNV_R_SMESHDS_Document() {
-  myFile = string("");
+DriverUNV_R_SMESHDS_Document::DriverUNV_R_SMESHDS_Document()
+{
+       myFile = string("");
 }
 
-DriverUNV_R_SMESHDS_Document::~DriverUNV_R_SMESHDS_Document() {
-;
+DriverUNV_R_SMESHDS_Document::~DriverUNV_R_SMESHDS_Document()
+{
+       ;
 }
 
 //void DriverUNV_R_SMESHDS_Document::SetFile(string aFile) {
@@ -33,53 +38,53 @@ DriverUNV_R_SMESHDS_Document::~DriverUNV_R_SMESHDS_Document() {
 //myDocument = aDoc;
 //}
 
-void DriverUNV_R_SMESHDS_Document::Read() {
+void DriverUNV_R_SMESHDS_Document::Read()
+{
 
-  int myMeshId;
-  SCRUTE(myFile);
-  //Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1);
+       int myMeshId;
+       SCRUTE(myFile);
+       //Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1);
 
   /****************************************************************************
   *                      OUVERTURE DU FICHIER EN LECTURE                      *
   ****************************************************************************/
-  char* file2Read = (char*)myFile.c_str();
-  FILE* fid = fopen(file2Read,"r");
-  if (fid < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-      exit(EXIT_FAILURE);
-    }
+       char *file2Read = (char *)myFile.c_str();
+       FILE *fid = fopen(file2Read, "r");
+       if (fid < 0)
+       {
+               fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+               exit(EXIT_FAILURE);
+       }
 
   /****************************************************************************
   *                      COMBIEN DE MAILLAGES ?                               *
   ****************************************************************************/
-  int nmaa = 1;
+       int nmaa = 1;
 
   /****************************************************************************
   *                      FERMETURE DU FICHIER                                 *
   ****************************************************************************/
-  fclose(fid);
-  
-  printf("Nombre de maillages = %d\n",nmaa);
+       fclose(fid);
 
-  string myClass = string("SMESHDS_Mesh");
-  string myExtension = string("UNV");
+       printf("Nombre de maillages = %d\n", nmaa);
 
-  for (int meshIt=1;meshIt<=nmaa;meshIt++) {
-    myMeshId = myDocument->NewMesh();
+       string myClass = string("SMESHDS_Mesh");
+       string myExtension = string("UNV");
 
-    Handle(SMDS_Mesh) myMesh = myDocument->GetMesh(myMeshId);
+       for (int meshIt = 1; meshIt <= nmaa; meshIt++)
+       {
+               myMeshId = myDocument->NewMesh();
 
-    DriverUNV_R_SMESHDS_Mesh* myReader = new DriverUNV_R_SMESHDS_Mesh;
+               SMDS_Mesh * myMesh = myDocument->GetMesh(myMeshId);
 
+               DriverUNV_R_SMESHDS_Mesh *myReader = new DriverUNV_R_SMESHDS_Mesh;
 
-    myReader->SetMesh(myMesh);
-    myReader->SetFile(myFile);
-    //myReader->SetFileId(fid);
+               myReader->SetMesh(myMesh);
+               myReader->SetFile(myFile);
+               //myReader->SetFileId(fid);
 
-    myReader->Read();
-
-  }
+               myReader->Read();
 
+       }
 
 }
index 849a523d0e6be60ab84d3377514d62dcd5546764..752e786e436bdd5f1beaaaf6f5639e4bf3f370c6 100644 (file)
@@ -4,45 +4,53 @@ using namespace std;
 
 #include "utilities.h"
 
-DriverUNV_R_SMESHDS_Mesh::DriverUNV_R_SMESHDS_Mesh() {
-;
+DriverUNV_R_SMESHDS_Mesh::DriverUNV_R_SMESHDS_Mesh()
+{
+       ;
 }
 
-DriverUNV_R_SMESHDS_Mesh::~DriverUNV_R_SMESHDS_Mesh() {
-;
+DriverUNV_R_SMESHDS_Mesh::~DriverUNV_R_SMESHDS_Mesh()
+{
+       ;
 }
 
-void DriverUNV_R_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh);
-  myMesh = aMesh;
+void DriverUNV_R_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       //myMesh = SMESHDS_Mesh *::DownCast(aMesh);
+       myMesh = aMesh;
 }
 
-void DriverUNV_R_SMESHDS_Mesh::SetFile(string aFile) {
-  myFile = aFile;
+void DriverUNV_R_SMESHDS_Mesh::SetFile(string aFile)
+{
+       myFile = aFile;
 }
 
-void DriverUNV_R_SMESHDS_Mesh::SetFileId(FILE* aFileId) {
-  myFileId = aFileId;
+void DriverUNV_R_SMESHDS_Mesh::SetFileId(FILE * aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverUNV_R_SMESHDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverUNV_R_SMESHDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverUNV_R_SMESHDS_Mesh::Add() {
-  ;
+void DriverUNV_R_SMESHDS_Mesh::Add()
+{
+       ;
 }
 
-void DriverUNV_R_SMESHDS_Mesh::Read() {
-  string myClass = string("SMDS_Mesh");
-  string myExtension = string("UNV");
+void DriverUNV_R_SMESHDS_Mesh::Read()
+{
+       string myClass = string("SMDS_Mesh");
+       string myExtension = string("UNV");
 
-  DriverUNV_R_SMDS_Mesh* myReader = new DriverUNV_R_SMDS_Mesh;
+       DriverUNV_R_SMDS_Mesh *myReader = new DriverUNV_R_SMDS_Mesh;
 
-  myReader->SetMesh(myMesh);
-  myReader->SetFile(myFile);
-  //myReader->SetFileId(myFileId);
+       myReader->SetMesh(myMesh);
+       myReader->SetFile(myFile);
+       //myReader->SetFileId(myFileId);
 
-  myReader->Read();
+       myReader->Read();
 
 }
index 0c3a7e6fae6f2f6e9e3b1f6dba46a5903c6d475a..e2ce3e2a70f4261558cd63344aaa6f494585b24c 100644 (file)
@@ -6,25 +6,24 @@
 #include "SMESHDS_Mesh.hxx"
 #include "Mesh_Reader.h"
 
-class DriverUNV_R_SMESHDS_Mesh : public Mesh_Reader {
+class DriverUNV_R_SMESHDS_Mesh:public Mesh_Reader
+{
 
-  public :
-    DriverUNV_R_SMESHDS_Mesh();
-    ~DriverUNV_R_SMESHDS_Mesh();
+  public:DriverUNV_R_SMESHDS_Mesh();
+       ~DriverUNV_R_SMESHDS_Mesh();
 
-    void Add();
-    void Read();
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
+       void Add();
+       void Read();
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
 
-    void SetFileId(FILE*);
-    void SetMeshId(int);
+       void SetFileId(FILE *);
+       void SetMeshId(int);
 
-private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    FILE* myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       FILE *myFileId;
+       int myMeshId;
 
 };
 #endif
index 6bf42e674fe428a4c2537c31c417f626c7238905..01b112baa9058f229e1371eecd8ba304920722b8 100644 (file)
@@ -3,10 +3,10 @@ using namespace std;
 
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
-#include "SMDS_MeshEdgesIterator.hxx"
-#include "SMDS_MeshFacesIterator.hxx"
-#include "SMDS_MeshNodesIterator.hxx"
-#include "SMDS_MeshVolumesIterator.hxx"
+
+
+
+
 
 #include <utilities.h>
 
@@ -19,178 +19,212 @@ using namespace std;
 #define sELT_BEAM_DESC1 "%10d        %2d         1         1         7         %1d\n"
 #define sELT_BEAM_DESC2 "         0         1         1\n"
 
-DriverUNV_W_SMDS_Mesh::DriverUNV_W_SMDS_Mesh() {
-;
+DriverUNV_W_SMDS_Mesh::DriverUNV_W_SMDS_Mesh()
+{
+       ;
 }
 
-DriverUNV_W_SMDS_Mesh::~DriverUNV_W_SMDS_Mesh() {
-;
+DriverUNV_W_SMDS_Mesh::~DriverUNV_W_SMDS_Mesh()
+{
+       ;
 }
 
-void DriverUNV_W_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  myMesh = aMesh;
+void DriverUNV_W_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       myMesh = aMesh;
 }
 
-void DriverUNV_W_SMDS_Mesh::SetFile(string aFile) {
-  myFile = aFile;
+void DriverUNV_W_SMDS_Mesh::SetFile(string aFile)
+{
+       myFile = aFile;
 }
 
-void DriverUNV_W_SMDS_Mesh::SetFileId(FILE* aFileId) {
-  myFileId = aFileId;
+void DriverUNV_W_SMDS_Mesh::SetFileId(FILE * aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverUNV_W_SMDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverUNV_W_SMDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverUNV_W_SMDS_Mesh::Add() {
-  ;
+void DriverUNV_W_SMDS_Mesh::Add()
+{
+       ;
 }
 
-void DriverUNV_W_SMDS_Mesh::Write() {
+void DriverUNV_W_SMDS_Mesh::Write()
+{
 
-  int nbNodes,nbCells;
-  int i;
+       int nbNodes, nbCells;
+       int i;
 
-  char* file2Read = (char*)myFile.c_str();
-  myFileId = fopen(file2Read,"w+");
-  if (myFileId < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-      exit(EXIT_FAILURE);
-    }
-  SCRUTE(myMesh);
+       char *file2Read = (char *)myFile.c_str();
+       myFileId = fopen(file2Read, "w+");
+       if (myFileId < 0)
+       {
+               fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+               exit(EXIT_FAILURE);
+       }
+       SCRUTE(myMesh);
   /****************************************************************************
   *                       NOMBRES D'OBJETS                                    *
   ****************************************************************************/
-  fprintf(stdout,"\n(****************************)\n");
-  fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
-  fprintf(stdout,"(****************************)\n");
-
-  /* Combien de noeuds ? */
-  nbNodes = myMesh->NbNodes();
-
-  /* Combien de mailles, faces ou aretes ? */
-  Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes;
-  nb_of_edges = myMesh->NbEdges();
-  nb_of_faces = myMesh->NbFaces();
-  nb_of_volumes = myMesh->NbVolumes();
-  nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
-  SCRUTE(nb_of_edges);
-  SCRUTE(nb_of_faces);
-  SCRUTE(nb_of_volumes);
-
-  fprintf(stdout,"%d %d\n",nbNodes,nbCells);
-  fprintf(myFileId,"%d %d\n",nbNodes,nbCells);
+       fprintf(stdout, "\n(****************************)\n");
+       fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
+       fprintf(stdout, "(****************************)\n");
+
+       /* Combien de noeuds ? */
+       nbNodes = myMesh->NbNodes();
+
+       /* Combien de mailles, faces ou aretes ? */
+       int nb_of_nodes, nb_of_edges, nb_of_faces, nb_of_volumes;
+       nb_of_edges = myMesh->NbEdges();
+       nb_of_faces = myMesh->NbFaces();
+       nb_of_volumes = myMesh->NbVolumes();
+       nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
+       SCRUTE(nb_of_edges);
+       SCRUTE(nb_of_faces);
+       SCRUTE(nb_of_volumes);
+
+       fprintf(stdout, "%d %d\n", nbNodes, nbCells);
+       fprintf(myFileId, "%d %d\n", nbNodes, nbCells);
 
   /****************************************************************************
   *                       ECRITURE DES NOEUDS                                 *
   ****************************************************************************/
-  fprintf(stdout,"\n(************************)\n");
-  fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(************************)\n");
-
-  SMDS_MeshNodesIterator itNodes(myMesh);
+       fprintf(stdout, "\n(************************)\n");
+       fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(************************)\n");
 
-  fprintf(myFileId,"%s\n", sUNV_SEPARATOR);
-  fprintf(myFileId,"%s\n", sNODE_UNV_ID  );
+       fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
+       fprintf(myFileId, "%s\n", sNODE_UNV_ID);
 
-  for (;itNodes.More();itNodes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itNodes.Value();
-    const Handle(SMDS_MeshNode   )& node = myMesh->GetNode(1, elem);
+       SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator();
+       while(itNodes->more())
+       {
+               const SMDS_MeshNode * node = itNodes->next();
 
-    fprintf(myFileId, sNODE_UNV_DESCR, node->GetID());
-    fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(), node->Z());
-  }
-  fprintf(myFileId,"%s\n", sUNV_SEPARATOR);
+               fprintf(myFileId, sNODE_UNV_DESCR, node->GetID());
+               fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(),
+                       node->Z());
+       }
+       delete itNodes;
+       fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
 
   /****************************************************************************
   *                       ECRITURE DES ELEMENTS                                *
   ****************************************************************************/
-  fprintf(stdout,"\n(**************************)\n");
-  fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(**************************)");
-  /* Ecriture des connectivites, noms, numeros des mailles */
-
-  fprintf(myFileId,"%s\n", sUNV_SEPARATOR);
-  fprintf(myFileId,"%s\n", sELT_UNV_ID   );
-
-  SMDS_MeshEdgesIterator itEdges(myMesh);
-  for (;itEdges.More();itEdges.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itEdges.Value();
-
-    switch (elem->NbNodes()) {
-      case 2 : {
-        fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 21, elem->NbNodes());
-        fprintf(myFileId, sELT_BEAM_DESC2);
-        fprintf(myFileId, "%10d%10d\n", elem->GetConnection(1), elem->GetConnection(2));
-        break;
-      } 
-      case 3 : {
-        fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 24, elem->NbNodes());
-        fprintf(myFileId, sELT_BEAM_DESC2);
-        fprintf(myFileId, "%10d%10d%10d\n",elem->GetConnection(1), elem->GetConnection(2), elem->GetConnection(3));
-        break;
-      }
-    }
-  }
-
-  SMDS_MeshFacesIterator itFaces(myMesh);
-  for (;itFaces.More();itFaces.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itFaces.Value();
-
-    switch (elem->NbNodes()) {
-      case 3 :
-        // linear triangle
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 74, elem->NbNodes());
-        break;
-      case 4 :
-        // linear quadrilateral
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 71, elem->NbNodes());
-        break;
-      case 6 :
-        // parabolic triangle
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 72, elem->NbNodes());
-        break;
-      case 8 :
-        // parabolic quadrilateral
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 75, elem->NbNodes());
-        break;
-      default:
-        fprintf(myFileId, "element not registered\n");
-    }
-
-    for (i=0;i<elem->NbNodes();i++)
-      fprintf(myFileId,"%10d",elem->GetConnection(i+1));
-    
-    fprintf(myFileId,"\n");
-  }
-
-  SMDS_MeshVolumesIterator itVolumes(myMesh);
-  for (;itVolumes.More();itVolumes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itVolumes.Value();
-
-    switch (elem->NbNodes()) {
-      case 4 : 
-        // linear tetrahedron
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 111, elem->NbNodes());
-        break;
-      case 6 : 
-        // linear tetrahedron
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 112, elem->NbNodes());
-        break;
-      case 8 : 
-        // linear brick
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 115, elem->NbNodes());
-        break;
-    }
-
-    for (i=0;i<elem->NbNodes();i++)
-      fprintf(myFileId,"%10d",elem->GetConnection(i+1));
-    
-    fprintf(myFileId,"\n");
-  }
-  fprintf(myFileId,"%s\n", sUNV_SEPARATOR);
-
-  fclose (myFileId);
+       fprintf(stdout, "\n(**************************)\n");
+       fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(**************************)");
+       /* Ecriture des connectivites, noms, numeros des mailles */
+
+       fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
+       fprintf(myFileId, "%s\n", sELT_UNV_ID);
+
+       SMDS_Iterator<const SMDS_MeshEdge *> * itEdges=myMesh->edgesIterator();
+       while(itEdges->more())
+       {
+               const SMDS_MeshElement * elem = itEdges->next();
+               SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator();
+
+               switch (elem->NbNodes())
+               {
+               case 2:
+                       fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 21,
+                               elem->NbNodes());
+                       fprintf(myFileId, sELT_BEAM_DESC2);
+                       fprintf(myFileId, "%10d%10d\n", itn->next()->GetID(),
+                               itn->next()->GetID());
+                       break;
+
+               case 3:
+                       fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 24,
+                               elem->NbNodes());
+                       fprintf(myFileId, sELT_BEAM_DESC2);
+                       fprintf(myFileId, "%10d%10d%10d\n", itn->next()->GetID(),
+                               itn->next()->GetID(), itn->next()->GetID());
+
+                       break;
+               }
+               delete itn;
+       }
+       delete itEdges;
+
+       SMDS_Iterator<const SMDS_MeshFace*> * itFaces=myMesh->facesIterator();
+       while(itFaces->more())
+       {
+               const SMDS_MeshElement * elem = itFaces->next();
+
+               switch (elem->NbNodes())
+               {
+               case 3:
+                       // linear triangle
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 74,
+                               elem->NbNodes());
+                       break;
+               case 4:
+                       // linear quadrilateral
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 71,
+                               elem->NbNodes());
+                       break;
+               case 6:
+                       // parabolic triangle
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 72,
+                               elem->NbNodes());
+                       break;
+               case 8:
+                       // parabolic quadrilateral
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 75,
+                               elem->NbNodes());
+                       break;
+               default:
+                       fprintf(myFileId, "element not registered\n");
+               }
+
+               SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator();
+               while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
+               delete itn;
+
+               fprintf(myFileId, "\n");
+       }
+       delete itFaces;
+
+       SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=myMesh->volumesIterator();
+       while(itVolumes->more())
+       {
+               const SMDS_MeshElement * elem = itVolumes->next();
+
+               switch (elem->NbNodes())
+               {
+               case 4:
+                       // linear tetrahedron
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 111,
+                               elem->NbNodes());
+                       break;
+               case 6:
+                       // linear tetrahedron
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 112,
+                               elem->NbNodes());
+                       break;
+               case 8:
+                       // linear brick
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 115,
+                               elem->NbNodes());
+                       break;
+               }
+
+               SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator();
+               while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
+               delete itn;
+
+               fprintf(myFileId, "\n");
+       }
+       delete itVolumes;
+
+       fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
+
+       fclose(myFileId);
 }
index 141ab21db190bbfb18c82cc00e4d7fe580b57a7c..82b2bcd96c90ea715aa68c8431ebba5358e936a0 100644 (file)
@@ -7,25 +7,24 @@
 #include "SMDS_Mesh.hxx"
 #include "Mesh_Writer.h"
 
-class DriverUNV_W_SMDS_Mesh : public Mesh_Writer {
+class DriverUNV_W_SMDS_Mesh:public Mesh_Writer
+{
 
-  public :
-    DriverUNV_W_SMDS_Mesh();
-    ~DriverUNV_W_SMDS_Mesh();
+  public:DriverUNV_W_SMDS_Mesh();
+       ~DriverUNV_W_SMDS_Mesh();
 
-    void Add();
-    void Write();
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
+       void Add();
+       void Write();
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
 
-    void SetFileId(FILE*);
-    void SetMeshId(int);
+       void SetFileId(FILE *);
+       void SetMeshId(int);
 
-private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    FILE* myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       FILE *myFileId;
+       int myMeshId;
 
 };
 #endif
index 7fb740cdded603b3522ce6b68a6429158ac8bf23..97e6d6d21c020f1a2bfd3c8bd91d4e5c67393c6a 100644 (file)
@@ -4,19 +4,22 @@ using namespace std;
 
 #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) {
@@ -27,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();
+       }
 
 }
index 231bba3dbd3dcdfe4fc47d9d99bfb21d9c6f1256..2923f9fa561780af10d8eccb9a076f8c2c0d09df 100644 (file)
@@ -4,10 +4,10 @@ using namespace std;
 
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
-#include "SMDS_MeshEdgesIterator.hxx"
-#include "SMDS_MeshFacesIterator.hxx"
-#include "SMDS_MeshNodesIterator.hxx"
-#include "SMDS_MeshVolumesIterator.hxx"
+
+
+
+
 
 #include "utilities.h"
 
@@ -20,188 +20,220 @@ using namespace std;
 #define sELT_BEAM_DESC1 "%10d        %2d         1         1         7         %1d\n"
 #define sELT_BEAM_DESC2 "         0         1         1\n"
 
-DriverUNV_W_SMESHDS_Mesh::DriverUNV_W_SMESHDS_Mesh() {
-;
+DriverUNV_W_SMESHDS_Mesh::DriverUNV_W_SMESHDS_Mesh()
+{
+       ;
 }
 
-DriverUNV_W_SMESHDS_Mesh::~DriverUNV_W_SMESHDS_Mesh() {
-;
+DriverUNV_W_SMESHDS_Mesh::~DriverUNV_W_SMESHDS_Mesh()
+{
+       ;
 }
 
-void DriverUNV_W_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
-  //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh);
-  myMesh = aMesh;
+void DriverUNV_W_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
+{
+       //myMesh = SMESHDS_Mesh *::DownCast(aMesh);
+       myMesh = aMesh;
 }
 
-void DriverUNV_W_SMESHDS_Mesh::SetFile(string aFile) {
-  myFile = aFile;
+void DriverUNV_W_SMESHDS_Mesh::SetFile(string aFile)
+{
+       myFile = aFile;
 }
 
-void DriverUNV_W_SMESHDS_Mesh::SetFileId(FILE* aFileId) {
-  myFileId = aFileId;
+void DriverUNV_W_SMESHDS_Mesh::SetFileId(FILE * aFileId)
+{
+       myFileId = aFileId;
 }
 
-void DriverUNV_W_SMESHDS_Mesh::SetMeshId(int aMeshId) {
-  myMeshId = aMeshId;
+void DriverUNV_W_SMESHDS_Mesh::SetMeshId(int aMeshId)
+{
+       myMeshId = aMeshId;
 }
 
-void DriverUNV_W_SMESHDS_Mesh::Write() {
-
-  string myClass = string("SMDS_Mesh");
-  string myExtension = string("UNV");
+void DriverUNV_W_SMESHDS_Mesh::Write()
+{
 
-  DriverUNV_W_SMDS_Mesh* myWriter = new DriverUNV_W_SMDS_Mesh;
+       string myClass = string("SMDS_Mesh");
+       string myExtension = string("UNV");
 
-  myWriter->SetMesh(myMesh);
-  myWriter->SetFile(myFile);
-  myWriter->SetMeshId(myMeshId);
-  //myWriter->SetFileId(myFileId);
+       DriverUNV_W_SMDS_Mesh *myWriter = new DriverUNV_W_SMDS_Mesh;
 
-  myWriter->Write();
+       myWriter->SetMesh(myMesh);
+       myWriter->SetFile(myFile);
+       myWriter->SetMeshId(myMeshId);
+       //myWriter->SetFileId(myFileId);
 
+       myWriter->Write();
 
 }
-void DriverUNV_W_SMESHDS_Mesh::Add() {
-  int nbNodes,nbCells;
-  int i;
-
-  char* file2Read = (char*)myFile.c_str();
-  myFileId = fopen(file2Read,"w+");
-  if (myFileId < 0)
-    {
-      fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
-      exit(EXIT_FAILURE);
-    }
-  
+
+void DriverUNV_W_SMESHDS_Mesh::Add()
+{
+       int nbNodes, nbCells;
+       int i;
+
+       char *file2Read = (char *)myFile.c_str();
+       myFileId = fopen(file2Read, "w+");
+       if (myFileId < 0)
+       {
+               fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+               exit(EXIT_FAILURE);
+       }
+
   /****************************************************************************
   *                       NOMBRES D'OBJETS                                    *
   ****************************************************************************/
-  fprintf(stdout,"\n(****************************)\n");
-  fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
-  fprintf(stdout,"(****************************)\n");
+       fprintf(stdout, "\n(****************************)\n");
+       fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
+       fprintf(stdout, "(****************************)\n");
 
-  /* Combien de noeuds ? */
-  nbNodes = myMesh->NbNodes();
+       /* Combien de noeuds ? */
+       nbNodes = myMesh->NbNodes();
 
-  /* Combien de mailles, faces ou aretes ? */
-  Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes;
-  nb_of_edges = myMesh->NbEdges();
-  nb_of_faces = myMesh->NbFaces();
-  nb_of_volumes = myMesh->NbVolumes();
-  nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
+       /* Combien de mailles, faces ou aretes ? */
+       int nb_of_nodes, nb_of_edges, nb_of_faces, nb_of_volumes;
+       nb_of_edges = myMesh->NbEdges();
+       nb_of_faces = myMesh->NbFaces();
+       nb_of_volumes = myMesh->NbVolumes();
+       nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
 
-  fprintf(stdout,"%d %d\n",nbNodes,nbCells);
+       fprintf(stdout, "%d %d\n", nbNodes, nbCells);
 //fprintf(myFileId,"%d %d\n",nbNodes,nbCells);
 
   /****************************************************************************
   *                       ECRITURE DES NOEUDS                                 *
   ****************************************************************************/
-  fprintf(stdout,"\n(************************)\n");
-  fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(************************)\n");
+       fprintf(stdout, "\n(************************)\n");
+       fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(************************)\n");
 
-  SMDS_MeshNodesIterator itNodes(myMesh);
 
-  fprintf(myFileId,"%s\n", sUNV_SEPARATOR);
-  fprintf(myFileId,"%s\n", sNODE_UNV_ID  );
+       fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
+       fprintf(myFileId, "%s\n", sNODE_UNV_ID);
 
-  for (;itNodes.More();itNodes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itNodes.Value();
-    const Handle(SMDS_MeshNode   )& node = myMesh->GetNode(1, elem);
+       SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator();
+       while(itNodes->more())
+       {
+               const SMDS_MeshNode * node = itNodes->next(); 
 
-    fprintf(myFileId, sNODE_UNV_DESCR, node->GetID());
-    fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(), node->Z());
-  }
-  fprintf(myFileId,"%s\n", sUNV_SEPARATOR);
+               fprintf(myFileId, sNODE_UNV_DESCR, node->GetID());
+               fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(),
+                       node->Z());
+       }
+       delete itNodes;
+       fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
 
   /****************************************************************************
   *                       ECRITURE DES ELEMENTS                                *
   ****************************************************************************/
-  fprintf(stdout,"\n(**************************)\n");
-  fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
-  fprintf(stdout,"(**************************)");
-  /* Ecriture des connectivites, noms, numeros des mailles */
-
-  fprintf(myFileId,"%s\n", sUNV_SEPARATOR);
-  fprintf(myFileId,"%s\n", sELT_UNV_ID   );
-
-  SMDS_MeshEdgesIterator itEdges(myMesh);
-  for (;itEdges.More();itEdges.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itEdges.Value();
-
-    switch (elem->NbNodes()) {
-      case 2 : {
-        fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 21, elem->NbNodes());
-        fprintf(myFileId, sELT_BEAM_DESC2);
-        fprintf(myFileId, "%10d%10d\n", elem->GetConnection(1), elem->GetConnection(2));
-        break;
-      }
-      case 3 : {
-        fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 24, elem->NbNodes());
-        fprintf(myFileId, sELT_BEAM_DESC2);
-        fprintf(myFileId, "%10d%10d%10d\n",elem->GetConnection(1), elem->GetConnection(2), elem->GetConnection(3));
-        break;
-      }
-    }
-  }
-
-  SMDS_MeshFacesIterator itFaces(myMesh);
-  for (;itFaces.More();itFaces.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itFaces.Value();
-
-    switch (elem->NbNodes()) {
-      case 3 :
-        // linear triangle
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 74, elem->NbNodes());
-        break;
-      case 4 :
-        // linear quadrilateral
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 71, elem->NbNodes());
-        break;
-      case 6 :
-        // parabolic triangle
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 72, elem->NbNodes());
-        break;
-      case 8 :
-        // parabolic quadrilateral
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 75, elem->NbNodes());
-        break;
-      default:
-        fprintf(myFileId, "element not registered\n");
-    }
-
-    for (i=0;i<elem->NbNodes();i++)
-      fprintf(myFileId,"%10d",elem->GetConnection(i+1));
-
-    fprintf(myFileId,"\n");
-  }
-
-  SMDS_MeshVolumesIterator itVolumes(myMesh);
-  for (;itVolumes.More();itVolumes.Next()) {
-    const Handle(SMDS_MeshElement)& elem = itVolumes.Value();
-
-    switch (elem->NbNodes()) {
-      case 4 :
-        // linear tetrahedron
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 111, elem->NbNodes());
-        break;
-      case 6 :
-        // linear tetrahedron
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 112, elem->NbNodes());
-        break;
-      case 8 :
-        // linear brick
-        fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 115, elem->NbNodes());
-        break;
-    }
-
-    for (i=0;i<elem->NbNodes();i++)
-      fprintf(myFileId,"%10d",elem->GetConnection(i+1));
-
-    fprintf(myFileId,"\n");
-  }
-  fprintf(myFileId,"%s\n", sUNV_SEPARATOR);
-
-  fclose (myFileId);
+       fprintf(stdout, "\n(**************************)\n");
+       fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
+       fprintf(stdout, "(**************************)");
+       /* Ecriture des connectivites, noms, numeros des mailles */
+
+       fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
+       fprintf(myFileId, "%s\n", sELT_UNV_ID);
+
+       SMDS_Iterator<const SMDS_MeshEdge *> * itEdges=myMesh->edgesIterator();
+       while(itEdges->more())
+       {
+               const SMDS_MeshEdge * elem = itEdges->next();
+               SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator();
+
+               switch (elem->NbNodes())
+               {
+               case 2:
+                       fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 21,
+                               elem->NbNodes());
+                       fprintf(myFileId, sELT_BEAM_DESC2);
+                       fprintf(myFileId, "%10d%10d\n", itn->next()->GetID(),
+                               itn->next()->GetID());
+                       break;
+
+               case 3:
+                       fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 24,
+                               elem->NbNodes());
+                       fprintf(myFileId, sELT_BEAM_DESC2);
+                       fprintf(myFileId, "%10d%10d%10d\n", itn->next()->GetID(),
+                               itn->next()->GetID(), itn->next()->GetID());
+                       break;
+               }
+               delete itn;
+       }
+       delete itEdges;
+
+       SMDS_Iterator<const SMDS_MeshFace*> * itFaces=myMesh->facesIterator();
+       while(itFaces->more())
+       {
+               const SMDS_MeshElement * elem = itFaces->next();
+
+               switch (elem->NbNodes())
+               {
+               case 3:
+                       // linear triangle
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 74,
+                               elem->NbNodes());
+                       break;
+               case 4:
+                       // linear quadrilateral
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 71,
+                               elem->NbNodes());
+                       break;
+               case 6:
+                       // parabolic triangle
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 72,
+                               elem->NbNodes());
+                       break;
+               case 8:
+                       // parabolic quadrilateral
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 75,
+                               elem->NbNodes());
+                       break;
+               default:
+                       fprintf(myFileId, "element not registered\n");
+               }
+
+               SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator();
+               while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
+               delete itn;
+
+               fprintf(myFileId, "\n");
+       }
+       delete itFaces;
+
+       SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=myMesh->volumesIterator();
+       while(itVolumes->more())
+       {
+               const SMDS_MeshElement * elem = itVolumes->next();
+
+               switch (elem->NbNodes())
+               {
+               case 4:
+                       // linear tetrahedron
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 111,
+                               elem->NbNodes());
+                       break;
+               case 6:
+                       // linear tetrahedron
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 112,
+                               elem->NbNodes());
+                       break;
+               case 8:
+                       // linear brick
+                       fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 115,
+                               elem->NbNodes());
+                       break;
+               }
+
+               SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator();
+               while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
+               delete itn;
+
+               fprintf(myFileId, "\n");
+       }
+       delete itVolumes;
+       fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
+
+       fclose(myFileId);
 }
-
index 4cd508b2d1d17bf727f0733a763d163fbcbbd567..d0b2c84e912f72d817a259bbf209608ca9f5a1c6 100644 (file)
@@ -7,25 +7,24 @@
 #include "SMESHDS_Mesh.hxx"
 #include "Mesh_Writer.h"
 
-class DriverUNV_W_SMESHDS_Mesh : public Mesh_Writer {
+class DriverUNV_W_SMESHDS_Mesh:public Mesh_Writer
+{
 
-  public :
-    DriverUNV_W_SMESHDS_Mesh();
-    ~DriverUNV_W_SMESHDS_Mesh();
+  public:DriverUNV_W_SMESHDS_Mesh();
+       ~DriverUNV_W_SMESHDS_Mesh();
 
-    void Add();
-    void Write();
-    void SetMesh(Handle(SMDS_Mesh)& aMesh);
-    void SetFile(string);
+       void Add();
+       void Write();
+       void SetMesh(SMDS_Mesh * aMesh);
+       void SetFile(string);
 
-    void SetFileId(FILE*);
-    void SetMeshId(int);
+       void SetFileId(FILE *);
+       void SetMeshId(int);
 
-private :
-    Handle_SMDS_Mesh myMesh;
-    string myFile; 
-    FILE* myFileId;
-    int myMeshId;
+  private:  SMDS_Mesh * myMesh;
+       string myFile;
+       FILE *myFileId;
+       int myMeshId;
 
 };
 #endif