PSCF v1.5.0
Pscf::RField< D, CPT > Class Template Reference

Field of real double precision values on a regular mesh. More...

#include <RField.h>

Inheritance diagram for Pscf::RField< D, CPT >:
Pscf::BackendArray< double, CPT >

Public Member Functions

 RField ()
 Default constructor.
 RField (const RField< D, CPT > &other)
 Copy constructor.
 ~RField () override=default
 Destructor.
RField< D, CPT > & operator= (RField< D, CPT > const &other)
 Assignment operator.
RField< D, CPT > & operator= (HostSendArray< double, CPT > const &other)
 Pseudo-assignment from an associated HostSendArray.
void allocate (IntVec< D > const &meshDimensions)
 Allocate the underlying C array for values on a regular mesh.
void deallocate () override
 Deallocate memory and return to empty state.
void associate (BackendArray< double, CPT > &arr, int beginId, IntVec< D > const &meshDimensions)
 Associate this object with a slice of another BackendArray.
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::RField< D, CPT >

Field of real double precision values on a regular mesh.

Definition at line 33 of file cpp/RField.h.

Constructor & Destructor Documentation

◆ RField() [1/2]

template<int D>
Pscf::RField< D, CPT >::RField ( )

Default constructor.

Definition at line 23 of file cpp/RField.tpp.

References RField().

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

◆ RField() [2/2]

template<int D>
Pscf::RField< D, CPT >::RField ( const RField< D, CPT > & other)

Copy constructor.

Allocates new memory and copies all elements by value.

Parameters
otherthe RField to be copied.

Definition at line 36 of file cpp/RField.tpp.

References RField().

◆ ~RField()

template<int D>
Pscf::RField< D, CPT >::~RField ( )
overridedefault

Member Function Documentation

◆ operator=() [1/2]

template<int D>
RField< D, CPT > & Pscf::RField< D, CPT >::operator= ( RField< D, CPT > const & other)

Assignment operator.

If this Field is not allocated, allocates and copies all elements.

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 104 of file cpp/RField.tpp.

References allocate(), RField(), and UTIL_CHECK.

◆ operator=() [2/2]

template<int D>
RField< D, CPT > & Pscf::RField< D, CPT >::operator= ( HostSendArray< double, CPT > const & other)

Pseudo-assignment from an associated HostSendArray.

This function simply calls the corresponding assignment operator of the BackendArray base class, then returns this RFieldDft object. It checks if an association exists between the LHS and RHS arrays, and does nothing if this is the case.

Exceptions
Exceptionif other (RHS) is not allocated
Exceptionif other (RHS) is not associated with this (LHS)
Parameters
otherthe RHS host array

Definition at line 130 of file cpp/RField.tpp.

References RField().

◆ allocate()

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

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

Exceptions
Exceptionif the RField is already allocated.
Parameters
meshDimensionsvector of numbers of grid points per direction

Definition at line 52 of file cpp/RField.tpp.

References Pscf::FftwDRArray< Data >::allocate(), meshDimensions(), RField(), and UTIL_CHECK.

Referenced by operator=(), and ~RField().

◆ deallocate()

template<int D>
void Pscf::RField< D, CPT >::deallocate ( )
override

Deallocate memory and return to empty state.

Definition at line 67 of file cpp/RField.tpp.

References Pscf::FftwDRArray< Data >::deallocate(), and RField().

Referenced by ~RField().

◆ associate()

template<int D>
void Pscf::RField< D, CPT >::associate ( BackendArray< double, CPT > & 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 79 of file cpp/RField.tpp.

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

Referenced by ~RField().

◆ meshDimensions()

template<int D>
IntVec< D > const & Pscf::RField< D, CPT >::meshDimensions ( ) const
inline

Return mesh dimensions by constant reference.

Definition at line 152 of file cpp/RField.h.

References RField().

Referenced by allocate(), associate(), and ~RField().

◆ serialize()

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

Serialize a Field to/from an Archive.

Parameters
ararchive
versionarchive version id

Definition at line 160 of file cpp/RField.h.

References RField(), and Pscf::FftwDRArray< Data >::serialize().

Referenced by ~RField().


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