|
PSCF v1.4.0
|
Discrete Fourier Transform (DFT) of a real field, allocated on a GPU. More...
#include <RFieldDft.h>
Public Member Functions | |
| RFieldDft () | |
| Default constructor. | |
| RFieldDft (IntVec< D > const &meshDimensions) | |
| Allocating constructor. | |
| RFieldDft (RFieldDft< D > const &other) | |
| Copy constructor. | |
| virtual | ~RFieldDft () |
| Destructor. | |
| RFieldDft< D > & | operator= (RFieldDft< D > const &other) |
| Assignment operator, assignment from another RFieldDft<D>. | |
| RFieldDft< D > & | operator= (HostDArray< cudaComplex > const &other) |
| Assignment operator, assignment from a HostDArray<cudaComplex>. | |
| void | allocate (IntVec< D > const &meshDimensions) |
| Allocate the underlying C array for an FFT grid. | |
| void | associate (DeviceArray< cudaComplex > &arr, int beginId, IntVec< D > const &meshDimensions) |
| Associate this object with a slice of another DeviceArray. | |
| 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. | |
| Public Member Functions inherited from Pscf::DeviceArray< cudaComplex > | |
| DeviceArray () | |
| Default constructor. | |
| virtual | ~DeviceArray () |
| Destructor. | |
| void | allocate (int capacity) |
| Allocate the underlying C array on the device. | |
| void | deallocate () |
| Dellocate the underlying C array. | |
| void | associate (DeviceArray< cudaComplex > &arr, int beginId, int capacity) |
| Associate this object with a slice of a different DeviceArray. | |
| void | dissociate () |
| Dissociate this object from an externally owned memory block. | |
| void | addReference (CountedReference &reference) |
| Associate a reference with reference counter for this container. | |
| virtual DeviceArray< cudaComplex > & | operator= (const DeviceArray< cudaComplex > &other) |
| Assignment operator, assign from another DeviceArray<Data> array. | |
| int | capacity () const |
| Return array capacity. | |
| bool | isAllocated () const |
| Return true if the array has allocated data, false otherwise. | |
| bool | isOwner () const |
| Does this container own an allocated memory block? | |
| bool | isAssociated () const |
| Is this container associated with a memory block it does not own? | |
| cudaComplex * | cArray () |
| Return pointer to underlying C array. | |
Additional Inherited Members | |
| Public Types inherited from Pscf::DeviceArray< cudaComplex > | |
| typedef cudaComplex | ValueType |
| Data type of each element. | |
| Protected Attributes inherited from Pscf::DeviceArray< cudaComplex > | |
| cudaComplex * | dataPtr_ |
| Pointer to a C array of Data elements on the GPU device. | |
| int | capacity_ |
| Allocated size (capacity) of the array. | |
| ReferenceCounter | refCounter_ |
| Counter for any arrays that use data owned by this. | |
| CountedReference | ref_ |
| Reference to another array that owns memory used by this one. | |
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 33 of file cuda/RFieldDft.h.
| Pscf::Prdc::Cuda::RFieldDft< D >::RFieldDft | ( | ) |
Default constructor.
Definition at line 24 of file cuda/RFieldDft.tpp.
References Pscf::DeviceArray< cudaComplex >::DeviceArray().
Referenced by operator=(), and RFieldDft().
| Pscf::Prdc::Cuda::RFieldDft< D >::RFieldDft | ( | IntVec< D > const & | meshDimensions | ) |
Allocating constructor.
Calls allocate(meshDimensions) internally.
| meshDimensions | dimensions of asssociated r-grid mesh |
Definition at line 32 of file cuda/RFieldDft.tpp.
References allocate(), Pscf::DeviceArray< cudaComplex >::DeviceArray(), and meshDimensions().
| Pscf::Prdc::Cuda::RFieldDft< D >::RFieldDft | ( | RFieldDft< D > const & | other | ) |
Copy constructor.
Allocates new memory and copies all elements by value.
| other | the RFieldDft to be copied. |
Definition at line 47 of file cuda/RFieldDft.tpp.
References Pscf::DeviceArray< cudaComplex >::DeviceArray(), and RFieldDft().
|
virtual |
Destructor.
Deletes underlying C array, if allocated previously.
Definition at line 40 of file cuda/RFieldDft.tpp.
| RFieldDft< D > & Pscf::Prdc::Cuda::RFieldDft< D >::operator= | ( | RFieldDft< D > const & | other | ) |
Assignment operator, assignment from another RFieldDft<D>.
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.
| other | the RHS Field |
Definition at line 58 of file cuda/RFieldDft.tpp.
References Pscf::DeviceArray< Data >::operator=(), and RFieldDft().
| RFieldDft< D > & Pscf::Prdc::Cuda::RFieldDft< D >::operator= | ( | HostDArray< cudaComplex > const & | other | ) |
Assignment operator, assignment from a HostDArray<cudaComplex>.
Performs a deep copy, by copying all elements of the RHS RFieldDft<D> from host memory to device memory.
The RHS HostDArray<cudaComplex> and LHS RFieldDft<D> must both be allocated and have equal capacity values on entry.
| other | the RHS HostDArray<cudaComplex> |
Definition at line 75 of file cuda/RFieldDft.tpp.
References Util::Array< Data >::capacity(), Pscf::DeviceArray< cudaComplex >::capacity_, Pscf::DeviceArray< cudaComplex >::isAllocated(), Util::DArray< Data >::isAllocated(), Pscf::DeviceArray< Data >::operator=(), and UTIL_THROW.
| void Pscf::Prdc::Cuda::RFieldDft< D >::allocate | ( | IntVec< D > const & | meshDimensions | ) |
Allocate the underlying C array for an FFT grid.
| meshDimensions | number of grid points in each dimension |
Definition at line 98 of file cuda/RFieldDft.tpp.
References Pscf::DeviceArray< Data >::allocate(), Pscf::Prdc::Cuda::FFT< D >::computeKMesh(), meshDimensions(), and UTIL_CHECK.
Referenced by RFieldDft(), and serialize().
| void Pscf::Prdc::Cuda::RFieldDft< D >::associate | ( | DeviceArray< cudaComplex > & | arr, |
| int | beginId, | ||
| IntVec< D > const & | meshDimensions ) |
Associate this object with a slice of another DeviceArray.
| Exception | if the array is already allocated. |
| arr | parent array that owns the data |
| beginId | index in the parent array at which this array starts |
| meshDimensions | number of grid points in each dimension |
Definition at line 118 of file cuda/RFieldDft.tpp.
References Pscf::DeviceArray< Data >::associate(), Pscf::Prdc::Cuda::FFT< D >::computeKMesh(), Pscf::DeviceArray< cudaComplex >::DeviceArray(), meshDimensions(), and UTIL_CHECK.
Referenced by Pscf::Rpg::Block< D >::stepThread().
|
inline |
Return vector of real-space mesh dimensions by constant reference.
Definition at line 163 of file cuda/RFieldDft.h.
Referenced by allocate(), associate(), Pscf::Rpg::FieldIo< D >::convertBasisToKGrid(), Pscf::Rpg::FieldIo< D >::convertKGridToBasis(), Pscf::Rpg::FieldIo< D >::hasSymmetry(), Pscf::Prdc::Cuda::FFT< D >::inverseTransformUnsafe(), and RFieldDft().
|
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 170 of file cuda/RFieldDft.h.
Referenced by Pscf::Rpg::FieldIo< D >::convertBasisToKGrid(), Pscf::Rpg::FieldIo< D >::convertKGridToBasis(), and Pscf::Rpg::FieldIo< D >::hasSymmetry().
| void Pscf::Prdc::Cuda::RFieldDft< D >::serialize | ( | Archive & | ar, |
| const unsigned int | version ) |
Serialize a Field to/from an Archive.
| ar | archive |
| version | archive version id |
Definition at line 178 of file cuda/RFieldDft.h.
References allocate(), Pscf::DeviceArray< cudaComplex >::capacity(), Pscf::DeviceArray< cudaComplex >::capacity_, Pscf::DeviceArray< cudaComplex >::isAllocated(), and UTIL_THROW.