|
Schnek
|
Allocate a single array for multidimensional grids in C ordering. More...
#include <single-array-allocation.hpp>

Classes | |
| struct | SizeInfo |
Public Types | |
| typedef Array< size_t, rank > | IndexType |
| The grid index type. | |
| typedef Range< size_t, rank > | RangeType |
| The grid range type. | |
Public Member Functions | |
| SingleArrayLazyAllocation () | |
| Default constructor. | |
| SingleArrayLazyAllocation (const SingleArrayLazyAllocation &) | |
| Copy constructor. | |
| SingleArrayLazyAllocation< T, rank > & | operator= (const SingleArrayLazyAllocation< T, rank > &) |
| Assignment operator. | |
| ~SingleArrayLazyAllocation () | |
| destructor | |
Protected Types | |
| typedef std::function< void()> | UpdaterType |
Protected Member Functions | |
| void | resizeImpl (const IndexType &lo, const IndexType &hi) |
| resizes to grid with lower indices lo[0],...,lo[rank-1] and upper indices hi[0],...,hi[rank-1] | |
| void | onUpdate (const UpdaterType &updater) |
| Add an updater to the data. More... | |
Protected Attributes | |
| std::shared_ptr< internal::SingleArrayAllocationData< T, SizeInfo > > | data |
| The pointer to the data. | |
| size_t | size |
| The length of the array. | |
| RangeType | range |
| The lowest and highest coordinates in the grid (inclusive) | |
| IndexType | dims |
The dimensions of the grid dims = high - low + 1 | |
Allocate a single array for multidimensional grids in C ordering.
Deallocation and allocation is performed only when required. When the memory need grows, the storage will allocate slightly more memory that needed. Shrinking of the allocated space happens lazily.
Use this, when a resize is expected regularly.
| T | The type of data stored in the grid |
| rank | The rank of the grid |
|
protected |
Add an updater to the data.
The updater is called when the data is resized.