PSCF v1.5.0
Pscf::RFieldDft< D, CUT > Class Template Reference

Discrete Fourier Transform (DFT) of a real field, allocated on a GPU. More...

#include <RFieldDft.h>

Inheritance diagram for Pscf::RFieldDft< D, CUT >:
Pscf::BackendArray< cudaComplex, CUT >

Public Member Functions

 RFieldDft ()
 Default constructor.
 RFieldDft (IntVec< D > const &meshDimensions)
 Allocating constructor.
 RFieldDft (RFieldDft< D, CUT > const &other)
 Copy constructor.
virtual ~RFieldDft ()
 Destructor.
void allocate (IntVec< D > const &meshDimensions)
 Allocate the underlying C array for an FFT grid.
void deallocate ()
 Deallocate the underlying array.
void associate (BackendArray< cudaComplex, CUT > &arr, int beginId, IntVec< D > const &meshDimensions)
 Associate this object with a slice of another BackendArray.
RFieldDft< D, CUT > & operator= (RFieldDft< D, CUT > const &other)
 Assignment operator, assignment from another RFieldDft<D,CUT>.
RFieldDft< D, CUT > & operator= (HostSendArray< cudaComplex, CUT > const &other)
 Assignment operator, assignment from a HostSendArray<cudaComplex,CUT>.
IntVec< D > const & meshDimensions () const
 Return vector of real-space mesh dimensions by constant reference.
IntVec< D > const & dftDimensions () const
 Return vector of dft (Fourier) grid dimensions by const reference.
template<class Archive>
void serialize (Archive &ar, const unsigned int version)
 Serialize a Field to/from an Archive.

Detailed Description

template<int D>
class Pscf::RFieldDft< D, CUT >

Discrete Fourier Transform (DFT) of a real field, allocated on a GPU.

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 36 of file cuda/RFieldDft.h.

Constructor & Destructor Documentation

◆ RFieldDft() [1/3]

template<int D>
Pscf::RFieldDft< D, CUT >::RFieldDft ( )

◆ RFieldDft() [2/3]

template<int D>
Pscf::RFieldDft< D, CUT >::RFieldDft ( IntVec< D > const & meshDimensions)

Allocating constructor.

Calls allocate(meshDimensions) internally.

Parameters
meshDimensionsdimensions of asssociated r-grid mesh

Definition at line 31 of file cuda/RFieldDft.tpp.

References allocate(), meshDimensions(), and RFieldDft().

◆ RFieldDft() [3/3]

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

Copy constructor.

Allocates new memory and copies all elements by value.

Parameters
otherthe RFieldDft to be copied.

Definition at line 46 of file cuda/RFieldDft.tpp.

References RFieldDft().

◆ ~RFieldDft()

template<int D>
Pscf::RFieldDft< D, CUT >::~RFieldDft ( )
virtual

Destructor.

Deletes underlying C array, if allocated previously.

Definition at line 39 of file cuda/RFieldDft.tpp.

References RFieldDft().

Member Function Documentation

◆ allocate()

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

Allocate the underlying C array for an FFT grid.

Exceptions
Exceptionif the RFieldDft is already allocated.
Parameters
meshDimensionsnumber of grid points in each dimension

Definition at line 57 of file cuda/RFieldDft.tpp.

References meshDimensions(), RFieldDft(), and UTIL_CHECK.

Referenced by RFieldDft(), and serialize().

◆ deallocate()

template<int D>
void Pscf::RFieldDft< D, CUT >::deallocate ( )

Deallocate the underlying array.

Definition at line 77 of file cuda/RFieldDft.tpp.

References RFieldDft().

◆ associate()

template<int D>
void Pscf::RFieldDft< D, CUT >::associate ( BackendArray< cudaComplex, CUT > & arr,
int beginId,
IntVec< D > const & meshDimensions )

Associate this object with a slice of another BackendArray.

Exceptions
Exceptionif the array is already allocated.
Parameters
arrparent array that owns the data
beginIdindex in the parent array at which this array starts
meshDimensionsnumber of grid points in each dimension

Definition at line 89 of file cuda/RFieldDft.tpp.

References meshDimensions(), RFieldDft(), and UTIL_CHECK.

◆ operator=() [1/2]

template<int D>
RFieldDft< D, CUT > & Pscf::RFieldDft< D, CUT >::operator= ( RFieldDft< D, CUT > const & other)

Assignment operator, assignment from another RFieldDft<D,CUT>.

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 113 of file cuda/RFieldDft.tpp.

References RFieldDft().

◆ operator=() [2/2]

template<int D>
RFieldDft< D, CUT > & Pscf::RFieldDft< D, CUT >::operator= ( HostSendArray< cudaComplex, CUT > const & other)

Assignment operator, assignment from a HostSendArray<cudaComplex,CUT>.

Performs a deep copy, by copying all elements of the RHS HostSendArray<cudaComplex,CUT> from host memory to device memory.

The RHS HostSendArray<cudaComplex,CUT> and LHS RFieldDft<D,CUT> must both be allocated and have equal capacity values on entry.

Parameters
otherthe RHS HostSendArray<cudaComplex,CUT>

Definition at line 130 of file cuda/RFieldDft.tpp.

References RFieldDft(), and UTIL_CHECK.

◆ meshDimensions()

template<int D>
const IntVec< D > & Pscf::RFieldDft< D, CUT >::meshDimensions ( ) const
inline

Return vector of real-space mesh dimensions by constant reference.

Definition at line 186 of file cuda/RFieldDft.h.

References RFieldDft().

Referenced by allocate(), associate(), and RFieldDft().

◆ dftDimensions()

template<int D>
IntVec< D > const & Pscf::RFieldDft< D, CUT >::dftDimensions ( ) const
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: dftDimensions()[D-1] = meshDimensions()/2 + 1. For D > 1, other elements are equal.

Definition at line 193 of file cuda/RFieldDft.h.

References RFieldDft().

◆ serialize()

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

Serialize a Field to/from an Archive.

Parameters
ararchive
versionarchive version id

Definition at line 201 of file cuda/RFieldDft.h.

References allocate(), RFieldDft(), and UTIL_THROW.


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