vtf-logo

F77BoundaryConditions.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_BOUNDARYCONDITIONS_H
00010 #define AMROC_F77_BOUNDARYCONDITIONS_H
00011 
00019 #include "BoundaryConditions.h"
00020 
00027 template <class VectorType, int dim>
00028 class F77BoundaryConditions : public BoundaryConditions<VectorType,dim> {
00029   typedef BoundaryConditions<VectorType,dim> base;
00030 public:
00031   typedef typename base::vec_grid_data_type vec_grid_data_type;
00032 
00033   typedef generic_fortran_func generic_func_type;
00034 
00035   typedef void (*boundary_1_func_type) ( FI(1,VectorType), BI, const DOUBLE xc[], 
00036                                          const DOUBLE dx[], const INTEGER& dir,
00037                                          const DOUBLE *bnd, const INTEGER& mb,  
00038                                          const DOUBLE& time, const INTEGER& meqn);
00039   typedef void (*boundary_2_func_type) ( FI(2,VectorType), BI, const DOUBLE xc[], 
00040                                          const DOUBLE dx[], const INTEGER& dir,
00041                                          const DOUBLE *bnd, const INTEGER& mb,  
00042                                          const DOUBLE& time, const INTEGER& meqn);
00043   typedef void (*boundary_3_func_type) ( FI(3,VectorType), BI, const DOUBLE xc[], 
00044                                          const DOUBLE dx[], const INTEGER& dir,
00045                                          const DOUBLE *bnd, const INTEGER& mb,  
00046                                          const DOUBLE& time, const INTEGER& meqn);
00047 
00048   F77BoundaryConditions() : base(), f_bndry(0) {}
00049   F77BoundaryConditions(generic_func_type bndry) : base(), f_bndry(bndry) {}
00050   
00051   virtual ~F77BoundaryConditions() {}
00052   
00053   virtual void SetBndry(vec_grid_data_type &gd, const int& level, const BBox &bb, 
00054                         const int &dir, const double& time) {    
00055 
00056     assert(f_bndry != (generic_func_type) 0);
00057     DCoords lbc = base::GH().worldCoords(gd.lower(), gd.stepsize());
00058     DCoords dx = base::GH().worldStep(gd.stepsize());
00059 
00060     if (dim == 1) 
00061       ((boundary_1_func_type) f_bndry)(FORTRAN_ARGS(1,gd),BOUNDING_BOX(bb),lbc(),dx(),dir,
00062                                        base::GH().wholebndry(),base::GH().nbndry(),time,
00063                                        base::NEquations());
00064     else if (dim == 2) 
00065       ((boundary_2_func_type) f_bndry)(FORTRAN_ARGS(2,gd),BOUNDING_BOX(bb),lbc(),dx(),dir,
00066                                        base::GH().wholebndry(),base::GH().nbndry(),time,
00067                                        base::NEquations());
00068     else if (dim == 3) 
00069       ((boundary_3_func_type) f_bndry)(FORTRAN_ARGS(3,gd),BOUNDING_BOX(bb),lbc(),dx(),dir,
00070                                        base::GH().wholebndry(),base::GH().nbndry(),time,
00071                                        base::NEquations());
00072   }
00073 
00074   inline void SetFunc(generic_func_type bndry) { f_bndry = bndry; }
00075   generic_func_type GetFunc() const { return f_bndry; }
00076 
00077 protected:
00078   generic_func_type f_bndry;
00079 };
00080 
00081 
00082 #endif

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