vtf-logo

WENOGFMBoundary.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // Copyright (C) 2003-2007 California Institute of Technology
00004 // Ralf Deiterding, ralf@amroc.net
00005 
00006 #ifndef AMROC_WENO_GFMBOUNDARY_H
00007 #define AMROC_WENO_GFMBOUNDARY_H
00008 
00016 #if DIM == 1
00017 #elif DIM == 2
00018 
00019 #include "GFMBoundary2.h"
00020 
00021 #define INTERNALBND_PARAMETER_LIST ( \
00022         FI(2,Vector_type), const INTEGER &, const INTEGER &, \
00023         const INTEGER *, const DOUBLE *, const DOUBLE *, \
00024         const DOUBLE *, const DOUBLE *, const DOUBLE *, \
00025         const DOUBLE &)
00026 extern "C" {
00027   typedef void (*intbnd_func_type) INTERNALBND_PARAMETER_LIST;
00028 }
00029 #define INTTRANSBND_PARAMETER_LIST ( \
00030         const INTEGER& mx, const INTEGER& my, \
00031         const INTEGER& meqn, Vector_type* q, Vector_type* qt)
00032 extern "C" {
00033   typedef void (*inttrans_func_type) INTTRANSBND_PARAMETER_LIST;
00034 }
00035 #elif DIM == 3  
00036 
00037 #include "GFMBoundary3.h"
00038 
00039 #define INTERNALBND_PARAMETER_LIST ( \
00040         FI(3,Vector_type), const INTEGER &, const INTEGER &, \
00041         const INTEGER *, const DOUBLE *, const DOUBLE *, \
00042         const DOUBLE *, const DOUBLE *, const DOUBLE *, \
00043         const DOUBLE &)
00044 extern "C" {
00045   typedef void (*intbnd_func_type) INTERNALBND_PARAMETER_LIST;
00046 }
00047 #define INTTRANSBND_PARAMETER_LIST ( \
00048         const INTEGER& mx, const INTEGER& my, const INTEGER& mz, \
00049         const INTEGER& meqn, Vector_type* q, Vector_type* qt)
00050 extern "C" {
00051   typedef void (*inttrans_func_type) INTTRANSBND_PARAMETER_LIST;
00052 }
00053 
00054 #endif
00055 
00056 #ifndef WENOGFMBoundaryName
00057 #define WENOGFMBoundary(dim)      name2(WENOGFMBoundary,dim)
00058 #define WENOGFMBoundaryName
00059 #endif
00060 
00067 template <class VectorType>
00068 class WENOGFMBoundary(DIM) : public GFMBoundary(DIM)<VectorType> {
00069   typedef typename VectorType::InternalDataType DataType;
00070   typedef GridData(DIM)<DataType>   grid_data_type;   
00071   typedef GridData(DIM)<VectorType> vec_grid_data_type;  
00072   typedef GFMBoundary(DIM)<VectorType> base; 
00073   typedef Vector(DIM)<DataType>  point_type;
00074 
00075 public:
00076   WENOGFMBoundary(DIM)(const int gh, intbnd_func_type bf, inttrans_func_type tf) : 
00077     base(gh), bnd_func(bf), trans_func(tf) {} 
00078 
00079   virtual void SetGrid(vec_grid_data_type& gdu, grid_data_type& gdphi, const BBox& bb,
00080                        const int& Level, DCoords& dx, double t, const int& Ncells, 
00081                        const int* indices, const point_type* xc, const DataType* distance, 
00082                        const point_type* normal) {
00083 
00084     Coords ex = gdu.extents();
00085     VectorType* u = (VectorType*) 0;
00086 
00087     if (base::NormalFactor()>0)
00088       if (trans_func) {
00089         vec_grid_data_type gdhelp(gdu.bbox());  
00090         (*trans_func)(AA(DIM,ex()),base::NEquations(),gdu.data(),gdhelp.data());
00091         base::Extrapolation(gdhelp,gdphi,u,Level,dx,Ncells,indices,xc,
00092                             distance,normal,base::NormalFactor());
00093       }
00094       else 
00095         base::Extrapolation(gdu,gdphi,u,Level,dx,Ncells,indices,xc,
00096                             distance,normal,base::NormalFactor());
00097 
00098     if (bnd_func)
00099       (*bnd_func)(FORTRAN_ARGS(DIM,gdu),base::NEquations(),Ncells,
00100                   indices,u[0].data(),xc[0].data(),distance,
00101                   normal[0].data(),dx(),t);
00102     
00103     if (u) delete [] u;
00104   }
00105 
00106 protected:
00107   intbnd_func_type bnd_func;
00108   inttrans_func_type trans_func;
00109 };
00110 
00111 
00112 #endif