aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-04-26 20:44:35 -0700
committerGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-04-26 20:44:35 -0700
commitcd2fc39d1dae02510a9fda43eab698d044eb7bd5 (patch)
treed65288fdafc1e413701b513e5ee6357d79097e41 /Source/FieldSolver/SpectralSolver
parent07c720803c5dbc671164dd4ea6acf7175ff6f2ce (diff)
downloadWarpX-cd2fc39d1dae02510a9fda43eab698d044eb7bd5.tar.gz
WarpX-cd2fc39d1dae02510a9fda43eab698d044eb7bd5.tar.zst
WarpX-cd2fc39d1dae02510a9fda43eab698d044eb7bd5.zip
Add missing file
Diffstat (limited to 'Source/FieldSolver/SpectralSolver')
-rw-r--r--Source/FieldSolver/SpectralSolver/WarpX_Complex.H27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/FieldSolver/SpectralSolver/WarpX_Complex.H b/Source/FieldSolver/SpectralSolver/WarpX_Complex.H
new file mode 100644
index 000000000..c898c5baa
--- /dev/null
+++ b/Source/FieldSolver/SpectralSolver/WarpX_Complex.H
@@ -0,0 +1,27 @@
+#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>
+#include <cufft.h>
+using Complex = thrust::complex<amrex::Real>;
+static_assert( sizeof(Complex) == sizeof(cuDoubleComplex),
+ "The complex types in WarpX and cuFFT do not match.");
+
+#else
+
+#include <complex>
+#include <fftw3.h>
+using Complex = std::complex<amrex::Real>;
+static_assert( sizeof(Complex) == sizeof(fftw_complex),
+ "The complex types in WarpX and FFTW do not match.");
+
+#endif
+static_assert(sizeof(Complex) == sizeof(amrex::Real[2]),
+ "Unexpected complex type.");
+
+#endif //WARPX_COMPLEX_H_