UsesCase_MEDinterp_1.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 
00019 
00020 
00021 
00022 
00023 
00024 #include <med.h>
00025 #define MESGERR 1
00026 #include <med_utils.h>
00027 
00028 #include <string.h>
00029 
00030 int main (int argc, char **argv) {
00031   med_idt fid;
00032   char interpname[MED_NAME_SIZE+1] = "MED_TRIA3 interpolation family";
00033   const med_int nvariable=2;
00034   const med_int maxdegree=1;
00035   const med_int nmaxcoefficient=3;
00036   const med_int         ncoefficient1_1 = 3;
00037   const med_int   const power1_1[]         = {0,0,1,0,0,1};
00038   const med_float const coefficient1_1[]   = {1,-1,-1};
00039 
00040   const med_int         ncoefficient1_2 = 1;
00041   const med_int   const power1_2[]         = {1,0};
00042   const med_float const coefficient1_2[]   = {1};
00043 
00044   const med_int         ncoefficient1_3 = 1;
00045   const med_int   const power1_3[]         = {0,1};
00046   const med_float const coefficient1_3[]   = {1};
00047   int ret=-1;
00048 
00049   
00050   fid = MEDfileOpen("UsesCase_MEDinterp_1.med",MED_ACC_CREAT);
00051   if (fid < 0) {
00052     MESSAGE("ERROR : file creation ...");
00053     goto ERROR;
00054   }
00055  
00056   
00057 
00058 
00059 
00060 
00061 
00062   if (MEDinterpCr(fid, interpname, MED_TRIA3, MED_FALSE, nvariable, maxdegree, nmaxcoefficient) < 0) {
00063     MESSAGE("ERROR : interpolation family creation ...");
00064     goto ERROR;
00065   }
00066 
00067   
00068   if (MEDinterpBaseFunctionWr(fid,interpname,1,ncoefficient1_1,power1_1,coefficient1_1) < 0) {
00069     MESSAGE("ERROR : first base function creation ...");
00070     goto ERROR;
00071   }
00072   
00073   if (MEDinterpBaseFunctionWr(fid,interpname,2,ncoefficient1_2,power1_2,coefficient1_2) < 0) {
00074     MESSAGE("ERROR : second base function creation ...");
00075     goto ERROR;
00076   }
00077 
00078   if (MEDinterpBaseFunctionWr(fid,interpname,3,ncoefficient1_3,power1_3,coefficient1_3) < 0) {
00079     MESSAGE("ERROR : third base function creation ...");
00080     goto ERROR;
00081   }
00082 
00083   ret=0;
00084  ERROR:
00085 
00086   
00087   if (MEDfileClose(fid) < 0) {
00088     MESSAGE("ERROR : close file ...");             
00089     ret=-1; 
00090   } 
00091   
00092   return ret;
00093 }