PSCF v1.1
|
Dynamic array with aligned data, for use with FFTW library. More...
#include <Field.h>
Public Member Functions | |
Field () | |
Default constructor. More... | |
virtual | ~Field () |
Destructor. More... | |
void | allocate (int capacity) |
Allocate the underlying C array. More... | |
void | deallocate () |
Dellocate the underlying C array. More... | |
bool | isAllocated () const |
Return true if the Field has been allocated, false otherwise. More... | |
int | capacity () const |
Return allocated size. 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 * | cField () |
Return pointer to underlying C array. More... | |
Data const * | cField () const |
Return pointer to const to underlying C array. More... | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Serialize a Field to/from an Archive. More... | |
Protected Attributes | |
Data * | data_ |
Pointer to an array of Data elements. More... | |
int | capacity_ |
Allocated size of the data_ array. More... | |
Dynamic array with aligned data, for use with FFTW library.
Definition at line 25 of file pspc/field/Field.h.
Pscf::Pspc::Field< Data >::Field | ( | ) |
Default constructor.
References Pscf::Pspc::Field< Data >::cField().
|
virtual |
void Pscf::Pspc::Field< Data >::allocate | ( | int | capacity | ) |
Allocate the underlying C array.
Exception | if the Field is already allocated. |
capacity | number of elements to allocate. |
Definition at line 51 of file Field.tpp.
References UTIL_THROW.
Referenced by Pscf::Pspc::RField< D >::allocate(), and Pscf::Pspc::RFieldDft< D >::allocate().
void Pscf::Pspc::Field< Data >::deallocate | ( | ) |
Dellocate the underlying C array.
Exception | if the Field is not allocated. |
Definition at line 69 of file Field.tpp.
References UTIL_THROW.
|
inline |
Return true if the Field has been allocated, false otherwise.
Definition at line 181 of file pspc/field/Field.h.
|
inline |
Return allocated size.
Definition at line 135 of file pspc/field/Field.h.
|
inline |
Get an element by non-const reference.
Mimic C-array subscripting.
i | array index |
Definition at line 142 of file pspc/field/Field.h.
|
inline |
Get an element by const reference.
Mimics C-array subscripting.
i | array index |
Definition at line 154 of file pspc/field/Field.h.
|
inline |
Return pointer to underlying C array.
Definition at line 166 of file pspc/field/Field.h.
Referenced by Pscf::Pspc::Field< Data >::Field().
|
inline |
Return pointer to const to underlying C array.
Definition at line 174 of file pspc/field/Field.h.
void Pscf::Pspc::Field< Data >::serialize | ( | Archive & | ar, |
const unsigned int | version | ||
) |
Serialize a Field to/from an Archive.
ar | archive |
version | archive version id |
Referenced by Pscf::Pspc::RField< D >::serialize(), and Pscf::Pspc::RFieldDft< D >::serialize().
|
protected |
Pointer to an array of Data elements.
Definition at line 112 of file pspc/field/Field.h.
|
protected |
Allocated size of the data_ array.
Definition at line 115 of file pspc/field/Field.h.