IAP GITLAB

Skip to content
Snippets Groups Projects
Commit b25342dd authored by Remy Prechelt's avatar Remy Prechelt Committed by ralfulrich
Browse files

Remove Setup from media and switch to BaseTrajectory.

parent 58ac567f
No related branches found
No related tags found
2 merge requests!365Ci improve,!356Remove Setup and setup:: from framework
Showing
with 105 additions and 54 deletions
...@@ -21,7 +21,7 @@ namespace corsika { ...@@ -21,7 +21,7 @@ namespace corsika {
template <typename TDerived> template <typename TDerived>
inline GrammageType BaseExponential<TDerived>::getIntegratedGrammage( inline GrammageType BaseExponential<TDerived>::getIntegratedGrammage(
setup::Trajectory const& traj, LengthType vL, DirectionVector const& axis) const { BaseTrajectory const& traj, LengthType vL, DirectionVector const& axis) const {
if (vL == LengthType::zero()) { return GrammageType::zero(); } if (vL == LengthType::zero()) { return GrammageType::zero(); }
auto const uDotA = traj.getDirection(0).dot(axis).magnitude(); auto const uDotA = traj.getDirection(0).dot(axis).magnitude();
...@@ -36,7 +36,7 @@ namespace corsika { ...@@ -36,7 +36,7 @@ namespace corsika {
template <typename TDerived> template <typename TDerived>
inline LengthType BaseExponential<TDerived>::getArclengthFromGrammage( inline LengthType BaseExponential<TDerived>::getArclengthFromGrammage(
setup::Trajectory const& traj, GrammageType grammage, BaseTrajectory const& traj, GrammageType grammage,
DirectionVector const& axis) const { DirectionVector const& axis) const {
auto const uDotA = traj.getDirection(0).dot(axis).magnitude(); auto const uDotA = traj.getDirection(0).dot(axis).magnitude();
auto const rhoStart = getImplementation().getMassDensity(traj.getPosition(0)); auto const rhoStart = getImplementation().getMassDensity(traj.getPosition(0));
......
...@@ -40,13 +40,13 @@ namespace corsika { ...@@ -40,13 +40,13 @@ namespace corsika {
template <typename T> template <typename T>
inline GrammageType FlatExponential<T>::getIntegratedGrammage( inline GrammageType FlatExponential<T>::getIntegratedGrammage(
setup::Trajectory const& line, LengthType to) const { BaseTrajectory const& line, LengthType to) const {
return BaseExponential<FlatExponential<T>>::getIntegratedGrammage(line, to, axis_); return BaseExponential<FlatExponential<T>>::getIntegratedGrammage(line, to, axis_);
} }
template <typename T> template <typename T>
inline LengthType FlatExponential<T>::getArclengthFromGrammage( inline LengthType FlatExponential<T>::getArclengthFromGrammage(
setup::Trajectory const& line, GrammageType grammage) const { BaseTrajectory const& line, GrammageType grammage) const {
return BaseExponential<FlatExponential<T>>::getArclengthFromGrammage(line, grammage, return BaseExponential<FlatExponential<T>>::getArclengthFromGrammage(line, grammage,
axis_); axis_);
} }
......
...@@ -33,13 +33,13 @@ namespace corsika { ...@@ -33,13 +33,13 @@ namespace corsika {
template <typename T> template <typename T>
inline GrammageType HomogeneousMedium<T>::getIntegratedGrammage( inline GrammageType HomogeneousMedium<T>::getIntegratedGrammage(
setup::Trajectory const&, LengthType to) const { BaseTrajectory const&, LengthType to) const {
return to * density_; return to * density_;
} }
template <typename T> template <typename T>
inline LengthType HomogeneousMedium<T>::getArclengthFromGrammage( inline LengthType HomogeneousMedium<T>::getArclengthFromGrammage(
setup::Trajectory const&, GrammageType grammage) const { BaseTrajectory const&, GrammageType grammage) const {
return grammage / density_; return grammage / density_;
} }
} // namespace corsika } // namespace corsika
...@@ -36,13 +36,13 @@ namespace corsika { ...@@ -36,13 +36,13 @@ namespace corsika {
template <typename T, typename TDensityFunction> template <typename T, typename TDensityFunction>
inline GrammageType InhomogeneousMedium<T, TDensityFunction>::getIntegratedGrammage( inline GrammageType InhomogeneousMedium<T, TDensityFunction>::getIntegratedGrammage(
setup::Trajectory const& line, LengthType to) const { BaseTrajectory const& line, LengthType to) const {
return densityFunction_.getIntegrateGrammage(line, to); return densityFunction_.getIntegrateGrammage(line, to);
} }
template <typename T, typename TDensityFunction> template <typename T, typename TDensityFunction>
inline LengthType InhomogeneousMedium<T, TDensityFunction>::getArclengthFromGrammage( inline LengthType InhomogeneousMedium<T, TDensityFunction>::getArclengthFromGrammage(
setup::Trajectory const& line, GrammageType grammage) const { BaseTrajectory const& line, GrammageType grammage) const {
return densityFunction_.getArclengthFromGrammage(line, grammage); return densityFunction_.getArclengthFromGrammage(line, grammage);
} }
......
...@@ -19,7 +19,7 @@ namespace corsika { ...@@ -19,7 +19,7 @@ namespace corsika {
template <typename TDerived> template <typename TDerived>
inline auto LinearApproximationIntegrator<TDerived>::getIntegrateGrammage( inline auto LinearApproximationIntegrator<TDerived>::getIntegrateGrammage(
setup::Trajectory const& line, LengthType length) const { BaseTrajectory const& line, LengthType length) const {
auto const c0 = getImplementation().evaluateAt(line.getPosition(0)); auto const c0 = getImplementation().evaluateAt(line.getPosition(0));
auto const c1 = getImplementation().rho_.getFirstDerivative(line.getPosition(0), auto const c1 = getImplementation().rho_.getFirstDerivative(line.getPosition(0),
line.getDirection(0)); line.getDirection(0));
...@@ -28,7 +28,7 @@ namespace corsika { ...@@ -28,7 +28,7 @@ namespace corsika {
template <typename TDerived> template <typename TDerived>
inline auto LinearApproximationIntegrator<TDerived>::getArclengthFromGrammage( inline auto LinearApproximationIntegrator<TDerived>::getArclengthFromGrammage(
setup::Trajectory const& line, GrammageType grammage) const { BaseTrajectory const& line, GrammageType grammage) const {
auto const c0 = getImplementation().rho_(line.getPosition(0)); auto const c0 = getImplementation().rho_(line.getPosition(0));
auto const c1 = getImplementation().rho_.getFirstDerivative(line.getPosition(0), auto const c1 = getImplementation().rho_.getFirstDerivative(line.getPosition(0),
line.getDirection(0)); line.getDirection(0));
...@@ -38,7 +38,7 @@ namespace corsika { ...@@ -38,7 +38,7 @@ namespace corsika {
template <typename TDerived> template <typename TDerived>
inline auto LinearApproximationIntegrator<TDerived>::getMaximumLength( inline auto LinearApproximationIntegrator<TDerived>::getMaximumLength(
setup::Trajectory const& line, [[maybe_unused]] double relError) const { BaseTrajectory const& line, [[maybe_unused]] double relError) const {
[[maybe_unused]] auto const c1 = getImplementation().rho_.getSecondDerivative( [[maybe_unused]] auto const c1 = getImplementation().rho_.getSecondDerivative(
line.getPosition(0), line.getDirection(0)); line.getPosition(0), line.getDirection(0));
......
...@@ -39,7 +39,7 @@ namespace corsika { ...@@ -39,7 +39,7 @@ namespace corsika {
template <typename T> template <typename T>
inline GrammageType SlidingPlanarExponential<T>::getIntegratedGrammage( inline GrammageType SlidingPlanarExponential<T>::getIntegratedGrammage(
setup::Trajectory const& traj, LengthType l) const { BaseTrajectory const& traj, LengthType l) const {
auto const axis = (traj.getPosition(0) - auto const axis = (traj.getPosition(0) -
BaseExponential<SlidingPlanarExponential<T>>::getAnchorPoint()) BaseExponential<SlidingPlanarExponential<T>>::getAnchorPoint())
.normalized(); .normalized();
...@@ -49,7 +49,7 @@ namespace corsika { ...@@ -49,7 +49,7 @@ namespace corsika {
template <typename T> template <typename T>
inline LengthType SlidingPlanarExponential<T>::getArclengthFromGrammage( inline LengthType SlidingPlanarExponential<T>::getArclengthFromGrammage(
setup::Trajectory const& traj, GrammageType const grammage) const { BaseTrajectory const& traj, GrammageType const grammage) const {
auto const axis = (traj.getPosition(0) - auto const axis = (traj.getPosition(0) -
BaseExponential<SlidingPlanarExponential<T>>::getAnchorPoint()) BaseExponential<SlidingPlanarExponential<T>>::getAnchorPoint())
.normalized(); .normalized();
......
/*
* (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/framework/geometry/Line.hpp>
#include <corsika/framework/geometry/Point.hpp>
namespace corsika {
/**
*
* A Trajectory is a description of a momvement of an object in
* three-dimensional space that describes the trajectory (connection
* between two Points in space), as well as the direction of motion
* at any given point.
*
* A Trajectory has a start `0` and an end `1`, where
* e.g. getPosition(0) returns the start point and getDirection(1)
* the direction of motion at the end. Values outside 0...1 are not
* defined.
*
* A Trajectory has a length in [m], getLength, a duration in [s], getDuration.
*
* Note: so far it is assumed that the speed (d|vec{r}|/dt) between
* start and end does not change and is constant for the entire
* Trajectory.
*
**/
class BaseTrajectory {
public:
virtual Point getPosition(double const u) const = 0;
virtual VelocityVector getVelocity(double const u) const = 0;
virtual DirectionVector getDirection(double const u) const = 0;
virtual TimeType getDuration(double const u = 1) const = 0;
virtual LengthType getLength(double const u = 1) const = 0;
virtual void setLength(LengthType const limit) = 0;
virtual void setDuration(TimeType const limit) = 0;
};
} // namespace corsika
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Line.hpp>
#include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/geometry/PhysicalGeometry.hpp> #include <corsika/framework/geometry/PhysicalGeometry.hpp>
#include <corsika/framework/geometry/BaseTrajectory.hpp>
namespace corsika { namespace corsika {
...@@ -29,7 +30,7 @@ namespace corsika { ...@@ -29,7 +30,7 @@ namespace corsika {
* *
**/ **/
class LeapFrogTrajectory { class LeapFrogTrajectory : public BaseTrajectory {
public: public:
LeapFrogTrajectory() = delete; LeapFrogTrajectory() = delete;
......
...@@ -9,25 +9,14 @@ ...@@ -9,25 +9,14 @@
#pragma once #pragma once
#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/geometry/Line.hpp>
#include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/geometry/PhysicalGeometry.hpp> #include <corsika/framework/geometry/PhysicalGeometry.hpp>
#include <corsika/framework/geometry/BaseTrajectory.hpp>
namespace corsika { namespace corsika {
/** /**
* *
* A Trajectory is a description of a momvement of an object in * This implements a straight trajectory between two points.
* three-dimensional space that describes the trajectory (connection
* between two Points in space), as well as the direction of motion
* at any given point.
*
* A Trajectory has a start `0` and an end `1`, where
* e.g. getPosition(0) returns the start point and getDirection(1)
* the direction of motion at the end. Values outside 0...1 are not
* defined.
*
* A Trajectory has a length in [m], getLength, a duration in [s], getDuration.
* *
* Note: so far it is assumed that the speed (d|vec{r}|/dt) between * Note: so far it is assumed that the speed (d|vec{r}|/dt) between
* start and end does not change and is constant for the entire * start and end does not change and is constant for the entire
...@@ -35,7 +24,7 @@ namespace corsika { ...@@ -35,7 +24,7 @@ namespace corsika {
* *
**/ **/
class StraightTrajectory { class StraightTrajectory : public BaseTrajectory {
public: public:
StraightTrajectory() = delete; StraightTrajectory() = delete;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Line.hpp>
#include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Point.hpp>
#include <corsika/setup/SetupTrajectory.hpp> #include <corsika/framework/geometry/BaseTrajectory.hpp>
#include <limits> #include <limits>
namespace corsika { namespace corsika {
...@@ -40,7 +40,7 @@ namespace corsika { ...@@ -40,7 +40,7 @@ namespace corsika {
* \f] * \f]
*/ */
// clang-format on // clang-format on
GrammageType getIntegratedGrammage(setup::Trajectory const& line, LengthType vL, GrammageType getIntegratedGrammage(BaseTrajectory const& line, LengthType vL,
DirectionVector const& axis) const; DirectionVector const& axis) const;
// clang-format off // clang-format off
...@@ -61,7 +61,7 @@ namespace corsika { ...@@ -61,7 +61,7 @@ namespace corsika {
* \f] * \f]
*/ */
// clang-format on // clang-format on
LengthType getArclengthFromGrammage(setup::Trajectory const& line, LengthType getArclengthFromGrammage(BaseTrajectory const& line,
GrammageType grammage, GrammageType grammage,
DirectionVector const& axis) const; DirectionVector const& axis) const;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Point.hpp>
#include <corsika/media/BaseExponential.hpp> #include <corsika/media/BaseExponential.hpp>
#include <corsika/media/NuclearComposition.hpp> #include <corsika/media/NuclearComposition.hpp>
#include <corsika/setup/SetupTrajectory.hpp> #include <corsika/framework/geometry/BaseTrajectory.hpp>
namespace corsika { namespace corsika {
...@@ -41,10 +41,10 @@ namespace corsika { ...@@ -41,10 +41,10 @@ namespace corsika {
NuclearComposition const& getNuclearComposition() const override; NuclearComposition const& getNuclearComposition() const override;
GrammageType getIntegratedGrammage(setup::Trajectory const& line, GrammageType getIntegratedGrammage(BaseTrajectory const& line,
LengthType to) const override; LengthType to) const override;
LengthType getArclengthFromGrammage(setup::Trajectory const& line, LengthType getArclengthFromGrammage(BaseTrajectory const& line,
GrammageType grammage) const override; GrammageType grammage) const override;
private: private:
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
#include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Line.hpp>
#include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Point.hpp>
#include <corsika/media/NuclearComposition.hpp> #include <corsika/media/NuclearComposition.hpp>
#include <corsika/framework/geometry/BaseTrajectory.hpp>
#include <corsika/setup/SetupTrajectory.hpp>
/** /**
* a homogeneous medium * a homogeneous medium
...@@ -31,10 +30,10 @@ namespace corsika { ...@@ -31,10 +30,10 @@ namespace corsika {
NuclearComposition const& getNuclearComposition() const override; NuclearComposition const& getNuclearComposition() const override;
GrammageType getIntegratedGrammage(setup::Trajectory const&, GrammageType getIntegratedGrammage(BaseTrajectory const&,
LengthType to) const override; LengthType to) const override;
LengthType getArclengthFromGrammage(setup::Trajectory const&, LengthType getArclengthFromGrammage(BaseTrajectory const&,
GrammageType grammage) const override; GrammageType grammage) const override;
private: private:
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#pragma once #pragma once
#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/setup/SetupTrajectory.hpp> #include <corsika/framework/geometry/BaseTrajectory.hpp>
namespace corsika { namespace corsika {
...@@ -25,7 +25,8 @@ namespace corsika { ...@@ -25,7 +25,8 @@ namespace corsika {
class IEmpty { class IEmpty {
public: public:
virtual LengthType getArclengthFromGrammage(setup::Trajectory const&,
virtual LengthType getArclengthFromGrammage(BaseTrajectory const&,
GrammageType) const = 0; GrammageType) const = 0;
virtual ~IEmpty() {} virtual ~IEmpty() {}
...@@ -34,7 +35,8 @@ namespace corsika { ...@@ -34,7 +35,8 @@ namespace corsika {
template <typename TModel = IEmpty> template <typename TModel = IEmpty>
class Empty : public TModel { class Empty : public TModel {
public: public:
LengthType getArclengthFromGrammage(setup::Trajectory const&, GrammageType) const {
LengthType getArclengthFromGrammage(BaseTrajectory const&, GrammageType) const {
return 0. * meter; return 0. * meter;
} }
}; };
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <corsika/media/NuclearComposition.hpp> #include <corsika/media/NuclearComposition.hpp>
#include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/setup/SetupTrajectory.hpp> #include <corsika/framework/geometry/BaseTrajectory.hpp>
namespace corsika { namespace corsika {
...@@ -23,10 +23,10 @@ namespace corsika { ...@@ -23,10 +23,10 @@ namespace corsika {
// todo: think about the mixin inheritance of the trajectory vs the BaseTrajectory // todo: think about the mixin inheritance of the trajectory vs the BaseTrajectory
// approach; for now, only lines are supported // approach; for now, only lines are supported
virtual GrammageType getIntegratedGrammage(setup::Trajectory const&, virtual GrammageType getIntegratedGrammage(BaseTrajectory const&,
LengthType) const = 0; LengthType) const = 0;
virtual LengthType getArclengthFromGrammage(setup::Trajectory const&, virtual LengthType getArclengthFromGrammage(BaseTrajectory const&,
GrammageType) const = 0; GrammageType) const = 0;
virtual NuclearComposition const& getNuclearComposition() const = 0; virtual NuclearComposition const& getNuclearComposition() const = 0;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Line.hpp>
#include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Point.hpp>
#include <corsika/media/NuclearComposition.hpp> #include <corsika/media/NuclearComposition.hpp>
#include <corsika/setup/SetupTrajectory.hpp> #include <corsika/framework/geometry/BaseTrajectory.hpp>
/** /**
* A general inhomogeneous medium. The mass density distribution TDensityFunction must be * A general inhomogeneous medium. The mass density distribution TDensityFunction must be
...@@ -32,10 +32,10 @@ namespace corsika { ...@@ -32,10 +32,10 @@ namespace corsika {
NuclearComposition const& getNuclearComposition() const override; NuclearComposition const& getNuclearComposition() const override;
GrammageType getIntegratedGrammage(setup::Trajectory const& line, GrammageType getIntegratedGrammage(BaseTrajectory const& line,
LengthType to) const override; LengthType to) const override;
LengthType getArclengthFromGrammage(setup::Trajectory const& pLine, LengthType getArclengthFromGrammage(BaseTrajectory const& pLine,
GrammageType grammage) const override; GrammageType grammage) const override;
private: private:
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <limits> #include <limits>
#include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/Line.hpp>
#include <corsika/setup/SetupTrajectory.hpp> #include <corsika/framework/geometry/BaseTrajectory.hpp>
namespace corsika { namespace corsika {
...@@ -20,12 +20,12 @@ namespace corsika { ...@@ -20,12 +20,12 @@ namespace corsika {
auto const& getImplementation() const; auto const& getImplementation() const;
public: public:
auto getIntegrateGrammage(setup::Trajectory const& line, LengthType length) const; auto getIntegrateGrammage(BaseTrajectory const& line, LengthType length) const;
auto getArclengthFromGrammage(setup::Trajectory const& line, auto getArclengthFromGrammage(BaseTrajectory const& line,
GrammageType grammage) const; GrammageType grammage) const;
auto getMaximumLength(setup::Trajectory const& line, auto getMaximumLength(BaseTrajectory const& line,
[[maybe_unused]] double relError) const; [[maybe_unused]] double relError) const;
}; };
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <corsika/framework/random/RNGManager.hpp> #include <corsika/framework/random/RNGManager.hpp>
#include <corsika/media/FlatExponential.hpp> #include <corsika/media/FlatExponential.hpp>
#include <corsika/media/NuclearComposition.hpp> #include <corsika/media/NuclearComposition.hpp>
#include <corsika/setup/SetupTrajectory.hpp> #include <corsika/framework/geometry/BaseTrajectory.hpp>
namespace corsika { namespace corsika {
...@@ -46,10 +46,10 @@ namespace corsika { ...@@ -46,10 +46,10 @@ namespace corsika {
NuclearComposition const& getNuclearComposition() const override; NuclearComposition const& getNuclearComposition() const override;
GrammageType getIntegratedGrammage(setup::Trajectory const& line, GrammageType getIntegratedGrammage(BaseTrajectory const& line,
LengthType l) const override; LengthType l) const override;
LengthType getArclengthFromGrammage(setup::Trajectory const& line, LengthType getArclengthFromGrammage(BaseTrajectory const& line,
GrammageType grammage) const override; GrammageType grammage) const override;
private: private:
......
...@@ -43,4 +43,5 @@ namespace corsika::setup::testing { ...@@ -43,4 +43,5 @@ namespace corsika::setup::testing {
tEnd); tEnd);
} }
} // namespace corsika::setup::testing } // namespace corsika::setup::testing
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <corsika/media/VolumeTreeNode.hpp> #include <corsika/media/VolumeTreeNode.hpp>
#include <SetupTestTrajectory.hpp> #include <SetupTestTrajectory.hpp>
#include <corsika/setup/SetupTrajectory.hpp>
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <corsika/media/VolumeTreeNode.hpp> #include <corsika/media/VolumeTreeNode.hpp>
#include <SetupTestTrajectory.hpp> #include <SetupTestTrajectory.hpp>
#include <corsika/setup/SetupTrajectory.hpp>
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment