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

Discrete Fourier Transform (DFT) of a real field on an FFT mesh. More...

#include <RDFieldDft.h>

Inheritance diagram for Pscf::Pspg::RDFieldDft< D >:
Pscf::Pspg::DField< cudaComplex >

Public Member Functions

 RDFieldDft ()
 Default constructor. More...
 
 RDFieldDft (const RDFieldDft< D > &other)
 Copy constructor. More...
 
virtual ~RDFieldDft ()
 Destructor. More...
 
RDFieldDft< D > & operator= (const RDFieldDft< D > &other)
 Assignment operator. More...
 
void allocate (const IntVec< D > &meshDimensions)
 Allocate the underlying C array for an FFT grid. More...
 
const IntVec< D > & meshDimensions () const
 Return vector of mesh dimensions by constant reference. More...
 
const IntVec< D > & dftDimensions () const
 Return vector of dft (Fourier) grid dimensions by const 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::Pspg::DField< cudaComplex >
 DField ()
 Default constructor. More...
 
 DField (const DField &other)
 Copy constructor. More...
 
virtual ~DField ()
 Destructor. More...
 
void allocate (int capacity)
 Allocate the underlying C array on the device. More...
 
void deallocate ()
 Dellocate the underlying C array. More...
 
bool isAllocated () const
 Return true if the Field has been allocated, false otherwise. More...
 
int capacity () const
 Return allocated size. More...
 
cudaComplex * cDField ()
 Return pointer to underlying C array. More...
 
const cudaComplex * cDField () const
 Return pointer to const to underlying C array. More...
 
virtual DField< cudaComplex > & operator= (const DField< cudaComplex > &other)
 Assignment operator. More...
 

Additional Inherited Members

- Protected Attributes inherited from Pscf::Pspg::DField< cudaComplex >
cudaComplex * data_
 Pointer to an array of Data elements on the device / GPU. More...
 
int capacity_
 Allocated size of the data_ array. More...
 

Detailed Description

template<int D>
class Pscf::Pspg::RDFieldDft< D >

Discrete Fourier Transform (DFT) of a real field on an FFT mesh.

The DFT is stored internally as a C array of cudaComplex elements located in global GPU memory. All member functions are C++ functions that can be called from the host CPU.

Definition at line 34 of file RDFieldDft.h.

Constructor & Destructor Documentation

◆ RDFieldDft() [1/2]

template<int D>
Pscf::Pspg::RDFieldDft< D >::RDFieldDft

Default constructor.

Definition at line 22 of file RDFieldDft.tpp.

◆ RDFieldDft() [2/2]

template<int D>
Pscf::Pspg::RDFieldDft< D >::RDFieldDft ( const RDFieldDft< D > &  other)

Copy constructor.

Allocates new memory and copies all elements by value.

Parameters
otherthe RDFieldDft to be copied.

Definition at line 41 of file RDFieldDft.tpp.

◆ ~RDFieldDft()

template<int D>
Pscf::Pspg::RDFieldDft< D >::~RDFieldDft
virtual

Destructor.

Deletes underlying C array, if allocated previously.

Definition at line 30 of file RDFieldDft.tpp.

Member Function Documentation

◆ operator=()

template<int D>
RDFieldDft< D > & Pscf::Pspg::RDFieldDft< D >::operator= ( const RDFieldDft< D > &  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 59 of file RDFieldDft.tpp.

References Pscf::Pspg::DField< Data >::operator=().

◆ allocate()

template<int D>
void Pscf::Pspg::RDFieldDft< D >::allocate ( const IntVec< D > &  meshDimensions)

Allocate the underlying C array for an FFT grid.

Exceptions
Exceptionif the RDFieldDft is already allocated.
Parameters
meshDimensionsvector of mesh dimensions

Definition at line 121 of file RDFieldDft.h.

References Pscf::Pspg::DField< Data >::allocate(), and UTIL_CHECK.

Referenced by Pscf::Pspg::FFT< D >::setup().

◆ meshDimensions()

template<int D>
const IntVec< D > & Pscf::Pspg::RDFieldDft< D >::meshDimensions
inline

Return vector of mesh dimensions by constant reference.

Definition at line 142 of file RDFieldDft.h.

Referenced by Pscf::Pspg::FieldIo< D >::convertBasisToKGrid(), Pscf::Pspg::FFT< D >::inverseTransform(), Pscf::Pspg::FFT< D >::setup(), and Pscf::Pspg::FFTBatched< D >::setup().

◆ dftDimensions()

template<int D>
const IntVec< D > & Pscf::Pspg::RDFieldDft< D >::dftDimensions
inline

Return vector of dft (Fourier) grid dimensions by const 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 149 of file RDFieldDft.h.

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

◆ serialize()

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

Serialize a Field to/from an Archive.

Parameters
ararchive
versionarchive version id

Definition at line 157 of file RDFieldDft.h.

References UTIL_THROW.


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