The mesh is just a collection of elements, as they are described in the previous section, together with an optional data function on the mesh.
We restrict the access to the elements to a procedural interface, that delivers pointers to elements in one of two possible ways:
Both the next_element() and neighbour() routines may overwrite the element data structure, so that no additional storage is needed for the next element's data structures. In case that one needs to collect information about several elements, a routine
This procedural access to the mesh elements allows the generation of local element data at the time when it is actually needed. Otherwise, in case of an array or pointered list, complete information for all elements of the mesh would have to be present at the same time (and occupy much more storage).
The routines which generate the element data structures have to convert between the representations via user's data structures and the element structures. They do this mainly by filling out vertex and index information for an element and referring to a previously prepared description. As mentioned above, in case of structured meshes this is done mainly by index arithmetic, whereas for unstructured meshes such information is usually stored with the mesh.
The MESH data structure contains values for the allocation of temporary memory that some routines may need:
At last, the MESH structure contains an interface to data given on the mesh. Here we want to support a situation where different types of data are given at the same time on the same mesh with different value dimensions and other characteristics (example: a piecewise linear, scalar pressure, a piecewise quadratic, vector-valued velocity, and some more), together with some method to select one of the data values for display. The data characteristics may change between two visualization tasks. Additionally, there may be data characteristics which change from element to element in the same mesh, for example the polynomial degree of the basis functions. To handle all these situations, we use a rather general interface for functions on the mesh. A user supplied procedure evaluates data selected for visualization. Instead of only supporting functions given in terms of a Lagrangian basis, this concept is open for any type of user function such as one of Hermitian type or one only piecewisely defined on several parts of a single element, for example.
Data to be displayed is defined globally on the whole mesh, although the evaluation of data is done on element level (using local coordinates). Thus, the data interface is located at mesh level, and described by the following structure:
typedef struct { char *name; /* textual data description */ int dimension_of_value; /* dimension of data value vector */ int continuous_data; /* data globally continuous? (0/1) */ void (*f)(ELEMENT3D *, int, double[], double[]); void (*f_el_info)(ELEMENT3D *, F_EL_INFO3D *); int size_of_user_data; void *user_data; F_DATA3D *last, *next; /* to build doubly linked list */ } F_DATA3D; typedef struct { int polynomial_degree; /* local polynomial degree of data */ } F_EL_INFO3D;
In detail, the entries are:
The f_data entry in the mesh structure gives access to data which is currently selected for display. By use of the doubly linked list, an interactive choice between different data is possible.
In the end, the mesh structure contains a data pointer user_data and the size of the underlying memory area size_of_user_data. This simplifies read and write operations and the simultaneous handling of multiple mesh3d data sets.
typedef struct { ELEMENT3D *(*first_element)(MESH3D *); ELEMENT3D *(*next_element)(ELEMENT3D *); ELEMENT3D *(*copy_element)(ELEMENT3D *); void (*free_element)(ELEMENT3D *); int max_dimension_of_coord; /* max. dimension of the local */ /* coordinate system */ int max_number_of_vertices; /* max. number of vertices of */ /* one single element */ int max_eindex; /* max. global element index */ int max_vindex; /* max. global vertex index */ F_DATA3D *f_data; int size_of_user_data; /* optional size of user data */ void *user_data; /* optional pointer to user data */ } MESH3D;
Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.