PSCF v1.1
Public Member Functions | List of all members
Pscf::Pspc::FFT< D > Class Template Reference

Fourier transform wrapper for real data. More...

#include <FFT.h>

Public Member Functions

 FFT ()
 Default constructor. More...
 
virtual ~FFT ()
 Destructor. More...
 
void setup (IntVec< D > const &meshDimensions)
 Setup grid dimensions, plans and work space. More...
 
void setup (RField< D > &rField, RFieldDft< D > &kField)
 Setup grid dimensions, plans and work space. More...
 
void forwardTransform (RField< D > const &in, RFieldDft< D > &out) const
 Compute forward (real-to-complex) Fourier transform. More...
 
void inverseTransform (RFieldDft< D > &in, RField< D > &out) const
 Compute inverse (complex-to-real) Fourier transform. More...
 
void inverseTransformSafe (RFieldDft< D > const &in, RField< D > &out) const
 Compute inverse (complex-to-real) Fourier transform without destroying input. More...
 
IntVec< D > const & meshDimensions () const
 Return the dimensions of the grid for which this was allocated. More...
 
bool isSetup () const
 Has this FFT object been setup? More...
 

Detailed Description

template<int D>
class Pscf::Pspc::FFT< D >

Fourier transform wrapper for real data.

Definition at line 30 of file pspc/field/FFT.h.

Constructor & Destructor Documentation

◆ FFT()

template<int D>
Pscf::Pspc::FFT< D >::FFT

Default constructor.

Definition at line 23 of file pspc/field/FFT.tpp.

◆ ~FFT()

template<int D>
Pscf::Pspc::FFT< D >::~FFT
virtual

Destructor.

Definition at line 37 of file pspc/field/FFT.tpp.

Member Function Documentation

◆ setup() [1/2]

template<int D>
void Pscf::Pspc::FFT< D >::setup ( IntVec< D > const &  meshDimensions)

Setup grid dimensions, plans and work space.

Parameters
meshDimensionsDimensions of real-space grid.

Definition at line 51 of file pspc/field/FFT.tpp.

References Pscf::Pspc::RField< D >::allocate(), Pscf::Pspc::RFieldDft< D >::allocate(), and UTIL_CHECK.

◆ setup() [2/2]

template<int D>
void Pscf::Pspc::FFT< D >::setup ( RField< D > &  rField,
RFieldDft< D > &  kField 
)

Setup grid dimensions, plans and work space.

Parameters
rFieldreal data on r-space grid
kFieldcomplex data on k-space grid

Definition at line 69 of file pspc/field/FFT.tpp.

References Util::Array< Data >::capacity(), Pscf::Pspc::RField< D >::meshDimensions(), Pscf::Pspc::RFieldDft< D >::meshDimensions(), and UTIL_CHECK.

◆ forwardTransform()

template<int D>
void Pscf::Pspc::FFT< D >::forwardTransform ( RField< D > const &  in,
RFieldDft< D > &  out 
) const

Compute forward (real-to-complex) Fourier transform.

This function computes a scaled Fourier transform, which is obtained by dividing the unscaled transform computed by FFTW by the number of elements. A scaled copy of the input data is copied to a temporary real array before being passed to the FFT forward transform function.

This function does not overwrite or corrupt the input array.

Parameters
inarray of real values on r-space grid
outarray of complex values on k-space grid

Definition at line 125 of file pspc/field/FFT.tpp.

References Util::Array< Data >::capacity(), Pscf::Pspc::RField< D >::meshDimensions(), Pscf::Pspc::RFieldDft< D >::meshDimensions(), and UTIL_CHECK.

◆ inverseTransform()

template<int D>
void Pscf::Pspc::FFT< D >::inverseTransform ( RFieldDft< D > &  in,
RField< D > &  out 
) const

Compute inverse (complex-to-real) Fourier transform.

This function computes the same unscaled inverse transform as the FFTW library.

NOTE: The inverse transform generally overwrites and corrupts its input. This is the behavior of the complex-to-real transform of the underlying FFTW library. See Sec. 2.3 of the FFTW 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, ..."

Parameters
inarray of complex values on k-space grid (overwritten)
outarray of real values on r-space grid

Definition at line 149 of file pspc/field/FFT.tpp.

References Util::Array< Data >::capacity(), Pscf::Pspc::RField< D >::meshDimensions(), Pscf::Pspc::RFieldDft< D >::meshDimensions(), and UTIL_CHECK.

◆ inverseTransformSafe()

template<int D>
void Pscf::Pspc::FFT< D >::inverseTransformSafe ( RFieldDft< D > const &  in,
RField< D > &  out 
) const

Compute inverse (complex-to-real) Fourier transform without destroying input.

Parameters
inarray of complex values on k-space grid
outarray of real values on r-space grid

Definition at line 166 of file pspc/field/FFT.tpp.

References Util::Array< Data >::capacity(), and UTIL_CHECK.

◆ meshDimensions()

template<int D>
IntVec< D > const & Pscf::Pspc::FFT< D >::meshDimensions
inline

Return the dimensions of the grid for which this was allocated.

Definition at line 166 of file pspc/field/FFT.h.

◆ isSetup()

template<int D>
bool Pscf::Pspc::FFT< D >::isSetup
inline

Has this FFT object been setup?

Definition at line 159 of file pspc/field/FFT.h.


The documentation for this class was generated from the following files: