CORSIKA8  0.0.0
The framework to simulate particle cascades for astroparticle physics
UniformMagneticField.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 
11 #include <corsika/media/IMagneticFieldModel.hpp>
12 #include <corsika/framework/geometry/Vector.hpp>
13 #include <corsika/framework/geometry/PhysicalGeometry.hpp>
14 
15 namespace corsika {
16 
24  template <typename T>
25  class UniformMagneticField : public T {
26 
27  public:
36  template <typename... Args>
37  UniformMagneticField(MagneticFieldVector const& B, Args&&... args)
38  : T(std::forward<Args>(args)...)
39  , B_(B) {}
40 
47  MagneticFieldVector getMagneticField(Point const&) const final override { return B_; }
48 
55  auto setMagneticField(MagneticFieldVector const& Bfield) -> void { B_ = Bfield; }
56 
57  private:
59 
60  }; // END: class MagneticField
61 
62 } // namespace corsika
auto setMagneticField(MagneticFieldVector const &Bfield) -> void
Set the magnetic field returned by this instance.
STL namespace.
The cascade namespace assembles all objects needed to simulate full particles cascades.
MagneticFieldVector getMagneticField(Point const &) const final override
Evaluate the magnetic field at a given location.
A uniform (constant) magnetic field.
UniformMagneticField(MagneticFieldVector const &B, Args &&... args)
Construct a UniformMagneticField.