CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::ChunkBase Struct Referenceabstract

A chunk stores a contiguous block of data in CoDiPack. More...

#include <chunk.hpp>

Inheritance diagram for codi::ChunkBase:

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.
 

Detailed Description

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:

item 0 | item 1 | item 2 | etc.
array1 (double) : 0.1 | 3.14 | 2.17 | ...
array2 (int) : 1 | 10 | 2 | ...

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.

Member Function Documentation

◆ allocateData()

virtual void codi::ChunkBase::allocateData ( )
inlinepure virtual

◆ dataPointer()

template<typename... Pointers>
void codi::ChunkBase::dataPointer ( size_t const & index,
Pointers *&... pointers )
inline

Extract pointer to requested position. For each entry one argument has to be provided.

◆ deleteData()

virtual void codi::ChunkBase::deleteData ( )
inlinepure virtual

◆ erase()

virtual void codi::ChunkBase::erase ( size_t const & start,
size_t const & end )
pure virtual

◆ pushData()

template<typename... Data>
void codi::ChunkBase::pushData ( Data &&... dataEntries)
inline

provided.

Add one data item. For each entry one argument has to be

◆ readData()

virtual void codi::ChunkBase::readData ( FileIo & handle)
inlinepure virtual

◆ writeData()

virtual void codi::ChunkBase::writeData ( FileIo & handle) const
inlinepure virtual

The documentation for this struct was generated from the following file: