dune-grid  2.2.0
combinedgrapedisplay.hh
Go to the documentation of this file.
00001 #ifndef DUNE_COMBINEDGRAPEDISPLAY_HH
00002 #define DUNE_COMBINEDGRAPEDISPLAY_HH
00003 
00004 //- System includes 
00005 #include <list>
00006 #include <vector>
00007 
00008 //- Dune includes
00009 
00010 #if HAVE_GRAPE
00011 //- Local includes
00012 #include "grapedatadisplay.hh"
00013 #endif
00014 
00020 namespace Dune 
00021 {
00022 
00027 template<class DisplayType>
00028 class CombinedGrapeDisplay 
00029 {
00030 
00031 #if HAVE_GRAPE
00032   typedef CombinedGrapeDisplay < DisplayType > MyDisplayType;
00033 
00034   typedef typename DisplayType :: MyGridType GridType; 
00035   enum { dim      = GridType :: dimension };
00036   enum { dimworld = GridType :: dimensionworld };
00037   
00038   // defined in griddisplay.hh 
00039   typedef typename GrapeInterface<dim,dimworld>::DUNE_ELEM  DUNE_ELEM;
00040   typedef typename GrapeInterface<dim,dimworld>::DUNE_FDATA DUNE_FDATA;
00041   typedef typename GrapeInterface<dim,dimworld>::DUNE_DAT   DUNE_DAT;
00042   typedef typename GrapeInterface<dim,dimworld>::F_DATA     F_DATA;
00043   typedef typename GrapeInterface<dim,dimworld>::STACKENTRY STACKENTRY; 
00044   
00045 protected:
00046   typedef typename std::list< DisplayType * > DisplayListType;
00047   DisplayListType dispList_;
00048 
00049   typedef typename DisplayListType :: iterator DisplayListIteratorType;
00050   DisplayListIteratorType grditer_;
00051   DisplayListIteratorType enditer_;
00052 
00053   typedef typename std::list< void * > GridPartListType;
00054   GridPartListType gridPartList_; 
00055   typedef typename GridPartListType :: iterator GridPartListIteratorType;
00056   GridPartListIteratorType partEnd_;
00057   GridPartListIteratorType partIter_;
00058 
00059   
00060   DUNE_ELEM * dhel_;
00061  
00062   // actual element data 
00063   DUNE_ELEM hel_;
00064 
00065   // actual dat struct
00066   DUNE_DAT dune_;
00067 #endif
00068   
00069   // pointer to actual display
00070   DisplayType * disp_;
00071   
00072 public:
00073   // no better way than this canot export HMESH structure to here
00075   void *hmesh_;
00076 
00077 public:
00079   inline CombinedGrapeDisplay();
00080 
00082   inline ~CombinedGrapeDisplay();
00083 
00085   void addDisplay ( DisplayType & disp );
00086 
00089   inline void display();
00090 
00091 #if HAVE_GRAPE
00092 
00093   inline void * getHmesh();
00094 
00095   inline void addMyMeshToGlobalTimeScene(double time, int proc);
00096  
00097 private:  
00098   // generate hmesh 
00099   inline void * setupHmesh();
00100 
00101   typedef typename DisplayType :: StackEntryType StackEntryType; 
00102   StackEntryType stackEntry_;
00103 
00104 protected:
00105   std::vector < DUNE_FDATA * > vecFdata_;
00106 //****************************************************************  
00107 //
00108 // --GrapeGridDisplay, Some Subroutines needed for display with GRAPE
00109 // 
00110 //****************************************************************  
00111   inline int callFirstMacro(DUNE_ELEM * he) ;
00112   // first and next macro element via LevelIterator level 0 
00113   inline int first_leaf (DUNE_ELEM * he) ;
00114   inline int next_leaf (DUNE_ELEM * he) ;
00115   
00116   // first and next macro element via LevelIterator level 0 
00117   inline int first_macro (DUNE_ELEM * he) ;
00118   inline int next_macro (DUNE_ELEM * he) ;
00119 
00120   // first and next child via HierarchicIterator with given maxlevel in Grape
00121   inline int first_child (DUNE_ELEM * he) ;
00122   inline int next_child (DUNE_ELEM * he) ;
00123 
00124   inline static void * copy_iterator (const void * i) ;
00125 
00126   // local to world 
00127   inline void local_to_world (DUNE_ELEM * he, const double * c, double * w);
00128 
00129   // world to local 
00130   inline int world_to_local (DUNE_ELEM * he, const double * w, double * c);
00131  
00132   // check inside reference element 
00133   inline int checkInside (DUNE_ELEM * he, const double * w);
00134 
00135   // local to world 
00136   inline static void ctow (DUNE_ELEM * he, const double * c, double * w);
00137 
00138   // world to local 
00139   inline static int wtoc (DUNE_ELEM * he, const double * w, double * c);
00140  
00141   // check inside reference element 
00142   inline static int check_inside (DUNE_ELEM * he, const double * w);
00143 
00144   // wrapper methods for first_child and next_child
00145   inline static int first_mac (DUNE_ELEM * he);
00146   inline static int next_mac (DUNE_ELEM * he);
00147   
00148   // wrapper methods for first_child and next_child
00149   inline static int fst_leaf (DUNE_ELEM * he);
00150   inline static int nxt_leaf (DUNE_ELEM * he);
00151   
00152   // wrapper methods for first_child and next_child
00153   inline static int fst_child (DUNE_ELEM * he);
00154   inline static int nxt_child (DUNE_ELEM * he);
00155 
00157   inline void evalCoord (DUNE_ELEM *he, DUNE_FDATA *df,
00158                   const double *coord, double * val);
00160   inline void evalDof (DUNE_ELEM *he, DUNE_FDATA *df, int localNum, double * val);
00161  
00164   inline static void evalCoordWrap (DUNE_ELEM *he, DUNE_FDATA *df,
00165                   const double *coord, double * val);
00168   inline static void evalDofWrap (DUNE_ELEM *he, DUNE_FDATA *df, int localNum, double * val);
00169   
00170   // function to evaluate data 
00171   inline static void func_real (DUNE_ELEM *he , DUNE_FDATA * fe,int ind,
00172                                 const double *coord, double *val);
00173 
00174   inline void setIterationMethods(DUNE_DAT *, DUNE_FDATA *); 
00175   static inline void setIterationModus(DUNE_DAT *, DUNE_FDATA *); 
00176 
00177   static void * getStackEn(DUNE_DAT *);
00178   static void freeStackEn(DUNE_DAT *, void *);
00179 #endif 
00180 
00181 }; // end class GrapeGridDisplay
00182 
00183 } // end namespace Dune
00184 
00185 #include "grape/combinedgrapedisplay.cc"
00186 #endif