geldesc.hh

00001 #ifndef __GRAPE_ELDESC_H__
00002 #define __GRAPE_ELDESC_H__
00003 
00004 #include <assert.h>
00005 #include <string.h>
00006 
00007 #if GRAPE_DIM==3
00008 typedef HELEMENT3D  HELEMENT;
00009 typedef ELEMENT3D   ELEMENT;
00010 typedef HMESH3D     HMESH;
00011 typedef HMESH       GRAPEMESH;
00012 typedef GENMESH3D   GENMESHnD;
00013 typedef HELEMENT3D_DESCRIPTION H_ELEMENT_DESCRIPTION;
00014 typedef ELEMENT3D_DESCRIPTION  ELEMENT_DESCRIPTION;
00015 typedef F_HDATA3D    F_DATA;
00016 typedef F_HEL_INFO3D F_EL_INFO;
00017 #define HMesh       HMesh3d
00018 #define GenMesh     GenMesh3d
00019 #define GrapeMesh   HMesh
00020 #else
00021 typedef HELEMENT2D  HELEMENT;
00022 typedef ELEMENT2D   ELEMENT;
00023 typedef GENMESH2D   GENMESHnD;
00024 typedef HELEMENT2D_DESCRIPTION H_ELEMENT_DESCRIPTION;
00025 typedef ELEMENT2D_DESCRIPTION  ELEMENT_DESCRIPTION;
00026 typedef F_HEL_INFO2D F_EL_INFO;
00027 
00028 // definitions for using HPMesh2d 
00029 typedef HPMESH2D    HMESH;
00030 typedef F_HPDATA2D   F_DATA;
00031 #define HMesh       HPMesh2d
00032 
00033 // definitions for using Mesh2d 
00034 //typedef HMESH2D    HMESH;
00035 //typedef F_HDATA2D   F_DATA;
00036 //#define HMesh       HMesh2d
00037 
00038 typedef HMESH       GRAPEMESH;
00039 #define GenMesh     GenMesh2d
00040 #define GrapeMesh   HMesh
00041 #endif
00042 
00043 /**************************************************************************/
00044 /*  element types, see dune/grid/common/grid.hh and grapegriddisplay.hh */
00045 enum GR_ElementType 
00046     {gr_vertex=6,gr_line=7, 
00047      // here consecutive numbering from zero that this numbers can be used
00048      // in an array starting from 0 
00049      gr_triangle=0, gr_quadrilateral=1,gr_tetrahedron=2,
00050      gr_pyramid=3, gr_prism=4, gr_hexahedron=5,
00051      gr_iso_triangle=8, gr_iso_quadrilateral=9, 
00052      gr_unknown=127};
00053 enum { numberOfUsedGrapeElementTypes = 6 };
00054 
00055 /*****************************************************************************
00056 * HELEMENT2D_DESCRIPTION for Triangles               *
00057 *****************************************************************************/
00058 
00059 
00060 static HELEMENT2D_DESCRIPTION triangle_description;
00061 
00062 static double triangle_local_coordinate_vector_0[3] = {0.,0.,0.};
00063 static double triangle_local_coordinate_vector_1[3] = {1.,0.,0.};
00064 static double triangle_local_coordinate_vector_2[3] = {0.,1.,0.};
00065 
00066 static G_CONST double *triangle_local_coordinate_system[3] = {triangle_local_coordinate_vector_0,
00067                triangle_local_coordinate_vector_1,
00068                triangle_local_coordinate_vector_2};
00069 
00070 /*  inheritance-rules:
00071      2                           0 1
00072     /\                          /| |\
00073    /  \                     C0 / | | \  C1
00074   /    \           =>         /  | |  \
00075  /      \                    /   | |   \
00076 0--------1                  1----2 2----0
00077 */
00078 
00079 // NOTE: To be revised 
00080 static VINHERIT inheritance_rule_in_child_0[3]; 
00081 static VINHERIT inheritance_rule_in_child_1[3];
00082 
00083 static double pweight_point_0_or_1[1] = {1.0};
00084 
00085 static int        pindex_point_0_in_child_0[1] = {2};
00086 static VINHERIT vinherit_point_0_in_child_0    = {1,
00087               pindex_point_0_in_child_0,
00088               pweight_point_0_or_1};
00089 
00090 
00091 static int        pindex_point_1_in_child_0[1] = {0};
00092 static VINHERIT vinherit_point_1_in_child_0    = {1,
00093               pindex_point_1_in_child_0,
00094               pweight_point_0_or_1};
00095 
00096 static int        pindex_point_0_in_child_1[1] = {1};
00097 static VINHERIT vinherit_point_0_in_child_1    = {1,
00098               pindex_point_0_in_child_1, 
00099               pweight_point_0_or_1};
00100 
00101 static int        pindex_point_1_in_child_1[1] = {2};
00102 static VINHERIT vinherit_point_1_in_child_1    = {1,
00103               pindex_point_1_in_child_1,
00104               pweight_point_0_or_1};
00105  
00106 static int        pindex_point_2[2] = {0  ,1  };
00107 static double    pweight_point_2[2] = {0.5,0.5};
00108 static VINHERIT vinherit_point_2    = {2,pindex_point_2,pweight_point_2};
00109   
00110 
00111 /*****************************************************************************
00112 ******************************************************************************
00113 **                      **
00114 **  Die HEL_DESCR Routinen "neighbour, boundary, check_inside,        **
00115 **              world2coord, coord2world"       **
00116 **                      **
00117 ******************************************************************************
00118 *****************************************************************************/
00119 
00120 inline static HELEMENT2D * triangle_neighbour(HELEMENT2D *el, int np, int flag,
00121 
00122   double * coord, double * xyz, MESH_ELEMENT_FLAGS p) {
00123   printf(" neighbour nicht implementiert \n");
00124   return el ;
00125 }
00126 
00127 inline int triangle_boundary(HELEMENT2D * el, int np) {
00128   return ((DUNE_ELEM *)el->user_data)->bnd[np] ;
00129 }
00130 
00131 /***********************************************************************
00132  *
00133  * the functions check_inside, world2coord and coord2world 
00134  * work for all types of elements 
00135  *
00136  ***********************************************************************/ 
00137 
00138 /* the 2d versions */
00139 inline int el_check_inside(HELEMENT2D * e, const double * coord) 
00140 {
00141   DUNE_DAT * dat = (DUNE_DAT *) ((HMESH2D *) e->mesh)->user_data;
00142   return dat->check_inside((DUNE_ELEM *) e->user_data, coord);
00143 }
00144 
00145 inline int world2coord(HELEMENT2D * e, const double * xyz,double * coord) 
00146 {
00147   DUNE_DAT * dat = (DUNE_DAT *) ((HMESH2D *) e->mesh)->user_data;
00148   return dat->wtoc((DUNE_ELEM *) e->user_data, xyz, coord);
00149 }
00150 
00151 inline void coord2world(HELEMENT2D * e, const double * coord,double * xyz) 
00152 {
00153   DUNE_DAT * dat = (DUNE_DAT *) ((HMESH2D *) e->mesh)->user_data;
00154   dat->ctow((DUNE_ELEM *) e->user_data, coord, xyz);
00155 }
00156 
00157 /* the 3d versions */
00158 inline int el_check_inside_3d(HELEMENT3D * e, double * coord) 
00159 {
00160   DUNE_DAT * dat = (DUNE_DAT *) ((HMESH3D *) e->mesh)->user_data;
00161   return dat->check_inside((DUNE_ELEM *) e->user_data, coord);
00162 }
00163 
00164 inline static int world2coord_3d(HELEMENT3D * e, const double * xyz, 
00165                                    double * coord) 
00166 {
00167   DUNE_DAT * dat = (DUNE_DAT *) ((HMESH3D *) e->mesh)->user_data;
00168   return dat->wtoc((DUNE_ELEM *) e->user_data, xyz, coord);
00169 }
00170 
00171 inline static void coord2world_3d(HELEMENT3D * e, const double * coord, 
00172                                      double * xyz) 
00173 {
00174   DUNE_DAT * dat = (DUNE_DAT *) ((HMESH3D *) e->mesh)->user_data;
00175   dat->ctow((DUNE_ELEM *) e->user_data, coord, xyz);
00176 }
00177 
00178 /*****************************************************************************
00179 * HELEMENT2D_DESCRIPTION for Quadrilaterals            *
00180 *****************************************************************************/
00181 
00182 /****************************************************************************/
00183 /*  Eckpunkte :             
00184  *
00185  *
00186  *   (0,1)  3---------2  (1,1)
00187  *          |         |                
00188  *          |         |              
00189  *          |         |                
00190  *          |         | 
00191  *          |         |
00192  *   (0,0)  0---------1  (1,0)                
00193  *
00194  *  this is the dune local coordinate system
00195  ***************************************************************************/
00196 
00197 
00198 static HELEMENT2D_DESCRIPTION quadrilateral_description;
00199 
00200 static double quadrilateral_local_coordinate_vector_0[3] = {0.,0.,0.};
00201 static double quadrilateral_local_coordinate_vector_1[3] = {1.,0.,0.};
00202 static double quadrilateral_local_coordinate_vector_2[3] = {1.,1.,0.};
00203 static double quadrilateral_local_coordinate_vector_3[3] = {0.,1.,0.};
00204 
00205 static G_CONST double *quadrilateral_local_coordinate_system[4] = {quadrilateral_local_coordinate_vector_0,
00206     quadrilateral_local_coordinate_vector_1,quadrilateral_local_coordinate_vector_2,
00207     quadrilateral_local_coordinate_vector_3};
00208 
00209 
00210 
00211 /*****************************************************************************
00212  *  HELEMENT3D_DESCRIPTION for Tetrahedra              *
00213 *****************************************************************************/
00214 
00215 static HELEMENT3D_DESCRIPTION tetra_description;
00216 
00217 /* vertex indices of the polygons (faces) for a tetrahedron           */
00218 static int t_v0_e[3] = {1,3,2},   t_v1_e[3] = {0,2,3};
00219 static int t_v2_e[3] = {0,3,1},   t_v3_e[3] = {0,1,2};
00220 
00221 /* polygon adjacencies  for a tetrahedron                     */
00222 static int t_p0_e[3] = {2,1,3},   t_p1_e[3] = {3,0,2};
00223 static int t_p2_e[3] = {1,0,3},   t_p3_e[3] = {2,0,1};
00224 
00225 /* local coordinates of the vertices for a tetrahedron  in barycentric
00226  * coords */
00227 //static double t_c0[4] = {1.,0.,0.,0.}, t_c1[4] = {0.,1.,0.,0.};
00228 //static double t_c2[4] = {0.,0.,1.,0.}, t_c3[4] = {0.,0.,0.,1.};
00229 /* local coordinates of the vertices for a tetrahedron        */
00230 static double t_c0[3] = {0.,0.,0.}, t_c1[3] = {1.,0.,0.};
00231 static double t_c2[3] = {0.,1.,0.}, t_c3[3] = {0.,0.,1.};
00232 
00233 static int    tetra_polygon_length[4]          = {3, 3, 3, 3};
00234 static G_CONST int    *tetra_vertex_e[4]       = {t_v0_e,t_v1_e,t_v2_e,t_v3_e};
00235 static G_CONST int    *tetra_next_polygon_e[4] = {t_p0_e,t_p1_e,t_p2_e,t_p3_e};
00236 static G_CONST double *tetra_local_coordinate_system[4] =  {t_c0,t_c1,t_c2,t_c3};
00237 
00238 /*****************************************************************************
00239 ******************************************************************************
00240 **                      **
00241 **  Die HEL_DESCR Routinen "neighbour, boundary, check_inside,        **
00242 **              world2coord, coord2world"       **
00243 **                      **
00244 ******************************************************************************
00245 *****************************************************************************/
00246 
00247 inline static HELEMENT3D * dummy_neighbour(HELEMENT3D *el, int np, int flag,
00248 
00249   double * coord, double * xyz, MESH_ELEMENT_FLAGS p) {
00250 
00251   printf(" neighbour nicht implementiert \n");
00252   return el ;
00253  
00254 }
00255 
00256 inline static int wrap_boundary(HELEMENT3D * el, int np) 
00257 {
00258   return ((DUNE_ELEM *)el->user_data)->bnd[np] ;
00259 }
00260 
00261 /*****************************************************************************
00262  *  HELEMENT3D_DESCRIPTION for Hexahedra               *
00263 *****************************************************************************/
00264 /****************************************************************************/
00265 /*  Eckpunkte und Seitenflaechen in GRAPE:             
00266  *              7---------6                            
00267  *             /.        /|                            
00268  *            / .  1    / |               
00269  *           /  .      /  |               
00270  *          4---------5   | <-- 4 (hinten)            
00271  *    5 --> |   .     | 3 |               
00272  *          |   3.....|...2               
00273  *          |  .      |  /                
00274  *          | .   2   | / <-- 0 (unten)             
00275  *          |.        |/                  
00276  *          0---------1                 
00277  *
00278  *  this is the GRAPE local coordinate system
00279  *  
00280  ***************************************************************************
00281  *
00282  *  Eckpunkte und Seitenflaechen in DUNE:             
00283  *
00284  *              6---------7                            
00285  *             /.        /|                            
00286  *            / .  5    / |               
00287  *           /  .      /  |               
00288  *          4---------5   | <-- 3 (hinten)            
00289  *    0 --> |   .     | 1 |               
00290  *          |   2.....|...3               
00291  *          |  .      |  /                
00292  *          | .   2   | / <-- 4 (unten)             
00293  *          |.        |/                  
00294  *          0---------1                 
00295  *
00296  *  this is the DUNE local coordinate system
00297  ***************************************************************************/
00298 static HELEMENT3D_DESCRIPTION cube_description; 
00299 
00300 
00301 static VEC3 cc1={0.,0.,0.},cc2={1.,0.,0.},cc3={1.,1.,0.},cc4={0.,1.,0.},
00302             cc5={0.,0.,1.},cc6={1.,0.,1.},cc7={1.,1.,1.},cc8={0.,1.,1.};
00303 static G_CONST double *cube_local_coordinate_system[8] = {cc1,cc2,cc3,cc4,cc5,cc6,cc7,cc8};
00304 // how many polygons on which face 
00305 static int cube_polygon_length[6] = {4,4,4,4,4,4};
00306 // vertices of the faces 
00307 static int cv1[4]={0,3,2,1},cv2[4]={4,5,6,7},cv3[4]={0,1,5,4},
00308            cv4[4]={1,2,6,5},cv5[4]={2,3,7,6},cv6[4]={0,4,7,3};
00309 static G_CONST int *cube_polygon_vertex[6] = {cv1,cv2,cv3,cv4,cv5,cv6};
00310 static int cn1[4]={5,4,3,2},cn2[4]={2,3,4,5},cn3[4]={0,3,1,5},
00311            cn4[4]={0,4,1,2},cn5[4]={0,5,1,3},cn6[4]={2,1,4,0};
00312 static G_CONST int *cube_polygon_neighbour[6] = {cn1,cn2,cn3,cn4,cn5,cn6};
00313 
00314 
00315 /*****************************************************************************/
00316 /*****************************************************************************/
00317 /*****************************************************************************/
00318 /*****************************************************************************/
00319 /*****************************************************************************/
00320 /*****************************************************************************
00321  *  HELEMENT3D_DESCRIPTION for Pyramids             *
00322 *****************************************************************************/
00323 static HELEMENT3D_DESCRIPTION pyra_description; 
00324 
00325 static VEC3 pyc1={0.,0.,0.},pyc2={1.,0.,0.},pyc3={1.,1.,0.},
00326             pyc4={0.,1.,0.},pyc5={0.,0.,1.};
00327 static G_CONST double *pyra_local_coordinate_system[5] = {pyc1,pyc2,pyc3,pyc4,pyc5};
00328 
00329 static int pyra_polygon_length[5] = {4,3,3,3,3};
00330 static int pyv1[4]={0,1,2,3},pyv2[3]={0,4,1},pyv3[3]={1,4,2},
00331            pyv4[3]={2,4,3}  ,pyv5[3]={0,3,4};
00332 static G_CONST int *pyra_polygon_vertex[5] = {pyv1,pyv2,pyv3,pyv4,pyv5};
00333 
00334 static int pyn1[4]={5,4,3,2},pyn2[3]={0,2,4},pyn3[3]={0,3,1},
00335            pyn4[3]={0,4,2}  ,pyn5[3]={0,1,3};
00336 static G_CONST int *pyra_polygon_neighbour[5] = {pyn1,pyn2,pyn3,pyn4,pyn5};
00337 
00338 /*****************************************************************************/
00339 /*****************************************************************************/
00340 /*****************************************************************************/
00341 /*****************************************************************************/
00342 /*****************************************************************************/
00343 /*****************************************************************************/
00344 /*****************************************************************************
00345  *  HELEMENT3D_DESCRIPTION for Prism             *
00346 *****************************************************************************/
00347 static HELEMENT3D_DESCRIPTION prism_description; 
00348 
00349 static VEC3 prc1={0.,0.,0.},prc2={1.,0.,0.},prc3={0.,1.,0.},
00350             prc4={0.,0.,1.},prc5={1.,0.,1.},prc6={0.,1.,1.};
00351 static G_CONST double *prism_local_coordinate_system[6] = {prc1,prc2,prc3,prc4,prc5,prc6};
00352 
00353 // how many polygons on which face 
00354 static int prism_polygon_length[5] = {3,4,4,4,3};
00355 
00356 // vertices of the faces 
00357 static int prv1[3]={0,1,2},  prv2[4]={0,1,4,3},prv3[4]={1,2,5,4},
00358            prv4[4]={2,0,3,5},prv5[3]={3,4,5};
00359 
00360 static G_CONST int *prism_polygon_vertex[5] = {prv1,prv2,prv3,prv4,prv5};
00361 
00362 static int prn1[4]={5,4,3,2},prn2[4]={2,3,4,5},prn3[4]={0,3,1,5},
00363            prn4[4]={0,4,1,2},prn5[4]={0,5,1,3},prn6[4]={2,1,4,0};
00364 static G_CONST int *prism_polygon_neighbour[6] = {prn1,prn2,prn3,prn4,prn5,prn6};
00365 
00366 /*  Standard description                */
00367 /****************************************************************************/
00368 
00369 /*static int  cube_world2coord();
00370 static void cube_coord2world();
00371 static int cube_check_inside();
00372 static HELEMENT3D *cube_neighbour();
00373 static int cube_boundary();
00374 */
00375 
00376 #if 0
00377 static void  cube_coord2world(HELEMENT3D *cube,
00378                                  const double *coord, double *xyz)
00379 { 
00380 #if 0
00381   int j;
00382   const double **v = cube->vertex;
00383 
00384   for(j=0;j<3;j++)
00385   xyz[j]=(1.0-coord[2])*((1.0-coord[1])*((1.0-coord[0])*v[0][j]+coord[0]*v[1][j])
00386                          + coord[1]    *((1.0-coord[0])*v[3][j]+coord[0]*v[2][j]))
00387           + coord[2]   *((1.0-coord[1])*((1.0-coord[0])*v[4][j]+coord[0]*v[5][j])
00388                          + coord[1]    *((1.0-coord[0])*v[7][j]+coord[0]*v[6][j]));
00389 
00390   return;
00391 #endif
00392 }
00393 
00394 static int cube_boundary(HELEMENT3D *el,int pn);
00395 #if 0
00396 { int i;
00397   STACKENTRY *stel;
00398   stel = (STACKENTRY *)el;
00399   switch(pn){
00400     case 0 : return(stel->l[2] == inp->l[2]);
00401     case 1 : return(stel->r[2] == inp->r[2]);
00402     case 2 : return(stel->l[1] == inp->l[1]); 
00403     case 3 : return(stel->r[0] == inp->r[0]);
00404     case 4 : return(stel->r[1] == inp->r[1]);
00405     case 5 : return(stel->l[0] == inp->l[0]);
00406     default : fprintf(stderr,"%s l. %s: unknown case in 'cube_boundary'\n",
00407     __FILE__, __LINE__); return(-1);
00408   }
00409 } 
00410 #endif
00411 static int cube_check_inside(HELEMENT3D *el,double *coord)
00412 { int j;
00413 static int pp[] = {5,2,0};
00414 static int pm[] = {3,4,1};
00415    
00416   for(j=0;j<3;j++) {
00417     if(coord[j]<0.) return(pm[j]);
00418     if(coord[j]>1.) return(pp[j]);
00419   }
00420   return(INSIDE);
00421    
00422    
00423 }  
00424 
00425 
00426 static int  cube_world2coord(HELEMENT3D *cube,
00427                                  const double *xyz, double *coord)
00428 
00429 { 
00430 #if 0
00431   /* MATRIX33 a; VEC3 b; */
00432   VEC3 p, q;
00433   double **v;
00434   int j,k,count,merke[3];
00435    
00436   /********************************************/
00437   /* ONLY if the elements are parallelepipeds */
00438   /********************************************/
00439    
00440   v = cube->vertex;
00441    
00442 /* 
00443   for(i=0;i<3;i++) {
00444     b[i] = xyz[i]-v[0][i];
00445     for(j=0;j<3;j++) a[i][j] = v[help[i]][j]-v[0][j];  
00446   }
00447   g_solve3(a,b,coord);
00448 */
00449 
00450   /****************************************************************/
00451   /* ONLY if solely the normal in one coord. dir. is not constant */
00452   /****************************************************************/
00453 
00454   for(k=0,count = 0;k<3;k++) {
00455     if(test_normal(cube,xyz,k,coord)) merke[count++] = k;
00456     if(count == 2) {
00457       merke[2] = (merke[0]==0) ? ((merke[1]==1) ? 2 : 1) : 0;
00458       for(j=0;j<3;j++) {
00459         p[j] = v[0][j]+
00460                coord[merke[0]]*(v[help[merke[0]]][j]-v[0][j]) +
00461                coord[merke[1]]*(v[help[merke[1]]][j]-v[0][j]);
00462         q[j] = v[help[merke[2]]][j] +
00463                coord[merke[0]]*(v[help2[merke[2]][0]][j]-v[help[merke[2]]][j]) +
00464                coord[merke[1]]*(v[help2[merke[2]][1]][j]-v[help[merke[2]]][j])
00465                -p[j];
00466         p[j] = xyz[j]-p[j];
00467       }
00468       coord[merke[2]] = g_vec3_skp(p,q)/g_vec3_skp(q,q);
00469       break;
00470     }
00471   }
00472   ASSURE((count==2),"world to coord failed",return(INSIDE));
00473 
00474   return(cube_check_inside(cube,coord));
00475 #endif
00476   return 1;
00477 }
00478 #endif
00479 
00480 /* fill the upper reference elements */
00481 inline void setupReferenceElements()
00482 {
00483   static bool initialized = false;
00484  
00485   if(!initialized)
00486   {
00487     /* fill the helement description in 2D*/
00488 
00489     triangle_description.dindex             = 0; // index of description
00490     triangle_description.number_of_vertices = 3;
00491     /* dimension of local coords */
00492     triangle_description.dimension_of_coord = GRAPE_DIM;
00493     triangle_description.coord              = triangle_local_coordinate_system;
00494     triangle_description.parametric_degree  = 1;
00495     triangle_description.world_to_coord     = world2coord;
00496     triangle_description.coord_to_world     = coord2world;
00497     triangle_description.check_inside       = el_check_inside;
00498     triangle_description.neighbour          = triangle_neighbour;
00499     triangle_description.boundary           = triangle_boundary;
00500 
00501 
00502     quadrilateral_description.dindex             = 1; // index of description
00503     quadrilateral_description.number_of_vertices = 4;
00504     quadrilateral_description.dimension_of_coord = GRAPE_DIM;
00505     quadrilateral_description.coord              = quadrilateral_local_coordinate_system;
00506     quadrilateral_description.parametric_degree  = 1;
00507     quadrilateral_description.world_to_coord     = world2coord;
00508     quadrilateral_description.coord_to_world     = coord2world;
00509     quadrilateral_description.check_inside       = el_check_inside;
00510     quadrilateral_description.neighbour          = triangle_neighbour;
00511     quadrilateral_description.boundary           = triangle_boundary;
00512 
00513     /* fill the helement description in 3D*/
00514 
00515     tetra_description.dindex             = 2; // index of description
00516     tetra_description.number_of_vertices = 4;
00517     tetra_description.number_of_polygons = 4; // i.e. number of faces 
00518     tetra_description.polygon_length = tetra_polygon_length;
00519     tetra_description.polygon_vertex  = tetra_vertex_e;
00520     tetra_description.polygon_neighbour  = tetra_next_polygon_e;
00521     tetra_description.dimension_of_coord = 3; // GRAPE_DIM
00522     tetra_description.coord              = tetra_local_coordinate_system;
00523     tetra_description.parametric_degree  = 1;
00524     tetra_description.world_to_coord     = world2coord_3d;
00525     tetra_description.coord_to_world     = coord2world_3d;
00526     tetra_description.check_inside       = el_check_inside_3d;
00527     tetra_description.neighbour          = dummy_neighbour;
00528     tetra_description.boundary           = wrap_boundary;
00529     tetra_description.get_boundary_vertex_estimate = NULL;
00530     tetra_description.get_boundary_face_estimate   = NULL;
00531     tetra_description.coord_of_parent              = NULL;
00532 
00533     /* pyramid */
00534     pyra_description.dindex             = 3; // index of description , see element type 
00535     pyra_description.number_of_vertices = 5;
00536     pyra_description.number_of_polygons = 5; // i.e. number of faces 
00537     pyra_description.polygon_length     = pyra_polygon_length;   
00538     pyra_description.polygon_vertex     = pyra_polygon_vertex;
00539     pyra_description.polygon_neighbour  = pyra_polygon_neighbour;
00540     pyra_description.dimension_of_coord = 3; // GRAPE_DIM 
00541     pyra_description.coord              = pyra_local_coordinate_system;
00542     pyra_description.parametric_degree  = 1;
00543     pyra_description.world_to_coord     = world2coord_3d;
00544     pyra_description.coord_to_world     = coord2world_3d;
00545     pyra_description.check_inside       = el_check_inside_3d;
00546     pyra_description.neighbour          = dummy_neighbour;
00547     pyra_description.boundary           = wrap_boundary;
00548     pyra_description.get_boundary_vertex_estimate = NULL;
00549     pyra_description.get_boundary_face_estimate   = NULL;
00550     pyra_description.coord_of_parent              = NULL;
00551 
00552     
00553     /* prism */
00554     prism_description.dindex             = 4; // index of description 
00555     prism_description.number_of_vertices = 6; 
00556     prism_description.number_of_polygons = 5; // i.e. number of faces 
00557     prism_description.polygon_length     = prism_polygon_length;   
00558     prism_description.polygon_vertex     = prism_polygon_vertex;
00559     prism_description.polygon_neighbour  = prism_polygon_neighbour;
00560     prism_description.dimension_of_coord = 3; // GRAPE_DIM 
00561     prism_description.coord              = prism_local_coordinate_system;
00562     prism_description.parametric_degree  = 1;
00563     prism_description.world_to_coord     = world2coord_3d;
00564     prism_description.coord_to_world     = coord2world_3d;
00565     prism_description.check_inside       = el_check_inside_3d;
00566     prism_description.neighbour          = dummy_neighbour;
00567     prism_description.boundary           = wrap_boundary;
00568     prism_description.get_boundary_vertex_estimate = NULL;
00569     prism_description.get_boundary_face_estimate   = NULL;
00570     prism_description.coord_of_parent              = NULL;
00571 
00572     /* Hexahedrons */
00573     cube_description.dindex             = 5; // index of description 
00574     cube_description.number_of_vertices = 8;
00575     cube_description.number_of_polygons = 6; // i.e. number of faces 
00576     cube_description.polygon_length     = cube_polygon_length;   
00577     cube_description.polygon_vertex     = cube_polygon_vertex;
00578     cube_description.polygon_neighbour  = cube_polygon_neighbour;
00579     cube_description.dimension_of_coord = 3; // GRAPE_DIM 
00580     cube_description.coord              = cube_local_coordinate_system;
00581     cube_description.parametric_degree  = 1;
00582     cube_description.world_to_coord     = world2coord_3d;
00583     cube_description.coord_to_world     = coord2world_3d;
00584     cube_description.check_inside       = el_check_inside_3d;
00585     cube_description.neighbour          = dummy_neighbour;
00586     cube_description.boundary           = wrap_boundary;
00587     cube_description.get_boundary_vertex_estimate = NULL;
00588     cube_description.get_boundary_face_estimate = NULL;
00589     cube_description.coord_of_parent = NULL;
00590 
00591 
00592     /* inheritance rules */
00593     inheritance_rule_in_child_0[0] = vinherit_point_0_in_child_0;
00594     inheritance_rule_in_child_0[1] = vinherit_point_1_in_child_0;
00595     inheritance_rule_in_child_0[2] = vinherit_point_2;
00596 
00597     inheritance_rule_in_child_1[0] = vinherit_point_0_in_child_1;
00598     inheritance_rule_in_child_1[1] = vinherit_point_1_in_child_1;
00599     inheritance_rule_in_child_1[2] = vinherit_point_2;
00600 
00601     initialized = true;
00602   }
00603 }
00604 
00605 //vector holding the descriptions enumerated after it's index 
00606 static void *
00607 elementDescriptions[numberOfUsedGrapeElementTypes] = { 
00608   (void *) &triangle_description,
00609   (void *) &quadrilateral_description,
00610   (void *) &tetra_description,
00611   (void *) &pyra_description,
00612   (void *) &prism_description,
00613   (void *) &cube_description
00614 };
00615 
00616 // the mapping of the reference elements 
00617 static const int dune2GrapeDefaultMap[MAX_EL_DOF] = {0,1,2,3,4,5,6,7};
00618 static const int * dune2GrapeTriangle      = dune2GrapeDefaultMap;  
00619 static const int * dune2GrapeTetrahedron   = dune2GrapeDefaultMap;  
00620 static const int * dune2GrapePyramid       = dune2GrapeDefaultMap;  
00621 static const int * dune2GrapePrism         = dune2GrapeDefaultMap;  
00622 
00623 // for quads the vertices 2,3 are swaped 
00624 static const int dune2GrapeQuadrilateral[MAX_EL_DOF] = {0,1,3,2,4,5,6,7};   
00625 // for hexas the vertices 2,3 and 6,7 are swaped 
00626 static const int dune2GrapeHexahedron[MAX_EL_DOF] = {0,1,3,2,4,5,7,6}; 
00627 
00628 // mapping from dune to grape 
00629 static const int * 
00630 dune2GrapeVertex[numberOfUsedGrapeElementTypes] = {
00631   dune2GrapeTriangle ,
00632   dune2GrapeQuadrilateral ,
00633   dune2GrapeTetrahedron,
00634   dune2GrapePyramid ,
00635   dune2GrapePrism ,
00636   dune2GrapeHexahedron 
00637 };
00638 
00639 static H_ELEMENT_DESCRIPTION * getElementDescription( int type ) 
00640 {
00641   assert( type >= 0 );
00642   assert( type <  numberOfUsedGrapeElementTypes );
00643   return (H_ELEMENT_DESCRIPTION * )elementDescriptions[type];
00644 }
00645 #endif

Generated on Thu Apr 2 10:40:39 2009 for dune-grid by  doxygen 1.5.6