CoDiPack  3.0.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

inlineexplicit ChunkBase (size_t const &size)
 Constructor.
 
inlinevirtual ~ChunkBase ()
 Destructor.
 
Interface: Entry management
template<typename... Data>
inlinevoid pushData (Data &&... dataEntries)
 provided.
 
template<typename... Pointers>
inlinevoid 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
inlinevirtual void allocateData ()=0
 Allocated the data if it was deallocated before.
 
inlinevirtual void deleteData ()=0
 Delete the allocated data.
 
inlinevirtual void readData (FileIo &handle)=0
 Read data from the FileIo handle.
 
inlinevirtual void writeData (FileIo &handle) const =0
 Write data to the FileIo handle.
 
Interface: Misc
inlinevoid swap (ImplProxy &other)
 Swap data with other chunk of the same type.
 
Common functionality
inlinesize_t getSize () const
 Get the allocated size.
 
inlinesize_t getUnusedSize () const
 Number of unused data items.
 
inlinesize_t getUsedSize () const
 Number of used data items.
 
inlinevoid reset ()
 Sets the number of used items to zero.
 
inlinevoid resize (size_t newSize)
 Resize the allocated data. Stored data is lost. Used size is set to zero.
 
inlinevoid 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

inlinevoid 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()

◆ dataPointer()

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

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

◆ deleteData()

◆ erase()

◆ pushData()

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

provided.

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

◆ readData()

◆ writeData()


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