dune-grid  2.2.1
combinedgrapedisplay.hh
Go to the documentation of this file.
1 #ifndef DUNE_COMBINEDGRAPEDISPLAY_HH
2 #define DUNE_COMBINEDGRAPEDISPLAY_HH
3 
4 //- System includes
5 #include <list>
6 #include <vector>
7 
8 //- Dune includes
9 
10 #if HAVE_GRAPE
11 //- Local includes
12 #include "grapedatadisplay.hh"
13 #endif
14 
20 namespace Dune
21 {
22 
27 template<class DisplayType>
29 {
30 
31 #if HAVE_GRAPE
32  typedef CombinedGrapeDisplay < DisplayType > MyDisplayType;
33 
34  typedef typename DisplayType :: MyGridType GridType;
35  enum { dim = GridType :: dimension };
36  enum { dimworld = GridType :: dimensionworld };
37 
38  // defined in griddisplay.hh
39  typedef typename GrapeInterface<dim,dimworld>::DUNE_ELEM DUNE_ELEM;
40  typedef typename GrapeInterface<dim,dimworld>::DUNE_FDATA DUNE_FDATA;
41  typedef typename GrapeInterface<dim,dimworld>::DUNE_DAT DUNE_DAT;
42  typedef typename GrapeInterface<dim,dimworld>::F_DATA F_DATA;
44 
45 protected:
46  typedef typename std::list< DisplayType * > DisplayListType;
47  DisplayListType dispList_;
48 
49  typedef typename DisplayListType :: iterator DisplayListIteratorType;
50  DisplayListIteratorType grditer_;
51  DisplayListIteratorType enditer_;
52 
53  typedef typename std::list< void * > GridPartListType;
54  GridPartListType gridPartList_;
55  typedef typename GridPartListType :: iterator GridPartListIteratorType;
56  GridPartListIteratorType partEnd_;
57  GridPartListIteratorType partIter_;
58 
59 
60  DUNE_ELEM * dhel_;
61 
62  // actual element data
63  DUNE_ELEM hel_;
64 
65  // actual dat struct
66  DUNE_DAT dune_;
67 #endif
68 
69  // pointer to actual display
70  DisplayType * disp_;
71 
72 public:
73  // no better way than this canot export HMESH structure to here
75  void *hmesh_;
76 
77 public:
79  inline CombinedGrapeDisplay();
80 
82  inline ~CombinedGrapeDisplay();
83 
85  void addDisplay ( DisplayType & disp );
86 
89  inline void display();
90 
91 #if HAVE_GRAPE
92 
93  inline void * getHmesh();
94 
95  inline void addMyMeshToGlobalTimeScene(double time, int proc);
96 
97 private:
98  // generate hmesh
99  inline void * setupHmesh();
100 
101  typedef typename DisplayType :: StackEntryType StackEntryType;
102  StackEntryType stackEntry_;
103 
104 protected:
105  std::vector < DUNE_FDATA * > vecFdata_;
106 //****************************************************************
107 //
108 // --GrapeGridDisplay, Some Subroutines needed for display with GRAPE
109 //
110 //****************************************************************
111  inline int callFirstMacro(DUNE_ELEM * he) ;
112  // first and next macro element via LevelIterator level 0
113  inline int first_leaf (DUNE_ELEM * he) ;
114  inline int next_leaf (DUNE_ELEM * he) ;
115 
116  // first and next macro element via LevelIterator level 0
117  inline int first_macro (DUNE_ELEM * he) ;
118  inline int next_macro (DUNE_ELEM * he) ;
119 
120  // first and next child via HierarchicIterator with given maxlevel in Grape
121  inline int first_child (DUNE_ELEM * he) ;
122  inline int next_child (DUNE_ELEM * he) ;
123 
124  inline static void * copy_iterator (const void * i) ;
125 
126  // local to world
127  inline void local_to_world (DUNE_ELEM * he, const double * c, double * w);
128 
129  // world to local
130  inline int world_to_local (DUNE_ELEM * he, const double * w, double * c);
131 
132  // check inside reference element
133  inline int checkInside (DUNE_ELEM * he, const double * w);
134 
135  // local to world
136  inline static void ctow (DUNE_ELEM * he, const double * c, double * w);
137 
138  // world to local
139  inline static int wtoc (DUNE_ELEM * he, const double * w, double * c);
140 
141  // check inside reference element
142  inline static int check_inside (DUNE_ELEM * he, const double * w);
143 
144  // wrapper methods for first_child and next_child
145  inline static int first_mac (DUNE_ELEM * he);
146  inline static int next_mac (DUNE_ELEM * he);
147 
148  // wrapper methods for first_child and next_child
149  inline static int fst_leaf (DUNE_ELEM * he);
150  inline static int nxt_leaf (DUNE_ELEM * he);
151 
152  // wrapper methods for first_child and next_child
153  inline static int fst_child (DUNE_ELEM * he);
154  inline static int nxt_child (DUNE_ELEM * he);
155 
157  inline void evalCoord (DUNE_ELEM *he, DUNE_FDATA *df,
158  const double *coord, double * val);
160  inline void evalDof (DUNE_ELEM *he, DUNE_FDATA *df, int localNum, double * val);
161 
164  inline static void evalCoordWrap (DUNE_ELEM *he, DUNE_FDATA *df,
165  const double *coord, double * val);
168  inline static void evalDofWrap (DUNE_ELEM *he, DUNE_FDATA *df, int localNum, double * val);
169 
170  // function to evaluate data
171  inline static void func_real (DUNE_ELEM *he , DUNE_FDATA * fe,int ind,
172  const double *coord, double *val);
173 
174  inline void setIterationMethods(DUNE_DAT *, DUNE_FDATA *);
175  static inline void setIterationModus(DUNE_DAT *, DUNE_FDATA *);
176 
177  static void * getStackEn(DUNE_DAT *);
178  static void freeStackEn(DUNE_DAT *, void *);
179 #endif
180 
181 }; // end class GrapeGridDisplay
182 
183 } // end namespace Dune
184 
186 #endif