next up previous contents index
Next: General Meshes Up: Fe3d Previous: Fe3d

Special Methods on Fe3d

 

   

GRAPE(fe, "point-probe-send")()

The value of a function at a position the user has to pick by mouse click is displayed.



                       

GRAPE(fe, "clip")(f,var,draw_clip,scal,clip_flag)
GRAPE(fe, "clip-isoline-disp")()
GRAPE(fe, "clip-iso-select-disp")()
GRAPE(fe, "clip-in-out-disp")()
GRAPE(fe, "clip-vect-disp")()
GRAPE(mgr, "set-clip-parm")(nx,ny,nz,d,is,io,ih,ms,vl)
FE3D *fe ;
MANAGER *mgr;
SCENE *s;
double (*f)();
char *var;
int (*draw_clip)();
char *scal;
int clip_flag;
double nx,ny,nz,d,is,io,ih,ms,vl;

Different to the 'clip' method on a Triang3d instance the function of the Fe3d instance can now be employed to define the draw_clip function. This enforces all those intersection methods which include function depending drawing to act on the class Fe3d.

There are some predefined ones:

The method set-clip-parm allows the user to predefine the frequently used variables of the interactive clipping routines. (nx,ny,nz are the components of the plane normal, d its distance from the origin, is,io the scaling and the coloroffset of the isolines,ih the graph height over the clipping plane, ms the mesh size of vector fields, and vl the vector length scaling).

The user himself can add new clipping methods by changing the hypersurface or by adding new local rendering functions. Therefore we now explain the parameter structure for the local rendering function draw_clip. The general 'clip' method calls this function in the following way:

draw_clip(clip3d_par)

The structure clip3d_par must be used to construct a draw_clip function:

typedef struct clip3d_par {
        TRIANG3D *triang3d; /* instance of class Triang3d */
        int it;             /* number of tetrahedron      */ 
        int n;              /* number of points of the */
                            /* intersection */
        VEC3 v[5];          /* v[0]: coordinates of visible */ 
                            /* tetrahedron point, v[1]..v[n]: */
                            /* vector with the coordinates of the */
                            /* intersection points */
        double bary[5][4];  /* barycentric coordinates of the */
                            /* intersection points */
        double (*f)();      /* the clipping function f(x,y,z,var) */
        char *var;          /* pointer to parameters of the */
                            /* clipping function */
        char *scal;         /* pointer to the parameters of */
                            /* draw_clip function, as they were */
                            /* passed to the original clip */
                            /* routine */
     } CLIP3D_PAR;

This structure describes the shape of the intersection of the clipping function level and the tetrahedron it. The filled structure is delivered by the actual clip routine.

The vector v[0] contains the coordinates of a visible tetrahedron point. v[1 tex2html_wrap_inline44350 n] are the coordinates of those points which lie on edges of the tetrahedron it and in the surface described by the clipping function f.

In all the listed interactive methods a plane is used as the clipping function.

       

(TRIANG3D *)GRAPE(tr, "fix-clip")(f,fpar)
(TRIANG3D *)GRAPE(s, "fix-clip-send")()
TRIANG3D *tr;
SCENE *s;
double (*f)();
char *fpar;

This method performs the same clipping operation and builds up a TRIANG3D instance containing the sub level of this function cut with the geometry. The methods "fix-clip-send" takes the object of the scene node and the current kind of clipping from the "disp" methods and inserts a new scene node containing the clipped TRIANG3D instance as its object.


       

GRAPE(fe, "bnd-isoline-disp")()
GRAPE(fe, "bnd-iso-select-disp")()
FE3D *fe;

These methods produce an isoline image of a one dimensional FEM function (or of the absolute value of a vector valued function) at the boundary of the Fe3d-Instance. The method "bnd-iso-select-disp" displays in grid mode only those isolines whose values are stored in the array colorbar->values. In patch mode these particular values are displayed as white lines above the isoline image.

Additionally a ruler bnd-value (for bnd-isoline-disp) appears to choose the bnd-value. If these value is less then 0, the isolines are displayed only at those boundary-faces, of which the neighbour-value is equal to bnd-value. If the value is 0, isolines are displayed at all boundary-faces and if the neighbourhood-relations are correct, the edges of the boundary are highlighted by additional lines. The minimal angle only just specifying an edge can be set by the root-method "choice-edge-angle-send".


                               

GRAPE(tr, "level")(func,lev)
GRAPE(fe, "level-disp")()
(TRIANG2D *)GRAPE(tr, "fix-level")(func,lev)
(TRIANG3D *)GRAPE(tr, "fix-sub-level")(funct,lev)
(TRIANG3D *)GRAPE(tr, "fix-super-level")(funct,lev)
(SCENE *)GRAPE(scene, "fix-level-send")()
(SCENE *)GRAPE(scene, "fix-super-level-send")()
(SCENE *)GRAPE(scene, "fix-sub-level-send")()
TRIANG3D *tr;
FE3D *fe;
SCENE *s;
void (*funct)();
double lev;

The slices of tetrahedron are calculated where the one-dimensional finite element function func has the level lev. If func is NIL and tr is an instance of a subclass of Fe3d then the finite element function is taken into account. In that case you can choose first or second order approximation if the polynomial order is greater than 1. For switching there is a button in the options menu. If the dimension of value of this function is greater than 1 the absolute value of the vector defines the inspected function. In the case of a three dimensional field the components are weighted, each by a specific double (with corresponding rulers). The resulting 2D level surface consists of a polygonal approximation. The "fix"-methods perform the same level calculation for the object of the scene instance and insert as the next scene in the chain the level set as a Triang2d instance. The "super" and the "sub"-methods focus to the super of sub volumes (3D triangulations) of the function on the volume geometry.

       

(FE3D *) GRAPE(Fe3d, "make")
(x,y,z,x_n,y_n,z_n,values,dim,inst_name)
(FE3D *) GRAPE(Fe3d, "make6")
(x,y,z,x_n,y_n,z_n,values,dim,inst_name)
TRIANG *tr;
double *x,*y,*z;
int x_n,y_n,z_n;
double *values;
int dim;
char *inst_name;

For the corresponding Triang3d instance the method "make" is called and some additional variables for a Fe3d instance are declared. The finite element function is built with linear interpolation of the function values given at the discretization points. The function value at the discretization point index_x in the x-direction, index_y in the y-direction and index_z in the z-direction is found as

value[ index_z + z_n * ( index_y + y_n * index_x ) ].

The resulting mesh consists of 5 tetrahedron for each cube in the 3D mesh. The method "make6" does the same, except that 6 tetrahedron form one cube. This kind of discretization is more regular and therefore better conditions for finite element calculations.

The name of the new instance is inst_name.

   

(double *) GRAPE(Fe3d, "get-gradient")()
FE3D *fe;

This methods calculates the local gradient of the current fe->f function locally on the elements. Then its recovers by weighted interpolation values on the vertices of the mesh. The locally gradient calculation is exact on polynomials of degree 2 and works on the lagrangian point of 2nd order. The method returns a double field grad[k+3*j+3*dim*i] of size sizeof(double )*3*dim*mnp.

eqnarray11906

   

GRAPE(fe3d,"add-grad-send")()
VEC3 *g_fe3d_gradient(fe, i, bary, jmax, Du)
VEC3 *g_fe3d_grad(fe, i, bary, _u, jmax, Du)
FE3D *fe;
int i, jmax;
f3_func *_u; /* typedef void (f3_func)(FE3D*, int, double*, double*); */
double bary[4], Du[jmax][3];

The method add-grad-send creates the Jacobian matrix field corresponding to the fe3d-data, and stores it behind the fe3d-data. If the fe->data - array is already larger than usual, the method asks, if the Grad field is already there (stdout). The point wise gradients are distributed by the method calc-gradient.

g_fe3d_gradient writes the first jmax rows of the Jacobian matrix(i,bary) to the array Du. The Jacobian matrix(i,bary) is the Jacobian of the point specified by the tetrahedron number i and the barycentric coordinates bary. The function assumes that the grad-field is behind the fe-data (->add-grad-send). Du is interpolated. Return value: the field address Du (i.e. just the argument Du).

g_fe3d_grad : like g_fe3d_gradient, but the gradient is calculated directly from the fe - function (by differentiating the quadratic interpolation of the function in the midpoints and ends of the edges), i.e. you don't have to provide the gradient field mentioned above. The function returns NULL in case of trouble (which might occur in the calculation of the reference map), otherwise Du.


next up previous contents index
Next: General Meshes Up: Fe3d Previous: Fe3d

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.