CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
QGSJetIIFragmentsStack.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 
12 #include <corsika/framework/geometry/RootCoordinateSystem.hpp>
13 #include <corsika/framework/geometry/Vector.hpp>
15 #include <corsika/modules/qgsjetII/ParticleConversion.hpp>
16 
17 #include <qgsjet-II-04.hpp>
18 
19 namespace corsika::qgsjetII {
20 
22 
23  public:
24  void dump() const {}
25 
26  void clear() {
27  qgarr13_.nsf = 0;
28  qgarr55_.nwt = 0;
29  }
30  unsigned int getSize() const { return qgarr13_.nsf; }
31  unsigned int getCapacity() const { return iapmax; }
32 
33  static unsigned int getWoundedNucleonsTarget() { return qgarr55_.nwt; }
34  static unsigned int getWoundedNucleonsProjectile() { return qgarr55_.nwp; }
35 
36  int getFragmentSize(const unsigned int i) const { return qgarr13_.iaf[i]; }
37  void setFragmentSize(const unsigned int i, const int v) { qgarr13_.iaf[i] = v; }
38 
39  void copy(const unsigned int i1, const unsigned int i2) {
40  qgarr13_.iaf[i2] = qgarr13_.iaf[i1];
41  }
42 
43  void swap(const unsigned int i1, const unsigned int i2) {
44  std::swap(qgarr13_.iaf[i1], qgarr13_.iaf[i2]);
45  }
46 
47  void incrementSize() { qgarr13_.nsf++; }
48  void decrementSize() {
49  if (qgarr13_.nsf > 0) { qgarr13_.nsf--; }
50  }
51  };
52 
53  template <typename TStackIterator>
54  class FragmentsInterface : public corsika::ParticleBase<TStackIterator> {
55 
58 
59  public:
60  void setParticleData(const int vSize) { setFragmentSize(vSize); }
61 
62  void setParticleData(FragmentsInterface<TStackIterator>& /*parent*/,
63  const int vSize) {
64  setFragmentSize(vSize);
65  }
66 
67  void setFragmentSize(const int v) { getStackData().setFragmentSize(getIndex(), v); }
68 
69  double getFragmentSize() const { return getStackData().getFragmentSize(getIndex()); }
70  };
71 
74 
75 } // end namespace corsika::qgsjetII
76 
77 //#include <corsika/detail/modules/qgsjetII/QGSJetIIFragmentsStack.inl>
Import and extend the phys::units package.
The Stack class provides (and connects) the main particle data storage machinery. ...
Definition: Stack.hpp:77
Description of particle stacks.
The base class to define the readout of particle properties from a particle stack.