|
CORSIKA
@c8_version@
The framework to simulate particle cascades for astroparticle physics
|
The Stack class provides (and connects) the main particle data storage machinery. More...
#include <Stack.hpp>

Public Types | |
| typedef TStackData | stack_data_type |
| this is the type of the user-provided data structure | |
| typedef SecondaryView< TStackData, MParticleInterface, MSecondaryProducer > | stack_view_type |
| template<typename TStackIterator > | |
| using | pi_type = MParticleInterface< TStackIterator > |
| typedef StackIteratorInterface< value_type, MParticleInterface, MSecondaryProducer, Stack > | stack_iterator_type |
| Via the StackIteratorInterface and ConstStackIteratorInterface specialization, the type of the stack_iterator_type template class is declared for a particular stack data object. More... | |
| typedef ConstStackIteratorInterface< value_type, MParticleInterface, MSecondaryProducer, Stack > | const_stack_iterator_type |
| typedef stack_iterator_type::particle_interface_type | particle_interface_type |
| this is the full type of the user-declared MParticleInterface | |
| typedef stack_iterator_type | particle_type |
| In all programming context, the object to access, copy, and transport particle data is via the stack_iterator_type. | |
Public Member Functions | |
| Stack () | |
| create a new Stack, if there is already data associated prepare needed initialization. | |
| Stack (Stack &)=delete | |
| since Stack can be very big, we don't want to copy it | |
| Stack & | operator= (Stack &)=delete |
| since Stack can be very big, we don't want to copy it | |
| template<typename UType = TStackData, typename = typename std::enable_if<std::is_reference<UType>::value>::type> | |
| Stack (TStackData vD) | |
| if TStackData is a reference member we HAVE to initialize it in the constructor, this is typically needed for SecondaryView | |
| template<typename... TArgs, typename UType = TStackData, typename = typename std::enable_if<std::is_reference<UType>::value>::type> | |
| Stack (TArgs... args) | |
| This constructor takes any argument and passes it on to the TStackData user class. More... | |
Most generic proxy methods for TStackData data_ | |
| unsigned int | getCapacity () const |
| unsigned int | getErased () const |
| unsigned int | getEntries () const |
| template<typename... TArgs> | |
| void | clear (TArgs... args) |
These are functions required by std containers and std loops | |
| stack_iterator_type | begin () |
| stack_iterator_type | end () |
| stack_iterator_type | last () |
| const_stack_iterator_type | begin () const |
| const_stack_iterator_type | end () const |
| const_stack_iterator_type | last () const |
| const_stack_iterator_type | cbegin () const |
| const_stack_iterator_type | cend () const |
| const_stack_iterator_type | clast () const |
| stack_iterator_type | at (unsigned int i) |
| const_stack_iterator_type | at (unsigned int i) const |
| stack_iterator_type | first () |
| const_stack_iterator_type | cfirst () const |
| stack_iterator_type | getNextParticle () |
| template<typename... TArgs> | |
| stack_iterator_type | addParticle (const TArgs... v) |
| increase stack size, create new particle at end of stack | |
| void | swap (stack_iterator_type a, stack_iterator_type b) |
| void | copy (stack_iterator_type a, stack_iterator_type b) |
| void | copy (const_stack_iterator_type a, stack_iterator_type b) |
| void | erase (stack_iterator_type p) |
| void | erase (particle_interface_type p) |
| delete this particle | |
| bool | isEmpty () |
| check if there are no further non-deleted particles on stack | |
| bool | isErased (const stack_iterator_type &p) const |
| check if this particle was already deleted | |
| bool | isErased (const const_stack_iterator_type &p) const |
| bool | isErased (const particle_interface_type &p) const |
| bool | purgeLastIfDeleted () |
| Function to ultimatively remove the last entry from the stack, if it was marked as deleted before. More... | |
| void | purge () |
| Function to ultimatively remove all entries from the stack marked as deleted. More... | |
| unsigned int | getSize () const |
| std::string | asString () const |
| template<typename... TArgs> | |
| stack_iterator_type | addSecondary (stack_iterator_type &parent, const TArgs... v) |
| increase stack size, create new particle at end of stack, related to parent particle/projectile More... | |
| void | swap (unsigned int const a, unsigned int const b) |
| void | copy (unsigned int const a, unsigned int const b) |
| bool | isErased (unsigned int const i) const |
| void | erase (unsigned int const i) |
| void | purge (unsigned int i) |
| will remove from storage the element i. More... | |
| unsigned int | getIndexFromIterator (const unsigned int vI) const |
| Function to perform eventual transformation from StackIterator::getIndex() to index in data stored in TStackData data_. More... | |
The Stack class provides (and connects) the main particle data storage machinery.
The StackDataType type is the user-provided bare data storage object. This can be of any complexity, from a simple struct (fortran common block), to a combination of different and distributed data sources.
The user-provided ParticleInterface template type is the base class type of the StackIteratorInterface class (CRTP) and must provide all functions to read single particle data from the StackDataType, given an 'unsigned int' index.
Important: ParticleInterface must inherit from ParticleBase.
The Stack implements the std-type begin/end function to allow integration in normal for loops, ranges, etc.
The template argument MSecondaryProducer is only needed because of gitlab Issue 161
Due to a limitation of clang the corsika::MakeView does not work. Thus, MSecondaryProducer is needed here to fully define a SecondaryView class.
| typedef StackIteratorInterface<value_type, MParticleInterface, MSecondaryProducer, Stack> corsika::Stack< TStackData, MParticleInterface, MSecondaryProducer >::stack_iterator_type |
Via the StackIteratorInterface and ConstStackIteratorInterface specialization, the type of the stack_iterator_type template class is declared for a particular stack data object.
Using CRTP, this also determines the type of MParticleInterface template class simultaneously.
|
inline |
This constructor takes any argument and passes it on to the TStackData user class.
If the user did not provide a suited constructor this will fail with an error message.
Furthermore, this is disabled with enable_if for SecondaryView stacks, where the inner data container is always a reference and cannot be initialized here.
|
protected |
increase stack size, create new particle at end of stack, related to parent particle/projectile
This should only get internally called from a StackIterator::addSecondary via ParticleBase
|
protected |
Function to perform eventual transformation from StackIterator::getIndex() to index in data stored in TStackData data_.
By default (and in almost all cases) this should just be identiy. See class SecondaryView for an alternative implementation.
| void corsika::Stack< TStackData, MParticleInterface, MSecondaryProducer >::purge | ( | ) |
Function to ultimatively remove all entries from the stack marked as deleted.
Careful: this will re-order the entries on the stack, since "gaps" in the stack are filled with entries from the back (copied).
|
protected |
will remove from storage the element i.
This is a helper function for SecondaryView.
| bool corsika::Stack< TStackData, MParticleInterface, MSecondaryProducer >::purgeLastIfDeleted | ( | ) |
Function to ultimatively remove the last entry from the stack, if it was marked as deleted before.
If this is not the case, the function will just return false and do nothing.