next up previous contents
Next: get_function_vertex_estimate() Up: Routines for Functions on Previous: local_information()

get_bounds()

This routine calculates the maximum and the minimum of the function on an element. In the mask we find:

static void get_bounds(HELEMENT2D* helement,
                double*     min,
                double*     max,
                void*       function_data)
{
  *min = ...;
  *max = ...;

  return;
}
And we adapt this to our piecewise linear function:
static void get_bounds(HELEMENT2D* helement,
                double*     min,
                double*     max,
                void*       function_data)
{
  USER_FUNCTION_DATA* user_function_data;
  double*             function_values;
 
  int i;

  user_function_data = (USER_FUNCTION_DATA*)function_data;
  function_values    = user_function_data->function_values;

  *min = function_values[helement->vindex[0]];
  *max = *min;

  for(i=0;i<2;i++){
    if(function_values[helement->vindex[i]] < *min)
      *min = function_values[helement->vindex[i]];
    if(function_values[helement->vindex[i]] > *max)
      *max = function_values[helement->vindex[i]];
  }

  return;
}

next up previous contents
Next: get_function_vertex_estimate() Up: Routines for Functions on Previous: local_information()

SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.