MED fichier
Test_MEDinterpInfo.c
Aller à la documentation de ce fichier.
1/* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN
4 * MED is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * MED is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with MED. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include <med.h>
19#define MESGERR 1
20#include <med_utils.h>
21#include <string.h>
22
23#ifdef DEF_LECT_ECR
24#define MODE_ACCES MED_ACC_RDWR
25#elif DEF_LECT_AJOUT
26#define MODE_ACCES MED_ACC_RDEXT
27#else
28#define MODE_ACCES MED_ACC_CREAT
29#endif
30
31int main (int argc, char **argv)
32
33{
34 med_err _ret=-1;
35 med_idt _fid=0;
36
37 med_int _ninterp=0;
38 int _interpit =0;
39 char _interpname[MED_NAME_SIZE+1]="";
41 med_bool _cellnodes =MED_FALSE;
42 med_int _nbasisfunc =0;
43 med_int _nvariable =0;
44 med_int _maxdegree =0;
45 med_int _nmaxcoefficient =0;
46
47
48 /* Ouverture en mode creation du fichier "current.med" */
49 _fid = MEDfileOpen("current.med",MED_ACC_RDONLY);
50 if (_fid < 0) {
51 MESSAGE("Erreur a la creation du fichier current.med");
52 return -1;
53 }
54
55 if ( (_ninterp = MEDnInterp(_fid)) <0) _ret=_ninterp;
56
57 ISCRUTE(_ninterp);
58
59 for ( _interpit=1; _interpit<= _ninterp; ++_interpit) {
60
61 if ( (_ret = MEDinterpInfo(_fid,
62 _interpit,
63 _interpname,
64 &_geotype,
65 &_cellnodes,
66 &_nbasisfunc,
67 &_nvariable,
68 &_maxdegree,
69 &_nmaxcoefficient
70 ) <0) ) {
71 MESSAGE("Erreur à la création de la fonction d'interpolation n°");ISCRUTE(_interpit);
72 goto ERROR;
73 }
74
75 fprintf(stdout,"Fonction d'interpolation n° %d |%s| sur le type géométrique n° %d\n",
76 _interpit,_interpname, _geotype);
77
78 if ( _cellnodes )
79 if ( _nbasisfunc == (_geotype % 100) )
80 fprintf(stdout,"\t Les noeuds de construction sont les noeuds de la maille de référence.\n");
81 else {
82 MESSAGE("Erreur : le nombre de noeuds de construction "\
83 "est différent du nombre de noeuds de la maille de référence.\n");
84 ISCRUTE(_nbasisfunc); ISCRUTE(_geotype % 100);
85 }
86
87 if ( _nvariable != (_geotype / 100) ) {
88 MESSAGE("Erreur : le nombre de variables "\
89 "est différent de la dimension de l'espace de la maille de référence.\n");
90 ISCRUTE(_nvariable); ISCRUTE (_geotype / 100);
91 } else
92 fprintf(stdout,"\t Il y a %d fonctions de base avec %d variables\n ",_nbasisfunc,_nvariable);
93 fprintf(stdout,"\t Le degré maximum des fonctions de base est %d et possèdent au maximum %d coefficients\n"
94 ,_maxdegree,_nmaxcoefficient);
95
96 }
97
98 if (MEDfileClose(_fid) < 0) {
99 MESSAGE("ERROR : file closing");
100 return -1;
101 }
102
103 _ret=0;
104 ERROR:
105
106 return _ret;
107
108}
109
int main(int argc, char **argv)
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
Definition: MEDfileClose.c:30
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition: MEDfileOpen.c:42
MEDC_EXPORT med_int MEDnInterp(const med_idt fid)
Cette routine renvoie le nombre d'interpolations disponibles dans le fichier.
Definition: MEDnInterp.c:34
MEDC_EXPORT med_err MEDinterpInfo(const med_idt fid, const int interpit, char *const interpname, med_geometry_type *const geotype, med_bool *const cellnode, med_int *const nbasisfunc, med_int *const nvariable, med_int *const maxdegree, med_int *const nmaxcoef)
Cette fonction informe des caractéristiques de la fonction d'interpolation n° interpit.
Definition: MEDinterpInfo.c:43
#define MED_NAME_SIZE
Definition: med.h:81
int med_geometry_type
Definition: med.h:194
med_bool
Definition: med.h:260
@ MED_FALSE
Definition: med.h:260
int med_int
Definition: med.h:333
#define MED_NONE
Definition: med.h:231
herr_t med_err
Definition: med.h:323
@ MED_ACC_RDONLY
Definition: med.h:120
hid_t med_idt
Definition: med.h:322
#define MESSAGE(chaine)
Definition: med_utils.h:324
#define ISCRUTE(entier)
Definition: med_utils.h:313