MED fichier
Test_MEDinterpCr.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 /*Exemple 1 :
38
39 - Elément de référence de type géométrique MED_TRIA3
40 - Point X(X1,X2) quelconque dans le plan de l'élément de référence
41 - Fonctions de base : P1(X)=1-X1-X2 ; P2(X)=X1; P3(X)=X2;
42 (issu du choix de la base polynomiale (1,X1,X2)
43 et des trois noeuds de la maille de référence pour
44 construire l'interpolation)
45 */
46 const char _interpname1[] ="interpname1";
48 med_bool _cellnodes1 =MED_TRUE;
49/* med_int _nbasisfunc1 =3; */
50 med_int _nvariable1 =2;
51 med_int _maxdegree1 =1;
52 med_int _nmaxcoefficient1=3;
53
54 /* Ouverture en mode creation du fichier "current.med" */
55 _fid = MEDfileOpen("current.med",MODE_ACCES);
56 if (_fid < 0) {
57 MESSAGE("Erreur a la creation du fichier current.med");
58 return -1;
59 }
60
61 if ( (_ret = MEDinterpCr(_fid,
62 _interpname1,
63 _geotype1,
64 _cellnodes1,
65 _nvariable1,
66 _maxdegree1,
67 _nmaxcoefficient1
68 ) <0) ) {
69 MESSAGE("Erreur à la création de la fonction d'interpolation n°1");
70 }
71
72
73 if (MEDfileClose(_fid) < 0) {
74 MESSAGE("ERROR : file closing");
75 return -1;
76 }
77
78
79 return _ret;
80
81}
82
#define MODE_ACCES
int main(int argc, char **argv)
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
Definition: MEDfileClose.c:30
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition: MEDfileOpen.c:42
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
int med_geometry_type
Definition: med.h:194
med_bool
Definition: med.h:260
@ MED_TRUE
Definition: med.h:260
#define MED_TRIA3
Definition: med.h:203
int med_int
Definition: med.h:333
herr_t med_err
Definition: med.h:323
hid_t med_idt
Definition: med.h:322
#define MESSAGE(chaine)
Definition: med_utils.h:324