Test_MEDinterpBaseFunctionWr.c
Aller à la documentation de ce fichier.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #include <med.h>
00019 #define MESGERR 1
00020 #include <med_utils.h>
00021 #include <string.h>
00022 
00023 #ifdef DEF_LECT_ECR
00024 #define MODE_ACCES MED_ACC_RDWR
00025 #elif DEF_LECT_AJOUT
00026 #define MODE_ACCES MED_ACC_RDEXT
00027 #else
00028 #define MODE_ACCES MED_ACC_CREAT
00029 #endif
00030 
00031 int main (int argc, char **argv)
00032 
00033 {
00034   med_err           _ret=-1;
00035   med_idt           _fid=0;
00036 
00037   
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046   const char         _interpname1[]   ="interpname1";
00047   med_geometry_type  _geotype1        =MED_TRIA3;
00048   med_bool           _cellnodes1      =MED_TRUE;
00049   med_int            _nbasisfunc1  =3;
00050   med_int            _nvariable1   =2;
00051   med_int            _maxdegree1      =1;
00052   med_int            _nmaxcoefficient1=3;
00053 
00054   const med_int         _ncoefficient1_1 = 3;
00055   const med_int   const _power1_1[]         = {0,0,1,0,0,1};
00056   const med_float const _coefficient1_1[]   = {1,-1,-1};
00057 
00058   const med_int         _ncoefficient1_2 = 1;
00059   const med_int   const _power1_2[]         = {0,0,1,0,0,0};
00060   const med_float const _coefficient1_2[]   = {0,1,0};
00061 
00062   const med_int         _ncoefficient1_3 = 1;
00063   const med_int   const _power1_3[]         = {0,0,0,0,0,1};
00064   const med_float const _coefficient1_3[]   = {0,0,1};
00065 
00066  
00067   _fid = MEDfileOpen("current.med",MODE_ACCES);
00068   if (_fid < 0) {
00069     MESSAGE("Erreur a la creation du fichier current.med");
00070     return -1;
00071   }
00072 
00073   if ( (_ret = MEDinterpBaseFunctionWr( _fid,
00074                                         _interpname1,
00075                                         1,
00076                                         _ncoefficient1_1,
00077                                         _power1_1,
00078                                         _coefficient1_1) <0) ) {
00079     MESSAGE("Erreur à l'écriture de la fonction de base n°1 de la fct. d'intp n°1");
00080     goto ERROR;
00081   }
00082 
00083   if ( (_ret = MEDinterpBaseFunctionWr( _fid,
00084                                         _interpname1,
00085                                         2,
00086                                         _ncoefficient1_2,
00087                                         _power1_2,
00088                                         _coefficient1_2) <0) ) {
00089     MESSAGE("Erreur à l'écriture de la fonction de base n°2 de la fct. d'intp n°1");
00090     goto ERROR;
00091   }
00092 
00093   if ( (_ret = MEDinterpBaseFunctionWr( _fid,
00094                                         _interpname1,
00095                                         3,
00096                                         _ncoefficient1_3,
00097                                         _power1_3,
00098                                         _coefficient1_3) <0) ) {
00099     MESSAGE("Erreur à l'écriture de la fonction de base n°3 de la fct. d'intp n°1");
00100     goto ERROR;
00101   }
00102 
00103   _ret=0;
00104 
00105  ERROR:
00106 
00107   if (MEDfileClose(_fid) < 0) {
00108     MESSAGE("ERROR : file closing");
00109     return -1;
00110   }
00111 
00112 
00113   return _ret;
00114 
00115 }
00116