aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver/WarpX_Complex.H
blob: c898c5baa7edb22f87d6fc67ed2450516ed185fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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_