00001
00002
00003 #ifndef _included_GridFunctionFunctors_h
00004 #define _included_GridFunctionFunctors_h
00005
00011 template <class GFType, int dim>
00012 class GFBndryUpdateFunc {
00013 public:
00014 virtual ~GFBndryUpdateFunc() {}
00015 virtual void operator() (GridData<GFType,dim> &target, const int& target_level,
00016 const BBox &bb, const int &side, const double& phystime) = 0;
00017 };
00018
00019 template <class TClass, class GFType, int dim>
00020 class GFBndryUpdateSpecificFunc : public GFBndryUpdateFunc<GFType,dim> {
00021 public:
00022 typedef void (TClass::*Func) (GridData<GFType,dim> &target, const int& target_level,
00023 const BBox &bb, const int &side, const double& phystime);
00024
00025 GFBndryUpdateSpecificFunc(TClass* _tcobj, Func _func) : tcobj(_tcobj), func(_func) {}
00026
00027 virtual ~GFBndryUpdateSpecificFunc() {}
00028 virtual void operator() (GridData<GFType,dim> &target, const int& target_level,
00029 const BBox &bb, const int &side, const double& phystime)
00030 { (*tcobj.*func)(target, target_level, bb, side, phystime); }
00031
00032 private:
00033 TClass* tcobj;
00034 Func func;
00035 };
00036
00037
00038 template <class GFType, int dim>
00039 class GFLevelTransferFunc {
00040 public:
00041 virtual ~GFLevelTransferFunc() {}
00042 virtual void operator() (GridData<GFType,dim> &source, const int& source_level,
00043 GridData<GFType,dim> &target, const int& target_level, const BBox &bb) = 0;
00044 };
00045
00046 template <class TClass, class GFType, int dim>
00047 class GFLevelTransferSpecificFunc : public GFLevelTransferFunc<GFType,dim> {
00048 public:
00049 typedef void (TClass::*Func) (GridData<GFType,dim> &source, const int& source_level,
00050 GridData<GFType,dim> &target, const int& target_level, const BBox &bb);
00051
00052 GFLevelTransferSpecificFunc(TClass* _tcobj, Func _func) : tcobj(_tcobj), func(_func) {}
00053
00054 virtual ~GFLevelTransferSpecificFunc() {}
00055 virtual void operator() (GridData<GFType,dim> &source, const int& source_level,
00056 GridData<GFType,dim> &target, const int& target_level, const BBox &bb)
00057 { (*tcobj.*func)(source, source_level, target, target_level, bb); }
00058
00059 private:
00060 TClass* tcobj;
00061 Func func;
00062 };
00063
00064
00065 template <class GFType, int dim>
00066 class GFAdptBndryUpdateFunc {
00067 public:
00068 virtual ~GFAdptBndryUpdateFunc() {}
00069 virtual void operator() (GridData<GFType,dim> &target, GridData<GFType,dim> &target_help_previous,
00070 GridData<GFType,dim> &target_help_next, GridData<GFType,dim> &source_next, const double &frac,
00071 GridData<GFType,dim> &source_previous, const double &oneminusfrac,
00072 const int &target_level, const BBox &bb, const int side) = 0;
00073 };
00074
00075 template <class TClass, class GFType, int dim>
00076 class GFAdptBndryUpdateSpecificFunc : public GFAdptBndryUpdateFunc<GFType,dim> {
00077 public:
00078 typedef void (TClass::*Func) (GridData<GFType,dim> &target, GridData<GFType,dim> &target_help_previous,
00079 GridData<GFType,dim> &target_help_next, GridData<GFType,dim> &source_next, const double &frac,
00080 GridData<GFType,dim> &source_previous, const double &oneminusfrac,
00081 const int &target_level, const BBox &bb, const int side);
00082
00083 GFAdptBndryUpdateSpecificFunc(TClass* _tcobj, Func _func) : tcobj(_tcobj), func(_func) {}
00084
00085 virtual ~GFAdptBndryUpdateSpecificFunc() {}
00086 virtual void operator() (GridData<GFType,dim> &target, GridData<GFType,dim> &target_help_previous,
00087 GridData<GFType,dim> &target_help_next, GridData<GFType,dim> &source_next, const double &frac,
00088 GridData<GFType,dim> &source_previous, const double &oneminusfrac,
00089 const int &target_level, const BBox &bb, const int side)
00090 { (*tcobj.*func)(target, target_help_previous, target_help_next, source_next, frac, source_previous,
00091 oneminusfrac, target_level, bb, side); }
00092
00093 private:
00094 TClass* tcobj;
00095 Func func;
00096 };
00097
00098
00099 template <class GFType, int dim>
00100 class GFIOFunc {
00101 public:
00102 virtual ~GFIOFunc() {}
00103 virtual void operator() (GridData<GFType,dim> &source, const int& source_level, const BBox &bb) = 0;
00104 };
00105
00106 template <class TClass, class GFType, int dim>
00107 class GFIOSpecificFunc : public GFIOFunc<GFType,dim> {
00108 public:
00109 typedef void (TClass::*Func) (GridData<GFType,dim> &source, const int& source_level, const BBox &bb);
00110
00111 GFIOSpecificFunc(TClass* _tcobj, Func _func) : tcobj(_tcobj), func(_func) {}
00112
00113 virtual ~GFIOSpecificFunc() {}
00114 virtual void operator() (GridData<GFType,dim> &source, const int& source_level, const BBox &bb)
00115 { (*tcobj.*func)(source, source_level, bb); }
00116
00117 private:
00118 TClass* tcobj;
00119 Func func;
00120 };
00121
00122
00123 template <class GFType, int dim>
00124 class GFRecomposeFunc {
00125 public:
00126 virtual ~GFRecomposeFunc() {}
00127 virtual void operator() (GridFunction<GFType,dim> &gf, const int& time,
00128 const int& level, const double& phystime) = 0;
00129 };
00130
00131 template <class TClass, class GFType, int dim>
00132 class GFRecomposeSpecificFunc : public GFRecomposeFunc<GFType,dim> {
00133 public:
00134 typedef void (TClass::*Func) (GridFunction<GFType,dim> &gf, const int& time,
00135 const int& level, const double& phystime);
00136
00137 GFRecomposeSpecificFunc(TClass* _tcobj, Func _func) : tcobj(_tcobj), func(_func) {}
00138
00139 virtual ~GFRecomposeSpecificFunc() {}
00140 virtual void operator() (GridFunction<GFType,dim> &gf, const int& time,
00141 const int& level, const double& phystime)
00142 { (*tcobj.*func)(gf, time, level, phystime); }
00143
00144 private:
00145 TClass* tcobj;
00146 Func func;
00147 };
00148
00149
00150 #endif
00151
00152