From 5f3d1e542616ded63b7d0b15ec21efc3c872471c Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Tue, 15 Sep 2020 14:02:52 +0200 Subject: [PATCH] added so far empty dummy class for NoMagneticField --- Environment/CMakeLists.txt | 1 + Environment/NoMagneticField.h | 59 +++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 Environment/NoMagneticField.h diff --git a/Environment/CMakeLists.txt b/Environment/CMakeLists.txt index c02aa9586..46ecfb3cb 100644 --- a/Environment/CMakeLists.txt +++ b/Environment/CMakeLists.txt @@ -35,6 +35,7 @@ set ( ShowerAxis.h IMagneticFieldModel.h UniformMagneticField.h + NoMagneticField.h IRefractiveIndexModel.h UniformRefractiveIndex.h IMediumPropertyModel.h diff --git a/Environment/NoMagneticField.h b/Environment/NoMagneticField.h new file mode 100644 index 000000000..38e99347e --- /dev/null +++ b/Environment/NoMagneticField.h @@ -0,0 +1,59 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + +#pragma once + +#include <corsika/environment/IMagneticFieldModel.h> +#include <corsika/geometry/RootCoordinateSystem.h> + +namespace corsika::environment { + + /** + * A uniform (constant) magnetic field. + * + * This class returns the same magnetic field vector + * for all evaluated locations. + * + */ + template <typename T> + class NoMagneticField : public T { + + // a type-alias for a magnetic field vector + using MagneticFieldVector = + corsika::geometry::Vector<corsika::units::si::magnetic_flux_density_d>; + + public: + /** + * Construct a NoMagneticField. + * + * This is initialized with a fixed magnetic field + * and returns this magnetic field at all locations. + * + * @param field The fixed magnetic field to return. + */ + template <typename... Args> + NoMagneticField(Args&&... args) + : T(std::forward<Args>(args)...) + {} + + /** + * Evaluate the magnetic field at a given location. + * + * @param point The location to evaluate the field at. + * @returns The magnetic field vector. + */ + MagneticFieldVector GetMagneticField( + corsika::geometry::Point const&) const final override { + CoordinateSystem const& gCS = + RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); + return MagneticFieldVector(gCS, {0_T, 0_T, 0_T}); + } + + }; // END: class MagneticField + +} // namespace corsika::environment -- GitLab