CORSIKA8  0.0.0
The framework to simulate particle cascades for astroparticle physics
LayeredSphericalAtmosphereBuilder.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/Point.hpp>
13 #include <corsika/media/Environment.hpp>
14 #include <corsika/media/IMediumModel.hpp>
15 #include <corsika/media/NuclearComposition.hpp>
16 #include <corsika/media/VolumeTreeNode.hpp>
17 
18 // for detail namespace, NoExtraModelInner, NoExtraModel and traits
19 #include <corsika/detail/media/LayeredSphericalAtmosphereBuilder.hpp>
20 
21 #include <memory>
22 #include <stack>
23 #include <tuple>
24 #include <type_traits>
25 #include <functional>
26 
27 namespace corsika {
28 
39  template <typename TMediumInterface = IMediumModel,
40  template <typename> typename MExtraEnvirnoment = detail::NoExtraModel>
42 
55  template <typename TMediumInterface = IMediumModel,
56  template <typename> typename TMediumModelExtra = detail::NoExtraModel,
57  typename... TModelArgs>
59 
64  const LayeredSphericalAtmosphereBuilder&) = delete;
65 
66  // friend, to allow construction
67  template <typename, template <typename> typename>
69 
70  protected:
71  LayeredSphericalAtmosphereBuilder(TModelArgs... args, Point const& center,
72  LengthType planetRadius)
73  : center_(center)
74  , planetRadius_(planetRadius)
75  , additionalModelArgs_{args...} {}
76 
77  public:
78  void setNuclearComposition(NuclearComposition const& composition);
79  void addExponentialLayer(GrammageType b, LengthType c, LengthType upperBoundary);
80  void addLinearLayer(LengthType c, LengthType upperBoundary);
81 
82  void addTabularLayer(std::function<MassDensityType(LengthType)> const& funcRho,
83  unsigned int const nBins, LengthType const deltaHeight,
84  LengthType const upperBoundary);
85 
86  int getSize() const { return layers_.size(); }
87 
88  void assemble(Environment<TMediumInterface>& env);
90 
94  LengthType getPlanetRadius() const { return planetRadius_; }
95 
96  private:
97  void checkRadius(LengthType r) const;
98 
99  std::unique_ptr<NuclearComposition> composition_;
100  Point center_;
101  LengthType previousRadius_{LengthType::zero()};
102  LengthType planetRadius_;
103  std::tuple<TModelArgs...> const additionalModelArgs_;
104 
105  std::stack<typename VolumeTreeNode<TMediumInterface>::VTNUPtr>
106  layers_; // innermost layer first
107 
108  }; // end class LayeredSphericalAtmosphereBuilder
109 
110 } // namespace corsika
111 
112 #include <corsika/detail/media/LayeredSphericalAtmosphereBuilder.inl>
LengthType getPlanetRadius() const
Get the current planet radius.
Import and extend the phys::units package.
Helper class to setup concentric spheres of layered atmosphere with spcified density profiles (expone...
The cascade namespace assembles all objects needed to simulate full particles cascades.
Helper class to create LayeredSphericalAtmosphereBuilder, the extra environment models have to be pas...
static constexpr quantity zero()
We need a "zero" of each type – for comparisons, to initialize running totals, etc.
Definition: quantity.hpp:359
Describes the composition of matter Allowes and handles the creation of custom matter compositions...
Base Evnironment class Describes the Environment in which the shower is propagated.
Definition: Environment.hpp:27