Table of Contents

26. Mesh Generation Modules, Part III

This section describes the use of a suite of optional VisTools modules for performing mesh generation. A summary of the basic features of the mesh generation modules appear below: Table of Contents

26.1 Module Summary

The mesh generation modules are designed to be integrated into existing software systems such as finite element pre processors with minimal impact upon established data structures. The modules currently delivered as VisTools mesh generation modules may be divided into four categories: 1) mapped mesh generation and extrusion, 2) 2D planar mesh generation, 3) 3D curve and surface mesh generation, and 4) 3D volume mesh generation.

Table of Contents

26.2 Controlling Mesh Size

Mesh spacing is controlled in a number of ways depending upon the mesh generation module used. The mapped mesh and extrusion modules, MapMesh and ExtMesh, the mesh spacing is very specific to the mesh generation technique. In the unstructured mesh modules, there are a set of common parameters such as target edge length, growth rate and minimum edge length. Additional parameters such as spanning angle are available for curve and surface mesh generation.

In the unstructured meshing modules such as TriMesh, SurfMesh and TetMesh, the normal input sizing parameters may be overridden by installing a callback function to specify the mesh size as a function of spatial coordinate. Generally, both isotropic and anisotropic sizing callback functions are available. These sizing callback functions have the same general form for all modules. Note that if an anisotropic sizing function is set, it takes precedence over any isotropic sizing function which has been set. The function prototypes for the SurfMesh module appear below as an example.

The isotropic sizing callback function prototype is

     void function (vis_SurfMesh *surfmesh,
                    Vobject *object,
                    Vdouble x[3],
                    Vdouble *s)
The first argument is the SurfMesh object, surfmesh, the second is a user defined object, object, the third is the coordinate location x and the fourth is the returned size s.

The anisotropic sizing callback function prototype is

     void function (vis_SurfMesh *surfmesh,
                    Vobject *object,
                    Vdouble x[3],
                    Vdouble s[3][3])
The first argument is the SurfMesh object, surfmesh, the second is a user defined object, object, the third is the coordinate location x and the fourth is the returned anisotropic scaled orthogonal direction vectors. The first 3 components are the first size scaled direction, the next 3 components are the second size scaled direction, the next 3 components are the third size scaled direction.

Table of Contents

26.3 Monitoring Meshing Progress

Each meshing module allow a callback function to be installed which is called periodically during the meshing process. The user may call from within the monitor function, query functions such as vis_SurfMeshGetInteger to return progress parameters. In addition the user may abort the meshing process by setting an abort flag. In the SurfMesh module this flag is set using vis_SurfMeshAbort. The monitor function prototype for the SurfMesh module appears below as an example.

The monitor callback function prototype is

     void function (vis_SurfMesh *surfmesh,
                    Vobject *object)
The first argument is the SurfMesh object, surfmesh, the second is a user defined object, object.

Table of Contents

26.4 Use of the Connect Module

In all mesh generation modules the generated mesh is output in a Connect object. This object contains the generated node coordinates and element connectivity, topology, material number, etc. All generated nodes and elements are appended to any nodes and elements already existing in the specified Connect object. The Connect module contains access functions to retrieve the generated node and element information. The following code fragment illustrates the basic process:

   vis_Connect *connect;
   Vint numnp, numel;
   Vint shape, maxi,maxj,maxk;
   Vint nix, ix[27];
   Vdouble x[3];
                   /* print generated nodes and elements */
   vis_ConnectNumber (connect,SYS_NODE,&numnp);
   vis_ConnectNumber (connect,SYS_ELEM,&numel);
   printf("numnp= %d, numel= %d\n",numnp,numel);

                   /* print node information */
   printf("Node information\n");
   for(i = 1; i <= numnp; i++) {
      vis_ConnectCoordsdv (connect,1,&i,(Vdouble(*)[3])x);
      printf("id= %d  x= %f, y= %f, z= %f\n",i,x[0],x[1],x[2]);
   }
                   /* print element information */
   printf("Element information\n");
   for(i = 1; i <= numel; i++) {
                   /* topology */ 
      vis_ConnectTopology (connect,i,&shape,&maxi,&maxj,&maxk);
      if(shape == VIS_SHAPEPOINT) printf("id= %d POINT ix=",i);
      if(shape == VIS_SHAPELINE)  printf("id= %d LINE  ix=",i);
      if(shape == VIS_SHAPETRI)   printf("id= %d TRI   ix=",i);
      if(shape == VIS_SHAPEQUAD)  printf("id= %d QUAD  ix=",i);
      if(shape == VIS_SHAPETET)   printf("id= %d TET   ix=",i);
      if(shape == VIS_SHAPEPYR)   printf("id= %d PYR   ix=",i);
      if(shape == VIS_SHAPEWED)   printf("id= %d WED   ix=",i);
      if(shape == VIS_SHAPEHEX)   printf("id= %d HEX   ix=",i);
                   /* connectivity */ 
      vis_ConnectElemNode (connect,i,&nix,ix);
      for(j = 0; j < nix; j++) {
         printf(" %d",ix[j]);
      }
      printf("\n");
   }