CORSIKA  @c8_version@
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 
23  template <typename T>
24  class UniformMagneticField : public T {
25 
26  public:
35  template <typename... Args>
36  UniformMagneticField(MagneticFieldVector const& field, Args&&... args)
37  : T(std::forward<Args>(args)...)
38  , B_(field) {}
39 
47  [maybe_unused]] Point const& point) const final override {
48  return B_;
49  }
50 
56  void setMagneticField(MagneticFieldVector const& Bfield) { B_ = Bfield; }
57 
58  private:
60 
61  }; // END: class MagneticField
62 
63 } // namespace corsika
UniformMagneticField(MagneticFieldVector const &field, Args &&... args)
Construct a UniformMagneticField.
STL namespace.
MagneticFieldVector getMagneticField([[maybe_unused]] Point const &point) const final override
Evaluate the magnetic field at a given location.
`, since they are used everywhere as integral part of the framework.
A uniform (constant) magnetic field.
void setMagneticField(MagneticFieldVector const &Bfield)
Set the magnetic field returned by this instance.