|
PSCF v1.4.0
|
Dynamic array with data aligned for use with FFTW library. More...
#include <FftwDArray.h>
Public Types | |
| using | ValueType = Data |
| Data type of each array element. | |
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 > | |
| 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 () | |
| Constructor (protected to provent direct instantiation). | |
| ~Array () | |
| Destructor (protected to prevent direct destruction). | |
| 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.
| using Pscf::Prdc::Cpu::FftwDArray< Data >::ValueType = Data |
Data type of each array element.
Definition at line 40 of file FftwDArray.h.
| Pscf::Prdc::Cpu::FftwDArray< Data >::FftwDArray | ( | ) |
Default constructor.
Definition at line 24 of file FftwDArray.tpp.
|
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 49 of file FftwDArray.tpp.
References Util::Array< Data >::capacity(), and isAllocated().
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 67 of file FftwDArray.tpp.
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 107 of file FftwDArray.h.
References Util::Array< Data >::data_.
Referenced by allocate(), Pscf::Prdc::Cpu::CField< D >::CField(), 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(), serialize(), Pscf::Cpc::Block< D >::stepThread(), 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 115 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().