usecases/c/UsesCase_MEDinterp_1.c
#include <med.h>
#define MESGERR 1
#include <med_utils.h>
#include <string.h>
int main (int argc, char **argv) {
  med_idt fid;
  char interpname[MED_NAME_SIZE+1] = "MED_TRIA3 interpolation family";
  const med_int nvariable=2;
  const med_int maxdegree=1;
  const med_int nmaxcoefficient=3;
  const med_int         ncoefficient1_1 = 3;
  const med_int   const power1_1[]         = {0,0,1,0,0,1};
  const med_float const coefficient1_1[]   = {1,-1,-1};
  const med_int         ncoefficient1_2 = 1;
  const med_int   const power1_2[]         = {1,0};
  const med_float const coefficient1_2[]   = {1};
  const med_int         ncoefficient1_3 = 1;
  const med_int   const power1_3[]         = {0,1};
  const med_float const coefficient1_3[]   = {1};
  int ret=-1;
  
  fid = MEDfileOpen("UsesCase_MEDinterp_1.med",MED_ACC_CREAT);
  if (fid < 0) {
    MESSAGE("ERROR : file creation ...");
    goto ERROR;
  }
 
  
  if (MEDinterpCr(fid, interpname, MED_TRIA3, MED_FALSE, nvariable, maxdegree, nmaxcoefficient) < 0) {
    MESSAGE("ERROR : interpolation family creation ...");
    goto ERROR;
  }
  
  if (MEDinterpBaseFunctionWr(fid,interpname,1,ncoefficient1_1,power1_1,coefficient1_1) < 0) {
    MESSAGE("ERROR : first base function creation ...");
    goto ERROR;
  }
  
  if (MEDinterpBaseFunctionWr(fid,interpname,2,ncoefficient1_2,power1_2,coefficient1_2) < 0) {
    MESSAGE("ERROR : second base function creation ...");
    goto ERROR;
  }
  if (MEDinterpBaseFunctionWr(fid,interpname,3,ncoefficient1_3,power1_3,coefficient1_3) < 0) {
    MESSAGE("ERROR : third base function creation ...");
    goto ERROR;
  }
  ret=0;
 ERROR:
  
  if (MEDfileClose(fid) < 0) {
    MESSAGE("ERROR : close file ...");             
    ret=-1; 
  } 
  
  return ret;
}