PSCF v1.2
|
Fourier transform wrapper. More...
#include <FFT.h>
Public Member Functions | |
FFT () | |
Default constructor. | |
virtual | ~FFT () |
Destructor. | |
void | setup (IntVec< D > const &meshDimensions) |
Setup grid dimensions, FFT plans and work space. | |
void | forwardTransform (RField< D > const &in, RFieldDft< D > &out) const |
Compute forward (real-to-complex) discrete Fourier transform. | |
void | inverseTransformUnsafe (RFieldDft< D > &in, RField< D > &out) const |
Compute inverse (complex-to-real) DFT, overwriting the input. | |
void | inverseTransformSafe (RFieldDft< D > const &in, RField< D > &out) const |
Compute inverse (complex-to-real) DFT without overwriting input. | |
void | forwardTransform (CField< D > const &in, CField< D > &out) const |
Compute forward (complex-to-complex) discrete Fourier transform. | |
void | inverseTransform (CField< D > const &in, CField< D > &out) const |
Compute complex-to-complex inverse Fourier transform. | |
IntVec< D > const & | meshDimensions () const |
Return the dimensions of the grid for which this was setup. | |
bool | isSetup () const |
Has this FFT object been setup? | |
Fourier transform wrapper.
Definition at line 25 of file rpc/solvers/Mixture.h.
Pscf::Prdc::Cuda::FFT< D >::FFT | ( | ) |
Default constructor.
Definition at line 57 of file cpu/FFT.tpp.
|
virtual |
Destructor.
Definition at line 72 of file cpu/FFT.tpp.
void Pscf::Prdc::Cuda::FFT< D >::setup | ( | IntVec< D > const & | meshDimensions | ) |
Setup grid dimensions, FFT plans and work space.
meshDimensions | Dimensions of real-space grid. |
Definition at line 92 of file cpu/FFT.tpp.
References Pscf::Prdc::Cpu::CField< D >::allocate(), Pscf::Prdc::Cpu::RField< D >::allocate(), Util::Array< Data >::capacity(), Pscf::Prdc::Cpu::CField< D >::meshDimensions(), Pscf::Prdc::Cpu::RField< D >::meshDimensions(), and UTIL_CHECK.
void Pscf::Prdc::Cuda::FFT< D >::forwardTransform | ( | RField< D > const & | in, |
RFieldDft< D > & | out ) const |
Compute forward (real-to-complex) discrete Fourier transform.
The resulting complex array is the output of FFTW's forward transform method scaled by a factor of 1/N (where N is the number of grid points). The scaling ensures that a round-trip Fourier transform (forward + inverse) reproduces the original input array.
This function does not overwrite or corrupt the input array.
in | array of real values on r-space grid |
out | array of complex values on k-space grid |
Definition at line 151 of file cpu/FFT.tpp.
References Util::Array< Data >::capacity(), Pscf::Prdc::Cpu::RField< D >::meshDimensions(), Pscf::Prdc::Cpu::RFieldDft< D >::meshDimensions(), and UTIL_CHECK.
void Pscf::Prdc::Cuda::FFT< D >::inverseTransformUnsafe | ( | RFieldDft< D > & | in, |
RField< D > & | out ) const |
Compute inverse (complex-to-real) DFT, overwriting the input.
The resulting real array is the unaltered output of FFTW's inverse transform function.
NOTE: The inverse transform generally overwrites and corrupts its input. This is the behavior of the complex-to-real (c2r) transform of the underlying FFTW library. See Sec. 2.3 of the FFTW 3 documentation at https://www.fftw.org/fftw3_doc, One-Dimensional DFTs of Real Data: "...the inverse transform (complex to real) has the side-effect of overwriting its input array, ..."
in | array of complex values on k-space grid (overwritten) |
out | array of real values on r-space grid |
Definition at line 179 of file cpu/FFT.tpp.
References Util::Array< Data >::capacity(), Pscf::Prdc::Cpu::RField< D >::meshDimensions(), Pscf::Prdc::Cpu::RFieldDft< D >::meshDimensions(), and UTIL_CHECK.
void Pscf::Prdc::Cuda::FFT< D >::inverseTransformSafe | ( | RFieldDft< D > const & | in, |
RField< D > & | out ) const |
Compute inverse (complex-to-real) DFT without overwriting input.
The resulting real array is the unaltered output of FFTW's inverse transform function.
This function makes a copy of the input data and passes the copy to inverseTransformUnsafe to avoid overwriting the input data.
in | array of complex values on k-space grid |
out | array of real values on r-space grid |
Definition at line 197 of file cpu/FFT.tpp.
References Util::Array< Data >::capacity(), and UTIL_CHECK.
void Pscf::Prdc::Cuda::FFT< D >::forwardTransform | ( | CField< D > const & | in, |
CField< D > & | out ) const |
Compute forward (complex-to-complex) discrete Fourier transform.
The resulting complex array is the output of FFTW's forward transform method scaled by a factor of 1/N (where N is the number of grid points). The scaling ensures that a round-trip Fourier transform (forward + inverse) reproduces the original input array.
This function does not overwrite or corrupt the input array.
Note that, in this transform, the k-space grid is the same size as the r-space grid, which differs from the real-to-complex transform.
in | array of complex values on r-space grid |
out | array of complex values on k-space grid |
Definition at line 214 of file cpu/FFT.tpp.
References Util::Array< Data >::capacity(), Pscf::Prdc::Cpu::CField< D >::meshDimensions(), and UTIL_CHECK.
void Pscf::Prdc::Cuda::FFT< D >::inverseTransform | ( | CField< D > const & | in, |
CField< D > & | out ) const |
Compute complex-to-complex inverse Fourier transform.
The resulting complex array is the unaltered output of FFTW's inverse transform function.
Note that, in this transform, the k-space grid is the same size as the r-space grid, which differs from the complex-to-real transform.
in | array of complex values on k-space grid |
out | array of complex values on r-space grid |
Definition at line 241 of file cpu/FFT.tpp.
References Util::Array< Data >::capacity(), Pscf::Prdc::Cpu::CField< D >::meshDimensions(), and UTIL_CHECK.
|
inline |
Return the dimensions of the grid for which this was setup.
Definition at line 217 of file cpu/FFT.h.
Referenced by Pscf::Rpc::Mixture< D >::associate(), Pscf::Rpg::Block< D >::associate(), and Pscf::Rpg::Mixture< D >::associate().
|
inline |
Has this FFT object been setup?
Definition at line 210 of file cpu/FFT.h.
Referenced by Pscf::Rpc::Mixture< D >::associate(), Pscf::Rpg::Block< D >::associate(), and Pscf::Rpg::Mixture< D >::associate().