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 296 additions and 167 deletions
/*
* (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
......
/*
* (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,6 +11,7 @@
#include <corsika/framework/geometry/Line.hpp>
#include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/geometry/PhysicalGeometry.hpp>
#include <corsika/framework/utility/QuarticSolver.hpp>
namespace corsika {
......@@ -28,34 +28,65 @@ namespace corsika {
}
inline Point LeapFrogTrajectory::getPosition(double const u) const {
Point position = initialPosition_ + initialVelocity_ * timeStep_ * u / 2;
VelocityVector velocity =
if (u == 0) return initialPosition_;
Point const position = initialPosition_ + initialVelocity_ * timeStep_ * u / 2;
VelocityVector const velocity =
initialVelocity_ + initialVelocity_.cross(magneticfield_) * timeStep_ * u * k_;
return position + velocity * timeStep_ * u / 2;
}
inline VelocityVector LeapFrogTrajectory::getVelocity(double const u) const {
return initialVelocity_ + initialVelocity_.cross(magneticfield_) * timeStep_ * u * k_;
return getDirection(u) * initialVelocity_.getNorm();
}
inline DirectionVector LeapFrogTrajectory::getDirection(double const u) const {
return getVelocity(u).normalized();
if (u == 0) return initialDirection_;
return (initialDirection_ +
initialDirection_.cross(magneticfield_) * timeStep_ * u * k_)
.normalized();
}
inline TimeType LeapFrogTrajectory::getDuration(double const u) const {
return u * timeStep_ *
(double(getVelocity(u).getNorm() / initialVelocity_.getNorm()) + 1.0) / 2;
TimeType const step = timeStep_ * u;
double const correction = 1;
// the eventual (delta-L to L) correction factor is:
// (initialDirection_ + initialDirection_.cross(magneticfield_) * step *
// k_).getNorm();
return step / 2 * (correction + 1);
}
template <typename Particle>
inline TimeType LeapFrogTrajectory::getTime(Particle const& particle,
double const u) const {
return particle.getTime() + getDuration(u);
}
inline LengthType LeapFrogTrajectory::getLength(double const u) const {
return timeStep_ * initialVelocity_.getNorm() * u;
return getDuration(u) * initialVelocity_.getNorm();
}
inline void LeapFrogTrajectory::setLength(LengthType const limit) {
if (initialVelocity_.getNorm() == 0_m / 1_s) setDuration(0_s);
if (initialVelocity_.getNorm() == SpeedType::zero()) setDuration(0_s);
setDuration(limit / initialVelocity_.getNorm());
}
inline void LeapFrogTrajectory::setDuration(TimeType const limit) { timeStep_ = limit; }
inline void LeapFrogTrajectory::setDuration(TimeType const limit) {
/*
initial attempt to calculate delta-L from assumed full-leap-frog-length L:
Note: often return 0. Not good enough yet.
LengthType const L = initialVelocity_.getNorm() * limit; // distance
double const a = (initialVelocity_.cross(magneticfield_) * k_).getSquaredNorm() / 4 /
square(1_m) * static_pow<4>(1_s);
double const d = L * initialVelocity_.getNorm() / square(1_m) * 1_s;
double const e = -square(L) / square(1_m);
std::vector<double> solutions = solve_quartic_real(a, 0, 0, d, e);
CORSIKA_LOG_DEBUG("setDuration limit={} L={} solution={}", limit, L,
fmt::join(solutions, ", "));
*/
timeStep_ = limit;
}
} // namespace corsika
/*
* (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
......
/*
* (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 <deque>
#include <corsika/framework/geometry/Point.hpp>
namespace corsika {
Path::Path(Point const& point) { points_.push_front(point); }
inline Path::Path(Point const& point) { points_.push_front(point); }
Path::Path(std::deque<Point> const& points)
inline Path::Path(std::deque<Point> const& points)
: points_(points) {
int dequesize_ = points.size();
if (dequesize_ == 0 || dequesize_ == 1) {
......@@ -51,15 +49,21 @@ namespace corsika {
inline LengthType Path::getLength() const { return length_; }
inline Point Path::getStart() const { return points_.front(); }
inline Point const& Path::getStart() const { return points_.front(); }
inline Point Path::getEnd() const { return points_.back(); }
inline Point const& Path::getEnd() const { return points_.back(); }
inline Point Path::getPoint(std::size_t const index) const { return points_.at(index); }
inline Point const& Path::getPoint(std::size_t const index) const {
return points_.at(index);
}
inline Path::const_iterator Path::begin() const { return points_.cbegin(); }
inline Path::const_iterator Path::end() const { return points_.cend(); }
inline auto Path::begin() { return points_.begin(); }
inline Path::iterator Path::begin() { return points_.begin(); }
inline auto Path::end() { return points_.end(); }
inline Path::iterator Path::end() { return points_.end(); }
inline int Path::getNSegments() const { return points_.size() - 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 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
......@@ -24,46 +23,22 @@ namespace corsika {
}
inline LengthType Point::getX(CoordinateSystemPtr const& pCS) const {
CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
if (*pCS == *cs) {
return BaseVector<length_d>::getQuantityVector().getX();
} else {
return QuantityVector<length_d>(
get_transformation(*cs.get(), *pCS.get()) *
BaseVector<length_d>::getQuantityVector().eigenVector_)
.getX();
}
return getCoordinates(pCS).getX();
}
inline LengthType Point::getY(CoordinateSystemPtr const& pCS) const {
CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
if (*pCS == *cs) {
return BaseVector<length_d>::getQuantityVector().getY();
} else {
return QuantityVector<length_d>(
get_transformation(*cs.get(), *pCS.get()) *
BaseVector<length_d>::getQuantityVector().eigenVector_)
.getY();
}
return getCoordinates(pCS).getY();
}
inline LengthType Point::getZ(CoordinateSystemPtr const& pCS) const {
CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
if (*pCS == *cs) {
return BaseVector<length_d>::getQuantityVector().getZ();
} else {
return QuantityVector<length_d>(
get_transformation(*cs.get(), *pCS.get()) *
BaseVector<length_d>::getQuantityVector().eigenVector_)
.getZ();
}
return getCoordinates(pCS).getZ();
}
/// this always returns a QuantityVector as triple
inline QuantityVector<length_d> Point::getCoordinates(
CoordinateSystemPtr const& pCS) const {
CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
if (*pCS == *cs) {
if (pCS == cs) {
return BaseVector<length_d>::getQuantityVector();
} else {
return QuantityVector<length_d>(
......@@ -74,7 +49,7 @@ namespace corsika {
/// this always returns a QuantityVector as triple
inline QuantityVector<length_d>& Point::getCoordinates(CoordinateSystemPtr const& pCS) {
if (*pCS != *BaseVector<length_d>::getCoordinateSystem()) { rebase(pCS); }
if (pCS != BaseVector<length_d>::getCoordinateSystem()) { rebase(pCS); }
return BaseVector<length_d>::getQuantityVector();
}
......@@ -91,11 +66,15 @@ namespace corsika {
return Point(cs, getCoordinates() + pVec.getComponents(cs));
}
inline Point Point::operator-(Vector<length_d> const& pVec) const {
CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
return Point(cs, getCoordinates() - pVec.getComponents(cs));
}
inline Vector<length_d> Point::operator-(Point const& pB) const {
CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
return Vector<length_d>(cs, getCoordinates() - pB.getCoordinates(cs));
}
inline std::ostream& operator<<(std::ostream& os, corsika::Point const& p) {
auto const& qv = p.getCoordinates();
os << qv << " (ref:" << fmt::ptr(p.getCoordinateSystem()) << ")";
......@@ -106,4 +85,4 @@ namespace corsika {
return (p1 - p2).getNorm();
}
} // namespace corsika
\ No newline at end of file
} // namespace corsika
/*
* (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
......@@ -17,8 +16,8 @@
namespace corsika {
template <typename TDimension>
inline typename QuantityVector<TDimension>::quantity_type
QuantityVector<TDimension>::operator[](size_t const index) const {
inline typename QuantityVector<TDimension>::quantity_type QuantityVector<TDimension>::
operator[](size_t const index) const {
return quantity_type(phys::units::detail::magnitude_tag, eigenVector_[index]);
}
......
/*
* (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
namespace corsika {
inline SeparationPlane::SeparationPlane(Plane const& plane)
: plane_(plane) {}
inline bool SeparationPlane::contains(Point const& p) const {
return !plane_.isAbove(p);
}
inline std::string SeparationPlane::asString() const { return plane_.asString(); }
} // namespace corsika
\ No newline at end of file
/*
* (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
......@@ -25,4 +24,14 @@ namespace corsika {
inline void Sphere::setRadius(LengthType const r) { radius_ = r; }
inline CoordinateSystemPtr const Sphere::getCoordinateSystem() const {
return center_.getCoordinateSystem();
}
inline std::string Sphere::asString() const {
std::ostringstream txt;
txt << "center=" << center_ << ", radius=" << radius_;
return txt.str();
}
} // namespace corsika
/*
* (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
......@@ -23,6 +22,12 @@ namespace corsika {
return u * timeStep_;
}
template <typename Particle>
inline TimeType StraightTrajectory::getTime(Particle const& particle,
double const u) const {
return particle.getTime() + getDuration(u); // timeStep_ * u;
}
inline LengthType StraightTrajectory::getLength(double const u) const {
if (timeLength_ == 0_s) return 0_m;
if (timeStep_ == std::numeric_limits<TimeType::value_type>::infinity() * 1_s)
......
/*
* (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
......@@ -27,7 +26,7 @@ namespace corsika {
template <typename TDimension>
inline QuantityVector<TDimension> Vector<TDimension>::getComponents(
CoordinateSystemPtr const& pCS) const {
if (*pCS == *BaseVector<TDimension>::getCoordinateSystem()) {
if (pCS == BaseVector<TDimension>::getCoordinateSystem()) {
return BaseVector<TDimension>::getQuantityVector();
} else {
return QuantityVector<TDimension>(
......@@ -238,4 +237,17 @@ namespace corsika {
return os;
}
/*
* scalar * vector multiplication
*/
template <typename TDimension, typename UDimension>
inline Vector<phys::units::detail::product_d<TDimension, UDimension>> operator*(
quantity<UDimension> const n, Vector<TDimension> const& vec) {
return vec * n;
}
template <typename TDimension>
inline Vector<TDimension> operator*(double const n, Vector<TDimension> const& vec) {
return vec * n;
}
} // namespace corsika
/*
* (c) Copyright 2021 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 2021 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/ProcessTraits.hpp>
#include <corsika/framework/utility/HasMethodSignature.hpp>
/**
* @file CascadeEquationsProcess.hpp
*/
namespace corsika {
/**
* traits test for CascadeEquationsProcess::doCascadeEquations method.
*/
template <class TProcess, typename TReturn, typename... TArg>
struct has_method_doCascadeEquations
: public detail::has_method_signature<TReturn, TArg...> {
//! method signature
using detail::has_method_signature<TReturn, TArg...>::testSignature;
//! the default value
template <class T>
static std::false_type test(...);
//! templated parameter option
template <class T>
static decltype(testSignature(&T::template doCascadeEquations<TArg...>)) test(
std::nullptr_t);
//! non templated parameter option
template <class T>
static decltype(testSignature(&T::doCascadeEquations)) test(std::nullptr_t);
public:
/**
* @name traits results
* @{
*/
using type = decltype(test<std::decay_t<TProcess>>(nullptr));
static const bool value = type::value;
//! @}
};
/**
* value traits type.
*/
template <class TProcess, typename TReturn, typename... TArg>
bool constexpr has_method_doCascadeEquations_v =
has_method_doCascadeEquations<TProcess, TReturn, TArg...>::value;
} // namespace corsika
/*
* (c) Copyright 2021 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 2021 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
......@@ -18,29 +17,20 @@ namespace corsika {
template <class TCountedProcess>
template <typename TSecondaryView>
inline void InteractionCounter<TCountedProcess>::doInteraction(TSecondaryView& view) {
auto const projectile = view.getProjectile();
auto const massNumber = projectile.getNode()
->getModelProperties()
.getNuclearComposition()
.getAverageMassNumber();
inline void InteractionCounter<TCountedProcess>::doInteraction(
TSecondaryView& view, Code const projectileId, Code const targetId,
FourMomentum const& projectileP4, FourMomentum const& targetP4) {
size_t const massNumber = is_nucleus(targetId) ? get_nucleus_A(targetId) : 1;
auto const massTarget = massNumber * constants::nucleonMass;
if (auto const projectile_id = projectile.getPID(); projectile_id == Code::Nucleus) {
auto const A = projectile.getNuclearA();
auto const Z = projectile.getNuclearZ();
histogram_.fill(projectile_id, projectile.getEnergy(), massTarget, A, Z);
} else {
histogram_.fill(projectile_id, projectile.getEnergy(), massTarget);
}
process_.doInteraction(view);
histogram_.fill(projectileId, projectileP4.getTimeLikeComponent(), massTarget);
process_.doInteraction(view, projectileId, targetId, projectileP4, targetP4);
}
template <class TCountedProcess>
template <typename TParticle>
inline GrammageType InteractionCounter<TCountedProcess>::getInteractionLength(
TParticle const& particle) const {
return process_.getInteractionLength(particle);
inline CrossSectionType InteractionCounter<TCountedProcess>::getCrossSection(
Code const projectileId, Code const targetId, FourMomentum const& projectileP4,
FourMomentum const& targetP4) const {
return process_.getCrossSection(projectileId, targetId, projectileP4, targetP4);
}
template <class TCountedProcess>
......
/*
* (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
......@@ -21,32 +20,27 @@ namespace corsika {
, inthist_lab_{detail::hist_factory(num_bins_lab, lower_edge_lab, upper_edge_lab)} {
}
inline void InteractionHistogram::fill(Code projectile_id, HEPEnergyType lab_energy,
HEPEnergyType mass_target, int A, int Z) {
inline void InteractionHistogram::fill(Code const projectile_id,
HEPEnergyType const lab_energy,
HEPEnergyType const mass_target) {
auto constexpr inv_eV = 1 / 1_eV;
if (projectile_id == Code::Nucleus) {
auto const sqrtS = sqrt(A * A * (constants::nucleonMass * constants::nucleonMass) +
mass_target * mass_target + 2 * lab_energy * mass_target);
int32_t const pdg = 1'000'000'000l + Z * 10'000l + A * 10l;
inthist_lab_(pdg, lab_energy * inv_eV);
inthist_cms_(pdg, sqrtS * inv_eV);
} else {
auto const projectile_mass = get_mass(projectile_id);
auto const sqrtS = sqrt(projectile_mass * projectile_mass +
mass_target * mass_target + 2 * lab_energy * mass_target);
inthist_cms_(static_cast<int>(get_PDG(projectile_id)), sqrtS * inv_eV);
inthist_lab_(static_cast<int>(get_PDG(projectile_id)), lab_energy * inv_eV);
}
auto const projectile_mass = get_mass(projectile_id);
auto const sqrtS = sqrt(projectile_mass * projectile_mass +
mass_target * mass_target + 2 * lab_energy * mass_target);
CORSIKA_LOG_DEBUG("pM={}, tM={}, pid={}, Elab={}, sqrtS={}, pdg={} a={} z={}",
projectile_mass / 1_GeV, mass_target / 1_GeV, projectile_id,
lab_energy / 1_GeV, sqrtS / 1_GeV, get_PDG(projectile_id),
get_nucleus_A(projectile_id), get_nucleus_Z(projectile_id));
inthist_cms_(static_cast<int>(get_PDG(projectile_id)), sqrtS * inv_eV);
inthist_lab_(static_cast<int>(get_PDG(projectile_id)), lab_energy * inv_eV);
}
inline InteractionHistogram& InteractionHistogram::operator+=(
InteractionHistogram const& other) {
inthist_lab_ += other.inthist_lab_;
inthist_cms_ += other.inthist_cms_;
return *this;
}
......@@ -54,7 +48,6 @@ namespace corsika {
InteractionHistogram other) const {
other.inthist_lab_ += inthist_lab_;
other.inthist_cms_ += inthist_cms_;
return other;
}
} // namespace corsika
/*
* (c) Copyright 2021 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 2021 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
......@@ -14,10 +13,10 @@
namespace corsika {
/**
traits test for InteractionProcess::doInteraction method
*/
* traits test for InteractionProcess::doInteraction method.
*/
template <class TProcess, typename TReturn, typename... TArgs>
template <class TProcess, typename TReturn, typename TTemplate, typename... TArgs>
struct has_method_doInteract : public detail::has_method_signature<TReturn, TArgs...> {
///! method signature
......@@ -29,7 +28,7 @@ namespace corsika {
//! signature of templated method
template <class T>
static decltype(testSignature(&T::template doInteraction<TArgs...>)) test(
static decltype(testSignature(&T::template doInteraction<TTemplate>)) test(
std::nullptr_t);
//! signature of non-templated method
......@@ -38,26 +37,25 @@ namespace corsika {
public:
/**
@name traits results
@{
*/
* @name traits results
* @{
*/
using type = decltype(test<std::decay_t<TProcess>>(nullptr));
static const bool value = type::value;
//! @}
};
//! @file InteractionProcess.hpp
//! value traits type
template <class TProcess, typename TReturn, typename... TArgs>
template <class TProcess, typename TReturn, typename TTemplate, typename... TArgs>
bool constexpr has_method_doInteract_v =
has_method_doInteract<TProcess, TReturn, TArgs...>::value;
has_method_doInteract<TProcess, TReturn, TTemplate, TArgs...>::value;
/**
traits test for InteractionProcess::getInteractionLength method
*/
* traits test for TEMPLATED InteractionProcess::getCrossSection method (PROPOSAL).
*/
template <class TProcess, typename TReturn, typename... TArgs>
struct has_method_getInteractionLength
template <class TProcess, typename TReturn, typename TTemplate, typename... TArgs>
struct has_method_getCrossSectionTemplate
: public detail::has_method_signature<TReturn, TArgs...> {
///! method signature
......@@ -69,28 +67,65 @@ namespace corsika {
//! templated parameter option
template <class T>
static decltype(testSignature(&T::template getInteractionLength<TArgs...>)) test(
static decltype(testSignature(&T::template getCrossSection<TTemplate>)) test(
std::nullptr_t);
//! non templated parameter option
template <class T>
static decltype(testSignature(&T::getInteractionLength)) test(std::nullptr_t);
static decltype(testSignature(&T::getCrossSection)) test(std::nullptr_t);
public:
/**
@name traits results
@{
*/
* @name traits results
* @{
*/
using type = decltype(test<std::decay_t<TProcess>>(nullptr));
static const bool value = type::value;
//! @}
};
//! @file InteractionProcess.hpp
//! value traits type
//! value traits type shortcut
template <class TProcess, typename TReturn, typename TTemplate, typename... TArgs>
bool constexpr has_method_getCrossSectionTemplate_v =
has_method_getCrossSectionTemplate<TProcess, TReturn, TTemplate, TArgs...>::value;
/**
* traits test for InteractionProcess::getCrossSection method.
*/
template <class TProcess, typename TReturn, typename... TArgs>
struct has_method_getCrossSection
: public detail::has_method_signature<TReturn, TArgs...> {
///! method signature
using detail::has_method_signature<TReturn, TArgs...>::testSignature;
//! the default value
template <class T>
static std::false_type test(...);
//! templated parameter option
template <class T>
static decltype(testSignature(&T::template getCrossSection<TArgs...>)) test(
std::nullptr_t);
//! non templated parameter option
template <class T>
static decltype(testSignature(&T::getCrossSection)) test(std::nullptr_t);
public:
/**
* @name traits results
* @{
*/
using type = decltype(test<std::decay_t<TProcess>>(nullptr));
static const bool value = type::value;
//! @}
};
//! value traits type shortcut
template <class TProcess, typename TReturn, typename... TArgs>
bool constexpr has_method_getInteractionLength_v =
has_method_getInteractionLength<TProcess, TReturn, TArgs...>::value;
bool constexpr has_method_getCrossSection_v =
has_method_getCrossSection<TProcess, TReturn, TArgs...>::value;
} // namespace corsika