11 #include <corsika/framework/stack/ParticleBase.hpp> 13 #include <boost/type_index.hpp> 16 template <
typename T,
template <
typename>
typename TParticleInterface>
22 template <
typename TStackData,
template <
typename>
typename TParticleInterface,
23 template <
class T1,
template <
class>
class T2>
class MSecondaryProducer>
26 template <
typename TStackData,
template <
typename>
typename TParticleInterface,
27 template <
class T1,
template <
class>
class T2>
class MSecondaryProducer>
30 template <
typename TStackData,
template <
typename>
typename TParticleInterface,
31 template <
class T1,
template <
class>
class T2>
class MSecondaryProducer,
73 template <
typename TStackData,
template <
typename>
typename TParticleInterface,
74 template <
typename T1,
template <
class>
class T2>
class MSecondaryProducer,
78 :
public TParticleInterface<StackIteratorInterface<
79 TStackData, TParticleInterface, MSecondaryProducer, TStackType>> {
83 TStackData, TParticleInterface, MSecondaryProducer, TStackType>>
84 particle_interface_type;
86 typedef TStackType stack_type;
87 typedef TStackData stack_data_type;
93 : index_(
std::move(rhs.index_))
94 , data_(
std::move(rhs.data_)) {}
123 template <
typename... TArgs>
129 (**this).setParticleData(args...);
142 template <
typename... TArgs>
148 (**this).setParticleData(*parent, args...);
151 bool isErased()
const {
return getStack().isErased(*
this); }
161 getStack().isErased(*
this));
169 getStack().isErased(*
this));
176 return index_ == rhs.index_;
179 return index_ != rhs.index_;
182 TStackData, TParticleInterface, MSecondaryProducer,
183 stack_type>& rhs)
const;
185 TStackData, TParticleInterface, MSecondaryProducer,
186 stack_type>& rhs)
const;
193 return static_cast<particle_interface_type&
>(*this);
201 return static_cast<particle_interface_type const&
>(*this);
210 unsigned int getIndex()
const {
return index_; }
215 stack_type
const&
getStack()
const {
return *data_; }
219 TStackData
const&
getStackData()
const {
return data_->getStackData(); }
222 return data_->getIndexFromIterator(index_);
227 friend class Stack<TStackData, TParticleInterface,
229 friend class Stack<TStackData&, TParticleInterface,
234 template <
typename T1,
235 template <
typename>
typename M1,
236 template <
typename T,
template <
typename>
typename T3>
typename M2>
239 template <
typename T,
template <
typename>
typename TParticleInterface_>
243 MSecondaryProducer, stack_type>;
246 unsigned int index_ = 0;
249 stack_type* data_ = 0;
268 template <
typename TStackData,
template <
typename>
typename TParticleInterface,
269 template <
typename T1,
template <
class>
class T2>
class MSecondaryProducer,
270 typename TStackType =
273 :
public TParticleInterface<ConstStackIteratorInterface<
274 TStackData, TParticleInterface, MSecondaryProducer, TStackType>> {
278 TStackData, TParticleInterface, MSecondaryProducer, TStackType>>
279 particle_interface_type;
281 typedef TStackType stack_type;
282 typedef TStackData stack_data_type;
289 : index_(
std::move(rhs.index_))
290 , data_(
std::move(rhs.data_)) {}
296 bool isErased()
const {
return getStack().isErased(*
this); }
305 getStack().isErased(*
this));
313 getStack().isErased(*
this));
320 return index_ == rhs.index_;
323 return index_ != rhs.index_;
327 stack_type>
const& rhs)
const {
328 return index_ == rhs.index_;
332 stack_type>
const& rhs)
const {
333 return index_ != rhs.index_;
336 particle_interface_type
const&
operator*()
const {
337 return static_cast<particle_interface_type const&
>(*this);
346 unsigned int getIndex()
const {
return index_; }
347 stack_type
const& getStack()
const {
return *data_; }
348 stack_data_type
const& getStackData()
const {
return data_->getStackData(); }
351 return data_->getIndexFromIterator(index_);
356 friend class Stack<stack_data_type, TParticleInterface,
358 friend class Stack<stack_data_type&, TParticleInterface,
363 template <
typename T1,
364 template <
typename>
typename M1,
365 template <
class T2,
template <
class>
class T3>
class M2>
366 friend class SecondaryView;
369 MSecondaryProducer, stack_type>;
371 template <
typename T,
template <
typename>
typename TParticleInterface_>
375 unsigned int index_ = 0;
378 stack_type
const* data_ = 0;
TStackData & getStackData()
Get current user particle TStackData object.
particle_interface_type const & operator*() const
Convert iterator to const value type, where value type is the user-provided particle readout class...
constexpr quantity< D, detail::PromoteMul< X, Y > > operator*(quantity< D, X > const &x, const Y &y)
quan * num
The Stack class provides (and connects) the main particle data storage machinery. ...
StackIteratorInterface(stack_type &data, unsigned int const index, const TArgs... args)
constructor that also sets new values on particle data object
particle_interface_type & operator*()
Convert iterator to value type, where value type is the user-provided particle readout class...
constexpr quantity< D, X > operator+(quantity< D, X > const &x)
stack_type const & getStack() const
Get current particle const Stack object.
TStackData const & getStackData() const
Get current const user particle TStackData object.
The cascade namespace assembles all objects needed to simulate full particles cascades.
constexpr bool operator!=(quantity< D, X > const &x, quantity< D, Y > const &y)
inequality.
StackIteratorInterface(StackIteratorInterface &&rhs)
unsigned int getIndexFromIterator() const
Get data index as mapped in Stack class.
StackIteratorInterface(stack_type &data, unsigned int const index)
iterator must always point to data, with an index:
SecondaryView can only be constructed by giving a valid Projectile particle, following calls to addSe...
ConstStackIteratorInterface(ConstStackIteratorInterface &&rhs)
unsigned int getIndexFromIterator() const
Get data index as mapped in Stack class.
stack_type & getStack()
Get current particle Stack object.
The base class to define the readout of particle properties from a particle stack.
This is the iterator class for const-access to stack data.
StackIteratorInterface(stack_type &data, unsigned int const index, StackIteratorInterface &parent, const TArgs... args)
constructor that also sets new values on particle data object, including reference to parent particle...
The StackIteratorInterface is the main interface to iterator over particles on a stack.