Skip to content

Introduction and overview about the core part of the DynStack API

Dominik Baack edited this page Apr 30, 2017 · 17 revisions

Architecture

The DynStack API is designed as decorator design pattern where the user need to modify only a single function defined in user_code/dynstack_setup.h. Additional functions are available to control clean up and reset calls.

Storage Container

The core part of the stack is made up from one or multiple storage container. Those classes handle the actual storage required by the stack and implement all basic functionality.

Name Description
LiFo Last In-First Out storage (similar to a normal array)
FiFo First In-First Out storage
Null Discards all objects written to it

Modifier

The modifier classes are used to extend the the base functionality delivered by a single storage container or another stack. Each one implements only basic functionality that can be combined to create more complex functions.

Name Description
filter Filter objects depending on the return value of the function. If 0 is returned the element will be passed down another level, otherwise it will be removed and CORSIKA receives the return value
in_callback Calls the function before element is passed down to the next level
in_modify Calls the function and passes the returned value to the next level. This function can be used to store additional data for every particle.
out_callback Calls the the function after an element is requested from the storage and passes the element one layer up.
out_modify Forwards the read request to the layer below and modifies the element before it will be passed a layer up. This should not introduce a copy of the element.
overflow_to_disk When one underlying layer returns a value not equal to zero this module will save the object to a second storage with a size defined by the given integer. If this storage is full its written to the hard disk and received when the storage is empty again. Read operations are forwarded to the underlying layer until it is empty. (this feature is currently incomplete)
sorted Sorts all written objects into N equal copys of the underlying stack depending on the return value of a given function. The read order works with ascending bin number.
timer Measures and accumulated the time of every function call executed by the layers below. This class directly forwards the data and is commonly used for analysis of complex functions.

Advanced Modifier

This classes allow the combination of multiple independent stacks (different types possible) to a bigger more complex stack. Different aproaches to control the dataflow to the different stacks are implemented.

Name Description
copy Copies all data written to the first stack into a second independend stack. All read requests are only forwarded to the first stack, it is not possible to read data from the second stack.
debug The debug stack allows debugging of currently not fully functional addition to the features of the stack classes. It has no direct use in normal usecases.
dynamic_sorted This stack functions simmilar to the normal sorted_stack, but allowes to use N independet stacks of different types instead of a single type.
Clone this wiki locally