User: rhaas Date: 2014/04/15 02:49 PM
Added: /trunk/src/ GRHydro_TrivialReconstruct.cc, GRHydro_TrivialReconstruct.hh
Modified: /trunk/src/ make.code.defn
Log: GRHydro: add Trivial (copy) reconstruct
File Changes:
Directory: /trunk/src/ ======================
File [added]: GRHydro_TrivialReconstruct.cc Delta lines: +34 -0 =================================================================== --- trunk/src/GRHydro_TrivialReconstruct.cc (rev 0) +++ trunk/src/GRHydro_TrivialReconstruct.cc 2014-04-15 19:49:28 UTC (rev 625) @@ -0,0 +1,34 @@ +#include <cmath> +#include "cctk.h" +#include "cctk_Parameters.h" +#include "cctk_Arguments.h" +#include "cctk_Functions.h" + +#include "GRHydro_TrivialReconstruct.hh" +#include "GRHydro_Reconstruct_drv_impl.hh" + +using namespace std; + + +/** + Trivial first-order reconstruction operator. +*/ +template <int dir> +void GRHydro_TrivialReconstruct1d:: +apply(const int nx, const CCTK_REAL* const restrict a, + CCTK_REAL* const restrict aminus, CCTK_REAL* const restrict aplus, + const cGH* const cctkGH, const int j, const int k) +{ + for (int i=0; i < nx; ++i) + { + const int ijk = dir ==0 ? CCTK_GFINDEX3D(cctkGH, i , j, k) : dir ==1 ? CCTK_GFINDEX3D(cctkGH, j, i , k) : CCTK_GFINDEX3D(cctkGH, j, k, i ); + + // Trivial reconstruction! + aminus[ijk] = a[ijk]; + aplus[ijk] = a[ijk]; + } +} + +// instantiate all copies we need, this way different operators can be compiled +// in parallel. This must match the select routine in GRHydro_Reconstruct.cc +INSTANTIATE_RECONSTRUCTION_OPERATOR(GRHydro_TrivialReconstruct1d)
File [added]: GRHydro_TrivialReconstruct.hh Delta lines: +20 -0 =================================================================== --- trunk/src/GRHydro_TrivialReconstruct.hh (rev 0) +++ trunk/src/GRHydro_TrivialReconstruct.hh 2014-04-15 19:49:28 UTC (rev 625) @@ -0,0 +1,20 @@ +#ifndef _GRHYDRO_TRIVIALRECONSTRUCT_HH +#define _GRHYDRO_TRIVIALRECONSTRUCT_HH + +#include "cctk.h" + +/** + Trivial first-order reconstruction operator. +*/ +struct GRHydro_TrivialReconstruct1d { +template <int dir> +static inline void apply(const int nx, + const CCTK_REAL* const restrict a, + CCTK_REAL* const restrict aminus, + CCTK_REAL* const restrict aplus, + const cGH* const cctkGH, + const int j, const int k + ); +}; // end struct + +#endif // _GRHYDRO_TRIVIALRECONSTRUCT_HH
File [modified]: make.code.defn Delta lines: +1 -0 =================================================================== --- trunk/src/make.code.defn 2014-04-15 19:49:25 UTC (rev 624) +++ trunk/src/make.code.defn 2014-04-15 19:49:28 UTC (rev 625) @@ -88,6 +88,7 @@ GRHydro_ePPM.cc \ GRHydro_PPMReconstruct_drv_opt.cc \ GRHydro_WENOReconstruct.cc \ + GRHydro_TrivialReconstruct.cc \ GRHydro_MP5Reconstruct.cc \ GRHydro_Wrappers.F90 \ GRHydro_HLLE.cc