diff options
Diffstat (limited to 'Source/FieldSolver/SpectralSolver')
5 files changed, 24 insertions, 30 deletions
diff --git a/Source/FieldSolver/SpectralSolver/Make.package b/Source/FieldSolver/SpectralSolver/Make.package index b0ee54095..205b363f2 100644 --- a/Source/FieldSolver/SpectralSolver/Make.package +++ b/Source/FieldSolver/SpectralSolver/Make.package @@ -1,4 +1,4 @@ -CEXE_headers += WarpX_Complex.H +CEXE_headers += WarpX_ComplexForFFT.H CEXE_headers += SpectralSolver.H CEXE_sources += SpectralSolver.cpp CEXE_headers += SpectralFieldData.H diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.H b/Source/FieldSolver/SpectralSolver/SpectralFieldData.H index 6a2446981..01ca11083 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralFieldData.H +++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.H @@ -1,7 +1,7 @@ #ifndef WARPX_SPECTRAL_FIELD_DATA_H_ #define WARPX_SPECTRAL_FIELD_DATA_H_ -#include <WarpX_Complex.H> +#include <WarpX_ComplexForFFT.H> #include <SpectralKSpace.H> #include <AMReX_MultiFab.H> diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H index ae7124b2e..a73356dca 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H +++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H @@ -1,7 +1,7 @@ #ifndef WARPX_SPECTRAL_K_SPACE_H_ #define WARPX_SPECTRAL_K_SPACE_H_ -#include <WarpX_Complex.H> +#include <WarpX_ComplexForFFT.H> #include <AMReX_BoxArray.H> #include <AMReX_LayoutData.H> diff --git a/Source/FieldSolver/SpectralSolver/WarpX_Complex.H b/Source/FieldSolver/SpectralSolver/WarpX_Complex.H deleted file mode 100644 index c898c5baa..000000000 --- a/Source/FieldSolver/SpectralSolver/WarpX_Complex.H +++ /dev/null @@ -1,27 +0,0 @@ -#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_ diff --git a/Source/FieldSolver/SpectralSolver/WarpX_ComplexForFFT.H b/Source/FieldSolver/SpectralSolver/WarpX_ComplexForFFT.H new file mode 100644 index 000000000..43c7a1950 --- /dev/null +++ b/Source/FieldSolver/SpectralSolver/WarpX_ComplexForFFT.H @@ -0,0 +1,21 @@ +#ifndef WARPX_COMPLEXFORFFT_H_ +#define WARPX_COMPLEXFORFFT_H_ + +#include <WarpX_Complex.H> + +// Check the complex type on GPU/CPU +#ifdef AMREX_USE_GPU + +#include <cufft.h> +static_assert( sizeof(Complex) == sizeof(cuDoubleComplex), + "The complex types in WarpX and cuFFT do not match."); + +#else + +#include <fftw3.h> +static_assert( sizeof(Complex) == sizeof(fftw_complex), + "The complex types in WarpX and FFTW do not match."); + +#endif + +#endif //WARPX_COMPLEXFORFFT_H_ |