PSCF v1.1
Public Member Functions | List of all members
Pscf::Field< T > Class Template Reference

Base class template for a field defined on a spatial grid. More...

#include <Field.h>

Inheritance diagram for Pscf::Field< T >:
Util::DArray< Data > Util::Array< Data >

Public Member Functions

 Field ()
 Constructor. More...
 
 Field (Field< T > const &other)
 Copy constructor. More...
 
Field< T > & operator= (Field< T > const &other)
 Assignment operator. More...
 
Field< T > & operator= (T &scalar)
 Assignment - assign all elements to a common scalar. More...
 
Field< T > & operator+= (Field< T > &other)
 Increment operator - add one field by another. More...
 
Field< T > & operator-= (Field< T > &other)
 Decrement operator - subtract one field from another. More...
 
Field< T > & operator*= (T scalar)
 Multiplication operator - multiply one field by a scalar. More...
 
Field< T > & operator*= (Field< T > &other)
 Pointwise multipication of one field by another. More...
 
void setToZero ()
 Set all elements to zero. More...
 
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<typename T = double>
class Pscf::Field< T >

Base class template for a field defined on a spatial grid.

Derived from DArray<T>, and provides useful arithmetic operations.

Definition at line 25 of file pscf/math/Field.h.

Constructor & Destructor Documentation

◆ Field() [1/2]

template<typename Data >
Pscf::Pspc::Field< Data >::Field

Constructor.

Definition at line 26 of file Field.tpp.

◆ Field() [2/2]

template<class T >
Pscf::Field< T >::Field ( Field< T > const &  other)

Member Function Documentation

◆ operator=() [1/2]

template<class T >
Field< T > & Pscf::Field< T >::operator= ( Field< T > const &  other)

◆ operator=() [2/2]

template<typename T >
Field< T > & Pscf::Field< T >::operator= ( T &  scalar)

Assignment - assign all elements to a common scalar.

Definition at line 152 of file pscf/math/Field.h.

References UTIL_THROW.

◆ operator+=()

template<typename T >
Field< T > & Pscf::Field< T >::operator+= ( Field< T > &  other)

Increment operator - add one field by another.

Definition at line 167 of file pscf/math/Field.h.

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

◆ operator-=()

template<typename T >
Field< T > & Pscf::Field< T >::operator-= ( Field< T > &  other)

Decrement operator - subtract one field from another.

Definition at line 188 of file pscf/math/Field.h.

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

◆ operator*=() [1/2]

template<typename T >
Field< T > & Pscf::Field< T >::operator*= ( scalar)

Multiplication operator - multiply one field by a scalar.

Definition at line 212 of file pscf/math/Field.h.

References UTIL_THROW.

◆ operator*=() [2/2]

template<typename T >
Field< T > & Pscf::Field< T >::operator*= ( Field< T > &  other)

Pointwise multipication of one field by another.

Definition at line 229 of file pscf/math/Field.h.

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

◆ setToZero()

template<typename T >
void Pscf::Field< T >::setToZero

Set all elements to zero.

Definition at line 252 of file pscf/math/Field.h.

◆ average()

template<typename T >
T Pscf::Field< T >::average

Compute and return average of all elements.

Definition at line 263 of file pscf/math/Field.h.


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