IAP GITLAB

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • AirShowerPhysics/corsika
  • rulrich/corsika
  • AAAlvesJr/corsika
  • Andre/corsika
  • arrabito/corsika
  • Nikos/corsika
  • olheiser73/corsika
  • AirShowerPhysics/papers/corsika
  • pranav/corsika
9 results
Show changes
Showing
with 394 additions and 149 deletions
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -35,7 +34,7 @@ namespace corsika {
using CoordinateSystemPtr = std::shared_ptr<CoordinateSystem const>;
/// this is the only way to create ONE unique root CS
static CoordinateSystemPtr& get_root_CoordinateSystem();
CoordinateSystemPtr const& get_root_CoordinateSystem();
/**
* Creates new CoordinateSystemPtr by translation along \a vector
......@@ -109,8 +108,8 @@ namespace corsika {
public:
// default resource allocation
CoordinateSystem(CoordinateSystem const&) = default;
CoordinateSystem(CoordinateSystem&&) = default;
CoordinateSystem(CoordinateSystem const&) = delete;
CoordinateSystem(CoordinateSystem&&) = delete;
CoordinateSystem& operator=(CoordinateSystem const& pCS) =
delete; // avoid making copies
~CoordinateSystem() = default;
......@@ -128,15 +127,13 @@ namespace corsika {
bool operator!=(CoordinateSystem const&) const;
protected:
static CoordinateSystem createCS() { return CoordinateSystem(); }
/**
* \name Friends
* Manipulation and creation functions.
* \{
**/
friend CoordinateSystemPtr& get_root_CoordinateSystem();
friend CoordinateSystemPtr const& get_root_CoordinateSystem();
friend CoordinateSystemPtr make_translation(CoordinateSystemPtr const& cs,
QuantityVector<length_d> const& vector);
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/geometry/Vector.hpp>
#include <corsika/framework/core/PhysicalGeometry.hpp>
#include <type_traits>
/**
* @file FourVector.hpp
* @author Ralf Ulrich
* @brief General FourVector object.
* @date 2021-10-16
*/
namespace corsika {
/**
Description of physical four-vectors
FourVector fully supports units, e.g. E in [GeV/c] and p in [GeV],
or also t in [s] and r in [m], etc.
However, for HEP applications it is also possible to use E and p
both in [GeV].
Thus, the input units of time-like and space-like coordinates
must either be idential (e.g. GeV) or scaled by "c" as in
[E/c]=[p].
The FourVector can return its squared-norm \ref getNormSqr and its
norm \ref getNorm, whereas norm is sqrt(abs(norm-squared)). The
physical units are always calculated and returned properly.
FourVector can also return if it is TimeLike, SpaceLike or PhotonLike.
When a FourVector is initialized with a lvalue references,
e.g. as `FourVector<TimeType&, Vector<length_d>&>`, references
are also used as internal data types, which should lead to
complete disappearance of the FourVector class during
optimization.
* Description of physical four-vectors
*
* FourVector fully supports units, e.g. E in [GeV/c] and p in [GeV],
* or also t in [s] and r in [m], etc.
*
* However, for HEP applications it is also possible to use E and p
* both in [GeV].
*
* Thus, the input units of time-like and space-like coordinates
* must either be idential (e.g. GeV) or scaled by "c" as in
* [E/c]=[p].
*
* The FourVector can return its squared-norm \ref getNormSqr and its
* norm \ref getNorm, whereas norm is sqrt(abs(norm-squared)). The
* physical units are always calculated and returned properly.
*
* FourVector can also return if it is TimeLike, SpaceLike or PhotonLike.
*
* When a FourVector is initialized with a lvalue references,
* e.g. as `FourVector<TimeType&, Vector<length_d>&>`, references
* are also used as internal data types, which should lead to
* complete disappearance of the FourVector class during
* optimization.
*/
template <typename TTimeType, typename TSpaceVecType>
......@@ -73,13 +78,11 @@ namespace corsika {
, spaceLike_(eS) {}
/**
*
* @return timeLike_
*/
TTimeType getTimeLikeComponent() const;
/**
*
* @return spaceLike_
*/
TSpaceVecType& getSpaceLikeComponents();
......@@ -124,12 +127,12 @@ namespace corsika {
FourVector& operator/(double const);
/**
Scalar product of two FourVectors
Note that the product between two 4-vectors assumes that you use
the same "c" convention for both. Only the LHS vector is checked
for this. You cannot mix different conventions due to
unit-checking.
* Scalar product of two FourVectors.
*
* Note that the product between two 4-vectors assumes that you use
* the same "c" convention for both. Only the LHS vector is checked
* for this. You cannot mix different conventions due to
* unit-checking.
*/
norm_type operator*(FourVector const& b);
......@@ -152,7 +155,7 @@ namespace corsika {
* value-copies.
* @{
*
**/
*/
friend FourVector<time_type, space_vec_type> operator+(FourVector const& a,
FourVector const& b) {
return FourVector<time_type, space_vec_type>(a.timeLike_ + b.timeLike_,
......@@ -179,20 +182,25 @@ namespace corsika {
private:
/**
This function is there to automatically remove the eventual
extra factor of "c" for the time-like quantity.
* This function is there to automatically remove the eventual
* extra factor of "c" for the time-like quantity.
*/
norm_square_type getTimeSquared() const;
};
/**
* streaming operator
**/
*/
template <typename TTimeType, typename TSpaceVecType>
std::ostream& operator<<(std::ostream& os,
corsika::FourVector<TTimeType, TSpaceVecType> const& qv);
/**
* @typedef FourMomentum A FourVector with HEPEnergyType and MomentumVector.
*/
typedef FourVector<HEPEnergyType, MomentumVector> FourMomentum;
} // namespace corsika
#include <corsika/detail/framework/geometry/FourVector.inl>
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (c) Copyright 2018 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -43,10 +42,20 @@ namespace corsika {
bool hasIntersections() const { return has_intersections_; }
///! where did the trajectory currently enter the volume
TimeType getEntry() const { return intersections_.first; }
TimeType getEntry() const {
if (has_intersections_)
return intersections_.first;
else
return std::numeric_limits<TimeType::value_type>::infinity() * second;
}
///! where did the trajectory currently exit the volume
TimeType getExit() const { return intersections_.second; }
TimeType getExit() const {
if (has_intersections_)
return intersections_.second;
else
return std::numeric_limits<TimeType::value_type>::infinity() * second;
}
private:
bool has_intersections_;
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -12,24 +11,37 @@
#include <corsika/framework/geometry/Line.hpp>
#include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/geometry/PhysicalGeometry.hpp>
#include <corsika/framework/geometry/BaseTrajectory.hpp>
namespace corsika {
/**
* The LeapFrogTrajectory stores information on one leap-frog step.
*
* The leap-frog algorithm uses a half-step and is used in magnetic
* The leap-frog algorithm uses two half-steps and is used in magnetic
* field tracking. The LeapFrogTrajectory will solve the leap-frog
* algorithm equation for a given constant $k$ that has to be
* algorithm equation for a given constant @f$k@f$ that has to be
* specified during construction (essentially fixing the magnetic
* field). Thus, different steps (length) can be dynamically
* generated here. The velocity vector will correctly point into the
* direction as calculated by the algorithm for any steplength, or
* intermediate position.
*
**/
* One complete leap-frog step is
* @f{eqnarray*}{
* \vec{x}(t_{i+0.5}) &=& \vec{x}(t_{i}) + \vec{v(t_{i})} * \Delta t / 2 \\
* \vec{v}(t_{i+1}) &=& \vec{v}(t_{i}) + \vec{v}(t_{i})\times\vec{B}(x_{i}, t_{i}) *
* \Delta t \\
* \vec{x}(t_{i+1}) &=& \vec{x}(t_{i+0.5}) + \vec{v}(t_{i+1}) * \Delta t /2 \\
* @f}
*
* The volocity update has the characteristics @f$|\vec{v}(t_{i+1})|>1@f$, thus final
* velocities are renormalised. The full leap-frog steplength is thus
* @f[ L = |\vec{v}(t_{i+1})| \cdot \Delta t / 2 + |\vec{v}(t_{i+1})| \cdot \Delta t /
* 2 @f]
*/
class LeapFrogTrajectory {
class LeapFrogTrajectory : public BaseTrajectory {
public:
LeapFrogTrajectory() = delete;
......@@ -39,7 +51,7 @@ namespace corsika {
LeapFrogTrajectory(Point const& pos, VelocityVector const& initialVelocity,
MagneticFieldVector const& Bfield,
decltype(square(meter) / (square(second) * volt)) const k,
decltype(1 / (tesla * second)) const k,
TimeType const timeStep) // leap-from total length
: initialPosition_(pos)
, initialVelocity_(initialVelocity)
......@@ -59,6 +71,10 @@ namespace corsika {
///! duration along potentially bend trajectory
TimeType getDuration(double const u = 1) const;
///! time at the start (u=0) or at the end (u=1) of the track of a particle
template <typename Particle>
TimeType getTime(Particle const& particle, double const u) const;
///! total length along potentially bend trajectory
LengthType getLength(double const u = 1) const;
......@@ -74,7 +90,7 @@ namespace corsika {
VelocityVector initialVelocity_;
DirectionVector initialDirection_;
MagneticFieldVector magneticfield_;
decltype(square(meter) / (square(second) * volt)) k_;
decltype(1 / (tesla * second)) k_;
TimeType timeStep_;
};
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
#include <deque>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/geometry/Point.hpp>
namespace corsika {
/**
* This class represents a (potentially) curved path between two
* points using N >= 1 straight-line segments.
*/
class Path {
protected:
std::deque<Point> points_; ///< The points that make up this path.
LengthType length_ = LengthType::zero(); ///< The length of the path.
using iterator = std::deque<Point>::iterator;
using const_iterator = std::deque<Point>::const_iterator;
public:
/**
* Create a Path with a given starting Point.
*/
Path(Point const& point);
/**
* Initialize a Path from an existing collection of Points.
*/
Path(std::deque<Point> const& points);
/**
* Add a new Point to the end of the path.
*/
inline void addToEnd(Point const& point);
/**
* Remove a point from the end of the path.
*/
inline void removeFromEnd();
/**
* Get the total length of the path.
*/
inline LengthType getLength() const;
/**
* Get the starting point of the path.
*/
inline Point const& getStart() const;
/**
* Get the end point of the path.
*/
inline Point const& getEnd() const;
/**
* Get a specific point of the path.
*/
inline Point const& getPoint(std::size_t const index) const;
/**
* Return an iterator to the start of the Path.
*/
inline const_iterator begin() const;
/**
* Return an iterator to the end of the Path.
*/
inline const_iterator end() const;
/**
* Return an iterator to the start of the Path.
*/
inline iterator begin();
/**
* Return an iterator to the end of the Path.
*/
inline iterator end();
/**
* Get the number of steps in the path.
* This is one less than the number of points that
* defines the path.
*/
inline int getNSegments() const;
}; // class Path
} // namespace corsika
#include <corsika/detail/framework/geometry/Path.inl>
\ No newline at end of file
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -31,8 +30,8 @@ namespace corsika {
/** \todo TODO: this should be private or protected, we don NOT want to expose numbers
* without reference to outside:
*/
QuantityVector<length_d> const& getCoordinates() const;
QuantityVector<length_d>& getCoordinates();
inline QuantityVector<length_d> const& getCoordinates() const;
inline QuantityVector<length_d>& getCoordinates();
/**
this always returns a QuantityVector as triple
......@@ -40,7 +39,7 @@ namespace corsika {
\returns A value type QuantityVector, since it may have to create a temporary
object to transform to pCS.
**/
QuantityVector<length_d> getCoordinates(CoordinateSystemPtr const& pCS) const;
inline QuantityVector<length_d> getCoordinates(CoordinateSystemPtr const& pCS) const;
/**
* this always returns a QuantityVector as triple
......@@ -49,7 +48,7 @@ namespace corsika {
* is actually transformed to pCS, if needed. Thus, there may be an implicit call to
* \ref rebase.
**/
QuantityVector<length_d>& getCoordinates(CoordinateSystemPtr const& pCS);
inline QuantityVector<length_d>& getCoordinates(CoordinateSystemPtr const& pCS);
/**
* \name access coordinate components
......@@ -60,25 +59,31 @@ namespace corsika {
* created and destroyed each call. This can be avoided by using
* \ref rebase first.
**/
LengthType getX(CoordinateSystemPtr const& pCS) const;
LengthType getY(CoordinateSystemPtr const& pCS) const;
LengthType getZ(CoordinateSystemPtr const& pCS) const;
inline LengthType getX(CoordinateSystemPtr const& pCS) const;
inline LengthType getY(CoordinateSystemPtr const& pCS) const;
inline LengthType getZ(CoordinateSystemPtr const& pCS) const;
/** \} **/
/*!
* transforms the Point into another CoordinateSystem by changing its
* coordinates interally
*/
void rebase(CoordinateSystemPtr const& pCS);
inline void rebase(CoordinateSystemPtr const& pCS);
Point operator+(Vector<length_d> const& pVec) const;
inline Point operator+(Vector<length_d> const& pVec) const;
inline Point operator-(Vector<length_d> const& pVec) const;
/*!
* returns the distance Vector between two points
*/
Vector<length_d> operator-(Point const& pB) const;
inline Vector<length_d> operator-(Point const& pB) const;
};
/*
* calculates the distance between two points
*/
inline LengthType distance(Point const& p1, Point const& p2);
} // namespace corsika
#include <corsika/detail/framework/geometry/Point.inl>
#include <corsika/detail/framework/geometry/Point.inl>
\ No newline at end of file
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -27,8 +26,8 @@ namespace corsika {
* RootCoordinateSystem
*/
static inline CoordinateSystemPtr& get_root_CoordinateSystem() {
static CoordinateSystemPtr rootCS(new CoordinateSystem); // THIS IS IT
inline CoordinateSystemPtr const& get_root_CoordinateSystem() {
static CoordinateSystemPtr const rootCS(new CoordinateSystem); // THIS IS IT
return rootCS;
}
......
/*
* (c) Copyright 2023 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
#include <corsika/framework/geometry/Plane.hpp>
#include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/geometry/IVolume.hpp>
namespace corsika {
/**
* Describes which exists on one side of a plane
*
* The separation line is given by a plane where the unit
* vector of the plane points outside of the volume
**/
class SeparationPlane : public IVolume {
public:
SeparationPlane(Plane const& plane);
~SeparationPlane() {}
Plane getPlane() const { return plane_; }
//! returns true if the Point p is below the plane
bool contains(Point const& p) const override;
std::string asString() const;
protected:
Plane const plane_;
};
} // namespace corsika
#include <corsika/detail/framework/geometry/SeparationPlane.inl>
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -38,6 +37,10 @@ namespace corsika {
void setRadius(LengthType const);
CoordinateSystemPtr const getCoordinateSystem() const;
std::string asString() const;
private:
Point center_;
LengthType radius_;
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
#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/BaseTrajectory.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.
* This implements a straight trajectory between two points.
*
* 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
......@@ -35,7 +23,7 @@ namespace corsika {
*
**/
class StraightTrajectory {
class StraightTrajectory : public BaseTrajectory {
public:
StraightTrajectory() = delete;
......@@ -95,6 +83,10 @@ namespace corsika {
///! duration along potentially bend trajectory
TimeType getDuration(double const u = 1) const;
///! time at the start (u=0) or at the end (u=1) of the track of a particle
template <typename Particle>
TimeType getTime(Particle const& particle, double const u) const;
///! total length along potentially bend trajectory
LengthType getLength(double const u = 1) const;
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -36,8 +35,9 @@ namespace corsika {
Vector(CoordinateSystemPtr const& pCS, QuantityVector<TDimension> const& pQVector)
: BaseVector<TDimension>(pCS, pQVector) {}
Vector(CoordinateSystemPtr const& cs, quantity_type const x, quantity_type const y,
quantity_type const z)
Vector(CoordinateSystemPtr const& cs, quantity_type const x = quantity_type::zero(),
quantity_type const y = quantity_type::zero(),
quantity_type const z = quantity_type::zero())
: BaseVector<TDimension>(cs, QuantityVector<TDimension>(x, y, z)) {}
/*!
......@@ -142,6 +142,31 @@ namespace corsika {
auto dot(Vector<TDimension2> const& pV) const;
};
/**
* Free operator to allow commutative multiplications of quantities and Vector.
*
* @tparam TDimension
* @tparam UDimension
* @param n
* @param vec
* @return auto
*/
template <typename TDimension, typename UDimension>
Vector<phys::units::detail::product_d<TDimension, UDimension>> operator*(
quantity<UDimension> const n, Vector<TDimension> const& vec);
/**
* Free operator to allow commutative multiplications of normal double with Vector.
*
* @tparam TDimension
* @tparam UDimension
* @param n
* @param vec
* @return auto
*/
template <typename TDimension>
Vector<TDimension> operator*(double const n, Vector<TDimension> const& vec);
} // namespace corsika
#include <corsika/detail/framework/geometry/Vector.inl>
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -11,22 +10,23 @@
#include <corsika/framework/process/ProcessTraits.hpp>
#include <type_traits>
#include <cstddef>
//! @file BaseProcess.hpp
namespace corsika {
/**
@ingroup Processes
@{
Each process in C8 must derive from BaseProcess
The structural base type of a process object in a
ProcessSequence. Both, the ProcessSequence and all its elements
are of type BaseProcess
@todo rename BaseProcess into just Process
* @ingroup Processes
* @{
*
* Each process in C8 must derive from BaseProcess
*
* The structural base type of a process object in a
* ProcessSequence. Both, the ProcessSequence and all its elements
* are of type BaseProcess.
*
* @todo rename BaseProcess into just Process
*/
template <typename TDerived>
......@@ -39,10 +39,10 @@ namespace corsika {
// BaseProcess itself
/** @name getRef Return reference to underlying type
@{
* @{
*/
TDerived& ref() { return static_cast<TDerived&>(*this); }
const TDerived& ref() const { return static_cast<const TDerived&>(*this); }
TDerived& getRef() { return static_cast<TDerived&>(*this); }
const TDerived& getRef() const { return static_cast<const TDerived&>(*this); }
//! @}
public:
......@@ -50,15 +50,15 @@ namespace corsika {
static bool const is_switch_process_sequence = false;
//! Default number of processes is just one, obviously
static unsigned int constexpr getNumberOfProcesses() { return 1; }
static size_t constexpr getNumberOfProcesses() { return 1; }
//! Base processor type for use in other template classes
using process_type = TDerived;
};
/**
is_process traits specialization to indicate inheritance from BaseProcess
*/
* is_process traits specialization to indicate inheritance from BaseProcess.
*/
template <typename TProcess>
struct is_process<
TProcess,
......@@ -67,14 +67,14 @@ namespace corsika {
: std::true_type {};
/**
count_processes traits specialization to increase process count by one.
* count_processes traits specialization to increase process count by one.
*/
template <typename TProcess, int N>
struct count_processes<
TProcess, N,
typename std::enable_if_t<is_process_v<std::decay_t<TProcess>> &&
!std::decay_t<TProcess>::is_process_sequence>> {
static unsigned int constexpr count = N + 1;
static size_t constexpr count = N + 1;
};
//! @}
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
#include <corsika/framework/process/BaseProcess.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/detail/framework/process/CascadeEquationsProcess.hpp> // for extra traits, method/interface checking
namespace corsika {
/**
* @ingroup Processes
* @{
*
* Processes executing cascade-equations calculations.
*
* Create a new CascadeEquationsProcess, e.g. for XYModel, via:
* @code{.cpp}
* class XYModel : public CascadeEquationsProcess<XYModel> {};
* @endcode
*
* and provide the necessary interface method:
* @code{.cpp}
* template <typename TStack>
* void doCascadeEquations(TStack& stack);
* @endcode
*
* Cascade equation processes may generate new particles on the stack. They also
* typically generate output.
*/
template <typename TDerived>
class CascadeEquationsProcess : public BaseProcess<TDerived> {
public:
};
/**
* ProcessTraits specialization to flag CascadeEquationsProcess objects.
*/
template <typename TProcess>
struct is_cascade_equations_process<
TProcess, std::enable_if_t<std::is_base_of_v<
CascadeEquationsProcess<typename std::decay_t<TProcess>>,
typename std::decay_t<TProcess>>>> : std::true_type {};
//! @}
} // namespace corsika