Test_MEDinterpCr.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=0;
med_idt _fid=0;
/*Exemple 1 :
- Elément de référence de type géométrique MED_TRIA3
- Point X(X1,X2) quelconque dans le plan de l'élément de référence
- Fonctions de base : P1(X)=1-X1-X2 ; P2(X)=X1; P3(X)=X2;
(issu du choix de la base polynomiale (1,X1,X2)
et des trois noeuds de la maille de référence pour
construire l'interpolation)
*/
const char _interpname1[] ="interpname1";
med_geometry_type _geotype1 =MED_TRIA3;
med_bool _cellnodes1 =MED_TRUE;
/* med_int _nbasisfunc1 =3; */
med_int _nvariable1 =2;
med_int _maxdegree1 =1;
med_int _nmaxcoefficient1=3;
/* Ouverture en mode creation du fichier "current.med" */
_fid = MEDfileOpen("current.med",MODE_ACCES);
if (_fid < 0) {
MESSAGE("Erreur a la creation du fichier current.med");
return -1;
}
if ( (_ret = MEDinterpCr(_fid,
_interpname1,
_geotype1,
_cellnodes1,
_nvariable1,
_maxdegree1,
_nmaxcoefficient1
) <0) ) {
MESSAGE("Erreur à la création de la fonction d'interpolation n°1");
}
if (MEDfileClose(_fid) < 0) {
MESSAGE("ERROR : file closing");
return -1;
}
return _ret;
}
MODE_ACCES
#define MODE_ACCES
Definition Test_MEDinterpCr.c:28
main
int main(int argc, char **argv)
Definition Test_MEDinterpCr.c:31
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_TRUE
@ MED_TRUE
Definition build.python3.12/include/med.h:260
MED_TRIA3
#define MED_TRIA3
Definition build.python3.12/include/med.h:203
med_int
int med_int
Definition build.python3.12/include/med.h:333
med_err
herr_t med_err
Definition build.python3.12/include/med.h:323
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
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
MEDinterpCr
MEDC_EXPORT med_err MEDinterpCr(const med_idt fid, const char *const interpname, const med_geometry_type geotype, const med_bool cellnodes, const med_int nvariable, const med_int maxdegree, const med_int nmaxcoef)
Cette routine permet de créer une nouvelle fonction d'interpolation polynômiale nommée interpname.
Definition MEDinterpCr.c:43