aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/Pusher/GetAndSetPosition.H
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Particles/Pusher/GetAndSetPosition.H')
-rw-r--r--Source/Particles/Pusher/GetAndSetPosition.H35
1 files changed, 30 insertions, 5 deletions
diff --git a/Source/Particles/Pusher/GetAndSetPosition.H b/Source/Particles/Pusher/GetAndSetPosition.H
index b0f1257f5..4df1ef3c1 100644
--- a/Source/Particles/Pusher/GetAndSetPosition.H
+++ b/Source/Particles/Pusher/GetAndSetPosition.H
@@ -35,10 +35,14 @@ void get_particle_position (const WarpXParticleContainer::SuperParticleType& p,
x = p.pos(0);
y = p.pos(1);
z = p.pos(2);
-#else
+#elif WARPX_DIM_XZ
x = p.pos(0);
y = amrex::ParticleReal(0.0);
z = p.pos(1);
+#else
+ x = amrex::ParticleReal(0.0);
+ y = amrex::ParticleReal(0.0);
+ z = p.pos(0);
#endif
}
@@ -55,6 +59,9 @@ struct GetParticlePosition
const RType* m_theta = nullptr;
#elif (AMREX_SPACEDIM == 2)
static constexpr RType m_y_default = RType(0.0);
+#elif (AMREX_SPACEDIM == 1)
+ static constexpr RType m_x_default = RType(0.0);
+ static constexpr RType m_y_default = RType(0.0);
#endif
GetParticlePosition () = default;
@@ -93,10 +100,14 @@ struct GetParticlePosition
x = p.pos(0);
y = p.pos(1);
z = p.pos(2);
-#else
+#elif WARPX_DIM_XZ
x = p.pos(0);
y = m_y_default;
z = p.pos(1);
+#else
+ x = m_x_default;
+ y = m_y_default;
+ z = p.pos(0);
#endif
}
@@ -117,10 +128,14 @@ struct GetParticlePosition
x = p.pos(0);
y = p.pos(1);
z = p.pos(2);
-#else
+#elif WARPX_DIM_XZ
x = p.pos(0);
y = m_y_default;
z = p.pos(1);
+#else
+ x = m_x_default;
+ y = m_y_default;
+ z = p.pos(0);
#endif
}
};
@@ -158,6 +173,9 @@ struct SetParticlePosition
#if defined(WARPX_DIM_XZ)
amrex::ignore_unused(y);
#endif
+#if defined(WARPX_DIM_1D_Z)
+ amrex::ignore_unused(x,y);
+#endif
#ifdef WARPX_DIM_RZ
m_theta[i] = std::atan2(y, x);
m_structs[i].pos(0) = std::sqrt(x*x + y*y);
@@ -166,9 +184,11 @@ struct SetParticlePosition
m_structs[i].pos(0) = x;
m_structs[i].pos(1) = y;
m_structs[i].pos(2) = z;
-#else
+#elif WARPX_DIM_XZ
m_structs[i].pos(0) = x;
m_structs[i].pos(1) = z;
+#else
+ m_structs[i].pos(0) = z;
#endif
}
@@ -182,6 +202,9 @@ struct SetParticlePosition
#if defined(WARPX_DIM_XZ)
amrex::ignore_unused(y);
#endif
+#if defined(WARPX_DIM_1D_Z)
+ amrex::ignore_unused(x,y);
+#endif
#ifdef WARPX_DIM_RZ
m_structs[i].pos(0) = x;
m_theta[i] = y;
@@ -190,9 +213,11 @@ struct SetParticlePosition
m_structs[i].pos(0) = x;
m_structs[i].pos(1) = y;
m_structs[i].pos(2) = z;
-#else
+#elif WARPX_DIM_XZ
m_structs[i].pos(0) = x;
m_structs[i].pos(1) = z;
+#else
+ m_structs[i].pos(0) = z;
#endif
}
};