PSCF v1.3
|
Dynamic array with data aligned for use with FFTW library. More...
#include <FftwDArray.h>
Public Member Functions | |
FftwDArray () | |
Default constructor. | |
virtual | ~FftwDArray () |
Destructor. | |
void | allocate (int capacity) |
Allocate the underlying C array. | |
virtual void | deallocate () |
Dellocate the underlying C array. | |
bool | isAllocated () const |
Return true if the FftwDArray has been allocated, false otherwise. | |
template<class Archive> | |
void | serialize (Archive &ar, const unsigned int version) |
Serialize a FftwDArray to/from an Archive. | |
Public Member Functions inherited from Util::Array< Data > | |
virtual | ~Array () |
Destructor. | |
int | capacity () const |
Return allocated size. | |
void | begin (ArrayIterator< Data > &iterator) |
Set an iterator to begin this Array. | |
void | begin (ConstArrayIterator< Data > &iterator) const |
Set a const iterator to begin this Array. | |
Data & | operator[] (int i) |
Get an element by non-const reference. | |
Data const & | operator[] (int i) const |
Get an element by const reference. | |
Data * | cArray () |
Return a pointer to the underlying C array. | |
Data const * | cArray () const |
Return pointer to const to the underlying C array. |
Additional Inherited Members | |
Protected Member Functions inherited from Util::Array< Data > | |
Array () | |
Default constructor. | |
Protected Attributes inherited from Util::Array< Data > | |
Data * | data_ |
Pointer to an array of Data elements. | |
int | capacity_ |
Allocated size of the data_ array. |
Dynamic array with data aligned for use with FFTW library.
The allocate and deallocate functions of this class use functions provided by the FFTW library to allocate and free aligned memory. The class is otherwise similar in most respects to a Util::DArray.
Definition at line 32 of file FftwDArray.h.
Pscf::Prdc::Cpu::FftwDArray< Data >::FftwDArray | ( | ) |
Default constructor.
Definition at line 24 of file FftwDArray.tpp.
References Util::Array< Data >::Array().
|
virtual |
Destructor.
Deletes underlying C array, if allocated previously.
Definition at line 32 of file FftwDArray.tpp.
References Util::Array< Data >::capacity_, Util::Array< Data >::data_, and isAllocated().
void Pscf::Prdc::Cpu::FftwDArray< Data >::allocate | ( | int | capacity | ) |
Allocate the underlying C array.
Exception | if the FftwDArray is already allocated. |
capacity | number of elements to allocate. |
Definition at line 48 of file FftwDArray.tpp.
References Util::Array< Data >::capacity(), isAllocated(), and UTIL_THROW.
Referenced by Pscf::Prdc::Cpu::CField< D >::allocate(), Pscf::Prdc::Cpu::RField< D >::allocate(), Pscf::Prdc::Cpu::RFieldDft< D >::allocate(), and serialize().
|
virtual |
Dellocate the underlying C array.
Exception | if the FftwDArray is not allocated. |
Reimplemented in Pscf::Prdc::Cpu::CField< D >, Pscf::Prdc::Cpu::RField< D >, and Pscf::Prdc::Cpu::RFieldDft< D >.
Definition at line 66 of file FftwDArray.tpp.
References Util::Array< Data >::capacity_, Util::Array< Data >::data_, isAllocated(), and UTIL_THROW.
Referenced by Pscf::Prdc::Cpu::CField< D >::deallocate(), Pscf::Prdc::Cpu::RField< D >::deallocate(), and Pscf::Prdc::Cpu::RFieldDft< D >::deallocate().
|
inline |
Return true if the FftwDArray has been allocated, false otherwise.
Definition at line 102 of file FftwDArray.h.
References Util::Array< Data >::data_.
Referenced by allocate(), Pscf::Prdc::Cpu::CField< D >::CField(), Pscf::Rpg::FieldIo< D >::convertBasisToKGrid(), Pscf::Rpg::FieldIo< D >::convertKGridToBasis(), deallocate(), Pscf::Rpg::FieldIo< D >::hasSymmetry(), Pscf::Prdc::Cpu::CField< D >::operator=(), Pscf::Prdc::Cpu::RField< D >::operator=(), Pscf::Prdc::Cpu::RFieldDft< D >::operator=(), Pscf::Prdc::Cpu::RField< D >::RField(), Pscf::Prdc::Cpu::RFieldDft< D >::RFieldDft(), Pscf::Rpg::FieldIo< D >::scaleFieldRGrid(), serialize(), Pscf::Rpc::Block< D >::stepThread(), and ~FftwDArray().
void Pscf::Prdc::Cpu::FftwDArray< Data >::serialize | ( | Archive & | ar, |
const unsigned int | version ) |
Serialize a FftwDArray to/from an Archive.
ar | archive |
version | archive version id |
Definition at line 110 of file FftwDArray.h.
References allocate(), Util::Array< Data >::capacity(), Util::Array< Data >::capacity_, Util::Array< Data >::data_, isAllocated(), and UTIL_THROW.
Referenced by Pscf::Prdc::Cpu::CField< D >::serialize(), Pscf::Prdc::Cpu::RField< D >::serialize(), and Pscf::Prdc::Cpu::RFieldDft< D >::serialize().