Salome HOME
Porting to MED3 V6_3_0a1
authorgdd <gdd>
Thu, 14 Apr 2011 09:43:31 +0000 (09:43 +0000)
committergdd <gdd>
Thu, 14 Apr 2011 09:43:31 +0000 (09:43 +0000)
doc/conf.py
src/HOMARDGUI/HomardQtCommun.cxx
src/HOMARDGUI/HomardQtCommun.h
src/HOMARD_I/HomardMedCommun.cxx
src/HOMARD_I/HomardMedCommun.h

index 2b658f9b76ead92c2e01004eba3a62bd9a7d61c7..ad1c1f463bff9a385f846a9e2aa0ab612600c959 100644 (file)
@@ -45,9 +45,9 @@ copyright = u'1996, 2011, EDF R&D, G. Nicolas, T. Fouquet, P. Noyret'
 # built documents.
 #
 # The short X.Y version.
-version = '9.9'
+version = '10.1'
 # The full version, including alpha/beta/rc tags.
-release = '9.9'
+release = '10.1'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
index 79746df41e1b44b6e2516484086fc0b64f817920..b96dfea7df4449f0090985fee29932f53372eb37 100644 (file)
@@ -178,21 +178,21 @@ int HOMARD_QT_COMMUN::OuvrirFichier(QString aFile)
 // =======================================================================
 // renvoie le medId associe au fichier Med apres ouverture
 {
-  int MedIdt = MEDouvrir(const_cast<char *>(aFile.toStdString().c_str()),MED_LECTURE);
-  if (MedIdt <0)
+  med_int medIdt = MEDfileOpen(aFile.toStdString().c_str(),MED_ACC_RDONLY);
+  if (medIdt <0)
   {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
                               QObject::tr("HOM_MED_FILE_1") );
   }
-  return MedIdt;
+  return (int) medIdt;
 }
 
 // ======================================================
 QString HOMARD_QT_COMMUN::LireNomMaillage(QString aFile)
 // ========================================================
 {
-  int MedIdt = HOMARD_QT_COMMUN::OuvrirFichier(aFile);
-  int numberOfMeshes = MEDnMaa(MedIdt) ;
+  med_int medIdt = HOMARD_QT_COMMUN::OuvrirFichier(aFile);
+  med_int numberOfMeshes = MEDnMesh(medIdt) ;
   if (numberOfMeshes == 0 )
   {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
@@ -204,30 +204,50 @@ QString HOMARD_QT_COMMUN::LireNomMaillage(QString aFile)
                               QObject::tr("HOM_MED_FILE_3") );
   }
 
-  QString nomMaillage= HOMARD_QT_COMMUN::LireNomMaillage(MedIdt,1);
-  MEDfermer(MedIdt);
+  QString nomMaillage= HOMARD_QT_COMMUN::LireNomMaillage(medIdt,1);
+  MEDfileClose(medIdt);
   return nomMaillage;
 }
 // =======================================================================
-QString HOMARD_QT_COMMUN::LireNomMaillage(int MedIdt ,int MeshId)
+QString HOMARD_QT_COMMUN::LireNomMaillage(int medIdt ,int meshId)
 // =======================================================================
 {
-     QString NomMaillage=QString::null;
-     char maa[MED_TAILLE_NOM+1];
-     char desc[MED_TAILLE_DESC+1];
-     med_int mdim;
-     med_maillage type;
-
-     if ( MEDmaaInfo(MedIdt,MeshId,maa,&mdim,&type,desc) < 0 )
-     {
-      QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-                                QObject::tr("HOM_MED_FILE_4") );
-     }
-     else
-     {
-        NomMaillage=QString(maa);
-     }
-     return NomMaillage;
+  QString NomMaillage=QString::null;
+  char meshname[MED_NAME_SIZE+1];
+  med_int spacedim,meshdim;
+  med_mesh_type meshtype;
+  char descriptionription[MED_COMMENT_SIZE+1];
+  char dtunit[MED_SNAME_SIZE+1];
+  med_sorting_type sortingtype;
+  med_int nstep;
+  med_axis_type axistype;
+  int naxis = MEDmeshnAxis(medIdt,1);
+  char *axisname=new char[naxis*MED_SNAME_SIZE+1];
+  char *axisunit=new char[naxis*MED_SNAME_SIZE+1];
+  med_err aRet = MEDmeshInfo(medIdt,
+                          meshId,
+                          meshname,
+                          &spacedim,
+                          &meshdim,
+                          &meshtype,
+                          descriptionription,
+                          dtunit,
+                          &sortingtype,
+                          &nstep,
+                          &axistype,
+                          axisname,
+                          axisunit);
+
+  if ( aRet < 0 )
+  {
+  QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+                            QObject::tr("HOM_MED_FILE_4") );
+  }
+  else
+  {
+    NomMaillage=QString(meshname);
+  }
+  return NomMaillage;
 }
 
 
@@ -237,111 +257,121 @@ std::list<QString> HOMARD_QT_COMMUN::GetListeChamps(QString aFile)
 {
 // Il faut voir si plusieurs maillages
 
-   MESSAGE("HOMARD_QT_COMMUN::GetListeChamps");
-   std::list<QString> ListeChamp;
+  MESSAGE("HOMARD_QT_COMMUN::GetListeChamps");
+  std::list<QString> ListeChamp;
 
-   char *comp, *unit;
-   char nomcha  [MED_TAILLE_NOM+1];
-   med_type_champ typcha;
-   med_int ncomp;
+  char *comp, *unit;
+  char nomcha  [MED_NAME_SIZE+1];
+  char meshname[MED_NAME_SIZE+1];
+  med_field_type typcha;
+  med_int ncomp;
+  med_bool local;
+  med_int nbofcstp;
 
-   SCRUTE(aFile.toStdString());
-   int MedIdt = HOMARD_QT_COMMUN::OuvrirFichier(aFile);
-   if ( MedIdt < 0 ) { return ListeChamp; }
+  SCRUTE(aFile.toStdString());
+  med_int medIdt = HOMARD_QT_COMMUN::OuvrirFichier(aFile);
+  if ( medIdt < 0 ) { return ListeChamp; }
 
-   // Le fichier Med est lisible
-   // Lecture du maillage
+  // Le fichier Med est lisible
+  // Lecture du maillage
 
-   // Lecture du nombre de champs
-   med_int ncha = MEDnChamp(MedIdt, 0) ;
-   if (ncha < 1 )
-   {
+  // Lecture du nombre de champs
+  med_int ncha = MEDnField(medIdt) ;
+  if (ncha < 1 )
+  {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-                              QObject::tr("HOM_MED_FILE_5") );
-   MEDfermer(MedIdt);
-   return ListeChamp;
-   }
-
-   for (int i=0; i< ncha; i++)
-   {
-   /* Lecture du type du champ, des noms des composantes et du nom de l'unite*/
-      ncomp = MEDnChamp(MedIdt,i+1);
-      comp = (char*) malloc(ncomp*MED_TAILLE_PNOM+1);
-      unit = (char*) malloc(ncomp*MED_TAILLE_PNOM+1);
-      if ( MEDchampInfo(MedIdt,i+1,nomcha,&typcha,comp,unit,ncomp) < 0 )
-      {
-        QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-                                  QObject::tr("HOM_MED_FILE_6") );
-   MEDfermer(MedIdt);
-          return ListeChamp;
-        }
+                            QObject::tr("HOM_MED_FILE_5") );
+    MEDfileClose(medIdt);
+    return ListeChamp;
+  }
 
-      ListeChamp.push_back(QString(nomcha));
-      free(comp);
-      free(unit);
-   }
-   MEDfermer(MedIdt);
-   return ListeChamp;
+  for (int i=0; i< ncha; i++)
+  {
+    /* Lecture du type du champ, des noms des composantes et du nom de l'unite*/
+    ncomp = MEDfieldnComponent(medIdt,i+1);
+    comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
+    unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
+    char dtunit[MED_SNAME_SIZE+1];
+    if ( MEDfieldInfo(medIdt,i+1,nomcha,meshname,&local,&typcha,comp,unit,dtunit,&nbofcstp) < 0 )
+    {
+      QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+                                QObject::tr("HOM_MED_FILE_6") );
+      MEDfileClose(medIdt);
+      return ListeChamp;
+    }
+
+    ListeChamp.push_back(QString(nomcha));
+    free(comp);
+    free(unit);
+  }
+  MEDfileClose(medIdt);
+  return ListeChamp;
 }
 
 // ======================================================================================
 std::list<QString> HOMARD_QT_COMMUN::GetListeComposants(QString aFile, QString aChamp)
 // ======================================================================================
 {
-   MESSAGE ( "GetListeComposants pour le fichier " << aFile.toStdString().c_str());
-   MESSAGE ( "GetListeComposants pour le champ " << aChamp.toStdString().c_str());
+  MESSAGE ( "GetListeComposants pour le fichier " << aFile.toStdString().c_str());
+  MESSAGE ( "GetListeComposants pour le champ " << aChamp.toStdString().c_str());
 
-   std::list<QString> ListeComposants;
+  std::list<QString> ListeComposants;
 
-   char *comp, *unit;
-   char nomcha  [MED_TAILLE_NOM+1];
-   med_type_champ typcha;
-   med_int ncomp;
+  char *comp, *unit;
+  char nomcha  [MED_NAME_SIZE+1];
+  char meshname[MED_NAME_SIZE+1];
+  med_field_type typcha;
+  med_int ncomp;
+  med_bool local;
+  med_int nbofcstp;
 
-   int MedIdt = HOMARD_QT_COMMUN::OuvrirFichier(aFile);
-   if ( MedIdt < 0 ) { return ListeComposants; }
+  int medIdt = HOMARD_QT_COMMUN::OuvrirFichier(aFile);
+  if ( medIdt < 0 ) { return ListeComposants; }
 
 
-   // Lecture du nombre de champs
-   med_int ncha = MEDnChamp(MedIdt, 0) ;
-   if (ncha < 1 )
-   {
+  // Lecture du nombre de champs
+  med_int ncha = MEDnField(medIdt) ;
+  if (ncha < 1 )
+  {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-                              QObject::tr("HOM_MED_FILE_5") );
-   MEDfermer(MedIdt);
-   return ListeComposants;
-   }
-
-   for (int i=0; i< ncha; i++)
-   {
-   /* Lecture du type du champ, des noms des composantes et du nom de l'unite*/
-      ncomp = MEDnChamp(MedIdt,i+1);
-      comp = (char*) malloc(ncomp*MED_TAILLE_PNOM+1);
-      unit = (char*) malloc(ncomp*MED_TAILLE_PNOM+1);
-
-      if ( MEDchampInfo(MedIdt,i+1,nomcha,&typcha,comp,unit,ncomp) < 0 )
-      {
-        QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
-                                  QObject::tr("HOM_MED_FILE_6") );
-    MEDfermer(MedIdt);
-           return ListeComposants;
-       }
-       if ( QString(nomcha) != aChamp ) {
-   free(comp);
-          free (unit);
-          continue;}
-
-       for (int j = 0; j <ncomp; j++)
-       {
-             char cible[MED_TAILLE_PNOM +1];
-             strncpy(cible,comp+j*MED_TAILLE_PNOM,MED_TAILLE_PNOM );
-             cible[MED_TAILLE_PNOM ]='\0';
-             ListeComposants.push_back(QString(cible));
-       }
-       break;
-   }
-   free(comp);
-   free(unit);
-   MEDfermer(MedIdt);
-   return ListeComposants;
+                            QObject::tr("HOM_MED_FILE_5") );
+    MEDfileClose(medIdt);
+    return ListeComposants;
+  }
+
+  for (int i=0; i< ncha; i++)
+  {
+    /* Lecture du type du champ, des noms des composantes et du nom de l'unite*/
+    ncomp = MEDfieldnComponent(medIdt,i+1);
+    comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
+    unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
+    char dtunit[MED_SNAME_SIZE+1];
+
+    if ( MEDfieldInfo(medIdt,i+1,nomcha,meshname,&local,&typcha,comp,unit,dtunit,&nbofcstp) < 0 )
+    {
+      QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+                                QObject::tr("HOM_MED_FILE_6") );
+      MEDfileClose(medIdt);
+      return ListeComposants;
+    }
+    
+    if ( QString(nomcha) != aChamp ) {
+      free(comp);
+      free(unit);
+      continue;
+    }
+
+    for (int j = 0; j <ncomp; j++)
+    {
+      char cible[MED_SNAME_SIZE +1];
+      strncpy(cible,comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE );
+      cible[MED_SNAME_SIZE ]='\0';
+      ListeComposants.push_back(QString(cible));
+    }
+    break;
+  }
+  free(comp);
+  free(unit);
+  MEDfileClose(medIdt);
+  return ListeComposants;
 }
index 490ebaa9b86060907950c34fd81f19b8ccd51715..d026648d8b7d74e03ef990753c821c60776b67ee 100644 (file)
 #include <qstring.h>
 #include <vector>
 #include <set>
-extern "C"
-{
-#include <med.h>
-}
 
 class QComboBox;
 
index bacc234ad8bca12c48f20a2156af8d6620dd053e..e99d676e4c180a3edaf8979bac2cdb112e9a6100 100644 (file)
@@ -1,9 +1,10 @@
 #include "HomardMedCommun.h"
-using namespace std;
+
 #include <iostream>
 #include <cstdlib>
 #include <cmath>
 #include <cstring>
+#include <algorithm>
 
 extern "C" 
 {
@@ -15,69 +16,98 @@ extern "C"
 std::set<std::string> GetListeGroupesInMedFile(const char * aFile)
 // =======================================================================
 {
-   std::set<std::string> ListeGroupes;
-   int MedIdt = MEDouvrir(const_cast<char *>(aFile),MED_LECTURE);
-   if ( MedIdt < 0 ) { return ListeGroupes; };
-
-   char maa[MED_TAILLE_NOM+1];
-   char desc[MED_TAILLE_DESC+1];
-   char nomfam[MED_TAILLE_NOM+1];
-   med_int numfam;
+  std::set<std::string> ListeGroupes;
+  med_idt medIdt = MEDfileOpen(aFile,MED_ACC_RDONLY);
+  if ( medIdt < 0 ) { return ListeGroupes; };
 
-   med_int mdim;
-   med_maillage type;
-   med_int numMaillage=1;
-   if ( MEDmaaInfo(MedIdt,numMaillage,maa,&mdim,&type,desc) < 0 ) { return ListeGroupes; };
+  char meshname[MED_NAME_SIZE+1];
+  med_int spacedim,meshdim;
+  med_mesh_type meshtype;
+  char descriptionription[MED_COMMENT_SIZE+1];
+  char dtunit[MED_SNAME_SIZE+1];
+  med_sorting_type sortingtype;
+  med_int nstep;
+  med_axis_type axistype;
+  int naxis = MEDmeshnAxis(medIdt,1);
+  char *axisname=new char[naxis*MED_SNAME_SIZE+1];
+  char *axisunit=new char[naxis*MED_SNAME_SIZE+1];
+  med_err aRet = MEDmeshInfo(medIdt,
+                          1,
+                          meshname,
+                          &spacedim,
+                          &meshdim,
+                          &meshtype,
+                          descriptionription,
+                          dtunit,
+                          &sortingtype,
+                          &nstep,
+                          &axistype,
+                          axisname,
+                          axisunit);
+   if ( aRet < 0 ) { return ListeGroupes; };
+   
    med_int nfam, ngro, natt;
-   if ((nfam = MEDnFam(MedIdt,maa)) < 0) { return ListeGroupes; };
-   for (int i=0;i<nfam;i++) 
-   {
-      if ((ngro = MEDnGroupe(MedIdt,maa,i+1)) < 0) 
-      {
-        // GERALD -- QMESSAGE BOX
-        std::cerr << " Error : Families are unreadable" << std::endl;
-        std::cerr << "Pb avec la famille : " << i << std::endl;
-        break;
-      }
-      if (ngro == 0) continue;
-
-      if ((natt = MEDnAttribut(MedIdt,maa,i+1)) < 0) 
-      {
-        // GERALD -- QMESSAGE BOX
-        std::cerr << " Error : Families are unreadable" << std::endl;
-        std::cerr << "Pb avec la famille : " << i << std::endl;
-        break;
-      }
+   if ((nfam = MEDnFamily(medIdt,meshname)) < 0) { return ListeGroupes; };
+   
+  char familyname[MED_NAME_SIZE+1];
+  med_int numfam;
+  for (int i=0;i<nfam;i++) 
+  {
+    if ((ngro = MEDnFamilyGroup(medIdt,meshname,i+1)) < 0) 
+    {
+      // GERALD -- QMESSAGE BOX
+      std::cerr << " Error : Families are unreadable" << std::endl;
+      std::cerr << "Pb avec la famille : " << i+1 << std::endl;
+      break;
+    }
+    if (ngro == 0) continue;
 
-      med_int* attide = (med_int*) malloc(sizeof(med_int)*natt);
-      med_int* attval = (med_int*) malloc(sizeof(med_int)*natt);
-      char*    attdes = (char *)   malloc(MED_TAILLE_DESC*natt+1);
-      char*    gro    = (char*)    malloc(MED_TAILLE_LNOM*ngro+1);
-      if (MEDfamInfo(MedIdt,maa,i+1,nomfam,&numfam,attide,attval,attdes,
-                      &natt,gro,&ngro) < 0) 
-      { 
-        // GERALD -- QMESSAGE BOX
-        std::cerr << " Error : Families are unreadable" << std::endl;
-        std::cerr << "Pb avec la famille : " << i << std::endl;
-         break;
-      }
-      free(attide);
-      free(attval);
-      free(attdes);
-      if ((numfam )> 0) { continue;} // On ne garde que les familles d elts
+    if ((natt = MEDnFamily23Attribute(medIdt,meshname,i+1)) < 0) 
+    {
+      // GERALD -- QMESSAGE BOX
+      std::cerr << " Error : Families are unreadable" << std::endl;
+      std::cerr << "Pb avec la famille : " << i+1 << std::endl;
+      break;
+    }
 
-      for (int j=0;j<ngro;j++) 
-      {
-           char str2[MED_TAILLE_LNOM+1];
-           strncpy(str2,gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
-           str2[MED_TAILLE_LNOM] = '\0';
-           ListeGroupes.insert(std::string(str2));
+    med_int* attide = (med_int*) malloc(sizeof(med_int)*natt);
+    med_int* attval = (med_int*) malloc(sizeof(med_int)*natt);
+    char*    attdes = (char *)   malloc(MED_COMMENT_SIZE*natt+1);
+    char*    gro    = (char*)    malloc(MED_LNAME_SIZE*ngro+1);
+    
+    med_err aRet = MEDfamily23Info(medIdt,
+                                meshname,
+                                i+1,
+                                familyname,
+                                attide,
+                                attval,
+                                attdes,
+                                &numfam,
+                                gro);
+    
+    if (aRet < 0) 
+    { 
+      // GERALD -- QMESSAGE BOX
+      std::cerr << " Error : Families are unreadable" << std::endl;
+      std::cerr << "Pb avec la famille : " << i+1 << std::endl;
+        break;
+    }
+    free(attide);
+    free(attval);
+    free(attdes);
+    if ((numfam )> 0) { continue;} // On ne garde que les familles d elts
 
-      }
-      free(gro);
-   }
-   MEDfermer(MedIdt);
-   return ListeGroupes;
+    for (int j=0;j<ngro;j++) 
+    {
+          char str2[MED_LNAME_SIZE+1];
+          strncpy(str2,gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+          str2[MED_LNAME_SIZE] = '\0';
+          ListeGroupes.insert(std::string(str2));
+    }
+    free(gro);
+  }
+  MEDfileClose(medIdt);
+  return ListeGroupes;
 }
 
 // =======================================================================
@@ -92,9 +122,9 @@ std::vector<double> GetBoundingBoxInMedFile(const char * aFile)
 
    std::vector<double> LesExtremes;
    
-                               // Ouverture du Fichier Med
-   int MedIdt = MEDouvrir(const_cast<char *>(aFile),MED_LECTURE);
-   if (MedIdt <0) 
+   // Ouverture du Fichier Med
+   med_idt medIdt = MEDfileOpen(aFile,MED_ACC_RDONLY);
+   if (medIdt <0) 
    {
           // GERALD -- QMESSAGE BOX
           std::cerr << "Error : mesh is unreadable" << std::endl;
@@ -102,8 +132,8 @@ std::vector<double> GetBoundingBoxInMedFile(const char * aFile)
    }
 
                                 // Le fichier Med est lisible
-                               // Boucle sur les noms de maillage
-   int numberOfMeshes = MEDnMaa(MedIdt) ;
+    // Boucle sur les noms de maillage
+   med_int numberOfMeshes = MEDnMesh(medIdt) ;
    if (numberOfMeshes != 1 ) 
    {
           // GERALD -- QMESSAGE BOX
@@ -111,40 +141,70 @@ std::vector<double> GetBoundingBoxInMedFile(const char * aFile)
           return LesExtremes;
    }
 
-   char maa[MED_TAILLE_NOM+1];
-   char desc[MED_TAILLE_DESC+1];
-   char nomcoo[3*MED_TAILLE_PNOM+1];
-   char unicoo[3*MED_TAILLE_PNOM+1];
-   med_maillage type;
-   med_repere rep;
-   med_booleen inonoe,inunoe;
-
-   med_int dim;
-   med_int numMaillage=1;
+  char meshname[MED_NAME_SIZE+1];
+  med_int spacedim,meshdim;
+  med_mesh_type meshtype;
+  char descriptionription[MED_COMMENT_SIZE+1];
+  char dtunit[MED_SNAME_SIZE+1];
+  med_sorting_type sortingtype;
+  med_int nstep;
+  med_axis_type axistype;
+  int naxis = MEDmeshnAxis(medIdt,1);
+  char *axisname=new char[naxis*MED_SNAME_SIZE+1];
+  char *axisunit=new char[naxis*MED_SNAME_SIZE+1];
+  med_err aRet = MEDmeshInfo(medIdt,
+                          1,
+                          meshname,
+                          &spacedim,
+                          &meshdim,
+                          &meshtype,
+                          descriptionription,
+                          dtunit,
+                          &sortingtype,
+                          &nstep,
+                          &axistype,
+                          axisname,
+                          axisunit);
 
-   if (MEDmaaInfo(MedIdt,numMaillage,maa,&dim,&type,desc) < 0) 
+   if (aRet < 0) 
    {
           // GERALD -- QMESSAGE BOX
-          std::cerr << "Error : mesh " << numMaillage << " is unreadable" << std::endl;
+          std::cerr << "Error : mesh is unreadable" << std::endl;
           return LesExtremes;
    }
 
-   med_int nnoe  = MEDnEntMaa(MedIdt,maa,MED_COOR,MED_NOEUD,(med_geometrie_element)0,(med_connectivite)0);
+  med_bool chgt,trsf;
+  med_int nnoe  = MEDmeshnEntity(medIdt,
+                            meshname,
+                            MED_NO_DT,
+                            MED_NO_IT,
+                            MED_NODE,
+                            MED_NO_GEOTYPE,
+                            MED_COORDINATE,
+                            MED_NO_CMODE,
+                            &chgt,
+                            &trsf);
    if ( nnoe < 0) 
    {
           // GERALD -- QMESSAGE BOX
-          std::cerr << "Error : mesh " << numMaillage << " is unreadable" << std::endl;
+          std::cerr << "Error : mesh is unreadable" << std::endl;
           return LesExtremes;
    }
 
-   med_float* coo    = (med_float*) malloc(sizeof(med_float)*nnoe*dim);
-   med_int*   numnoe = (med_int*)   malloc(sizeof(med_int)*nnoe);
-   med_int*   nufano = (med_int*)   malloc(sizeof(med_int)*nnoe);
-   char *     nomnoe = (char*)      malloc(MED_TAILLE_PNOM*nnoe+1);
+  med_float* coo    = (med_float*) malloc(sizeof(med_float)*nnoe*spacedim);
 
-   MEDnoeudsLire(MedIdt,maa,dim,coo,MED_NO_INTERLACE,&rep,
-                      nomcoo,unicoo,nomnoe,&inonoe,numnoe,&inunoe,
-                      nufano,nnoe);
+  aRet = MEDmeshNodeCoordinateRd(medIdt,
+                                      meshname,
+                                      MED_NO_DT,
+                                      MED_NO_IT,
+                                      MED_NO_INTERLACE,
+                                      coo);
+   if ( aRet < 0) 
+   {
+          // GERALD -- QMESSAGE BOX
+          std::cerr << "Error : mesh coordinates are unreadable" << std::endl;
+          return LesExtremes;
+   }
 
    med_float xmin,xmax,ymin,ymax,zmin,zmax;
    
@@ -152,17 +212,17 @@ std::vector<double> GetBoundingBoxInMedFile(const char * aFile)
    xmax=coo[0];
    for (int i=1;i<nnoe;i++)
    {
-      xmin = min(xmin,coo[i]);
-      xmax = max(xmax,coo[i]);
+      xmin = std::min(xmin,coo[i]);
+      xmax = std::max(xmax,coo[i]);
    }
 //
-   if (dim > 1)
+   if (spacedim > 1)
    {
        ymin=coo[nnoe]; ymax=coo[nnoe];
        for (int i=nnoe+1;i<2*nnoe;i++)
        {
-           ymin = min(ymin,coo[i]);
-           ymax = max(ymax,coo[i]);
+           ymin = std::min(ymin,coo[i]);
+           ymax = std::max(ymax,coo[i]);
        }
    }
    else
@@ -173,13 +233,13 @@ std::vector<double> GetBoundingBoxInMedFile(const char * aFile)
        zmax=0;
    }
 //
-   if (dim > 2)
+   if (spacedim > 2)
    {
        zmin=coo[2*nnoe]; zmax=coo[2*nnoe];
        for (int i=2*nnoe+1;i<3*nnoe;i++)
        {
-           zmin = min(zmin,coo[i]);
-           zmax = max(zmax,coo[i]);
+           zmin = std::min(zmin,coo[i]);
+           zmax = std::max(zmax,coo[i]);
        }
    }
    else
@@ -187,7 +247,7 @@ std::vector<double> GetBoundingBoxInMedFile(const char * aFile)
        zmin=0;
        zmax=0;
    }
-   MEDfermer(MedIdt);
+   MEDfileClose(medIdt);
 
    MESSAGE( "_______________________________________");
    MESSAGE( "xmin : " << xmin << " xmax : " << xmax );
@@ -206,8 +266,8 @@ std::vector<double> GetBoundingBoxInMedFile(const char * aFile)
    LesExtremes.push_back(0);
 
 
-   double max1=max ( LesExtremes[1] - LesExtremes[0] , LesExtremes[4] - LesExtremes[3] ) ;
-   double max2=max ( max1 , LesExtremes[7] - LesExtremes[6] ) ;
+   double max1=std::max ( LesExtremes[1] - LesExtremes[0] , LesExtremes[4] - LesExtremes[3] ) ;
+   double max2=std::max ( max1 , LesExtremes[7] - LesExtremes[6] ) ;
    LesExtremes.push_back(max2);
 
 // LesExtremes[0] = Xmini du maillage
index 9f9c65df39ac9b023d207a8c90c7eac9c494104e..2978e715fcf5f9afd32984c41abdb19f8a9034e5 100644 (file)
@@ -5,11 +5,6 @@
 #include <set>
 #include <string>
 
-extern "C"
-{
-#include <med.h>
-}
-
 std::vector<double>    GetBoundingBoxInMedFile( const char * aFile);
 std::set<std::string>  GetListeGroupesInMedFile(const char * aFile);