PSCF v1.4.0
Pscf::Prdc::Cpu::RFieldDft< D > Class Template Reference

Fourier transform of a real field on an FFT mesh. More...

#include <RFieldDft.h>

Inheritance diagram for Pscf::Prdc::Cpu::RFieldDft< D >:
Pscf::Prdc::Cpu::FftwDArray< fftw_complex > Util::Array< fftw_complex >

Public Types

using RealType = double
 Type of real and imaginary parts of a complex element value.
Public Types inherited from Pscf::Prdc::Cpu::FftwDArray< fftw_complex >
using ValueType
 Data type of each array element.

Public Member Functions

 RFieldDft ()
 Default constructor.
 RFieldDft (RFieldDft< D > const &other)
 Copy constructor.
virtual ~RFieldDft ()
 Destructor.
RFieldDft< D > & operator= (RFieldDft< D > const &other)
 Assignment operator.
void allocate (IntVec< D > const &meshDimensions)
 Allocate the underlying C array and set mesh dimensions.
virtual void deallocate ()
 Deallocate underlying C array and clear mesh dimensions.
IntVec< D > const & meshDimensions () const
 Return vector of spatial mesh dimensions by constant reference.
IntVec< D > const & dftDimensions () const
 Return vector of dft (Fourier) grid dimensions by constant reference.
template<class Archive>
void serialize (Archive &ar, const unsigned int version)
 Serialize a Field to/from an Archive.
Public Member Functions inherited from Pscf::Prdc::Cpu::FftwDArray< fftw_complex >
 FftwDArray ()
 Default constructor.
virtual ~FftwDArray ()
 Destructor.
void allocate (int capacity)
 Allocate the underlying C array.
bool isAllocated () const
 Return true if the FftwDArray has been allocated, false otherwise.
void serialize (Archive &ar, const unsigned int version)
 Serialize a FftwDArray to/from an Archive.
Public Member Functions inherited from Util::Array< fftw_complex >
int capacity () const
 Return allocated size.
void begin (ArrayIterator< fftw_complex > &iterator)
 Set an iterator to begin this Array.
fftw_complex & operator[] (int i)
 Get an element by non-const reference.
fftw_complex * cArray ()
 Return a pointer to the underlying C array.

Additional Inherited Members

Protected Member Functions inherited from Util::Array< fftw_complex >
 ~Array ()
 Destructor (protected to prevent direct destruction).
Protected Attributes inherited from Util::Array< fftw_complex >
fftw_complex * data_
 Pointer to an array of Data elements.
int capacity_
 Allocated size of the data_ array.

Detailed Description

template<int D>
class Pscf::Prdc::Cpu::RFieldDft< D >

Fourier transform of a real field on an FFT mesh.

Definition at line 28 of file cpu/RFieldDft.h.

Member Typedef Documentation

◆ RealType

template<int D>
using Pscf::Prdc::Cpu::RFieldDft< D >::RealType = double

Type of real and imaginary parts of a complex element value.

Definition at line 40 of file cpu/RFieldDft.h.

Constructor & Destructor Documentation

◆ RFieldDft() [1/2]

template<int D>
Pscf::Prdc::Cpu::RFieldDft< D >::RFieldDft ( )

Default constructor.

Definition at line 24 of file cpu/RFieldDft.tpp.

References Pscf::Prdc::Cpu::FftwDArray< fftw_complex >::FftwDArray().

Referenced by operator=(), and RFieldDft().

◆ RFieldDft() [2/2]

template<int D>
Pscf::Prdc::Cpu::RFieldDft< D >::RFieldDft ( RFieldDft< D > const & other)

◆ ~RFieldDft()

template<int D>
Pscf::Prdc::Cpu::RFieldDft< D >::~RFieldDft ( )
virtual

Destructor.

Deletes underlying C array, if allocated previously.

Definition at line 34 of file cpu/RFieldDft.tpp.

Member Function Documentation

◆ operator=()

template<int D>
RFieldDft< D > & Pscf::Prdc::Cpu::RFieldDft< D >::operator= ( RFieldDft< D > const & other)

Assignment operator.

If this Field is not allocated, allocates and copies all elements.

If this and the other Field are both allocated, the capacities must be exactly equal. If so, this method copies all elements.

Parameters
otherthe RHS Field

Definition at line 69 of file cpu/RFieldDft.tpp.

References allocate(), Util::Array< Data >::capacity_, Util::Array< fftw_complex >::capacity_, Util::Array< Data >::data_, Util::Array< fftw_complex >::data_, Pscf::Prdc::Cpu::FftwDArray< Data >::isAllocated(), Pscf::Prdc::Cpu::FftwDArray< fftw_complex >::isAllocated(), RFieldDft(), UTIL_CHECK, and UTIL_THROW.

◆ allocate()

template<int D>
void Pscf::Prdc::Cpu::RFieldDft< D >::allocate ( IntVec< D > const & meshDimensions)

Allocate the underlying C array and set mesh dimensions.

Exceptions
Exceptionif the RFieldDft is already allocated.
Parameters
meshDimensionsvector of grid points in each direction

Definition at line 100 of file cpu/RFieldDft.tpp.

References Pscf::Prdc::Cpu::FftwDArray< Data >::allocate(), Pscf::Prdc::Cpu::FFT< D >::computeKMesh(), meshDimensions(), and UTIL_CHECK.

Referenced by operator=(), and RFieldDft().

◆ deallocate()

template<int D>
void Pscf::Prdc::Cpu::RFieldDft< D >::deallocate ( )
virtual

Deallocate underlying C array and clear mesh dimensions.

Reimplemented from Pscf::Prdc::Cpu::FftwDArray< fftw_complex >.

Definition at line 120 of file cpu/RFieldDft.tpp.

References Pscf::Prdc::Cpu::FftwDArray< Data >::deallocate().

◆ meshDimensions()

template<int D>
IntVec< D > const & Pscf::Prdc::Cpu::RFieldDft< D >::meshDimensions ( ) const
inline

Return vector of spatial mesh dimensions by constant reference.

Definition at line 130 of file cpu/RFieldDft.h.

Referenced by allocate(), Pscf::Prdc::Cpu::FFT< D >::forwardTransform(), and Pscf::Prdc::Cpu::FFT< D >::inverseTransformUnsafe().

◆ dftDimensions()

template<int D>
IntVec< D > const & Pscf::Prdc::Cpu::RFieldDft< D >::dftDimensions ( ) const
inline

Return vector of dft (Fourier) grid dimensions by constant reference.

The last element of dftDimensions() and meshDimensions() differ by about a factor of two: dftDimension()[D-1] = meshDimensions()/2 + 1. For D > 1, other elements are equal.

Definition at line 137 of file cpu/RFieldDft.h.

Referenced by Pscf::Rpc::FieldIo< D >::convertBasisToKGrid(), Pscf::Rpc::FieldIo< D >::convertKGridToBasis(), and Pscf::Rpc::FieldIo< D >::hasSymmetry().

◆ serialize()

template<int D>
template<class Archive>
void Pscf::Prdc::Cpu::RFieldDft< D >::serialize ( Archive & ar,
const unsigned int version )

Serialize a Field to/from an Archive.

Parameters
ararchive
versionarchive version id

Definition at line 145 of file cpu/RFieldDft.h.

References Pscf::Prdc::Cpu::FftwDArray< Data >::serialize().


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