vtf-logo

F77UpdateLevelTransfer.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // Copyright (C) 2002 Ralf Deiterding
00004 // Brandenburgische Universitaet Cottbus
00005 //
00006 // Copyright (C) 2003-2007 California Institute of Technology
00007 // Ralf Deiterding, ralf@amroc.net
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, 
00072                              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) {
00075     base::SetAdaptBndry(target,source_next,frac,source_previous,oneminusfrac,target_level,bb);
00076     Update(target,bb);    
00077   }
00078 
00079 
00080   inline void SetUpdateFunc(generic_func_type update) { f_update = update; }
00081   generic_func_type GetUpdateFunc() const { return f_update; }
00082 
00083 protected:
00084   generic_func_type f_update;
00085 };
00086 
00087 
00088 #endif

Generated on Fri Aug 24 13:00:50 2007 for AMROC Fluid-solver Framework - by  doxygen 1.4.7