PSCF v1.5.0
Pscf::CField< D, CUT > Class Template Reference

Field of complex values on a regular mesh, allocated on a GPU device. More...

#include <CField.h>

Inheritance diagram for Pscf::CField< D, CUT >:
Pscf::BackendArray< cudaComplex, CUT >

Public Member Functions

 CField ()
 Default constructor.
 CField (IntVec< D > const &meshDimensions)
 Allocating constructor.
 CField (CField< D, CUT > const &other)
 Copy constructor.
virtual ~CField ()
 Destructor.
void allocate (IntVec< D > const &meshDimensions)
 Allocate the underlying C array for data on a regular mesh.
void deallocate ()
 Deallocate the underlying array.
void associate (BackendArray< cudaComplex, CUT > &arr, int beginId, IntVec< D > const &meshDimensions)
 Associate this object with a slice of another BackendArray.
CField< D, CUT > & operator= (CField< D, CUT > const &other)
 Assignment operator, assignment from another CField<D,CUT>.
CField< D, CUT > & operator= (HostSendArray< cudaComplex, CUT > const &other)
 Assignment operator, assignment from a HostSendArray<cudaComplex,CUT>.
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.

Detailed Description

template<int D>
class Pscf::CField< D, CUT >

Field of complex values on a regular mesh, allocated on a GPU device.

Definition at line 32 of file cuda/CField.h.

Constructor & Destructor Documentation

◆ CField() [1/3]

template<int D>
Pscf::CField< D, CUT >::CField ( )

Default constructor.

Definition at line 21 of file cuda/CField.tpp.

References CField().

Referenced by allocate(), associate(), CField(), CField(), CField(), deallocate(), meshDimensions(), operator=(), operator=(), serialize(), and ~CField().

◆ CField() [2/3]

template<int D>
Pscf::CField< D, CUT >::CField ( IntVec< D > const & meshDimensions)

Allocating constructor.

Calls allocate(meshDimension) internally.

Parameters
meshDimensionsnumbers of grid points in each dimension

Definition at line 29 of file cuda/CField.tpp.

References allocate(), CField(), and meshDimensions().

◆ CField() [3/3]

template<int D>
Pscf::CField< D, CUT >::CField ( CField< D, CUT > const & other)

Copy constructor.

Allocates new memory and copies all elements by value.

Parameters
otherthe CField to be copied.

Definition at line 37 of file cuda/CField.tpp.

References CField().

◆ ~CField()

template<int D>
Pscf::CField< D, CUT >::~CField ( )
virtual

Destructor.

Deletes underlying C array, if allocated previously.

Definition at line 46 of file cuda/CField.tpp.

References CField().

Member Function Documentation

◆ allocate()

template<int D>
void Pscf::CField< D, CUT >::allocate ( IntVec< D > const & meshDimensions)

Allocate the underlying C array for data on a regular mesh.

Exceptions
Exceptionif the CField is already allocated.
Parameters
meshDimensionsnumber of grid points in each dimension

Definition at line 53 of file cuda/CField.tpp.

References CField(), meshDimensions(), and UTIL_CHECK.

Referenced by CField(), and serialize().

◆ deallocate()

template<int D>
void Pscf::CField< D, CUT >::deallocate ( )

Deallocate the underlying array.

Definition at line 68 of file cuda/CField.tpp.

References CField().

◆ associate()

template<int D>
void Pscf::CField< D, CUT >::associate ( BackendArray< cudaComplex, CUT > & arr,
int beginId,
IntVec< D > const & meshDimensions )

Associate this object with a slice of another BackendArray.

Exceptions
Exceptionif the array is already allocated.
Parameters
arrparent array that owns the data
beginIdindex in the parent array at which this array starts
meshDimensionsnumber of grid points in each dimension

Definition at line 80 of file cuda/CField.tpp.

References CField(), meshDimensions(), and UTIL_CHECK.

◆ operator=() [1/2]

template<int D>
CField< D, CUT > & Pscf::CField< D, CUT >::operator= ( CField< D, CUT > const & other)

Assignment operator, assignment from another CField<D,CUT>.

Performs a deep copy, by copying all elements of the RHS CField<D,CUT> 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.

Parameters
otherthe RHS CField<D,CUT>

Definition at line 98 of file cuda/CField.tpp.

References CField().

◆ operator=() [2/2]

template<int D>
CField< D, CUT > & Pscf::CField< D, CUT >::operator= ( HostSendArray< cudaComplex, CUT > const & other)

Assignment operator, assignment from a HostSendArray<cudaComplex,CUT>.

Performs a deep copy, by copying all elements of the RHS CField<D,CUT> from host memory to device memory.

The RHS HostSendArray<cudaComplex,CUT> and LHS CField<D,CUT> must both be allocated with equal capacity values on entry.

Parameters
otherthe RHS HostSendArray<cudaComplex,CUT>

Definition at line 110 of file cuda/CField.tpp.

References CField(), and UTIL_THROW.

◆ meshDimensions()

template<int D>
const IntVec< D > & Pscf::CField< D, CUT >::meshDimensions ( ) const
inline

Return mesh dimensions by constant reference.

Definition at line 156 of file cuda/CField.h.

References CField().

Referenced by allocate(), associate(), and CField().

◆ serialize()

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

Serialize a Field to/from an Archive.

Parameters
ararchive
versionarchive version id

Definition at line 164 of file cuda/CField.h.

References allocate(), CField(), and UTIL_THROW.


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