dune-grid
2.2.0
|
00001 #ifndef DUNE_GRIDDISPLAY_HH 00002 #define DUNE_GRIDDISPLAY_HH 00003 00004 #include <cstdlib> 00005 #include <iostream> 00006 #include <cassert> 00007 #include <cstdarg> 00008 #include <cstring> 00009 #include <iostream> 00010 #include <stack> 00011 #include <map> 00012 #include <set> 00013 #include <list> 00014 00015 #if HAVE_GRAPE 00016 #include "grapecommon.hh" 00017 00018 namespace GrapeInterface_two_two 00019 { 00020 #define GRAPE_DIM 2 00021 #define GRAPE_DIMWORLD 2 00022 #undef GRAPE_GRAPEHMESH_HH_INCLUDED 00023 #include "grapehmesh.hh" 00024 } 00025 00026 namespace GrapeInterface_two_three 00027 { 00028 #define GRAPE_DIM 2 00029 #define GRAPE_DIMWORLD 3 00030 #undef GRAPE_GRAPEHMESH_HH_INCLUDED 00031 #include "grapehmesh.hh" 00032 } 00033 00034 namespace GrapeInterface_three_three 00035 { 00036 #define GRAPE_DIM 3 00037 #define GRAPE_DIMWORLD 3 00038 #undef GRAPE_GRAPEHMESH_HH_INCLUDED 00039 #include "grapehmesh.hh" 00040 } 00041 00042 namespace Dune 00043 { 00044 00045 static int __MaxPartition = 1; 00046 00047 // the interface to dune 00048 template <int dim, int dimworld> 00049 struct GrapeInterface; 00050 00051 template<> 00052 struct GrapeInterface<2,2> 00053 { 00054 static int called; 00055 typedef GrapeInterface_two_two::DUNE_ELEM DUNE_ELEM; 00056 typedef GrapeInterface_two_two::DUNE_FDATA DUNE_FDATA; 00057 typedef GrapeInterface_two_two::DUNE_DAT DUNE_DAT; 00058 typedef GrapeInterface_two_two::F_DATA F_DATA; 00059 typedef GrapeInterface_three_three::HELEMENT HELEMENT; 00060 typedef GrapeInterface_three_three::STACKENTRY STACKENTRY; 00061 00062 inline static void init() 00063 { 00064 GrapeInterface_two_two::grape_add_remove_methods(); 00065 GrapeInterface_two_two::setupReferenceElements(); 00066 } 00067 00068 inline static void setThread(int t) 00069 { 00070 } 00071 00072 inline static void setDefaultIterator(int val) 00073 { 00074 setDefaultIteratorValue(val); 00075 } 00076 00077 inline static void handleMesh (void *hmesh, bool grdMode = false ) 00078 { 00079 GrapeInterface_two_two::handleMesh(hmesh,grdMode); 00080 } 00081 00082 inline static void addDataToHmesh(void *hmesh, DUNE_FDATA * data) 00083 { 00084 GrapeInterface_two_two::addDataToHmesh(hmesh,data); 00085 } 00086 00087 inline static void *setupHmesh(const int noe, 00088 const int nov, const int maxlev,DUNE_DAT * dune, 00089 const char *meshName = "Dune Mesh" ) 00090 { 00091 return GrapeInterface_two_two::setupHmesh( 00092 noe,nov,maxlev,dune,meshName); 00093 } 00094 00095 inline static void deleteHmesh( void * hmesh ) 00096 { 00097 GrapeInterface_two_two::deleteHmesh( hmesh ); 00098 } 00099 00100 inline static void deleteFunctions( void * hmesh ) 00101 { 00102 GrapeInterface_two_two::deleteFunctions( hmesh ); 00103 } 00104 00105 inline static void addHmeshToTimeScene(void * timescene, double time, void *hmesh , int proc) 00106 { 00107 GrapeInterface_two_two::addHmeshToTimeScene(timescene,time,hmesh,proc); 00108 } 00109 00110 inline static void addHmeshToGlobalTimeScene(double time, void *hmesh , int proc) 00111 { 00112 GrapeInterface_two_two::addHmeshToGlobalTimeScene(time,hmesh,proc); 00113 } 00114 00115 inline static void colorBarMinMax(const double min, const double max) 00116 { 00117 GrapeInterface_two_two::colorBarMinMax(min,max); 00118 } 00119 }; 00120 00121 template <> 00122 struct GrapeInterface<2,3> 00123 { 00124 static int called; 00125 typedef GrapeInterface_two_three::DUNE_ELEM DUNE_ELEM; 00126 typedef GrapeInterface_two_three::DUNE_FDATA DUNE_FDATA; 00127 typedef GrapeInterface_two_three::DUNE_DAT DUNE_DAT; 00128 typedef GrapeInterface_two_three::F_DATA F_DATA; 00129 typedef GrapeInterface_two_three::HELEMENT HELEMENT; 00130 typedef GrapeInterface_two_three::STACKENTRY STACKENTRY; 00131 00132 inline static void init() 00133 { 00134 GrapeInterface_two_three::grape_add_remove_methods(); 00135 GrapeInterface_two_three::setupReferenceElements(); 00136 } 00137 00138 inline static void setThread(int t) 00139 { 00140 } 00141 00142 inline static void setDefaultIterator(int val) 00143 { 00144 setDefaultIteratorValue(val); 00145 } 00146 00147 inline static void handleMesh (void *hmesh, bool grdMode = false ) 00148 { 00149 GrapeInterface_two_three::handleMesh(hmesh,grdMode); 00150 } 00151 00152 inline static void addDataToHmesh(void *hmesh, DUNE_FDATA * data) 00153 { 00154 GrapeInterface_two_three::addDataToHmesh(hmesh,data); 00155 } 00156 00157 inline static void *setupHmesh(const int noe, 00158 const int nov, const int maxlev,DUNE_DAT * dune, 00159 const char *meshName = "Dune Mesh" ) 00160 { 00161 return GrapeInterface_two_three::setupHmesh( 00162 noe,nov,maxlev,dune, meshName); 00163 } 00164 00165 inline static void deleteHmesh( void * hmesh ) 00166 { 00167 GrapeInterface_two_three::deleteHmesh( hmesh ); 00168 } 00169 00170 inline static void deleteFunctions( void * hmesh ) 00171 { 00172 GrapeInterface_two_three::deleteFunctions( hmesh ); 00173 } 00174 00175 inline static void addHmeshToTimeScene(void * timescene, double time, void *hmesh , int proc) 00176 { 00177 GrapeInterface_two_three::addHmeshToTimeScene(timescene,time,hmesh,proc); 00178 } 00179 00180 inline static void addHmeshToGlobalTimeScene(double time, void *hmesh , int proc) 00181 { 00182 GrapeInterface_two_three::addHmeshToGlobalTimeScene(time,hmesh,proc); 00183 } 00184 00185 inline static void colorBarMinMax(const double min, const double max) 00186 { 00187 GrapeInterface_two_three::colorBarMinMax(min,max); 00188 } 00189 }; 00190 00191 // the interface to dune for dim = dimworld = 3 00192 template <> 00193 struct GrapeInterface<3,3> 00194 { 00195 typedef GrapeInterface_three_three::DUNE_ELEM DUNE_ELEM; 00196 typedef GrapeInterface_three_three::DUNE_FDATA DUNE_FDATA; 00197 typedef GrapeInterface_three_three::DUNE_DAT DUNE_DAT; 00198 typedef GrapeInterface_three_three::F_DATA F_DATA; 00199 typedef GrapeInterface_three_three::HELEMENT HELEMENT; 00200 typedef GrapeInterface_three_three::STACKENTRY STACKENTRY; 00201 00202 inline static void init() 00203 { 00204 GrapeInterface_three_three::initPartitionDisp(__MaxPartition); 00205 GrapeInterface_three_three::grape_add_remove_methods(); 00206 GrapeInterface_three_three::setupReferenceElements(); 00207 } 00208 00209 inline static void setThread(int t) 00210 { 00211 GrapeInterface_three_three::setThread(t); 00212 } 00213 00214 inline static void setDefaultIterator(int val) 00215 { 00216 setDefaultIteratorValue(val); 00217 } 00218 00219 inline static void handleMesh (void *hmesh, bool grdMode = false ) 00220 { 00221 GrapeInterface_three_three::handleMesh(hmesh,grdMode); 00222 } 00223 00224 inline static void addDataToHmesh(void *hmesh, DUNE_FDATA * data) 00225 { 00226 GrapeInterface_three_three::addDataToHmesh(hmesh,data); 00227 } 00228 00229 inline static void *setupHmesh(const int noe, 00230 const int nov, const int maxlev, DUNE_DAT * dune, 00231 const char *meshName = "Dune Mesh" ) 00232 { 00233 return GrapeInterface_three_three:: 00234 setupHmesh(noe,nov,maxlev,dune, meshName); 00235 } 00236 00237 inline static void deleteFunctions( void * hmesh ) 00238 { 00239 GrapeInterface_three_three::deleteFunctions( hmesh ); 00240 } 00241 00242 inline static void deleteHmesh( void * hmesh ) 00243 { 00244 GrapeInterface_three_three::deleteHmesh( hmesh ); 00245 } 00246 00247 inline static void addHmeshToTimeScene(void * timescene, double time, void *hmesh , int proc) 00248 { 00249 GrapeInterface_three_three::addHmeshToTimeScene(timescene,time,hmesh,proc); 00250 } 00251 inline static void addHmeshToGlobalTimeScene(double time, void *hmesh , int proc) 00252 { 00253 GrapeInterface_three_three::addHmeshToGlobalTimeScene(time,hmesh,proc); 00254 } 00255 00256 inline static void colorBarMinMax(const double min, const double max) 00257 { 00258 GrapeInterface_three_three::colorBarMinMax(min,max); 00259 } 00260 }; 00261 00262 } // end namespace Dune 00263 00264 #include "grapecommon.cc" 00265 00266 #endif // #if HAVE_GRAPE 00267 00268 #endif // #ifndef DUNE_GRIDDISPLAY_HH