PSCF v1.4.0
Pscf::Prdc::Cpu::CField< D > Class Template Reference

Field of complex double precision values on an FFT mesh. More...

#include <CField.h>

Inheritance diagram for Pscf::Prdc::Cpu::CField< D >:
Pscf::Prdc::Cpu::FftwDArray< fftw_complex > Util::Array< fftw_complex >

Public Types

using RealType = double
 Type of real and imaginary parts of a complex value.
Public Types inherited from Pscf::Prdc::Cpu::FftwDArray< fftw_complex >
using ValueType
 Data type of each array element.

Public Member Functions

 CField ()
 Default constructor.
 CField (const CField &other)
 Copy constructor.
virtual ~CField ()
 Destructor.
CFieldoperator= (const CField &other)
 Assignment operator.
void allocate (const IntVec< D > &meshDimensions)
 Allocate the underlying C array for an FFT grid.
virtual void deallocate ()
 Deallocate underlying C array and clear mesh dimensions.
const IntVec< D > & 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::Prdc::Cpu::FftwDArray< fftw_complex >
 FftwDArray ()
 Default constructor.
virtual ~FftwDArray ()
 Destructor.
void allocate (int capacity)
 Allocate the underlying C array.
bool isAllocated () const
 Return true if the FftwDArray has been allocated, false otherwise.
void serialize (Archive &ar, const unsigned int version)
 Serialize a FftwDArray to/from an Archive.
Public Member Functions inherited from Util::Array< fftw_complex >
int capacity () const
 Return allocated size.
void begin (ArrayIterator< fftw_complex > &iterator)
 Set an iterator to begin this Array.
fftw_complex & operator[] (int i)
 Get an element by non-const reference.
fftw_complex * cArray ()
 Return a pointer to the underlying C array.

Additional Inherited Members

Protected Member Functions inherited from Util::Array< fftw_complex >
 ~Array ()
 Destructor (protected to prevent direct destruction).
Protected Attributes inherited from Util::Array< fftw_complex >
fftw_complex * data_
 Pointer to an array of Data elements.
int capacity_
 Allocated size of the data_ array.

Detailed Description

template<int D>
class Pscf::Prdc::Cpu::CField< D >

Field of complex double precision values on an FFT mesh.

Definition at line 28 of file cpu/CField.h.

Member Typedef Documentation

◆ RealType

template<int D>
using Pscf::Prdc::Cpu::CField< D >::RealType = double

Type of real and imaginary parts of a complex value.

Definition at line 40 of file cpu/CField.h.

Constructor & Destructor Documentation

◆ CField() [1/2]

template<int D>
Pscf::Prdc::Cpu::CField< D >::CField ( )

Default constructor.

Definition at line 24 of file cpu/CField.tpp.

References Pscf::Prdc::Cpu::FftwDArray< fftw_complex >::FftwDArray().

Referenced by CField(), and operator=().

◆ CField() [2/2]

template<int D>
Pscf::Prdc::Cpu::CField< D >::CField ( const CField< D > & other)

Copy constructor.

Allocates new memory and copies all elements by value.

Parameters
otherthe CField to be copied.

Definition at line 42 of file cpu/CField.tpp.

References Util::Array< Data >::capacity_, CField(), Pscf::Prdc::Cpu::FftwDArray< fftw_complex >::FftwDArray(), and Pscf::Prdc::Cpu::FftwDArray< Data >::isAllocated().

◆ ~CField()

template<int D>
Pscf::Prdc::Cpu::CField< D >::~CField ( )
virtual

Destructor.

Deletes underlying C array, if allocated previously.

Definition at line 33 of file cpu/CField.tpp.

Member Function Documentation

◆ operator=()

template<int D>
CField< D > & Pscf::Prdc::Cpu::CField< D >::operator= ( const CField< D > & other)

Assignment operator.

If this field is not allocated, this function allocates the field and copies all elements.

If this and the other field are both allocated, the capacities must be equal. If so, this functions copies all elements.

Parameters
otherthe RHS CField

Definition at line 62 of file cpu/CField.tpp.

References allocate(), Util::Array< Data >::capacity_, Util::Array< fftw_complex >::capacity_, CField(), Util::Array< Data >::data_, Util::Array< fftw_complex >::data_, Pscf::Prdc::Cpu::FftwDArray< Data >::isAllocated(), Pscf::Prdc::Cpu::FftwDArray< fftw_complex >::isAllocated(), UTIL_CHECK, and UTIL_THROW.

◆ allocate()

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

Allocate the underlying C array for an FFT grid.

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

Definition at line 91 of file cpu/CField.tpp.

References allocate(), Pscf::Prdc::Cpu::FftwDArray< Data >::allocate(), meshDimensions(), and UTIL_CHECK.

Referenced by allocate(), operator=(), and Pscf::Prdc::Cpu::FFT< D >::setup().

◆ deallocate()

template<int D>
void Pscf::Prdc::Cpu::CField< D >::deallocate ( )
virtual

Deallocate underlying C array and clear mesh dimensions.

Reimplemented from Pscf::Prdc::Cpu::FftwDArray< fftw_complex >.

Definition at line 106 of file cpu/CField.tpp.

References deallocate(), and Pscf::Prdc::Cpu::FftwDArray< Data >::deallocate().

Referenced by deallocate().

◆ meshDimensions()

template<int D>
const IntVec< D > & Pscf::Prdc::Cpu::CField< D >::meshDimensions ( ) const
inline

◆ serialize()

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

Serialize a Field to/from an Archive.

Parameters
ararchive
versionarchive version id

Definition at line 127 of file cpu/CField.h.

References Pscf::Prdc::Cpu::FftwDArray< Data >::serialize().


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