PSCF v1.1
Public Member Functions | Protected Attributes | List of all members
Pscf::Pspg::DField< Data > Class Template Reference

Dynamic array on the GPU with alligned data. More...

#include <DField.h>

Public Member Functions

 DField ()
 Default 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...
 
Data * cDField ()
 Return pointer to underlying C array. More...
 
const Data * cDField () const
 Return pointer to const to underlying C array. More...
 
virtual DField< Data > & operator= (const DField< Data > &other)
 Assignment operator. More...
 
 DField (const DField &other)
 Copy constructor. More...
 

Protected Attributes

Data * 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<typename Data>
class Pscf::Pspg::DField< Data >

Dynamic array on the GPU with alligned data.

This class wraps an aligned C array with elements of type Data on the device. All member functions may be called from the host. As a result, the class does not offer access to individual elements via operator[]

Definition at line 29 of file DField.h.

Constructor & Destructor Documentation

◆ DField() [1/2]

template<typename Data >
Pscf::Pspg::DField< Data >::DField

Default constructor.

Definition at line 27 of file DField.tpp.

◆ ~DField()

template<typename Data >
Pscf::Pspg::DField< Data >::~DField
virtual

Destructor.

Deletes underlying C array, if allocated previously.

Definition at line 36 of file DField.tpp.

◆ DField() [2/2]

template<typename Data >
Pscf::Pspg::DField< Data >::DField ( const DField< Data > &  other)

Copy constructor.

Parameters
otherDField<Data> to be copied (input)

Definition at line 87 of file DField.tpp.

Member Function Documentation

◆ allocate()

template<typename Data >
void Pscf::Pspg::DField< Data >::allocate ( int  capacity)

Allocate the underlying C array on the device.

Exceptions
Exceptionif the Field is already allocated.
Parameters
capacitynumber of elements to allocate.

Definition at line 52 of file DField.tpp.

Referenced by Pscf::Pspg::RDField< D >::allocate(), and Pscf::Pspg::RDFieldDft< D >::allocate().

◆ deallocate()

template<typename Data >
void Pscf::Pspg::DField< Data >::deallocate

Dellocate the underlying C array.

Exceptions
Exceptionif the Field is not allocated.

Definition at line 70 of file DField.tpp.

References UTIL_THROW.

◆ isAllocated()

template<typename Data >
bool Pscf::Pspg::DField< Data >::isAllocated
inline

Return true if the Field has been allocated, false otherwise.

Definition at line 133 of file DField.h.

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

◆ capacity()

template<typename Data >
int Pscf::Pspg::DField< Data >::capacity
inline

◆ cDField() [1/2]

template<typename Data >
Data * Pscf::Pspg::DField< Data >::cDField
inline

◆ cDField() [2/2]

template<typename Data >
const Data * Pscf::Pspg::DField< Data >::cDField
inline

Return pointer to const to underlying C array.

Definition at line 126 of file DField.h.

◆ operator=()

template<typename Data >
DField< Data > & Pscf::Pspg::DField< Data >::operator= ( const DField< Data > &  other)
virtual

Member Data Documentation

◆ data_

template<typename Data >
Data* Pscf::Pspg::DField< Data >::data_
protected

Pointer to an array of Data elements on the device / GPU.

Definition at line 101 of file DField.h.

◆ capacity_

template<typename Data >
int Pscf::Pspg::DField< Data >::capacity_
protected

Allocated size of the data_ array.

Definition at line 104 of file DField.h.

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


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