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
Commits on Source (9)
Showing
with 106 additions and 220 deletions
image: ubuntu:bionic
variables:
GIT_SSL_NO_VERIFY: "1"
before_script:
- apt-get update --yes
- apt-get install --yes cmake libboost-dev libeigen3-dev python3 gfortran
build:
stage: build
tags:
- run1
script:
- mkdir build
- cd build
- cmake ..
- cmake --build .
- ctest -V
# code_quality:
# image: docker:stable
# variables:
# DOCKER_DRIVER: overlay2
# allow_failure: true
# services:
# - docker:stable-dind
# script:
# - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
# - docker run
# --env SOURCE_CODE="$PWD"
# --volume "$PWD":/code
# --volume /var/run/docker.sock:/var/run/docker.sock
# "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
# artifacts:
# reports:
# codequality: gl-code-quality-report.json
...@@ -28,7 +28,7 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/.git") ...@@ -28,7 +28,7 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
endif() endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_bluild_type}' as no other was specified.") message(STATUS "Setting build type to '${default_build_type}' as no other was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE) STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui # Set the possible values of build type for cmake-gui
...@@ -37,7 +37,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) ...@@ -37,7 +37,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
endif() endif()
# enable warnings and disallow non-standard language # enable warnings and disallow non-standard language
set(CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -Wno-ignored-qualifiers") set(CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -Wno-ignored-qualifiers -Wno-nonportable-include-path")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
......
...@@ -43,7 +43,7 @@ using namespace corsika::geometry; ...@@ -43,7 +43,7 @@ using namespace corsika::geometry;
using namespace corsika::environment; using namespace corsika::environment;
using namespace std; using namespace std;
using namespace corsika::units::si; using namespace corsika::units::hep;
static EnergyType fEnergy = 0. * 1_GeV; static EnergyType fEnergy = 0. * 1_GeV;
...@@ -119,8 +119,10 @@ public: ...@@ -119,8 +119,10 @@ public:
template <typename Particle> template <typename Particle>
LengthType MaxStepLength(Particle& p, setup::Trajectory&) const { LengthType MaxStepLength(Particle& p, setup::Trajectory&) const {
cout << "ProcessCut: MinStep: pid: " << p.GetPID() << endl;
cout << "ProcessCut: MinStep: energy (GeV): " << p.GetEnergy() / 1_GeV << endl;
const Code pid = p.GetPID(); const Code pid = p.GetPID();
if (isEmParticle(pid) || isInvisible(pid)) { if (isEmParticle(pid) || isInvisible(pid) || isBelowEnergyCut(p)) {
cout << "ProcessCut: MinStep: next cut: " << 0. << endl; cout << "ProcessCut: MinStep: next cut: " << 0. << endl;
return 0_m; return 0_m;
} else { } else {
...@@ -134,40 +136,26 @@ public: ...@@ -134,40 +136,26 @@ public:
EProcessReturn DoContinuous(Particle& p, setup::Trajectory&, Stack&) const { EProcessReturn DoContinuous(Particle& p, setup::Trajectory&, Stack&) const {
cout << "ProcessCut: DoContinuous: " << p.GetPID() << endl; cout << "ProcessCut: DoContinuous: " << p.GetPID() << endl;
const Code pid = p.GetPID(); const Code pid = p.GetPID();
EProcessReturn ret = EProcessReturn::eOk;
if (isEmParticle(pid)) { if (isEmParticle(pid)) {
cout << "removing em. particle..." << endl; cout << "removing em. particle..." << endl;
fEmEnergy += p.GetEnergy(); fEmEnergy += p.GetEnergy();
fEmCount += 1; fEmCount += 1;
p.Delete(); p.Delete();
ret = EProcessReturn::eParticleAbsorbed;
} else if (isInvisible(pid)) { } else if (isInvisible(pid)) {
cout << "removing inv. particle..." << endl; cout << "removing inv. particle..." << endl;
fInvEnergy += p.GetEnergy(); fInvEnergy += p.GetEnergy();
fInvCount += 1; fInvCount += 1;
p.Delete(); p.Delete();
ret = EProcessReturn::eParticleAbsorbed;
} else if (isBelowEnergyCut(p)) { } else if (isBelowEnergyCut(p)) {
cout << "removing low en. particle..." << endl; cout << "removing low en. particle..." << endl;
fEnergy += p.GetEnergy(); fEnergy += p.GetEnergy();
p.Delete(); p.Delete();
ret = EProcessReturn::eParticleAbsorbed;
} }
// cout << "ProcessCut: DoContinous: " << p.GetPID() << endl; return ret;
// cout << " is em: " << isEmParticle( p.GetPID() ) << endl;
// cout << " is inv: " << isInvisible( p.GetPID() ) << endl;
// const Code pid = p.GetPID();
// if( isEmParticle( pid ) ){
// cout << "removing em. particle..." << endl;
// fEmEnergy += p.GetEnergy();
// fEmCount += 1;
// p.Delete();
// return EProcessReturn::eParticleAbsorbed;
// }
// if ( isInvisible( pid ) ){
// cout << "removing inv. particle..." << endl;
// fInvEnergy += p.GetEnergy();
// fInvCount += 1;
// p.Delete();
// return EProcessReturn::eParticleAbsorbed;
// }
return EProcessReturn::eOk;
} }
void Init() { void Init() {
...@@ -182,10 +170,11 @@ public: ...@@ -182,10 +170,11 @@ public:
void ShowResults() { void ShowResults() {
cout << " ******************************" << endl cout << " ******************************" << endl
<< " ParticleCut: " << endl << " ParticleCut: " << endl
<< " energy in em. component (GeV): " << fEmEnergy / 1_GeV << endl << " energy in em. component (GeV): " << fEmEnergy / 1_GeV << endl
<< " no. of em. particles injected: " << fEmCount << endl << " no. of em. particles injected: " << fEmCount << endl
<< " energy in inv. component (GeV): " << fInvEnergy / 1_GeV << endl << " energy in inv. component (GeV): " << fInvEnergy / 1_GeV << endl
<< " no. of inv. particles injected: " << fInvCount << endl << " no. of inv. particles injected: " << fInvCount << endl
<< " energy below particle cut (GeV): " << fEnergy / 1_GeV << endl
<< " ******************************" << endl; << " ******************************" << endl;
} }
...@@ -228,7 +217,7 @@ int main() { ...@@ -228,7 +217,7 @@ int main() {
corsika::process::sibyll::Interaction sibyll; corsika::process::sibyll::Interaction sibyll;
corsika::process::sibyll::Decay decay; corsika::process::sibyll::Decay decay;
ProcessEMCut cut; ProcessEMCut cut;
const auto sequence = /*p0 +*/ sibyll + decay + cut; const auto sequence = /*p0 <<*/ sibyll << decay << cut;
setup::Stack stack; setup::Stack stack;
...@@ -237,9 +226,8 @@ int main() { ...@@ -237,9 +226,8 @@ int main() {
stack.Clear(); stack.Clear();
auto particle = stack.NewParticle(); auto particle = stack.NewParticle();
EnergyType E0 = 100_GeV; EnergyType E0 = 100_GeV;
MomentumType P0 = sqrt(E0 * E0 - 0.93827_GeV * 0.93827_GeV) / si::constants::c; hep::MomentumType P0 = sqrt(E0 * E0 - 0.93827_GeV * 0.93827_GeV);
auto plab = super_stupid::MomentumVector(rootCS, 0. * 1_GeV / si::constants::c, auto plab = stack::super_stupid::MomentumVector(rootCS, 0. * 1_GeV, 0. * 1_GeV, P0);
0. * 1_GeV / si::constants::c, P0);
particle.SetEnergy(E0); particle.SetEnergy(E0);
particle.SetMomentum(plab); particle.SetMomentum(plab);
particle.SetPID(Code::Proton); particle.SetPID(Code::Proton);
......
...@@ -86,7 +86,7 @@ void modular() { ...@@ -86,7 +86,7 @@ void modular() {
Process3 m3; Process3 m3;
Process4 m4(0.9); Process4 m4(0.9);
const auto sequence = m1 + m2 + m3 + m4; const auto sequence = m1 << m2 << m3 << m4;
DummyData p; DummyData p;
DummyStack s; DummyStack s;
......
...@@ -42,14 +42,14 @@ namespace corsika::environment { ...@@ -42,14 +42,14 @@ namespace corsika::environment {
NuclearComposition const& GetNuclearComposition() const override { return fNuclComp; } NuclearComposition const& GetNuclearComposition() const override { return fNuclComp; }
corsika::units::si::GrammageType IntegratedGrammage( corsika::units::si::GrammageType IntegratedGrammage(
corsika::geometry::Trajectory<corsika::geometry::Line> const& pTraj, corsika::geometry::Trajectory<corsika::geometry::Line> const&,
corsika::units::si::LengthType pTo) const override { corsika::units::si::LengthType pTo) const override {
using namespace corsika::units::si; using namespace corsika::units::si;
return pTo * fDensity; return pTo * fDensity;
} }
corsika::units::si::LengthType ArclengthFromGrammage( corsika::units::si::LengthType ArclengthFromGrammage(
corsika::geometry::Trajectory<corsika::geometry::Line> const& pTraj, corsika::geometry::Trajectory<corsika::geometry::Line> const&,
corsika::units::si::GrammageType pGrammage) const override { corsika::units::si::GrammageType pGrammage) const override {
return pGrammage / fDensity; return pGrammage / fDensity;
} }
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
#include <corsika/setup/SetupTrajectory.h> #include <corsika/setup/SetupTrajectory.h>
#include <corsika/units/PhysicalUnits.h> #include <corsika/units/PhysicalUnits.h>
#include <type_traits> #include <cmath>
#include <iostream>
namespace corsika::cascade { namespace corsika::cascade {
...@@ -56,7 +57,11 @@ namespace corsika::cascade { ...@@ -56,7 +57,11 @@ namespace corsika::cascade {
} }
void Step(Particle& particle) { void Step(Particle& particle) {
using namespace corsika::units::si; using namespace corsika::units::si;
using std::cout;
using std::endl;
using std::log;
// determine geometric tracking // determine geometric tracking
corsika::setup::Trajectory step = fTracking.GetTrack(particle); corsika::setup::Trajectory step = fTracking.GetTrack(particle);
...@@ -97,7 +102,7 @@ namespace corsika::cascade { ...@@ -97,7 +102,7 @@ namespace corsika::cascade {
// Environment::GetDistance(step, next_decay); // Environment::GetDistance(step, next_decay);
LengthType const distance_decay = next_decay * particle.GetMomentum().norm() / LengthType const distance_decay = next_decay * particle.GetMomentum().norm() /
particle.GetEnergy() * particle.GetEnergy() *
corsika::units::si::constants::cSquared; corsika::units::constants::c;
// take minimum of geometry, interaction, decay for next step // take minimum of geometry, interaction, decay for next step
auto const min_distance = auto const min_distance =
...@@ -152,10 +157,10 @@ namespace corsika::cascade { ...@@ -152,10 +157,10 @@ namespace corsika::cascade {
} }
private: private:
corsika::environment::Environment const& fEnvironment;
Tracking& fTracking; Tracking& fTracking;
ProcessList& fProcessSequence; ProcessList& fProcessSequence;
Stack& fStack; Stack& fStack;
corsika::environment::Environment const& fEnvironment;
corsika::random::RNG& fRNG = corsika::random::RNG& fRNG =
corsika::random::RNGManager::GetInstance().GetRandomStream("cascade"); corsika::random::RNGManager::GetInstance().GetRandomStream("cascade");
}; };
......
...@@ -113,7 +113,7 @@ TEST_CASE("Cascade", "[Cascade]") { ...@@ -113,7 +113,7 @@ TEST_CASE("Cascade", "[Cascade]") {
stack_inspector::StackInspector<setup::Stack> p0(true); stack_inspector::StackInspector<setup::Stack> p0(true);
ProcessSplit p1; ProcessSplit p1;
const auto sequence = p0 + p1; const auto sequence = p0 << p1;
setup::Stack stack; setup::Stack stack;
corsika::cascade::Cascade EAS(env, tracking, sequence, stack); corsika::cascade::Cascade EAS(env, tracking, sequence, stack);
...@@ -126,8 +126,8 @@ TEST_CASE("Cascade", "[Cascade]") { ...@@ -126,8 +126,8 @@ TEST_CASE("Cascade", "[Cascade]") {
particle.SetPID(particles::Code::Electron); particle.SetPID(particles::Code::Electron);
particle.SetEnergy(E0); particle.SetEnergy(E0);
particle.SetPosition(Point(rootCS, {0_m, 0_m, 10_km})); particle.SetPosition(Point(rootCS, {0_m, 0_m, 10_km}));
particle.SetMomentum(corsika::stack::super_stupid::MomentumVector( particle.SetMomentum(
rootCS, {0 * newton * second, 0 * newton * second, -1 * newton * second})); corsika::stack::super_stupid::MomentumVector(rootCS, {0_GeV, 0_GeV, -1_GeV}));
particle.SetTime(0_ns); particle.SetTime(0_ns);
EAS.Init(); EAS.Init();
EAS.Run(); EAS.Run();
......
...@@ -117,16 +117,16 @@ namespace corsika::geometry { ...@@ -117,16 +117,16 @@ namespace corsika::geometry {
auto operator==(QuantityVector<dim> const& p) const { return eVector == p.eVector; } auto operator==(QuantityVector<dim> const& p) const { return eVector == p.eVector; }
}; };
} // namespace corsika::geometry template <typename dim>
auto& operator<<(std::ostream& os, corsika::geometry::QuantityVector<dim> qv) {
using Quantity = phys::units::quantity<dim, double>;
template <typename dim> os << '(' << qv.eVector(0) << ' ' << qv.eVector(1) << ' ' << qv.eVector(2) << ") "
auto& operator<<(std::ostream& os, corsika::geometry::QuantityVector<dim> qv) { << phys::units::to_unit_symbol<dim, double>(
using Quantity = phys::units::quantity<dim, double>; Quantity(phys::units::detail::magnitude_tag, 1));
return os;
}
os << '(' << qv.eVector(0) << ' ' << qv.eVector(1) << ' ' << qv.eVector(2) << ") " } // namespace corsika::geometry
<< phys::units::to_unit_symbol<dim, double>(
Quantity(phys::units::detail::magnitude_tag, 1));
return os;
}
#endif #endif
...@@ -38,7 +38,7 @@ namespace corsika::geometry { ...@@ -38,7 +38,7 @@ namespace corsika::geometry {
corsika::units::si::TimeType GetDuration() const { return fTimeLength; } corsika::units::si::TimeType GetDuration() const { return fTimeLength; }
LengthType GetDistance(corsika::units::si::TimeType t) const { corsika::units::si::LengthType GetDistance(corsika::units::si::TimeType t) const {
assert(t > fTimeLength); assert(t > fTimeLength);
assert(t >= 0 * corsika::units::si::second); assert(t >= 0 * corsika::units::si::second);
return T::ArcLength(0, t); return T::ArcLength(0, t);
......
...@@ -10,11 +10,12 @@ ...@@ -10,11 +10,12 @@
*/ */
#include <corsika/particles/ParticleProperties.h> #include <corsika/particles/ParticleProperties.h>
#include <iostream>
namespace corsika::particles::io { namespace corsika::particles {
std::ostream& operator<<(std::ostream& stream, Code const p) { std::ostream& operator<<(std::ostream& stream, corsika::particles::Code const p) {
return stream << GetName(p); return stream << corsika::particles::GetName(p);
} }
} // namespace corsika::particles::io } // namespace corsika::particles
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <array> #include <array>
#include <cstdint> #include <cstdint>
#include <iostream> #include <iosfwd>
#include <type_traits> #include <type_traits>
#include <corsika/units/PhysicalConstants.h> #include <corsika/units/PhysicalConstants.h>
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace corsika::particles { namespace corsika::particles {
using corsika::units::si::second;
enum class Code : int16_t; enum class Code : int16_t;
using PDGCodeType = int32_t; using PDGCodeType = int32_t;
...@@ -76,7 +74,7 @@ namespace corsika::particles { ...@@ -76,7 +74,7 @@ namespace corsika::particles {
} }
corsika::units::si::ElectricChargeType constexpr GetElectricCharge(Code const p) { corsika::units::si::ElectricChargeType constexpr GetElectricCharge(Code const p) {
return GetElectricChargeNumber(p) * (corsika::units::si::constants::e / 3.); return GetElectricChargeNumber(p) * (corsika::units::constants::e / 3.);
} }
constexpr std::string const& GetName(Code const p) { constexpr std::string const& GetName(Code const p) {
...@@ -100,15 +98,12 @@ namespace corsika::particles { ...@@ -100,15 +98,12 @@ namespace corsika::particles {
return detail::nucleusZ[static_cast<CodeIntType const>(p)]; return detail::nucleusZ[static_cast<CodeIntType const>(p)];
} }
namespace io { /**
* the output operator for particles
std::ostream& operator<<(std::ostream& stream, Code const p); **/
} // namespace io std::ostream& operator<<(std::ostream& stream, corsika::particles::Code const p);
} // namespace corsika::particles } // namespace corsika::particles
// to inject the operator<< into the root namespace
using namespace corsika::particles::io;
#endif #endif
...@@ -292,7 +292,7 @@ def gen_properties(particle_db): ...@@ -292,7 +292,7 @@ def gen_properties(particle_db):
# particle masses table # particle masses table
string += "static constexpr std::array<corsika::units::hep::MassType const, size> masses = {\n" string += "static constexpr std::array<corsika::units::hep::MassType const, size> masses = {\n"
for p in particle_db.values(): for p in particle_db.values():
string += " {mass:e} * (1e9 * corsika::units::si::constants::eV), // {name:s}\n".format(mass = p['mass'], name = p['name']) string += " {mass:e} * (1e9 * corsika::units::constants::eV), // {name:s}\n".format(mass = p['mass'], name = p['name'])
string += "};\n\n" string += "};\n\n"
# PDG code table # PDG code table
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
// cpp file // cpp file
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
using namespace corsika::units::si; using namespace corsika::units;
using namespace corsika::units::hep;
using namespace corsika::particles; using namespace corsika::particles;
TEST_CASE("ParticleProperties", "[Particles]") { TEST_CASE("ParticleProperties", "[Particles]") {
......
...@@ -29,39 +29,7 @@ namespace corsika::process { ...@@ -29,39 +29,7 @@ namespace corsika::process {
struct BaseProcess { struct BaseProcess {
derived& GetRef() { return static_cast<derived&>(*this); } derived& GetRef() { return static_cast<derived&>(*this); }
const derived& GetRef() const { return static_cast<const derived&>(*this); } const derived& GetRef() const { return static_cast<const derived&>(*this); }
/*
template <typename Particle, typename Stack>
inline EProcessReturn DoDiscrete(Particle&, Stack&) const; // {}
template <typename Particle, typename Track, typename Stack>
inline EProcessReturn DoContinuous(Particle&, Track&, Stack&) const; // {}
*/
/*
template <typename Particle, typename Track>
inline double GetInverseInteractionLength(Particle& p, Track& t) const {
return 1./GetRef().GetInteractionLength(p, t);
}
*/
};
/*
template<template<typename, typename> class T, typename A, typename B>
typename BaseProcess< T<A, B> >::is_process_sequence
{
static const bool value = true;
};
*/
/*
template <typename T>
struct is_base {
static const bool value = false;
};
template <typename T>
struct is_base<BaseProcess<T>> {
static const bool value = true;
}; };
*/
} // namespace corsika::process } // namespace corsika::process
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#define _include_corsika_continuousprocess_h_ #define _include_corsika_continuousprocess_h_
#include <corsika/process/ProcessReturn.h> // for convenience #include <corsika/process/ProcessReturn.h> // for convenience
//#include <corsika/setup/SetupTrajectory.h>
namespace corsika::process { namespace corsika::process {
......
...@@ -26,6 +26,7 @@ namespace corsika::process { ...@@ -26,6 +26,7 @@ namespace corsika::process {
eInteracted = 3, eInteracted = 3,
eDecayed = 4, eDecayed = 4,
}; };
} // namespace corsika::process } // namespace corsika::process
#endif #endif
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <corsika/process/BaseProcess.h> #include <corsika/process/BaseProcess.h>
#include <corsika/process/ContinuousProcess.h> #include <corsika/process/ContinuousProcess.h>
#include <corsika/process/DecayProcess.h> #include <corsika/process/DecayProcess.h>
//#include <corsika/process/DiscreteProcess.h>
#include <corsika/process/InteractionProcess.h> #include <corsika/process/InteractionProcess.h>
#include <corsika/process/ProcessReturn.h> #include <corsika/process/ProcessReturn.h>
#include <corsika/units/PhysicalUnits.h> #include <corsika/units/PhysicalUnits.h>
...@@ -23,112 +22,8 @@ ...@@ -23,112 +22,8 @@
#include <cmath> #include <cmath>
#include <limits> #include <limits>
//#include <corsika/setup/SetupTrajectory.h>
// using corsika::setup::Trajectory;
//#include <variant>
//#include <type_traits> // still needed ?
namespace corsika::process { namespace corsika::process {
// namespace detail {
/* /\* template<typename TT1, typename TT2, typename Type = void> *\/ */
/* /\* struct CallHello { *\/ */
/* /\* static void Call(const TT1&, const TT2&) { *\/ */
/* /\* std::cout << "normal" << std::endl; *\/ */
/* /\* } *\/ */
/* /\* }; *\/ */
/* /\* template<typename TT1, typename TT2> *\/ */
/* /\* struct CallHello<TT1, TT2, typename
* std::enable_if<std::is_base_of<ContinuousProcess<TT2>, TT2>::value>::type> *\/ */
/* /\* { *\/ */
/* /\* static void Call(const TT1&, const TT2&) { *\/ */
/* /\* std::cout << "special" << std::endl; *\/ */
/* /\* } *\/ */
/* }; */
/* template<typename T1, typename T2, typename Particle, typename Trajectory, typename
* Stack> //, typename Type = void> */
/* struct DoContinuous { */
/* static EProcessReturn Call(const T1& A, const T2& B, Particle& p, Trajectory& t,
* Stack& s) { */
/* EProcessReturn ret = EProcessReturn::eOk; */
/* if constexpr (!std::is_base_of<DiscreteProcess<T1>, T1>::value) { */
/* A.DoContinuous(p, t, s); */
/* } */
/* if constexpr (!std::is_base_of<DiscreteProcess<T2>, T2>::value) { */
/* B.DoContinuous(p, t, s); */
/* } */
/* return ret; */
/* } */
/* }; */
/* /\* */
/* template<typename T1, typename T2, typename Particle, typename Trajectory, typename
* Stack> */
/* struct DoContinuous<T1,T2,Particle,Trajectory,Stack, typename
* std::enable_if<std::is_base_of<DiscreteProcess<T1>, T1>::value>::type> { */
/* static EProcessReturn Call(const T1& A, const T2& B, Particle& p, Trajectory& t,
* Stack& s) { */
/* EProcessReturn ret = EProcessReturn::eOk; */
/* A.DoContinuous(p, t, s); */
/* B.DoContinuous(p, t, s); */
/* return ret; */
/* } */
/* }; */
/* template<typename T1, typename T2, typename Particle, typename Trajectory,
* typename Stack> */
/* struct DoContinuous<T1,T2,Particle,Trajectory,Stack, typename
* std::enable_if<std::is_base_of<DiscreteProcess<T2>, T2>::value>::type> { */
/* static EProcessReturn Call(const T1& A, const T2&, Particle& p, Trajectory& t,
* Stack& s) { */
/* EProcessReturn ret = EProcessReturn::eOk; */
/* A.DoContinuous(p, t, s); */
/* B.DoContinuous(p, t, s); */
/* return ret; */
/* } */
/* }; */
/* *\/ */
/* template<typename T1, typename T2, typename Particle, typename Stack>//, typename
* Type = void> */
/* struct DoDiscrete { */
/* static EProcessReturn Call(const T1& A, const T2& B, Particle& p, Stack& s) { */
/* if constexpr (!std::is_base_of<ContinuousProcess<T1>, T1>::value) { */
/* A.DoDiscrete(p, s); */
/* } */
/* if constexpr (!std::is_base_of<ContinuousProcess<T2>, T2>::value) { */
/* B.DoDiscrete(p, s); */
/* } */
/* return EProcessReturn::eOk; */
/* } */
/* }; */
/* /\* */
/* template<typename T1, typename T2, typename Particle, typename Stack> */
/* struct DoDiscrete<T1,T2,Particle,Stack, typename
* std::enable_if<std::is_base_of<ContinuousProcess<T1>, T1>::value>::type> { */
/* static EProcessReturn Call(const T1&, const T2& B, Particle& p, Stack& s) { */
/* // A.DoDiscrete(p, s); */
/* B.DoDiscrete(p, s); */
/* return EProcessReturn::eOk; */
/* } */
/* }; */
/* template<typename T1, typename T2, typename Particle, typename Stack> */
/* struct DoDiscrete<T1,T2,Particle,Stack, typename
* std::enable_if<std::is_base_of<ContinuousProcess<T2>, T2>::value>::type> { */
/* static EProcessReturn Call(const T1& A, const T2&, Particle& p, Stack& s) { */
/* A.DoDiscrete(p, s); */
/* //B.DoDiscrete(p, s); */
/* return EProcessReturn::eOk; */
/* } */
/* }; */
/* *\/ */
//} // end namespace detail
/** /**
\class ProcessSequence \class ProcessSequence
...@@ -332,15 +227,15 @@ namespace corsika::process { ...@@ -332,15 +227,15 @@ namespace corsika::process {
} }
}; };
/// the + operator assembles many BaseProcess, ContinuousProcess, and /// the << operator assembles many BaseProcess, ContinuousProcess, and
/// InteractionProcess objects into a ProcessSequence, all combinatorics /// Interaction/DecayProcess objects into a ProcessSequence, all combinatorics
/// must be allowed, this is why we define a macro to define all /// must be allowed, this is why we define a macro to define all
/// combinations here: /// combinations here:
#define OPSEQ(C1, C2) \ #define OPSEQ(C1, C2) \
template <typename T1, typename T2> \ template <typename T1, typename T2> \
inline const ProcessSequence<T1, T2> operator+(const C1<T1>& A, const C2<T2>& B) { \ inline const ProcessSequence<T1, T2> operator<<(const C1<T1>& A, const C2<T2>& B) { \
return ProcessSequence<T1, T2>(A.GetRef(), B.GetRef()); \ return ProcessSequence<T1, T2>(A.GetRef(), B.GetRef()); \
} }
OPSEQ(BaseProcess, BaseProcess) OPSEQ(BaseProcess, BaseProcess)
...@@ -360,6 +255,7 @@ namespace corsika::process { ...@@ -360,6 +255,7 @@ namespace corsika::process {
OPSEQ(DecayProcess, ContinuousProcess) OPSEQ(DecayProcess, ContinuousProcess)
OPSEQ(DecayProcess, DecayProcess) OPSEQ(DecayProcess, DecayProcess)
/// marker to identify objectas ProcessSequence
template <typename A, typename B> template <typename A, typename B>
struct is_process_sequence<corsika::process::ProcessSequence<A, B> > { struct is_process_sequence<corsika::process::ProcessSequence<A, B> > {
static const bool value = true; static const bool value = true;
......
...@@ -188,7 +188,7 @@ TEST_CASE("Process Sequence", "[Process Sequence]") { ...@@ -188,7 +188,7 @@ TEST_CASE("Process Sequence", "[Process Sequence]") {
Process3 m3(2); Process3 m3(2);
Process4 m4(3); Process4 m4(3);
const auto sequence = m1 + m2 + m3 + m4; const auto sequence = m1 << m2 << m3 << m4;
globalCount = 0; globalCount = 0;
sequence.Init(); sequence.Init();
...@@ -208,7 +208,7 @@ TEST_CASE("Process Sequence", "[Process Sequence]") { ...@@ -208,7 +208,7 @@ TEST_CASE("Process Sequence", "[Process Sequence]") {
DummyStack s; DummyStack s;
DummyTrajectory t; DummyTrajectory t;
const auto sequence2 = cp1 + m2 + m3; const auto sequence2 = cp1 << m2 << m3;
GrammageType const tot = sequence2.GetTotalInteractionLength(s, t); GrammageType const tot = sequence2.GetTotalInteractionLength(s, t);
InverseGrammageType const tot_inv = sequence2.GetTotalInverseInteractionLength(s, t); InverseGrammageType const tot_inv = sequence2.GetTotalInverseInteractionLength(s, t);
cout << "lambda_tot=" << tot << "; lambda_tot_inv=" << tot_inv << endl; cout << "lambda_tot=" << tot << "; lambda_tot_inv=" << tot_inv << endl;
...@@ -222,7 +222,7 @@ TEST_CASE("Process Sequence", "[Process Sequence]") { ...@@ -222,7 +222,7 @@ TEST_CASE("Process Sequence", "[Process Sequence]") {
DummyStack s; DummyStack s;
const auto sequence2 = cp1 + m2 + m3 + d3; const auto sequence2 = cp1 << m2 << m3 << d3;
TimeType const tot = sequence2.GetTotalLifetime(s); TimeType const tot = sequence2.GetTotalLifetime(s);
InverseTimeType const tot_inv = sequence2.GetTotalInverseLifetime(s); InverseTimeType const tot_inv = sequence2.GetTotalInverseLifetime(s);
cout << "lambda_tot=" << tot << "; lambda_tot_inv=" << tot_inv << endl; cout << "lambda_tot=" << tot << "; lambda_tot_inv=" << tot_inv << endl;
...@@ -235,7 +235,7 @@ TEST_CASE("Process Sequence", "[Process Sequence]") { ...@@ -235,7 +235,7 @@ TEST_CASE("Process Sequence", "[Process Sequence]") {
Process2 m2(1); Process2 m2(1);
Process3 m3(2); Process3 m3(2);
const auto sequence2 = cp1 + m2 + m3 + cp2; const auto sequence2 = cp1 << m2 << m3 << cp2;
DummyData p; DummyData p;
DummyStack s; DummyStack s;
......
...@@ -30,13 +30,11 @@ namespace corsika::stack { ...@@ -30,13 +30,11 @@ namespace corsika::stack {
template <typename StackIterator> template <typename StackIterator>
class ParticleBase { class ParticleBase {
// friend class Stack<StackData, PI>; // for access to GetIterator
public: public:
ParticleBase() {} ParticleBase() {}
private: private:
ParticleBase(ParticleBase&); ParticleBase(ParticleBase&);
// ParticleBase& operation=(ParticleBase& p);
public: public:
/// delete this particle on the stack. The corresponding iterator /// delete this particle on the stack. The corresponding iterator
......
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
#include <corsika/stack/ParticleBase.h> #include <corsika/stack/ParticleBase.h>
#include <iomanip>
#include <iostream>
class StackData; // forward decl class StackData; // forward decl
namespace corsika::stack { namespace corsika::stack {
......