00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef AMROC_F77_UPDATE_LEVELTRANSFER_H
00010 #define AMROC_F77_UPDATE_LEVELTRANSFER_H
00011
00019 #include "F77Interfaces/F77LevelTransfer.h"
00020
00027 template <class VectorType, int dim>
00028 class F77UpdateLevelTransfer : public F77LevelTransfer<VectorType,dim> {
00029 typedef F77LevelTransfer<VectorType,dim> base;
00030 public:
00031 typedef typename base::vec_grid_data_type vec_grid_data_type;
00032 typedef typename base::generic_func_type generic_func_type;
00033
00034 typedef void (*update_1_func_type) ( FI(1,VectorType), BI, const INTEGER& meqn );
00035 typedef void (*update_2_func_type) ( FI(2,VectorType), BI, const INTEGER& meqn );
00036 typedef void (*update_3_func_type) ( FI(3,VectorType), BI, const INTEGER& meqn );
00037
00038 F77UpdateLevelTransfer() : base(), f_update(0) {}
00039 F77UpdateLevelTransfer(generic_func_type prolong, generic_func_type restrct,
00040 generic_func_type update) : base(prolong,restrct), f_update(update) {}
00041
00042 virtual ~F77UpdateLevelTransfer() {}
00043
00044 virtual void SetupData(GridHierarchy* gh, const int& ghosts) {
00045 base::SetAdaptiveBoundaryType(DAGHAdaptBoundaryBoth);
00046 base::SetupData(gh,ghosts);
00047 }
00048
00049 void Update(vec_grid_data_type &target, const BBox &bb) {
00050 if (!f_update) return;
00051 if (dim == 1)
00052 ((update_1_func_type) f_update)(FORTRAN_ARGS(1,target),BOUNDING_BOX(bb),base::NEquations());
00053 else if (dim == 2)
00054 ((update_2_func_type) f_update)(FORTRAN_ARGS(2,target),BOUNDING_BOX(bb),base::NEquations());
00055 else if (dim == 3)
00056 ((update_3_func_type) f_update)(FORTRAN_ARGS(3,target),BOUNDING_BOX(bb),base::NEquations());
00057 }
00058
00059 virtual void Prolong(vec_grid_data_type &source, const int& source_level,
00060 vec_grid_data_type &target, const int& target_level, const BBox &bb) {
00061 base::Prolong(source,source_level,target,target_level,bb);
00062 Update(target,bb);
00063 }
00064
00065 virtual void Restrict(vec_grid_data_type &source, const int& source_level,
00066 vec_grid_data_type &target, const int& target_level, const BBox &bb) {
00067 base::Restrict(source,source_level,target,target_level,bb);
00068 Update(target,bb);
00069 }
00070
00071 virtual void SetAdaptBndry(vec_grid_data_type &target, vec_grid_data_type &target_help_previous,
00072 vec_grid_data_type &target_help_next, vec_grid_data_type &source_next, const double &frac,
00073 vec_grid_data_type &source_previous, const double &oneminusfrac,
00074 const int &target_level, const BBox &bb, const int side) {
00075 base::SetAdaptBndry(target,target_help_previous,target_help_next,source_next,frac,
00076 source_previous,oneminusfrac,target_level,bb,side);
00077 Update(target,bb);
00078 }
00079
00080
00081 inline void SetUpdateFunc(generic_func_type update) { f_update = update; }
00082 generic_func_type GetUpdateFunc() const { return f_update; }
00083
00084 protected:
00085 generic_func_type f_update;
00086 };
00087
00088
00089 #endif