| 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 |
|
| 31 |
int 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 |
|