Blockstructured Adaptive Mesh Refinement in object-oriented C++
00001 #ifndef AMROC_CLP_EXACT_SOLUTION_H 00002 #define AMROC_CLP_EXACT_SOLUTION_H 00003 00011 #include "ExactSolution.h" 00012 00013 #ifndef ClpExactSolutionName 00014 #define ClpExactSolution(dim) name2(ClpExactSolution,dim) 00015 #define ClpExactSolutionName 00016 #endif 00017 00018 #if DIM == 1 00019 # define f_exact FORTRAN_NAME(exact_, EXACT, exact) 00020 extern "C" { 00021 void f_exact(const INTEGER& maxmx, 00022 const INTEGER& meqn, const INTEGER& mbc, 00023 const INTEGER& mx, 00024 const DOUBLE x[], 00025 const DOUBLE& dx, 00026 const DOUBLE& t, Vector_type* q); 00027 } 00028 #elif DIM == 2 00029 # define f_exact FORTRAN_NAME(exact_, EXACT, exact) 00030 extern "C" { 00031 void f_exact(const INTEGER& maxmx, const INTEGER& maxmy, 00032 const INTEGER& meqn, const INTEGER& mbc, 00033 const INTEGER& mx, const INTEGER& my, 00034 const DOUBLE x[], const DOUBLE y[], 00035 const DOUBLE& dx, const DOUBLE& dy, 00036 const DOUBLE& t, Vector_type* q); 00037 } 00038 #elif DIM == 3 00039 # define f_exact FORTRAN_NAME(exact_, EXACT, exact) 00040 extern "C" { 00041 void f_exact(const INTEGER& maxmx, const INTEGER& maxmy, const INTEGER& maxmz, 00042 const INTEGER& meqn, const INTEGER& mbc, 00043 const INTEGER& mx, const INTEGER& my, const INTEGER& mz, 00044 const DOUBLE x[], const DOUBLE y[], const DOUBLE z[], 00045 const DOUBLE& dx, const DOUBLE& dy, const DOUBLE& dz, 00046 const DOUBLE& t, Vector_type* q); 00047 } 00048 #endif 00049 00056 template <class VectorType> 00057 class ClpExactSolution(DIM) : public ExactSolution(DIM)<VectorType> { 00058 typedef typename VectorType::InternalDataType DataType; 00059 typedef GridData(DIM)<VectorType> vec_grid_data_type; 00060 00061 public: 00062 ClpExactSolution(DIM)(const int gh) : ExactSolution(DIM)<VectorType>(gh) {} 00063 00064 virtual void SetGrid(vec_grid_data_type& gd, double t, 00065 DCoords& dx) { 00066 Coords ex = gd.extents(); 00067 DCoords lbcorner = GH().worldCoords(gd.lower(), gd.stepsize()); 00068 int maxm[DIM], mx[DIM], d; 00069 DataType* x[DIM]; 00070 for (d=0; d<DIM; d++) { 00071 maxm[d] = ex(d); 00072 mx[d] = ex(d)-2*NGhosts(); 00073 x[d] = new DataType[maxm[d]]; 00074 for (int i=0; i<maxm[d]; i++) x[d][i] = (i+0.5)*dx(d)+lbcorner(d); 00075 } 00076 00077 f_exact(AA(DIM,mx), NEquations(), NGhosts(), AA(DIM,mx), 00078 AA(DIM,x), AA(DIM,dx()), t, gd.data()); 00079 00080 for (d=0; d<DIM; d++) 00081 delete [] x[d]; 00082 } 00083 }; 00084 00085 00086 #endif
Quickstart Users Guide Programmers Reference Installation Examples Download
AMROC Main Home Contactlast update: 06/01/04