PSCF v1.1
Public Member Functions | List of all members
Pscf::Pspg::RDField< D > Class Template Reference

Field of real single precision values on an FFT mesh on a device. More...

#include <RDField.h>

Inheritance diagram for Pscf::Pspg::RDField< D >:
Pscf::Pspg::DField< cudaReal >

Public Member Functions

 RDField ()
 Default constructor. More...
 
 RDField (const RDField &other)
 Copy constructor. More...
 
virtual ~RDField ()
 Destructor. More...
 
RDFieldoperator= (const RDField &other)
 Assignment operator. More...
 
void allocate (const IntVec< D > &meshDimensions)
 Allocate the underlying C array for an FFT grid. More...
 
const IntVec< D > & meshDimensions () const
 Return mesh dimensions by constant reference. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialize a Field to/from an Archive. More...
 
- Public Member Functions inherited from Pscf::Pspg::DField< cudaReal >
 DField ()
 Default constructor. More...
 
 DField (const DField &other)
 Copy 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...
 
cudaReal * cDField ()
 Return pointer to underlying C array. More...
 
const cudaReal * cDField () const
 Return pointer to const to underlying C array. More...
 
virtual DField< cudaReal > & operator= (const DField< cudaReal > &other)
 Assignment operator. More...
 

Additional Inherited Members

- Protected Attributes inherited from Pscf::Pspg::DField< cudaReal >
cudaReal * 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<int D>
class Pscf::Pspg::RDField< D >

Field of real single precision values on an FFT mesh on a device.

cudaReal = float or double, depending on preprocessor macro.

Definition at line 33 of file RDField.h.

Constructor & Destructor Documentation

◆ RDField() [1/2]

template<int D>
Pscf::Pspg::RDField< D >::RDField

Default constructor.

Definition at line 23 of file RDField.tpp.

◆ RDField() [2/2]

template<int D>
Pscf::Pspg::RDField< D >::RDField ( const RDField< D > &  other)

Copy constructor.

Allocates new memory and copies all elements by value.

Parameters
otherthe RField to be copied.

Definition at line 42 of file RDField.tpp.

◆ ~RDField()

template<int D>
Pscf::Pspg::RDField< D >::~RDField
virtual

Destructor.

Deletes underlying C array, if allocated previously.

Definition at line 31 of file RDField.tpp.

Member Function Documentation

◆ operator=()

template<int D>
RDField< D > & Pscf::Pspg::RDField< D >::operator= ( const RDField< D > &  other)

Assignment operator.

If this Field is not allocated, launch a kernel to swap memory.

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 RField

Definition at line 60 of file RDField.tpp.

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

◆ allocate()

template<int D>
void Pscf::Pspg::RDField< D >::allocate ( const IntVec< D > &  meshDimensions)

Allocate the underlying C array for an FFT grid.

Exceptions
Exceptionif the RField is already allocated.
Parameters
meshDimensionsnumber of grid points in each direction

Definition at line 108 of file RDField.h.

References Pscf::Pspg::DField< Data >::allocate(), and UTIL_CHECK.

Referenced by Pscf::Pspg::FFT< D >::setup(), Pscf::Pspg::System< D >::writeQ(), Pscf::Pspg::System< D >::writeQSlice(), and Pscf::Pspg::System< D >::writeQTail().

◆ meshDimensions()

template<int D>
const IntVec< D > & Pscf::Pspg::RDField< D >::meshDimensions
inline

Return mesh dimensions by constant reference.

Definition at line 123 of file RDField.h.

Referenced by Pscf::Pspg::FFT< D >::inverseTransform(), Pscf::Pspg::FFT< D >::setup(), and Pscf::Pspg::FFTBatched< D >::setup().

◆ serialize()

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

Serialize a Field to/from an Archive.

Parameters
ararchive
versionarchive version id

Definition at line 131 of file RDField.h.

References UTIL_THROW.


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