Test_MEDinterpInfo.c
Aller à la documentation de ce fichier.
/* This file is part of MED.
*
* COPYRIGHT (C) 1999 - 2020 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=-1;
med_idt _fid=0;
med_int _ninterp=0;
int _interpit =0;
char _interpname[MED_NAME_SIZE+1]="";
med_geometry_type _geotype =MED_NONE;
med_bool _cellnodes =MED_FALSE;
med_int _nbasisfunc =0;
med_int _nvariable =0;
med_int _maxdegree =0;
med_int _nmaxcoefficient =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 = MEDnInterp(_fid)) <0) _ret=_ninterp;
ISCRUTE(_ninterp);
for ( _interpit=1; _interpit<= _ninterp; ++_interpit) {
if ( (_ret = MEDinterpInfo(_fid,
_interpit,
_interpname,
&_geotype,
&_cellnodes,
&_nbasisfunc,
&_nvariable,
&_maxdegree,
&_nmaxcoefficient
) <0) ) {
MESSAGE("Erreur à la création de la fonction d'interpolation n°");ISCRUTE(_interpit);
goto ERROR;
}
fprintf(stdout,"Fonction d'interpolation n° %d |%s| sur le type géométrique n° %d\n",
_interpit,_interpname, _geotype);
if ( _cellnodes )
if ( _nbasisfunc == (_geotype % 100) )
fprintf(stdout,"\t Les noeuds de construction sont les noeuds de la maille de référence.\n");
else {
MESSAGE("Erreur : le nombre de noeuds de construction "\
"est différent du nombre de noeuds de la maille de référence.\n");
ISCRUTE(_nbasisfunc); ISCRUTE(_geotype % 100);
}
if ( _nvariable != (_geotype / 100) ) {
MESSAGE("Erreur : le nombre de variables "\
"est différent de la dimension de l'espace de la maille de référence.\n");
ISCRUTE(_nvariable); ISCRUTE (_geotype / 100);
} else
fprintf(stdout,"\t Il y a %d fonctions de base avec %d variables\n ",_nbasisfunc,_nvariable);
fprintf(stdout,"\t Le degré maximum des fonctions de base est %d et possèdent au maximum %d coefficients\n"
,_maxdegree,_nmaxcoefficient);
}
if (MEDfileClose(_fid) < 0) {
MESSAGE("ERROR : file closing");
return -1;
}
_ret=0;
ERROR:
return _ret;
}
main
int main(int argc, char **argv)
Definition Test_MEDinterpInfo.c:31
MED_NAME_SIZE
#define MED_NAME_SIZE
Definition build.python3.12/include/med.h:81
med_geometry_type
int med_geometry_type
Definition build.python3.12/include/med.h:194
med_bool
med_bool
Definition build.python3.12/include/med.h:260
MED_FALSE
@ MED_FALSE
Definition build.python3.12/include/med.h:260
med_int
int med_int
Definition build.python3.12/include/med.h:333
MED_NONE
#define MED_NONE
Definition build.python3.12/include/med.h:231
med_err
herr_t med_err
Definition build.python3.12/include/med.h:323
MED_ACC_RDONLY
@ MED_ACC_RDONLY
Definition build.python3.12/include/med.h:120
med_idt
hid_t med_idt
Definition build.python3.12/include/med.h:322
MESSAGE
#define MESSAGE(chaine)
Definition build.python3.12/include/med_utils.h:324
ISCRUTE
#define ISCRUTE(entier)
Definition build.python3.12/include/med_utils.h:313
MEDfileClose
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
Definition MEDfileClose.c:30
MEDfileOpen
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition MEDfileOpen.c:42
MEDnInterp
MEDC_EXPORT med_int MEDnInterp(const med_idt fid)
Cette routine renvoie le nombre d'interpolations disponibles dans le fichier.
Definition MEDnInterp.c:34
MEDinterpInfo
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