# Test_MEDstructElementInfoByName.c

Aller à la documentation de ce fichier.

    00001 /*  This file is part of MED.
    00002  *
    00003  *  COPYRIGHT (C) 1999 - 2012  EDF R&D, CEA/DEN
    00004  *  MED is free software: you can redistribute it and/or modify
    00005  *  it under the terms of the GNU Lesser General Public License as published by
    00006  *  the Free Software Foundation, either version 3 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  MED is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Lesser General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Lesser General Public License
    00015  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
    00016  */
    00017
    00018
    00019 #include <med.h>
    00020 #define MESGERR 1
    00021 #include <med_utils.h>
    00022 #include <string.h>
    00023
    00024 #ifdef DEF_LECT_ECR
    00025 #define MODE_ACCES MED_ACC_RDWR
    00026 #elif DEF_LECT_AJOUT
    00027 #define MODE_ACCES MED_ACC_RDEXT
    00028 #else
    00029 #define MODE_ACCES MED_ACC_CREAT
    00030 #endif
    00031
    00032 int main (int argc, char **argv)
    00033
    00034 {
    00035   med_err           _ret=0;
    00036   med_idt           _fid=0;
    00037   med_geometry_type _geotype=MED_NONE;
    00038
    00039   char            _elementname1[MED_NAME_SIZE+1]="MED_PARTICULE";
    00040   med_int         _elementdim1=3;
    00041   char            _supportmeshname1[MED_NAME_SIZE+1]="";
    00042   med_entity_type _entitytype1=MED_UNDEF_ENTITY_TYPE;
    00043   med_int         _nnode1=0;
    00044   med_int         _ncell1=0;
    00045   med_int         _geocelltype1=MED_NONE;
    00046   med_int         _nconstantatribute1=0;
    00047   med_bool        _anyprofile1=0;
    00048   med_int         _nvariableattribute1=0;
    00049
    00050
    00051   /* Ouverture en mode lecture du fichier Test_MEDstructuElement.med */
    00052   _fid = MEDfileOpen("current.med",MED_ACC_RDONLY);
    00053   if (_fid < 0) {
    00054     MESSAGE("Erreur à la lecture du fichier current.med");
    00055     return -1;
    00056   }
    00057
    00058   if (
    00059     MEDstructElementInfoByName(_fid,
    00060                                _elementname1,
    00061                                &_geotype,
    00062                                &_elementdim1,
    00063                                _supportmeshname1,
    00064                                &_entitytype1,
    00065                                &_nnode1,
    00066                                &_ncell1,
    00067                                &_geocelltype1,
    00068                                &_nconstantatribute1,
    00069                                &_anyprofile1,
    00070                                &_nvariableattribute1
    00071                                )
    00072     ) return -1;
    00073
    00074   fprintf(stdout,"Elément de structure |%s| de type géométrique n° %d et de dimension %d\n",_elementname1,_geotype,_elementdim1);
    00075   if ( strlen(_supportmeshname1) ) {
    00076     fprintf(stdout,"\t Maillage support de nom |%s|",_supportmeshname1);
    00077     if (_ncell1)
    00078       fprintf(stdout," avec %d mailles de type %d et ",_ncell1,_geocelltype1);
    00079     if (_nnode1)
    00080       fprintf(stdout," avec %d noeuds\n",_nnode1);
    00081     else {
    00082       fprintf(stderr,"\n Erreur : les noeuds doivent être définis s'il existe un maillage support\n");
    00083     }
    00084   } else
    00085     fprintf(stdout," avec support implicite sur noeud\n");
    00086
    00087
    00088
    00089   if (MEDfileClose(_fid) < 0) {
    00090     MESSAGE("ERROR : file closing");
    00091     return -1;
    00092   }
    00093
    00094   return _ret;
    00095
    00096
    00097 }
    00098