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

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

#include <RField.h>

Inheritance diagram for Pscf::Pspc::RField< D >:
Pscf::Field< double > Util::DArray< Data > Util::Array< Data >

Public Member Functions

 RField ()
 Default constructor. More...
 
 RField (const RField &other)
 Copy constructor. More...
 
virtual ~RField ()
 Destructor. More...
 
RFieldoperator= (const RField &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::Field< double >
 Field ()
 Constructor. More...
 
 Field (Field< double > const &other)
 Copy constructor. More...
 
Field< double > & operator= (Field< double > const &other)
 Assignment operator. More...
 
Field< double > & operator= (double &scalar)
 Assignment - assign all elements to a common scalar. More...
 
Field< double > & operator+= (Field< double > &other)
 Increment operator - add one field by another. More...
 
Field< double > & operator-= (Field< double > &other)
 Decrement operator - subtract one field from another. More...
 
Field< double > & operator*= (double scalar)
 Multiplication operator - multiply one field by a scalar. More...
 
Field< double > & operator*= (Field< double > &other)
 Pointwise multipication of one field by another. More...
 
void setToZero ()
 Set all elements to zero. More...
 
double average () const
 Compute and return average of all elements. More...
 
- Public Member Functions inherited from Util::DArray< Data >
 DArray ()
 Default constructor. More...
 
 DArray (DArray< Data > const &other)
 Copy constructor. More...
 
virtual ~DArray ()
 Destructor. More...
 
DArray< Data > & operator= (DArray< Data > const &other)
 Assignment operator. More...
 
void allocate (int capacity)
 Allocate the underlying C array. More...
 
void deallocate ()
 Dellocate the underlying C array. More...
 
void reallocate (int capacity)
 Reallocate the underlying C array and copy to new location. More...
 
bool isAllocated () const
 Return true if this DArray has been allocated, false otherwise. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialize a DArray to/from an Archive. More...
 
- Public Member Functions inherited from Util::Array< Data >
virtual ~Array ()
 Destructor. More...
 
int capacity () const
 Return allocated size. More...
 
void begin (ArrayIterator< Data > &iterator)
 Set an iterator to begin this Array. More...
 
void begin (ConstArrayIterator< Data > &iterator) const
 Set a const iterator to begin this Array. More...
 
Data & operator[] (int i)
 Get an element by non-const reference. More...
 
Data const & operator[] (int i) const
 Get an element by const reference. More...
 
Data * cArray ()
 Return a pointer to the underlying C array. More...
 
Data const * cArray () const
 Return pointer to const to the underlying C array. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Util::Array< Data >
 Array ()
 Default constructor. More...
 
- Protected Attributes inherited from Util::Array< Data >
Data * data_
 Pointer to an array of Data elements. More...
 
int capacity_
 Allocated size of the data_ array. More...
 

Detailed Description

template<int D>
class Pscf::Pspc::RField< D >

Field of real double precision values on an FFT mesh.

Definition at line 28 of file RField.h.

Constructor & Destructor Documentation

◆ RField() [1/2]

template<int D>
Pscf::Pspc::RField< D >::RField

Default constructor.

Definition at line 23 of file RField.tpp.

◆ RField() [2/2]

template<int D>
Pscf::Pspc::RField< D >::RField ( const RField< 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 RField.tpp.

References Util::Array< Data >::capacity_, Util::Array< Data >::data_, Util::DArray< Data >::isAllocated(), and UTIL_THROW.

◆ ~RField()

template<int D>
Pscf::Pspc::RField< D >::~RField
virtual

Destructor.

Deletes underlying C array, if allocated previously.

Definition at line 31 of file RField.tpp.

Member Function Documentation

◆ operator=()

template<int D>
RField< D > & Pscf::Pspc::RField< D >::operator= ( const RField< D > &  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 68 of file RField.tpp.

References Util::Array< Data >::capacity(), Util::Array< Data >::capacity_, Util::DArray< Data >::isAllocated(), and UTIL_THROW.

◆ allocate()

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

Allocate the underlying C array for an FFT grid.

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

Definition at line 97 of file RField.tpp.

References Pscf::Pspc::Field< Data >::allocate(), and UTIL_CHECK.

Referenced by Pscf::Pspc::FilmIteratorBase< D, IteratorType >::generateWallFields(), Pscf::Pspc::FieldIo< D >::readFieldRGrid(), Pscf::Pspc::FFT< D >::setup(), and Pscf::Pspc::FieldIo< D >::writeFieldRGrid().

◆ meshDimensions()

template<int D>
const IntVec< D > & Pscf::Pspc::RField< D >::meshDimensions
inline

◆ serialize()

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

Serialize a Field to/from an Archive.

Parameters
ararchive
versionarchive version id

Definition at line 110 of file RField.h.

References Pscf::Pspc::Field< Data >::serialize().


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