aboutsummaryrefslogtreecommitdiff
path: root/Source/Utils/WarpX_Complex.H
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Utils/WarpX_Complex.H')
-rw-r--r--Source/Utils/WarpX_Complex.H22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/Utils/WarpX_Complex.H b/Source/Utils/WarpX_Complex.H
new file mode 100644
index 000000000..f04e134c7
--- /dev/null
+++ b/Source/Utils/WarpX_Complex.H
@@ -0,0 +1,22 @@
+#ifndef WARPX_COMPLEX_H_
+#define WARPX_COMPLEX_H_
+
+#include <AMReX_REAL.H>
+
+// Define complex type on GPU/CPU
+#ifdef AMREX_USE_GPU
+
+#include <thrust/complex.h>
+using Complex = thrust::complex<amrex::Real>;
+
+#else
+
+#include <complex>
+using Complex = std::complex<amrex::Real>;
+
+#endif
+
+static_assert(sizeof(Complex) == sizeof(amrex::Real[2]),
+ "Unexpected complex type.");
+
+#endif //WARPX_COMPLEX_H_