From c55c6188ea2dafdc72764fabb35f01d0431f12ce Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Mon, 13 Jan 2020 08:46:38 -0800 Subject: Correct compilation errors --- .../FiniteDifferenceAlgorithms/YeeAlgorithm.H | 52 ++++++++++++++-------- 1 file changed, 33 insertions(+), 19 deletions(-) (limited to 'Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms') diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H index 7e32aebb4..54057091d 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H @@ -8,10 +8,10 @@ struct YeeAlgorithm { static void InitializeStencilCoefficients( - std::array cell_size, - amrex::Gpu::ManagedVector stencil_coefs_x, - amrex::Gpu::ManagedVector stencil_coefs_y, - amrex::Gpu::ManagedVector stencil_coefs_z ) { + std::array& cell_size, + amrex::Gpu::ManagedVector& stencil_coefs_x, + amrex::Gpu::ManagedVector& stencil_coefs_y, + amrex::Gpu::ManagedVector& stencil_coefs_z ) { // Store the inverse cell size along each direction in the coefficients stencil_coefs_x.resize(1); @@ -24,9 +24,9 @@ struct YeeAlgorithm { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real UpwardDx( - amrex::Array4 const F, - int const i, int const j, int const k, - amrex::Real const* coefs_x, int const n_coefs_x ) { + amrex::Array4 const& F, + amrex::Real const* coefs_x, int const n_coefs_x, + int const i, int const j, int const k ) { amrex::Real inv_dx = coefs_x[0]; return inv_dx*( F(i+1,j,k) - F(i,j,k) ); @@ -34,9 +34,9 @@ struct YeeAlgorithm { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real DownwardDx( - amrex::Array4 const F, - int const i, int const j, int const k, - amrex::Real const* coefs_x, int const n_coefs_x ) { + amrex::Array4 const& F, + amrex::Real const* coefs_x, int const n_coefs_x, + int const i, int const j, int const k ) { amrex::Real inv_dx = coefs_x[0]; return inv_dx*( F(i,j,k) - F(i-1,j,k) ); @@ -44,9 +44,9 @@ struct YeeAlgorithm { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real UpwardDy( - amrex::Array4 const F, - int const i, int const j, int const k, - amrex::Real const* coefs_y, int const n_coefs_y ) { + amrex::Array4 const& F, + amrex::Real const* coefs_y, int const n_coefs_y, + int const i, int const j, int const k ) { #if defined WARPX_DIM_3D amrex::Real inv_dy = coefs_y[0]; @@ -58,9 +58,9 @@ struct YeeAlgorithm { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real DownwardDy( - amrex::Array4 const F, - int const i, int const j, int const k, - amrex::Real const* coefs_y, int const n_coefs_y ) { + amrex::Array4 const& F, + amrex::Real const* coefs_y, int const n_coefs_y, + int const i, int const j, int const k ) { #if defined WARPX_DIM_3D amrex::Real inv_dy = coefs_y[0]; @@ -72,9 +72,9 @@ struct YeeAlgorithm { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real UpwardDz( - amrex::Array4 const F, - int const i, int const j, int const k, - amrex::Real const* coefs_z, int const n_coefs_z ) { + amrex::Array4 const& F, + amrex::Real const* coefs_z, int const n_coefs_z, + int const i, int const j, int const k ) { amrex::Real inv_dz = coefs_z[0]; #if defined WARPX_DIM_3D @@ -84,6 +84,20 @@ struct YeeAlgorithm { #endif }; + AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE + static amrex::Real DownwardDz( + amrex::Array4 const& F, + amrex::Real const* coefs_z, int const n_coefs_z, + int const i, int const j, int const k ) { + + amrex::Real inv_dz = coefs_z[0]; + #if defined WARPX_DIM_3D + return inv_dz*( F(i,j,k) - F(i,j,k-1) ); + #elif (defined WARPX_DIM_XZ) + return inv_dz*( F(i,j,k) - F(i,j-1,k) ); + #endif + }; + }; #endif // WARPX_FINITE_DIFFERENCE_ALGORITHM_YEE_H_ -- cgit v1.2.3