dune-grid
2.2.0
|
00001 #ifndef __GRAPE_HMESH_H__ 00002 #define __GRAPE_HMESH_H__ 00003 00004 //- system includes 00005 #include <cstdlib> 00006 #include <cassert> 00007 #include <cstring> 00008 #include <iostream> 00009 #include <stack> 00010 #include <set> 00011 #include <list> 00012 00013 //- Grape includes 00014 #include "grapecommon.hh" 00015 00016 #if HAVE_GRAPE 00017 00018 enum { MAX_NAME_LENGTH = 32 }; 00019 00020 typedef struct dune_elem DUNE_ELEM; 00021 typedef struct dune_fdata DUNE_FDATA; 00022 typedef struct dune_dat DUNE_DAT; 00023 00024 typedef void evalDof_t (DUNE_ELEM *, DUNE_FDATA *, int , double *); 00025 typedef void evalCoord_t(DUNE_ELEM *, DUNE_FDATA *, const double *, double * ); 00026 00027 /* interface element */ 00028 struct dune_elem 00029 { 00030 00031 // default constructor 00032 dune_elem() 00033 : type(127) 00034 , eindex(-1) 00035 , level(-1) 00036 , level_of_interest(-1) 00037 , has_children(0) 00038 , liter(0) 00039 , enditer(0) 00040 , hiter(0) 00041 , actElement(0) 00042 , gridPart(0) 00043 , display(0) 00044 , mesh(0) 00045 { 00046 // default set all coordinates to zero 00047 for(int i=0; i<MAX_EL_DOF; ++i) 00048 { 00049 vindex [i] = -1; 00050 vpointer[i] = (double *) coordinates[i]; 00051 for(int j=0; j<3; ++j) 00052 { 00053 vpointer[i][j] = 0.0; 00054 } 00055 } 00056 for(int i=0; i<MAX_EL_FACE; ++i) 00057 { 00058 bnd [i] = -1; 00059 } 00060 } 00061 00062 /* 00063 * see g_eldesc.h for ElementType 00064 */ 00065 int type; 00066 00067 double * vpointer [MAX_EL_DOF]; 00068 double coordinates [MAX_EL_DOF][3]; 00069 int vindex [MAX_EL_DOF] ; 00070 int bnd [MAX_EL_FACE] ; 00071 int eindex; 00072 int level; 00073 int level_of_interest; 00074 int has_children; 00075 00076 /* is the pointer to LevelIterator or to LeafIterator */ 00077 void * liter; 00078 void * enditer; 00079 00080 // pointer fo hierarchic iterator */ 00081 void * hiter; 00082 00083 /* points to actual iterator to compare an get type */ 00084 /* down cast to EntityPointer */ 00085 void * actElement; 00086 00087 /* actual choosen gridPart */ 00088 void * gridPart; 00089 00090 // pointer to my display class 00091 void * display; 00092 00093 // pointer to mesh 00094 void * mesh; 00095 }; 00096 00097 struct dune_fdata 00098 { 00099 static std::set<DUNE_FDATA*>& dataList () 00100 { 00101 static std::set<DUNE_FDATA*> dList; 00102 return dList; 00103 } 00104 00105 // default constructor 00106 dune_fdata() 00107 : mynum (-1) 00108 , name() 00109 , evalCoord(0) 00110 , evalDof(0) 00111 , discFunc(0) 00112 , indexSet(0) 00113 , allLevels(0) 00114 , dimVal(0) 00115 , dimRange(0) 00116 , comp(0) 00117 , polyOrd(0) 00118 , continuous(0) 00119 , compName(0) 00120 , gridPart(0) 00121 , setGridPartIterators(0) 00122 , f_data (0) 00123 , minValue(0.0) 00124 , maxValue(1.0) 00125 , valuesSet(false) 00126 , valCache(0.0) 00127 , getMinMaxValues(0) 00128 { 00129 // add this data to list of dune data funcs 00130 dataList().insert(this); 00131 } 00132 00133 // default destructor 00134 ~dune_fdata() 00135 { 00136 dataList().erase(this); 00137 } 00138 00139 /* my number in the data vector */ 00140 int mynum; 00141 00142 /* name of data */ 00143 std::string name; 00144 00145 // functions to evaluate 00146 evalCoord_t * evalCoord; 00147 evalDof_t * evalDof; 00148 00149 /* pointer to object of discrete function or vector */ 00150 const void *discFunc; 00151 00152 /* pointer to index set of underlying datas */ 00153 const void *indexSet; 00154 00155 /* are all Levels occupied? */ 00156 int allLevels; 00157 00158 /* dimension of value, i.e. the length of the vector */ 00159 int dimVal; 00160 00161 /* dimension of data, when vectorial data is interpreted as scalar data */ 00162 int dimRange; 00163 00164 /* index of current component */ 00165 /* for scalar this vec has length 1 and contains the component number */ 00166 /* for vector this contains the number of each component */ 00167 int * comp; 00168 00169 /* polynonial order of basis functions */ 00170 int polyOrd; 00171 00172 /* continuous or not */ 00173 int continuous; 00174 00175 /* max number of components */ 00176 int compName; 00177 00178 /* the corresponding gridPart */ 00179 void * gridPart; 00180 00181 /* function pointer to choose grid part iterators */ 00182 void (*setGridPartIterators)(DUNE_DAT * , void * gridPart); 00183 00184 /* pointer to f_data */ 00185 void * f_data; 00186 00187 /* minValue of function, for colorbar */ 00188 double minValue; 00189 /* maxValue of function, for colorbar */ 00190 double maxValue; 00191 00192 /* true if min and max values have been calculated */ 00193 bool valuesSet; 00194 00195 /* cache for polOrd zero functions */ 00196 double valCache; 00197 00198 /* returns min and max values of function */ 00199 void (*getMinMaxValues)(DUNE_FDATA *, double * min, double * max ); 00200 }; 00201 00202 /* dune_dat */ 00203 struct dune_dat 00204 { 00205 // default constructor 00206 dune_dat() 00207 : first_macro(0) 00208 , next_macro(0) 00209 , delete_iter(0) 00210 , first_child(0) 00211 , next_child(0) 00212 , copy(0) 00213 , check_inside(0) 00214 , wtoc(0) 00215 , ctow(0) 00216 , setIterationModus(0) 00217 , partition(-1) 00218 , iteratorType(-1) // g_LeafIterator 00219 , partitionIteratorType(-1) 00220 , gridPart(0) 00221 , all (0) 00222 , get_stackentry(0) 00223 , free_stackentry(0) {} 00224 00225 /* the actual first and next macro for Iteration */ 00226 int (* first_macro)(DUNE_ELEM *) ; 00227 int (* next_macro)(DUNE_ELEM *) ; 00228 00229 /* method to delete iterators */ 00230 void (* delete_iter)(DUNE_ELEM *) ; 00231 00232 /* first and next child , if 0, then no child iteration */ 00233 int (* first_child)(DUNE_ELEM *) ; 00234 int (* next_child)(DUNE_ELEM *) ; 00235 00236 void * (* copy)(const void *) ; 00237 00238 int (* check_inside)(DUNE_ELEM *, const double * ) ; 00239 int (* wtoc)(DUNE_ELEM *, const double *, double * ) ; 00240 void (* ctow)(DUNE_ELEM *, const double *, double * ) ; 00241 00242 00243 /* selects the iterators, like leaf iterator .. */ 00244 void (* setIterationModus)(DUNE_DAT *, DUNE_FDATA *); 00245 00246 /* to which processor partition the element belongs */ 00247 int partition; 00248 00249 /* type of choosen iterator */ 00250 int iteratorType; 00251 00252 /* type of partition to iterate */ 00253 int partitionIteratorType; 00254 00255 /* actual gridPart */ 00256 void * gridPart; 00257 00258 DUNE_ELEM * all; 00259 00260 /* get HELEMENT */ 00261 void * (*get_stackentry)(DUNE_DAT * ); 00262 /* free HELEMENT */ 00263 void (*free_stackentry)(DUNE_DAT * , void *); 00264 }; 00265 00266 /* setup hmesh with given data */ 00267 extern void *setupHmesh(const int noe, const int nov, 00268 const int maxlev, DUNE_DAT * dune); 00269 00270 /* delete given hmesh pointer */ 00271 extern void deleteHmesh( void * hmesh ); 00272 extern void deleteFunctions( void * hmesh ); 00273 00274 //extern void displayTimeScene(INFO * info, int procs); 00275 extern void handleMesh (void *hmesh, bool gridMode ); 00276 00277 extern DUNE_FDATA * extractData (void *hmesh , int num ); 00278 00279 /* setup TimeScene Tree */ 00280 extern void timeSceneInit(INFO *info, const int n_info, const int procs); 00281 extern void addDataToHmesh(void *hmesh, DUNE_FDATA * data); 00282 00283 extern void addHmeshToTimeScene(void * timescene, double time, void *hmesh , int proc); 00284 00285 extern void addHmeshToGlobalTimeScene(double time, void *hmesh , int proc); 00286 extern void tsc_timebar(void *timescene, double t_start, double t_end); 00287 extern void colorBarMinMax(const double min, const double max); 00288 00289 #endif // #if HAVE_GRAPE 00290 00291 #endif // #ifndef __GRAPE_HMESH_H__