next up previous contents index
Next: Methods on Mesh3d Up: Description of the mesh Previous: Element data

Global access to general meshes

   

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:

-
by building a procedurally linked list of elements, that runs sequentially through all elements in the mesh via two procedures
ELEMENT *first_element(mesh),
ELEMENT *next_element(element),

which return the anchor to the list resp. the next element in the list.
-
we can go from one element to an adjacent element (in space) across the face polygon via the routine
ELEMENT *neighbour(element, polygon, flag, coord, xyz).

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

ELEMENT *copy_element(element)

gives a copy of an element, which can be deleted later by
free_element(element).

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:

--
An upper bound max_number_of_vertices for the number of vertices of any element in the mesh, so that a routine which wants to store local vertex information knows how much memory it has to allocate.
--
Upper bounds max_eindex and max_vindex for the element index and vertex index, if such information is supplied (then the eindex and vindex[] entries in the ELEMENT data structure deliver values in the range tex2html_wrap_inline44440 , max_eindex-1] resp.\ tex2html_wrap_inline44440 , max_vindex-1]). If any one of the max_?index values is smaller or equal to zero, the elements do not give corresponding index information.

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:

name:
a textual description of current data (``pressure'', e.g.)
dimension_of_value:
current dimension of data values
continuous_data:
a flag which is 1, if the current data is continuous between elements, and 0 otherwise.
f(el, vindex, coord, val):
the data function itself generating dimension_of_value-dimensional values at a position which has to be specified in local coordinates on element el. This function may also be called with parameters coord=NULL and a local index vindex of one of the element's vertices.
f_el_info(el, el_info):
fills structure el_info with local information about data, such as polynomial degree for use by routines which adaptively choose the display resolution, e.g.
user_data, size_of_user_data:
optional pointer to user's data area
last, next:
to build a doubly linked list of data descriptions.

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;


next up previous contents index
Next: Methods on Mesh3d Up: Description of the mesh Previous: Element data

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.