|
PSCF v1.4.0
|
Field of complex values on a regular mesh, allocated on a GPU device. More...
#include <CField.h>
Public Member Functions | |
| CField () | |
| Default constructor. | |
| CField (IntVec< D > const &meshDimensions) | |
| Allocating constructor. | |
| CField (CField const &other) | |
| Copy constructor. | |
| virtual | ~CField () |
| Destructor. | |
| CField< D > & | operator= (CField< D > const &other) |
| Assignment operator, assignment from another CField<D>. | |
| CField< 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 data on a regular mesh. | |
| 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 mesh 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::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. | |
Field of complex values on a regular mesh, allocated on a GPU device.
Definition at line 30 of file cuda/CField.h.
| Pscf::Prdc::Cuda::CField< D >::CField | ( | ) |
Default constructor.
Definition at line 24 of file cuda/CField.tpp.
References Pscf::DeviceArray< cudaComplex >::DeviceArray().
Referenced by CField(), operator=(), and operator=().
| Pscf::Prdc::Cuda::CField< D >::CField | ( | IntVec< D > const & | meshDimensions | ) |
Allocating constructor.
Calls allocate(meshDimension) internally.
| meshDimensions | numbers of grid points in each dimension |
Definition at line 32 of file cuda/CField.tpp.
References allocate(), Pscf::DeviceArray< cudaComplex >::DeviceArray(), and meshDimensions().
| Pscf::Prdc::Cuda::CField< D >::CField | ( | CField< D > const & | other | ) |
Copy constructor.
Allocates new memory and copies all elements by value.
| other | the CField to be copied. |
Definition at line 47 of file cuda/CField.tpp.
References CField(), and Pscf::DeviceArray< cudaComplex >::DeviceArray().
|
virtual |
Destructor.
Deletes underlying C array, if allocated previously.
Definition at line 40 of file cuda/CField.tpp.
| CField< D > & Pscf::Prdc::Cuda::CField< D >::operator= | ( | CField< D > const & | other | ) |
Assignment operator, assignment from another CField<D>.
Performs a deep copy, by copying all elements of the RHS CField<D> from device memory to device memory.
The RHS CField must be allocated. If this LHS CField is not allocated on entry, allocate it before copying elements. If both LHS and RHS objects are allocated on entry, the capacities must be equal.
| other | the RHS CField<D> |
Definition at line 58 of file cuda/CField.tpp.
References CField(), and Pscf::DeviceArray< Data >::operator=().
| CField< D > & Pscf::Prdc::Cuda::CField< D >::operator= | ( | HostDArray< cudaComplex > const & | other | ) |
Assignment operator, assignment from a HostDArray<cudaComplex>.
Performs a deep copy, by copying all elements of the RHS CField<D> from host memory to device memory.
The RHS HostDArray<cudaComplex> and LHS CField<D> must both be allocated with equal capacity values on entry.
| other | the RHS HostDArray<cudaComplex> |
Definition at line 70 of file cuda/CField.tpp.
References Util::Array< Data >::capacity(), Pscf::DeviceArray< cudaComplex >::capacity_, CField(), Pscf::DeviceArray< cudaComplex >::isAllocated(), Util::DArray< Data >::isAllocated(), Pscf::DeviceArray< Data >::operator=(), and UTIL_THROW.
| void Pscf::Prdc::Cuda::CField< D >::allocate | ( | IntVec< D > const & | meshDimensions | ) |
Allocate the underlying C array for data on a regular mesh.
| meshDimensions | number of grid points in each dimension |
Definition at line 93 of file cuda/CField.tpp.
References Pscf::DeviceArray< Data >::allocate(), meshDimensions(), and UTIL_CHECK.
Referenced by CField(), and serialize().
| void Pscf::Prdc::Cuda::CField< 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 108 of file cuda/CField.tpp.
References Pscf::DeviceArray< Data >::associate(), Pscf::DeviceArray< cudaComplex >::DeviceArray(), meshDimensions(), and UTIL_CHECK.
|
inline |
Return mesh dimensions by constant reference.
Definition at line 148 of file cuda/CField.h.
Referenced by allocate(), associate(), CField(), Pscf::Prdc::Cuda::FFT< D >::forwardTransform(), and Pscf::Prdc::Cuda::FFT< D >::inverseTransform().
| void Pscf::Prdc::Cuda::CField< D >::serialize | ( | Archive & | ar, |
| const unsigned int | version ) |
Serialize a Field to/from an Archive.
| ar | archive |
| version | archive version id |
Definition at line 156 of file cuda/CField.h.
References allocate(), Pscf::DeviceArray< cudaComplex >::capacity(), Pscf::DeviceArray< cudaComplex >::capacity_, Pscf::DeviceArray< cudaComplex >::isAllocated(), and UTIL_THROW.