aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/PicsarHybridSpectralSolver/PicsarHybridFFTData.H
blob: 4e97ab675bd2a3d7da817ac7c535ebadb386852a (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
28
29
30
31
32
#ifndef WARPX_PICSAR_HYBRID_FFTDATA_H_
#define WARPX_PICSAR_HYBRID_FFTDATA_H_

// FFTData is a stuct containing a 22 pointers to auxiliary arrays
// 1-11: padded arrays in real space (required by FFTW); 12-22: arrays in spectral space
struct FFTData
{
    static constexpr int N = 22;
    void* data[N] = { nullptr };

    ~FFTData () {
        for (int i = 0; i < N; ++i) { // The memory is allocated with fftw_alloc.
            fftw_free(data[i]);
            data[i] = nullptr;
        }
    }

    FFTData () = default;

    FFTData (FFTData && rhs) noexcept {
        for (int i = 0; i < N; ++i) {
            data[i] = rhs.data[i];
            rhs.data[i] = nullptr;
        }
    }

    FFTData (FFTData const&) = delete;
    void operator= (FFTData const&) = delete;
    void operator= (FFTData&&) = delete;
};

#endif // WARPX_PICSAR_HYBRID_FFTDATA_H_