7 #ifndef ABLASTR_NODALFIELDGATHER_H_
8 #define ABLASTR_NODALFIELDGATHER_H_
33 const amrex::ParticleReal yp,
34 const amrex::ParticleReal zp,
37 int&
i,
int& j,
int& k, amrex::Real W[AMREX_SPACEDIM][2]) noexcept
39 using namespace amrex::literals;
40 #if (defined WARPX_DIM_3D)
41 amrex::Real x = (xp - plo[0]) * dxi[0];
42 amrex::Real
y = (yp - plo[1]) * dxi[1];
43 amrex::Real
z = (zp - plo[2]) * dxi[2];
45 i =
static_cast<int>(amrex::Math::floor(x));
46 j =
static_cast<int>(amrex::Math::floor(
y));
47 k =
static_cast<int>(amrex::Math::floor(
z));
53 W[0][0] = 1.0_rt - W[0][1];
54 W[1][0] = 1.0_rt - W[1][1];
55 W[2][0] = 1.0_rt - W[2][1];
57 #elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
59 # if (defined WARPX_DIM_XZ)
60 amrex::Real x = (xp - plo[0]) * dxi[0];
62 i =
static_cast<int>(amrex::Math::floor(x));
64 # elif (defined WARPX_DIM_RZ)
65 amrex::Real r = (std::sqrt(xp*xp+yp*yp) - plo[0]) * dxi[0];
66 i =
static_cast<int>(amrex::Math::floor(r));
70 amrex::Real
z = (zp - plo[1]) * dxi[1];
71 j =
static_cast<int>(amrex::Math::floor(
z));
74 W[0][0] = 1.0_rt - W[0][1];
75 W[1][0] = 1.0_rt - W[1][1];
80 amrex::Abort(
"Error: compute_weights not yet implemented in 1D");
93 const amrex::Real W[AMREX_SPACEDIM][2],
96 amrex::Real
value = 0;
97 #if (defined WARPX_DIM_3D)
98 value += scalar_field(
i, j , k ) * W[0][0] * W[1][0] * W[2][0];
99 value += scalar_field(
i+1, j , k ) * W[0][1] * W[1][0] * W[2][0];
100 value += scalar_field(
i, j+1, k ) * W[0][0] * W[1][1] * W[2][0];
101 value += scalar_field(
i+1, j+1, k ) * W[0][1] * W[1][1] * W[2][0];
102 value += scalar_field(
i, j , k+1) * W[0][0] * W[1][0] * W[2][1];
103 value += scalar_field(
i+1, j , k+1) * W[0][1] * W[1][0] * W[2][1];
104 value += scalar_field(
i , j+1, k+1) * W[0][0] * W[1][1] * W[2][1];
105 value += scalar_field(
i+1, j+1, k+1) * W[0][1] * W[1][1] * W[2][1];
106 #elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
107 value += scalar_field(
i, j , k) * W[0][0] * W[1][0];
108 value += scalar_field(
i+1, j , k) * W[0][1] * W[1][0];
109 value += scalar_field(
i, j+1, k) * W[0][0] * W[1][1];
110 value += scalar_field(
i+1, j+1, k) * W[0][1] * W[1][1];
113 amrex::Abort(
"Error: interp_field not yet implemented in 1D");
129 const amrex::ParticleReal yp,
130 const amrex::ParticleReal zp,
137 amrex::Real W[AMREX_SPACEDIM][2];
155 const amrex::ParticleReal yp,
156 const amrex::ParticleReal zp,
165 amrex::Real W[AMREX_SPACEDIM][2];
#define AMREX_GPU_HOST_DEVICE
def y
Definition: Excitation_Flag_Generator.py:76
def z
Definition: Excitation_Flag_Generator.py:77
Definition: DepositCharge.H:22
AMREX_GPU_HOST_DEVICE AMREX_INLINE amrex::Real interp_field_nodal(int i, int j, int k, const amrex::Real W[AMREX_SPACEDIM][2], amrex::Array4< const amrex::Real > const &scalar_field) noexcept
Interpolate nodal field value based on surrounding indices and weights.
Definition: NodalFieldGather.H:92
AMREX_GPU_HOST_DEVICE AMREX_INLINE void compute_weights_nodal(const amrex::ParticleReal xp, const amrex::ParticleReal yp, const amrex::ParticleReal zp, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &plo, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &dxi, int &i, int &j, int &k, amrex::Real W[AMREX_SPACEDIM][2]) noexcept
Compute weight of each surrounding node in interpolating a nodal field to the given coordinates.
Definition: NodalFieldGather.H:32
AMREX_GPU_HOST_DEVICE AMREX_INLINE amrex::Real doGatherScalarFieldNodal(const amrex::ParticleReal xp, const amrex::ParticleReal yp, const amrex::ParticleReal zp, amrex::Array4< const amrex::Real > const &scalar_field, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &dxi, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &lo) noexcept
Scalar field gather for a single particle. The field has to be defined at the cell nodes (see https:/...
Definition: NodalFieldGather.H:128
AMREX_GPU_HOST_DEVICE AMREX_INLINE amrex::GpuArray< amrex::Real, 3 > doGatherVectorFieldNodal(const amrex::ParticleReal xp, const amrex::ParticleReal yp, const amrex::ParticleReal zp, amrex::Array4< const amrex::Real > const &vector_field_x, amrex::Array4< const amrex::Real > const &vector_field_y, amrex::Array4< const amrex::Real > const &vector_field_z, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &dxi, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &lo) noexcept
Vector field gather for a single particle. The field has to be defined at the cell nodes (see https:/...
Definition: NodalFieldGather.H:154
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
void Abort(const std::string &msg)
i
Definition: check_interp_points_and_weights.py:174
ii
Definition: check_interp_points_and_weights.py:148
jj
Definition: check_interp_points_and_weights.py:160
value
Definition: updateAMReX.py:141