Back to index

salome-med  6.5.0
MEDpasdetempsInfo.cxx
Go to the documentation of this file.
00001 /*************************************************************************
00002 * COPYRIGHT (C) 1999 - 2002  EDF R&D
00003 * THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
00004 * IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE 
00005 * AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
00006 * EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00007 *  
00008 * THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
00009 * WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
00010 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
00011 * LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
00012 *
00013 * YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
00014 * ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
00015 * INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
00016 *
00017 *************************************************************************/
00018 
00019 #include "med.hxx"
00020 #include "med_outils.hxx"
00021 
00022 #include <cstring>
00023 
00024 /* Le nom de cette fonction n'est pas très bien choisie */
00025 
00026 namespace med_2_1{
00027 
00028 med_err 
00029 MEDpasdetempsInfo(med_idt fid,char *champ
00030                   ,med_entite_maillage type_ent, med_geometrie_element type_geo,
00031                   int indice, char *maa, med_int * ngauss, med_int * numdt, char * dt_unit, med_float * dt, 
00032                   med_int * numo)
00033 {
00034 
00035   med_err ret=0;
00036   med_idt gid;
00037   char chemin[(MED_TAILLE_CHA+MED_TAILLE_NOM+1)+(2*MED_TAILLE_NOM_ENTITE+2)+2*MED_MAX_PARA+1];
00038   int num;
00039   char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
00040   char tmp1         [MED_TAILLE_NOM_ENTITE+1];
00041 
00042   /*
00043    * On inhibe le gestionnaire d'erreur HDF 5
00044    */
00045   _MEDmodeErreurVerrouiller();
00046 
00047   /*
00048    * On recupere le nom du datagroup <numdtt>.<numoo>
00049    */
00050   strcpy(chemin,MED_CHA);
00051   strcat(chemin,champ);
00052   strcat(chemin,"/");
00053 
00054   if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
00055     return -1;
00056   if ((type_ent != MED_NOEUD))
00057     {
00058       if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
00059         return -1;
00060       strcat(nomdatagroup1,".");
00061       strcat(nomdatagroup1,tmp1);
00062     }
00063   strcat(chemin,nomdatagroup1);
00064   strcat(chemin,"/");
00065 
00066   num = indice - 1;
00067   if ((ret = _MEDobjetIdentifier(fid,chemin,num,nomdatagroup2)) < 0)
00068     return -1;
00069   strcat(chemin,nomdatagroup2);
00070   if ((gid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
00071     return -1;
00072 
00073   /*
00074    * La liste des attributs
00075    */
00076  if ((ret = _MEDattrStringLire(gid,MED_NOM_MAI,MED_TAILLE_NOM,maa)) < 0)
00077     return -1;
00078   
00079  if ((ret = _MEDattrEntierLire(gid,MED_NOM_NDT,(med_int*) numdt)) < 0)
00080    return -1;
00081 
00082  if ((ret = _MEDattrFloatLire(gid,MED_NOM_PDT,(med_float*) dt)) < 0)
00083    return -1;
00084 
00085  if ((ret = _MEDattrStringLire(gid,MED_NOM_UNI,MED_TAILLE_PNOM,dt_unit)) < 0)
00086    return -1;
00087  
00088  if ((ret = _MEDattrEntierLire(gid,MED_NOM_NOR,(med_int*) numo)) < 0)
00089    return -1;
00090 
00091  if ( (ret = _MEDattrEntierLire(gid,MED_NOM_NGA,ngauss)) < 0 )
00092    return -1;
00093 
00094 
00095  if ((ret = _MEDdatagroupFermer(gid)) < 0)
00096    return -1;
00097  
00098   return 0; 
00099 }
00100 
00101 }