Test_MEDfieldInterpInfo.c
Aller à la documentation de ce fichier.
/* This file is part of MED.
*
* COPYRIGHT (C) 1999 - 2021 EDF R&D, CEA/DEN
* MED is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MED is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MED. If not, see <http://www.gnu.org/licenses/>.
*/
#include <med.h>
#define MESGERR 1
#include <med_utils.h>
#include <string.h>
#ifdef DEF_LECT_ECR
#define MODE_ACCES MED_ACC_RDWR
#elif DEF_LECT_AJOUT
#define MODE_ACCES MED_ACC_RDEXT
#else
#define MODE_ACCES MED_ACC_CREAT
#endif
int main (int argc, char **argv)
{
med_err _ret=0;
med_idt _fid=0;
char _fieldname1[MED_NAME_SIZE+1] = "champ reel";
char _interpname[MED_NAME_SIZE+1] = "";
med_int _ninterp = 0;
int _interpit=0;
/* Ouverture en mode creation du fichier "current.med" */
_fid = MEDfileOpen("current.med",MED_ACC_RDONLY);
if (_fid < 0) {
MESSAGE("Erreur a la creation du fichier current.med");
return -1;
}
if ( (_ninterp = MEDfieldnInterp(_fid,
_fieldname1
) ) < 0 ) {
MESSAGE("Erreur à la lecture du nombre de fonctions d'interpolation sur le champ : ");
SSCRUTE(_fieldname1);_ret=_ninterp; goto ERROR;
}
for (_interpit=0;_interpit < _ninterp; ++_interpit ) {
if ( (_ret = MEDfieldInterpInfo(_fid,
_fieldname1,
_interpit+1,
_interpname ) <0) ) {
MESSAGE("Erreur à la lecture des informations de la fonction d'interpolation n° :");
ISCRUTE(_interpit);SSCRUTE("sur le champ : ");SSCRUTE(_fieldname1);
goto ERROR;
}
else
fprintf(stdout,"Le nom de la fonction d'interpolation n°%d du champ %s est %s\n",
_interpit+1,_fieldname1,_interpname);
}
ERROR:
if (MEDfileClose(_fid) < 0) {
MESSAGE("ERROR : file closing");
return -1;
}
return _ret;
}
MEDfileOpen
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition: MEDfileOpen.c:42
med_idt
hid_t med_idt
Definition: med.h:331
MEDfieldnInterp
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.
Definition: MEDfieldnInterp.c:35
MED_ACC_RDONLY
Definition: med.h:120
med_err
herr_t med_err
Definition: med.h:332
MESSAGE
#define MESSAGE(chaine)
Definition: med_utils.h:324
med_int
int med_int
Definition: med.h:342
med.h
ISCRUTE
#define ISCRUTE(entier)
Definition: med_utils.h:313
MEDfieldInterpInfo
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...
Definition: MEDfieldInterpInfo.c:37
main
int main(int argc, char **argv)
Definition: Test_MEDfieldInterpInfo.c:31
SSCRUTE
#define SSCRUTE(chaine)
Definition: med_utils.h:323
MED_NAME_SIZE
#define MED_NAME_SIZE
Definition: med.h:81
MEDfileClose
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
Definition: MEDfileClose.c:30
med_utils.h