00001
00002
00003
00004
00005
00006 #ifndef AMROC_F77_LEVELTRANSFER_H
00007 #define AMROC_F77_LEVELTRANSFER_H
00008
00016 #include "LevelTransfer.h"
00017
00024 template <class VectorType, int dim>
00025 class F77LevelTransfer : public LevelTransfer<VectorType,dim> {
00026 typedef LevelTransfer<VectorType,dim> base;
00027 public:
00028 typedef typename base::vec_grid_data_type vec_grid_data_type;
00029
00030 typedef generic_fortran_func generic_func_type;
00031
00032 typedef void (*transfer_1_func_type) ( FI(1,VectorType), FI(1,VectorType), BI,
00033 const INTEGER& meqn, const INTEGER& mbc);
00034 typedef void (*transfer_2_func_type) ( FI(2,VectorType), FI(2,VectorType), BI,
00035 const INTEGER& meqn, const INTEGER& mbc);
00036 typedef void (*transfer_3_func_type) ( FI(3,VectorType), FI(3,VectorType), BI,
00037 const INTEGER& meqn, const INTEGER& mbc);
00038
00039 F77LevelTransfer() : base(), f_prolong(0), f_restrict(0) {}
00040 F77LevelTransfer(generic_func_type prolong, generic_func_type restrct) :
00041 base(), f_prolong(prolong), f_restrict(restrct) {}
00042
00043 virtual ~F77LevelTransfer() {}
00044
00045 virtual void Prolong(vec_grid_data_type &source, const int& source_level,
00046 vec_grid_data_type &target, const int& target_level, const BBox &bb) {
00047 if (!f_prolong) return;
00048 if (dim == 1)
00049 ((transfer_1_func_type) f_prolong)(FORTRAN_ARGS(1,source),FORTRAN_ARGS(1,target),BOUNDING_BOX(bb),
00050 base::NEquations(),base::NGhosts());
00051 else if (dim == 2)
00052 ((transfer_2_func_type) f_prolong)(FORTRAN_ARGS(2,source),FORTRAN_ARGS(2,target),BOUNDING_BOX(bb),
00053 base::NEquations(),base::NGhosts());
00054 else if (dim == 3)
00055 ((transfer_3_func_type) f_prolong)(FORTRAN_ARGS(3,source),FORTRAN_ARGS(3,target),BOUNDING_BOX(bb),
00056 base::NEquations(),base::NGhosts());
00057 }
00058
00059 virtual void Restrict(vec_grid_data_type &source, const int& source_level,
00060 vec_grid_data_type &target, const int& target_level, const BBox &bb) {
00061 if (!f_restrict) return;
00062 if (dim == 1)
00063 ((transfer_1_func_type) f_restrict)(FORTRAN_ARGS(1,source),FORTRAN_ARGS(1,target),BOUNDING_BOX(bb),
00064 base::NEquations(),base::NGhosts());
00065 else if (dim == 2)
00066 ((transfer_2_func_type) f_restrict)(FORTRAN_ARGS(2,source),FORTRAN_ARGS(2,target),BOUNDING_BOX(bb),
00067 base::NEquations(),base::NGhosts());
00068 else if (dim == 3)
00069 ((transfer_3_func_type) f_restrict)(FORTRAN_ARGS(3,source),FORTRAN_ARGS(3,target),BOUNDING_BOX(bb),
00070 base::NEquations(),base::NGhosts());
00071 }
00072
00073 inline void SetProlongFunc(generic_func_type prolong) { f_prolong = prolong; }
00074 generic_func_type GetProlongFunc() const { return f_prolong; }
00075 inline void SetRestrictFunc(generic_func_type restrct) { f_restrict = restrct; }
00076 generic_func_type GetRestrictFunc() const { return f_restrict; }
00077
00078 protected:
00079 generic_func_type f_prolong, f_restrict;
00080 };
00081
00082
00083 #endif