next up previous contents
Next: The action-on-element routine Up: Data Extraction Previous: The projection routine

The test-if-proceed routine

As mentioned above this functions controlls the traverse. It may return each of the three values G_HM_NOACTION, G_HM_PROCEED or G_HM_ACTION. If G_HM_ACTION is returned the traverse is stopped on the current element and the action_on_element routine is called. Whereas if G_HM_NOACTION is returned the traverse is stopped on the current element without calling the action_on_element routine. In contrast G_HM_PROCEED causes the traverse to go on to the next finer level. It is important to understand that the traverse mode determines on which elements the action_on_element routine may be called (on all nodes of the tree or only on the leaves) but the result of test_if_proceed determines when the action_on_element routine is actually called.

The arguments of the test_if_proceed routine are the HELEMENT2D, the HM2_GENERAL-structure and the element data of the current element. For an example see the hm2_fct_lens_test_if_proceed routine at the end of this section.

Typically the test_if_proceed routine compares an element error indicator to an appropriate threshold. In the 3D-case other intersection tests are also a common task performed in this routine. In the GRAPE-library several standard routines of this kind are incorporated. In the 2D-case these are:

As the names indicate either the geometry error indicators, the function error indicators or both are compared to their respective threshold. Additionally the functionality of the lens is supported or not.

int hm2_fct_lens_test_if_proceed(HELEMENT2D* helement,
                                 HM2_GENERAL* general,
                                 void* el_data)
{
  HMESH2D*      hmesh     = (HMESH2D*)helement->mesh; 
  F_HDATA2D*    f_hdata2d = general->f_hdata2d;
  HMESH2D_LENS* lens      = general->lens;

  double   error,lens_error;
  double   lens_threshold;
    
  /* get element error estimator */
  
  if(f_hdata2d->get_element_estimate)
    error = f_hdata2d->get_element_estimate(helement,
                                            f_hdata2d->function_data);
  else
    error = f_hdata2d->threshold + 1.0;
   
  /* lens condition */
  
  lens_threshold = lens->get_lens_element_threshold(helement,lens);
  
  if(hmesh->get_lens_element_estimate)
    lens_error = hmesh->get_lens_element_estimate(helement,
                                                  lens->lens_data);
  else
    lens_error = lens_threshold + 1.0;
 
  /* compare with threshold */
    
  if(error < f_hdata2d->threshold && lens_error < lens_threshold)
    return G_HM_ACTION;
  else
    return G_HM_PROCEED;
}


next up previous contents
Next: The action-on-element routine Up: Data Extraction Previous: The projection routine

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.