|
PSCF v1.4.0
|
Field of real values on a regular mesh, allocated on a GPU device. More...
#include <RField.h>
Public Member Functions | |
| RField () | |
| Default constructor. | |
| RField (IntVec< D > const &meshDimensions) | |
| Allocating constructor. | |
| RField (RField< D > const &other) | |
| Copy constructor. | |
| virtual | ~RField () |
| Destructor. | |
| void | allocate (IntVec< D > const &meshDimensions) |
| Allocate the underlying C array for data on a regular mesh. | |
| void | associate (DeviceArray< cudaReal > &arr, int beginId, IntVec< D > const &meshDimensions) |
| Associate this object with a slice of another DeviceArray. | |
| RField< D > & | operator= (const RField< D > &other) |
| Assignment operator, assignment from another RField<D>. | |
| RField< D > & | operator= (const HostDArray< cudaReal > &other) |
| Assignment operator, assignment from a HostDArray<cudaReal>. | |
| 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< cudaReal > | |
| 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< cudaReal > &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< cudaReal > & | operator= (const DeviceArray< cudaReal > &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? | |
| cudaReal * | cArray () |
| Return pointer to underlying C array. | |
Additional Inherited Members | |
| Public Types inherited from Pscf::DeviceArray< cudaReal > | |
| typedef cudaReal | ValueType |
| Data type of each element. | |
| Protected Attributes inherited from Pscf::DeviceArray< cudaReal > | |
| cudaReal * | 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 real values on a regular mesh, allocated on a GPU device.
Type cudaReal is float or double, depending on preprocessor macro.
Definition at line 32 of file cuda/RField.h.
| Pscf::Prdc::Cuda::RField< D >::RField | ( | ) |
Default constructor.
Definition at line 24 of file cuda/RField.tpp.
References Pscf::DeviceArray< cudaReal >::DeviceArray().
Referenced by operator=(), operator=(), and RField().
| Pscf::Prdc::Cuda::RField< D >::RField | ( | IntVec< D > const & | meshDimensions | ) |
Allocating constructor.
Allocates memory by calling allocate(meshDimensions) internally.
| meshDimensions | number of grid points in each dimension |
Definition at line 32 of file cuda/RField.tpp.
References allocate(), Pscf::DeviceArray< cudaReal >::DeviceArray(), and meshDimensions().
| Pscf::Prdc::Cuda::RField< D >::RField | ( | RField< D > const & | other | ) |
Copy constructor.
Allocates new memory and copies all elements by value.
| other | the RField to be copied. |
Definition at line 40 of file cuda/RField.tpp.
References Pscf::DeviceArray< cudaReal >::DeviceArray(), and RField().
|
virtual |
Destructor.
Deletes underlying C array, if allocated previously.
Definition at line 49 of file cuda/RField.tpp.
| void Pscf::Prdc::Cuda::RField< 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 56 of file cuda/RField.tpp.
References Pscf::DeviceArray< Data >::allocate(), meshDimensions(), and UTIL_CHECK.
Referenced by Pscf::Rpg::FilmFieldGenMask< D >::compute(), RField(), serialize(), and Pscf::Rpg::FilmFieldGenMask< D >::stress().
| void Pscf::Prdc::Cuda::RField< D >::associate | ( | DeviceArray< cudaReal > & | 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 71 of file cuda/RField.tpp.
References Pscf::DeviceArray< Data >::associate(), Pscf::DeviceArray< cudaReal >::DeviceArray(), meshDimensions(), and UTIL_CHECK.
Referenced by Pscf::Rpg::Block< D >::stepThread().
| RField< D > & Pscf::Prdc::Cuda::RField< D >::operator= | ( | const RField< D > & | other | ) |
Assignment operator, assignment from another RField<D>.
Performs a deep copy, by copying all elements of the RHS RField<D> from device memory to device memory, and copying the meshDimensions.
The RHS RField<D> must be allocated on entry. If this LHS object is not allocated, allocate with the required capacity. If the LHS and RHS arrays are both allocated, capacity values must be equal.
| other | the RHS RField |
Definition at line 87 of file cuda/RField.tpp.
References Pscf::DeviceArray< Data >::operator=(), and RField().
| RField< D > & Pscf::Prdc::Cuda::RField< D >::operator= | ( | const HostDArray< cudaReal > & | other | ) |
Assignment operator, assignment from a HostDArray<cudaReal>.
Performs a deep copy, by copying all elements of the RHS RField<D> from host memory to device memory.
The RHS HostDArray<cudaReal> and LHS RField<D> must both be allocated with equal capacity values on entry.
| other | the RHS HostDArray<cudaReal> |
Definition at line 99 of file cuda/RField.tpp.
References Util::Array< Data >::capacity(), Pscf::DeviceArray< cudaReal >::capacity_, Pscf::DeviceArray< cudaReal >::isAllocated(), Util::DArray< Data >::isAllocated(), Pscf::DeviceArray< Data >::operator=(), RField(), and UTIL_THROW.
|
inline |
Return mesh dimensions by constant reference.
Definition at line 150 of file cuda/RField.h.
Referenced by allocate(), associate(), Pscf::Prdc::Cuda::FFT< D >::inverseTransformUnsafe(), RField(), and Pscf::Rpg::FieldIo< D >::writeFieldRGrid().
| void Pscf::Prdc::Cuda::RField< D >::serialize | ( | Archive & | ar, |
| const unsigned int | version ) |
Serialize a Field to/from an Archive.
| ar | archive |
| version | archive version id |
Definition at line 158 of file cuda/RField.h.
References allocate(), Pscf::DeviceArray< cudaReal >::capacity(), Pscf::DeviceArray< cudaReal >::capacity_, Pscf::DeviceArray< cudaReal >::isAllocated(), and UTIL_THROW.