CORSIKA8  0.0.0
The framework to simulate particle cascades for astroparticle physics
CombinedStack.hpp
1 /*
2  * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
3  *
4  * This software is distributed under the terms of the GNU General Public
5  * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
6  * the license.
7  */
8 
9 #pragma once
10 
15 
16 namespace corsika {
17 
37  template <template <typename> typename TParticleInterfaceA,
38  template <typename> class TParticleInterfaceB, typename TStackIterator>
40  : public TParticleInterfaceB<TParticleInterfaceA<TStackIterator>> {
41 
42  typedef CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB,
43  TStackIterator>
44  pi_c_type;
45  typedef TParticleInterfaceA<TStackIterator> pi_a_type;
46  typedef TParticleInterfaceB<TParticleInterfaceA<TStackIterator>> pi_b_type;
47 
48  protected:
49  using pi_b_type::getIndex; // choose B, A would also work
50  using pi_b_type::getStackData; // choose B, A would also work
51 
52  public:
69  template <typename... TArgs1>
70  void setParticleData(std::tuple<TArgs1...> const vA);
71 
72  template <typename... TArgs1, typename... TArgs2>
73  void setParticleData(std::tuple<TArgs1...> const vA, std::tuple<TArgs2...> const vB);
74 
75  template <typename... TArgs1>
76  void setParticleData(pi_a_type& p, std::tuple<TArgs1...> const vA);
77 
78  template <typename... TArgs1, typename... TArgs2>
79  void setParticleData(pi_c_type& p, std::tuple<TArgs1...> const vA,
80  std::tuple<TArgs2...> const vB);
82 
83  std::string asString() const;
84 
85  protected:
86  };
87 
97  template <typename Stack1Impl, typename Stack2Impl>
98  struct CombinedStackImpl : public Stack1Impl, public Stack2Impl {
99 
100  public:
101  void clear();
102 
103  unsigned int getSize() const { return Stack1Impl::getSize(); }
104  unsigned int getCapacity() const { return Stack1Impl::getCapacity(); }
105 
109  void copy(const unsigned int i1, const unsigned int i2);
110 
114  void swap(const unsigned int i1, const unsigned int i2);
115 
116  void incrementSize();
117 
118  void decrementSize();
119 
120  }; // end class CombinedStackImpl
121 
131  template <typename Stack1Impl, typename Stack2Impl, template <typename> typename _PI,
132  template <typename T1, template <class> class T2> class _MSecondaryProducer =
134  using CombinedStack =
136 
137 } // namespace corsika
138 
139 #include <corsika/detail/framework/stack/CombinedStack.inl>
Import and extend the phys::units package.
Memory implementation of a combined data stack.
The Stack class provides (and connects) the main particle data storage machinery. ...
Definition: Stack.hpp:77
CORSIKA8 logging utilities.
CombinedParticleInterface can be used to combine the data of several StackData objects.
Description of particle stacks.
The cascade namespace assembles all objects needed to simulate full particles cascades.
Class to handle the generation of new secondaries.
Interface to particle properties.