MED fichier
Test_MEDfieldInterpInfo.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=0;
35 med_idt _fid=0;
36
37 char _fieldname1[MED_NAME_SIZE+1] = "champ reel";
38 char _interpname[MED_NAME_SIZE+1] = "";
39 med_int _ninterp = 0;
40 int _interpit=0;
41
42
43 /* Ouverture en mode creation du fichier "current.med" */
44 _fid = MEDfileOpen("current.med",MED_ACC_RDONLY);
45 if (_fid < 0) {
46 MESSAGE("Erreur a la creation du fichier current.med");
47 return -1;
48 }
49
50 if ( (_ninterp = MEDfieldnInterp(_fid,
51 _fieldname1
52 ) ) < 0 ) {
53 MESSAGE("Erreur à la lecture du nombre de fonctions d'interpolation sur le champ : ");
54 SSCRUTE(_fieldname1);_ret=_ninterp; goto ERROR;
55 }
56
57 for (_interpit=0;_interpit < _ninterp; ++_interpit ) {
58 if ( (_ret = MEDfieldInterpInfo(_fid,
59 _fieldname1,
60 _interpit+1,
61 _interpname ) <0) ) {
62 MESSAGE("Erreur à la lecture des informations de la fonction d'interpolation n° :");
63 ISCRUTE(_interpit);SSCRUTE("sur le champ : ");SSCRUTE(_fieldname1);
64 goto ERROR;
65 }
66 else
67 fprintf(stdout,"Le nom de la fonction d'interpolation n°%d du champ %s est %s\n",
68 _interpit+1,_fieldname1,_interpname);
69
70 }
71
72 ERROR:
73 if (MEDfileClose(_fid) < 0) {
74 MESSAGE("ERROR : file closing");
75 return -1;
76 }
77
78 return _ret;
79
80}
81
int main(int argc, char **argv)
MEDC_EXPORT med_err MEDfieldInterpInfo(const med_idt fid, const char *const fieldname, const int interpit, char *const interpname)
Cette routine indique le nom interpname de la interpit ème fonction d'interpolation associées au cham...
MEDC_EXPORT med_int MEDfieldnInterp(const med_idt fid, const char *const fieldname)
Cette routine renvoie le nombre de fonctions d'interpolation associées au champ résultat fieldname.
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition MEDfileOpen.c:42
#define MED_NAME_SIZE
Definition med.h:81
int med_int
Definition med.h:333
herr_t med_err
Definition med.h:323
@ MED_ACC_RDONLY
Definition med.h:120
hid_t med_idt
Definition med.h:322
#define SSCRUTE(chaine)
Definition med_utils.h:323
#define MESSAGE(chaine)
Definition med_utils.h:324
#define ISCRUTE(entier)
Definition med_utils.h:313