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

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

#include <RFieldDft.h>

Inheritance diagram for Pscf::Pspc::RFieldDft< D >:
Pscf::Field< fftw_complex > Util::DArray< Data > Util::Array< Data >

Public Member Functions

 RFieldDft ()
 Default constructor. More...
 
 RFieldDft (RFieldDft< D > const &other)
 Copy constructor. More...
 
virtual ~RFieldDft ()
 Destructor. More...
 
RFieldDft< D > & operator= (RFieldDft< D > const &other)
 Assignment operator. More...
 
void allocate (IntVec< D > const &meshDimensions)
 Allocate the underlying C array for an FFT grid. More...
 
IntVec< D > const & meshDimensions () const
 Return vector of spatial mesh dimensions by constant reference. More...
 
IntVec< D > const & dftDimensions () const
 Return vector of dft (Fourier) grid dimensions by constant reference. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialize a Field to/from an Archive. More...
 
- Public Member Functions inherited from Pscf::Field< fftw_complex >
 Field ()
 Constructor. More...
 
 Field (Field< fftw_complex > const &other)
 Copy constructor. More...
 
Field< fftw_complex > & operator= (Field< fftw_complex > const &other)
 Assignment operator. More...
 
Field< fftw_complex > & operator= (fftw_complex &scalar)
 Assignment - assign all elements to a common scalar. More...
 
Field< fftw_complex > & operator+= (Field< fftw_complex > &other)
 Increment operator - add one field by another. More...
 
Field< fftw_complex > & operator-= (Field< fftw_complex > &other)
 Decrement operator - subtract one field from another. More...
 
Field< fftw_complex > & operator*= (fftw_complex scalar)
 Multiplication operator - multiply one field by a scalar. More...
 
Field< fftw_complex > & operator*= (Field< fftw_complex > &other)
 Pointwise multipication of one field by another. More...
 
void setToZero ()
 Set all elements to zero. More...
 
fftw_complex average () const
 Compute and return average of all elements. More...
 
- Public Member Functions inherited from Util::DArray< Data >
 DArray ()
 Default constructor. More...
 
 DArray (DArray< Data > const &other)
 Copy constructor. More...
 
virtual ~DArray ()
 Destructor. More...
 
DArray< Data > & operator= (DArray< Data > const &other)
 Assignment operator. More...
 
void allocate (int capacity)
 Allocate the underlying C array. More...
 
void deallocate ()
 Dellocate the underlying C array. More...
 
void reallocate (int capacity)
 Reallocate the underlying C array and copy to new location. More...
 
bool isAllocated () const
 Return true if this DArray has been allocated, false otherwise. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialize a DArray to/from an Archive. More...
 
- Public Member Functions inherited from Util::Array< Data >
virtual ~Array ()
 Destructor. More...
 
int capacity () const
 Return allocated size. More...
 
void begin (ArrayIterator< Data > &iterator)
 Set an iterator to begin this Array. More...
 
void begin (ConstArrayIterator< Data > &iterator) const
 Set a const iterator to begin this Array. More...
 
Data & operator[] (int i)
 Get an element by non-const reference. More...
 
Data const & operator[] (int i) const
 Get an element by const reference. More...
 
Data * cArray ()
 Return a pointer to the underlying C array. More...
 
Data const * cArray () const
 Return pointer to const to the underlying C array. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Util::Array< Data >
 Array ()
 Default constructor. More...
 
- Protected Attributes inherited from Util::Array< Data >
Data * data_
 Pointer to an array of Data elements. More...
 
int capacity_
 Allocated size of the data_ array. More...
 

Detailed Description

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

Fourier transform of a real field on an FFT mesh.

Definition at line 30 of file RFieldDft.h.

Constructor & Destructor Documentation

◆ RFieldDft() [1/2]

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

Default constructor.

Definition at line 22 of file RFieldDft.tpp.

◆ RFieldDft() [2/2]

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

Copy constructor.

Allocates new memory and copies all elements by value.

Parameters
otherthe RFieldDft to be copied.

Definition at line 41 of file RFieldDft.tpp.

References Util::Array< Data >::capacity_, Util::Array< Data >::data_, Util::DArray< Data >::isAllocated(), and UTIL_THROW.

◆ ~RFieldDft()

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

Destructor.

Deletes underlying C array, if allocated previously.

Definition at line 30 of file RFieldDft.tpp.

Member Function Documentation

◆ operator=()

template<int D>
RFieldDft< D > & Pscf::Pspc::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 68 of file RFieldDft.tpp.

References Util::Array< Data >::capacity(), Util::Array< Data >::capacity_, Util::Array< Data >::data_, Util::DArray< Data >::isAllocated(), and UTIL_THROW.

◆ allocate()

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

Allocate the underlying C array for an FFT grid.

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

Definition at line 116 of file RFieldDft.h.

References Pscf::Pspc::Field< Data >::allocate(), and UTIL_CHECK.

Referenced by Pscf::Pspc::Mask< D >::phiTot(), and Pscf::Pspc::FFT< D >::setup().

◆ meshDimensions()

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

Return vector of spatial mesh dimensions by constant reference.

Definition at line 137 of file RFieldDft.h.

Referenced by Pscf::Pspc::FFT< D >::forwardTransform(), Pscf::Pspc::FFT< D >::inverseTransform(), and Pscf::Pspc::FFT< D >::setup().

◆ dftDimensions()

template<int D>
IntVec< D > const & Pscf::Pspc::RFieldDft< D >::dftDimensions
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 144 of file RFieldDft.h.

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

◆ serialize()

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

Serialize a Field to/from an Archive.

Parameters
ararchive
versionarchive version id

Definition at line 152 of file RFieldDft.h.

References Pscf::Pspc::Field< Data >::serialize().


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