3#ifndef DUNE_GRAPE_DATA_DISPLAY_HH
4#define DUNE_GRAPE_DATA_DISPLAY_HH
25 template<
class ctype,
int dim,
int dimworld,
int polOrd >
26 class GrapeLagrangePoints;
33 template<
class GV,
int dimR,
int polOrd >
38 static const int dimDomain = GridView::Grid::dimension;
39 static const int dimRange = dimR;
41 typedef FieldVector< typename GridView::Grid::ctype, dimDomain > DomainVector;
42 typedef FieldVector< typename GridView::Grid::ctype, dimRange > RangeVector;
44 typedef typename GridView::template Codim< 0 >::Entity Entity;
46 virtual ~GrapeFunction ()
49 virtual void evaluate (
const Entity &entity,
const DomainVector &x, RangeVector &y )
const = 0;
51 virtual const GridView &gridView ()
const = 0;
53 virtual std::string name ()
const = 0;
62 template <
class EvalImpTraits>
63 struct EvalFunctionData
65 typedef typename EvalImpTraits :: GridType GridType;
66 typedef typename EvalImpTraits :: EvalImp EvalImp;
68 typedef typename GridType :: template Codim<0> :: Entity EntityType;
69 enum { dim = GridType::dimension };
70 enum { dimworld = GridType::dimensionworld };
72 typedef typename GridType :: ctype ctype;
74 typedef typename GrapeInterface<dim,dimworld>::DUNE_ELEM DUNE_ELEM;
75 typedef typename GrapeInterface<dim,dimworld>::DUNE_FDATA DUNE_FDATA;
78 inline static void evalCoordNow (
const EntityType &en, DUNE_FDATA *fdata,
const double *coord,
double * val)
80 EvalImp::evalCoordNow(en,fdata,coord,val);
84 inline static void evalDofNow (
const EntityType &en,
int geomType, DUNE_FDATA *fdata ,
int localNum,
double * val)
86 EvalImp::evalDofNow(en,geomType,fdata,localNum,val);
90 inline static void evalCoord (DUNE_ELEM *he, DUNE_FDATA *df,
91 const double *coord,
double * val);
94 inline static void evalDof (DUNE_ELEM *he, DUNE_FDATA *df,
int localNum,
double * val);
97 inline static void getMinMaxValues(DUNE_FDATA *df,
double* min,
double* max );
100 template <
class Gr
idImp,
class DiscreteFunctionType>
101 struct EvalDiscreteFunctions;
103 template <
class Gr
idImp,
class DiscreteFunctionType>
104 struct EvalDiscreteFunctionsTraits
106 typedef GridImp GridType;
107 typedef EvalDiscreteFunctions <GridImp, DiscreteFunctionType > EvalImp;
110 template <
class Gr
idImp,
class DiscreteFunctionType>
111 struct EvalDiscreteFunctions
112 :
public EvalFunctionData< EvalDiscreteFunctionsTraits <GridImp, DiscreteFunctionType > >
114 typedef GridImp GridType;
115 typedef typename GridType :: template Codim<0> :: Entity EntityType;
116 enum { dim = GridType::dimension };
117 enum { dimworld = GridType::dimensionworld };
119 typedef typename GridType :: ctype ctype;
121 typedef typename DiscreteFunctionType :: LocalFunctionType LocalFunctionType;
122 typedef typename DiscreteFunctionType :: DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
124 typedef typename DiscreteFunctionSpaceType :: RangeType RangeType;
125 typedef typename DiscreteFunctionSpaceType :: DomainType DomainType;
127 typedef typename GrapeInterface<dim,dimworld>::DUNE_ELEM DUNE_ELEM;
128 typedef typename GrapeInterface<dim,dimworld>::DUNE_FDATA DUNE_FDATA;
131 inline static void evalCoordNow (
const EntityType &en, DUNE_FDATA *fdata,
const double *coord,
double * val);
134 inline static void evalDofNow (
const EntityType &en,
int geomType, DUNE_FDATA *fdata ,
int localNum,
double * val);
137 inline static void evalScalar (
const EntityType &en,
int geomType,
138 DiscreteFunctionType & func, LocalFunctionType &lf,
139 const int * comp ,
int localNum,
double * val);
142 inline static void evalVector (
const EntityType &en,
int geomType,
143 DiscreteFunctionType & func, LocalFunctionType &lf,
144 const int * comp,
int vend,
int localNum,
double * val);
147 inline static void calcMinMax(DUNE_FDATA * df);
155 template<
class GV,
int dimR,
int polOrd >
156 struct EvalGrapeFunction;
158 template<
class GV,
int dimR,
int polOrd >
159 struct EvalGrapeFunctionTraits
161 typedef typename GV::Grid GridType;
162 typedef EvalGrapeFunction< GV, dimR, polOrd > EvalImp;
165 template<
class GV,
int dimR,
int polOrd >
166 struct EvalGrapeFunction
167 :
public EvalFunctionData< EvalGrapeFunctionTraits< GV, dimR, polOrd > >
171 typedef Dune::GrapeFunction< GV, dimR, polOrd > GrapeFunction;
173 static const int dimDomain = GrapeFunction::dimDomain;
174 static const int dimRange = GrapeFunction::dimRange;
175 static const int dimWorld = GridView::Grid::dimensionworld;
177 typedef typename GrapeFunction::DomainVector DomainVector;
178 typedef typename GrapeFunction::RangeVector RangeVector;
180 typedef typename GridView::template Codim< 0 >::Entity Entity;
182 typedef typename GrapeInterface< dimDomain, dimWorld >::DUNE_ELEM DUNE_ELEM;
183 typedef typename GrapeInterface< dimDomain, dimWorld >::DUNE_FDATA DUNE_FDATA;
186 static void evalCoordNow (
const Entity &entity, DUNE_FDATA *fdata,
const double *coord,
double *val );
189 static void evalDofNow (
const Entity &entity,
int geomType, DUNE_FDATA *fdata,
int localNum,
double *val );
192 static void calcMinMax ( DUNE_FDATA *fdata );
200 template <
class Gr
idImp,
class VectorType,
class IndexSetImp >
201 struct EvalVectorData;
203 template <
class Gr
idImp,
class VectorType ,
class IndexSetImp >
204 struct EvalVectorDataTraits
206 typedef GridImp GridType;
207 typedef EvalVectorData <GridImp, VectorType, IndexSetImp > EvalImp;
210 template <
class Gr
idImp,
class VectorType,
class IndexSetImp >
211 struct EvalVectorData
212 :
public EvalFunctionData< EvalVectorDataTraits <GridImp, VectorType, IndexSetImp > >
214 typedef GridImp GridType;
215 typedef typename GridType :: template Codim<0> :: Entity EntityType;
216 enum { dim = GridType::dimension };
217 enum { dimworld = GridType::dimensionworld };
219 typedef typename GridType :: ctype ctype;
221 typedef typename GrapeInterface<dim,dimworld>::DUNE_ELEM DUNE_ELEM;
222 typedef typename GrapeInterface<dim,dimworld>::DUNE_FDATA DUNE_FDATA;
225 inline static void evalCoordNow (
const EntityType &en, DUNE_FDATA *fdata,
const double *coord,
double * val);
228 inline static void evalDofNow (
const EntityType &en,
int geomType, DUNE_FDATA *fdata ,
int localNum,
double * val);
231 static void evalVectorLinear (
const EntityType &entity,
int geomType,
232 VectorType & func,
const IndexSetImp &indexSet,
233 const int *comp,
int vend,
int localNum,
double *val );
236 static void evalVectorConst (
const EntityType &entity,
int geomType,
237 VectorType & func,
const IndexSetImp &indexSet,
238 const int * comp,
int vend,
int localNum,
double * val);
241 inline static void calcMinMax(DUNE_FDATA * df);
248 template<
class Gr
idType>
255 enum { dim = GridType::dimension };
256 enum { dimworld = GridType::dimensionworld };
258 typedef typename GridType :: ctype ctype;
261 typedef typename GrapeInterface<dim,dimworld>::DUNE_ELEM DUNE_ELEM;
262 typedef typename GrapeInterface<dim,dimworld>::DUNE_FDATA DUNE_FDATA;
263 typedef typename GrapeInterface<dim,dimworld>::DUNE_DAT DUNE_DAT;
264 typedef typename GrapeInterface<dim,dimworld>::F_DATA F_DATA;
268 typedef GridType MyGridType;
274 template <
class Gr
idPartType>
275 inline GrapeDataDisplay(
const GridPartType & gridPart,
const int myrank = -1);
289 template<
class VectorType,
class IndexSetType >
291 const VectorType &data,
292 const IndexSetType &indexSet,
294 const unsigned int dimRange,
295 bool continuous =
false );
299 template <
class DiscFuncType>
300 inline void dataDisplay(
const DiscFuncType &func,
bool vector =
false);
306 template <
class DiscFuncType>
307 inline void addData(
const DiscFuncType &func,
double time = 0.0,
bool vector =
false );
310 template <
class DiscFuncType>
311 inline void addData(
const DiscFuncType &func, std::string name ,
double time ,
bool vector =
false );
313 template<
class GV,
int dimR,
int polOrd >
314 void addData (
const GrapeFunction< GV, dimR, polOrd > &function );
318 template <
class DiscFuncType>
319 inline void addData(
const DiscFuncType &func,
const DATAINFO * ,
double time );
322 bool hasData () {
return (vecFdata_.size() > 0); }
325 std::vector < DUNE_FDATA * > & getFdataVec () {
return vecFdata_; }
336 template<
class VectorType,
class IndexSetType >
337 inline void addVector(
const std::string name,
338 const VectorType & data,
const IndexSetType & indexSet,
339 const double time ,
const int polOrd ,
340 const int dimRange,
bool continuous );
352 template<
class VectorType,
class IndexSetType >
353 inline void addVector(
const VectorType & data,
const IndexSetType & indexSet,
354 const DATAINFO * dinf,
double time ,
355 const int polOrd ,
const int dimRange,
bool continuous );
359 std::vector < DUNE_FDATA * > vecFdata_;
361 enum { polynomialOrder = 1 };
363 GrapeLagrangePoints<ctype,dim,dimworld,polynomialOrder> lagrangePoints_;
365 typedef typename GridType :: template
Codim<0> :: Entity EntityCodim0Type;
366 typedef void evalCoord_t (EntityCodim0Type &, DUNE_FDATA *,
const double *,
double * );
367 typedef void evalDof_t (EntityCodim0Type &,
int , DUNE_FDATA * ,
int ,
double * );
371 static DUNE_FDATA * createDuneFunc ();
373 static void deleteDuneFunc (DUNE_FDATA *);
377 template <
typename ctype,
int dim,
int dimworld,
int polOrd>
378 class GrapeLagrangePoints
381 enum { maxPoints = 20 };
382 enum { numberOfTypes = (dim == 2) ? 2 : 6 };
384 std::vector < FieldMatrix<ctype,maxPoints,dim> > points_;
385 GrapeLagrangePoints (
const GrapeLagrangePoints& );
388 GrapeLagrangePoints () : points_()
390 GrapeInterface_two_two::setupReferenceElements();
391 GrapeInterface_two_three::setupReferenceElements();
392 GrapeInterface_three_three::setupReferenceElements();
394 for(
int type=0; type<numberOfTypes; ++type)
396 FieldMatrix<ctype,maxPoints,dim> coords( ctype(0) );
397 const int nvx = numberOfVertices(type);
399 for(
int i=0; i<nvx; ++i)
401 const double * p = getCoordinate(type,i);
402 for(
int j=0; j<dimworld; ++j)
408 points_.push_back( coords );
414 const FieldVector<ctype,dim> &
415 getPoint (
const int geomType,
const int polyOrder ,
const int localNum )
const
417 assert( polOrd == polyOrder );
418 assert( geomType >= 0 );
419 assert( geomType < numberOfTypes );
420 return points_[geomType][localNum];
424 static int numberOfVertices(
const int type )
426 if(type < GrapeInterface_three_three::gr_tetrahedron)
427 return GrapeInterface_two_two::getElementDescription(type)->number_of_vertices;
429 return GrapeInterface_three_three::getElementDescription(type)->number_of_vertices;
432 static const double * getCoordinate(
const int type,
const int i )
434 if(type < GrapeInterface_three_three::gr_tetrahedron)
436 return GrapeInterface_two_two::getElementDescription(type)->coord[i];
439 return GrapeInterface_three_three::getElementDescription(type)->coord[i];
446#include "grape/grapedatadisplay.cc"
Definition: grapedatadisplay.hh:250
GrapeDataDisplay(const GridType &grid, const int myrank=-1)
Constructor, make a GrapeDataDisplay for given grid.
Definition: grapedatadisplay.cc:446
void display()
display grid and data without grid mode
Definition: grapedatadisplay.cc:547
void displayVector(const std::string name, const VectorType &data, const IndexSetType &indexSet, const int polOrd, const unsigned int dimRange, bool continuous=false)
Definition: grapedatadisplay.cc:720
~GrapeDataDisplay()
Desctructor.
Definition: grapedatadisplay.cc:464
void dataDisplay(const DiscFuncType &func, bool vector=false)
Definition: grapedatadisplay.cc:533
void addData(const DiscFuncType &func, double time=0.0, bool vector=false)
add discrete function to display
Definition: grapedatadisplay.cc:559
Definition: grapegriddisplay.hh:55
Provides a GridDisplay class using the GRAPE-HMesh Interface.
Dune namespace.
Definition: alignment.hh:10