A chunk stores a contiguous block of data in CoDiPack. More...
#include <chunk.hpp>
Public Member Functions | |
ChunkBase (size_t const &size) | |
Constructor. | |
virtual | ~ChunkBase () |
Destructor. | |
Interface: Entry management | |
template<typename... Data> | |
void | pushData (Data &&... dataEntries) |
provided. | |
template<typename... Pointers> | |
void | dataPointer (size_t const &index, Pointers *&... pointers) |
virtual void | erase (size_t const &start, size_t const &end)=0 |
Erase data items start, ..., end - 1. | |
Interface: Data IO | |
virtual void | allocateData ()=0 |
Allocated the data if it was deallocated before. | |
virtual void | deleteData ()=0 |
Delete the allocated data. | |
virtual void | readData (FileIo &handle)=0 |
Read data from the FileIo handle. | |
virtual void | writeData (FileIo &handle) const =0 |
Write data to the FileIo handle. | |
Interface: Misc | |
void | swap (ImplProxy &other) |
Swap data with other chunk of the same type. | |
Common functionality | |
size_t | getSize () const |
Get the allocated size. | |
size_t | getUnusedSize () const |
Number of unused data items. | |
size_t | getUsedSize () const |
Number of used data items. | |
void | reset () |
Sets the number of used items to zero. | |
void | resize (size_t newSize) |
Resize the allocated data. Stored data is lost. Used size is set to zero. | |
void | setUsedSize (size_t const &usage) |
Set the used size. | |
Static Public Attributes | |
Interface: Types & constants | |
static size_t constexpr | EntrySize = false |
Total size of all data in one entry. | |
Protected Member Functions | |
void | swap (ChunkBase &other) |
Swap the entries of this base class. | |
Protected Attributes | |
size_t | size |
Maximum size of arrays. | |
size_t | usedSize |
Currently used size. | |
A chunk stores a contiguous block of data in CoDiPack.
See DataInterface for a more general description of the data layout in CoDiPack.
The chunk classes implement a structure of arrays approach for the data management. Each item can have multiple entries where each entry is stored in its own array.
E.g., if each item consists two entries (double, int), then we have two arrays:
ChunkBase serves both as a base class and as an interface. The base class defines functions for getting and setting the number of used items. The interface defines the functions for the data access.
|
inlinepure virtual |
Allocated the data if it was deallocated before.
Implemented in codi::Chunk1< Data1 >, codi::Chunk2< Data1, Data2 >, codi::Chunk3< Data1, Data2, Data3 >, and codi::Chunk4< Data1, Data2, Data3, Data4 >.
|
inline |
Extract pointer to requested position. For each entry one argument has to be provided.
|
inlinepure virtual |
Delete the allocated data.
Implemented in codi::Chunk1< Data1 >, codi::Chunk2< Data1, Data2 >, codi::Chunk3< Data1, Data2, Data3 >, and codi::Chunk4< Data1, Data2, Data3, Data4 >.
|
pure virtual |
Erase data items start, ..., end - 1.
Implemented in codi::Chunk1< Data1 >, codi::Chunk2< Data1, Data2 >, codi::Chunk3< Data1, Data2, Data3 >, and codi::Chunk4< Data1, Data2, Data3, Data4 >.
|
inline |
provided.
Add one data item. For each entry one argument has to be
|
inlinepure virtual |
Read data from the FileIo handle.
Implemented in codi::Chunk1< Data1 >, codi::Chunk2< Data1, Data2 >, codi::Chunk3< Data1, Data2, Data3 >, and codi::Chunk4< Data1, Data2, Data3, Data4 >.
|
inlinepure virtual |
Write data to the FileIo handle.
Implemented in codi::Chunk1< Data1 >, codi::Chunk2< Data1, Data2 >, codi::Chunk3< Data1, Data2, Data3 >, and codi::Chunk4< Data1, Data2, Data3, Data4 >.