In this sections the tools that are helpfull for extracting data are presented. Although the context is to write display methods the tools are also usefull for calculating error estimators, norms of functions and for many other purposes.
There are exceptions, but most display methods extract the necessary data in the following way: The hierachical tree is traversed via the interface functions and on any leaf the data are fetched, calculated and rendered. As hanging nodes may occur in an adaptive traverse, hierachical projection is needed to assure continuity.
To support this, there are functions in GRAPE - namely
g_traverse_hmesh2d()
and g_traverse_hmesh3d()
- that implement
such an traverse. Among other things these routines need three
call-back-functions as arguments.
projection
; in this routine the necessary data on the currrent
element are collected and if appropriate interpolated.
test_if_proceed
; this functions controlls the traverse. It is
decided whether to proceed on the next finer level or to stop on
the current element and in the latter case whether to render on the current
element or not. The outcome may be based on the projected data or for
example on the error estimators included in the HMesh
-interface.
action_on_element
; this functions should contain the code for
rendering the data on an element.
Further arguments of g_traverse_hmesh2d()
are the Hmesh2d
object, a pointer to a HM2_GENERAL
variable, the traverse mode, the
level of interest, an array of pointers to the element data, a pointer to
other arbitrary data possibly needed in the action_on_element
routine
and a mesh element flag.
The traverse mode, an variable of type integer, determines on which elements the
action_on_element
routine may be called. Possible values are
G_LEAVES
, G_PREFIX
and G_POSTFIX
. If the traverse mode is
G_LEAVES
the action is at most called on a leaf of the hierachical
tree. In contrast if the traverse mode is G_PREFIX
or G_POSTFIX
the action_on_element
routine may be called on all elements of the
tree. In the case of G_PREFIX
the action_on_element
routine is
called first on the parent element and after that the children are
considered. Whereas in the case of G_POSTFIX
only after the complete
subtree of an element is traversed the action_on_element
routine is
called on the element itself.
The level of interest is the maximum depth of the hierachical traverse. In
most display methods this should be the level of interest stored in the
Hmesh2d
object. Since this entry can be manipulated by the user via the
uif-hm2
-project it is not neccessary that display methods have an
interactive element controlling it.
The interface functions of the Hmesh2d
allow to choose which entries of
the HELEMENT2D
structure are filled by the interface. In the same way
this choice can be made for the whole traverse with the mesh element flag.
Below the exact prototype of the traverse routine is printed. The other arguments are explained in the next section.
void g_traverse_hmesh2d( HMESH2D* hmesh, HM2_GENERAL* general, int traverse_mode, int level_of_interest, int (*projection) (HELEMENT2D* helement, HM2_GENERAL* general, void* element_data, void* parent_data), int (*test_if_proceed) (HELEMENT2D* helement, HM2_GENERAL* general, void* element_data), int (*action_on_element)(HELEMENT2D* helement, HM2_GENERAL* general, void* element_data, void* action_arg), void** element_data, void* action_arg, MESH_ELEMENT_FLAGS mesh_element_flag)
Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.