IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 0c9d14b4 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

added boundary crossing process

parent 8b912f05
No related branches found
No related tags found
2 merge requests!91Resolve "define further classes of processes (MaintenanceProcess?)",!76Resolve "Handling of boundary crossings in geometry tree"
...@@ -242,6 +242,7 @@ namespace corsika::cascade { ...@@ -242,6 +242,7 @@ namespace corsika::cascade {
} else { // boundary crossing } else { // boundary crossing
std::cout << "boundary crossing! next node = " << nextVol << std::endl; std::cout << "boundary crossing! next node = " << nextVol << std::endl;
particle.SetNode(nextVol); particle.SetNode(nextVol);
fProcessSequence.DoBoundaryCrossing(particle, *currentLogicalNode, *nextVol);
} }
} }
......
/*
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
*
* See file AUTHORS for a list of contributors.
*
* 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.
*/
#ifndef _include_corsika_processes_BoundaryCrossingProcess_h_
#define _include_corsika_processes_BoundaryCrossingProcess_h_
#include <corsika/environment/Environment.h>
namespace corsika::process {
template <typename TDerived>
struct BoundaryCrossingProcess {
auto& GetRef() { return static_cast<TDerived&>(*this); }
auto const& GetRef() const { return static_cast<const TDerived&>(*this); }
/**
* This method is called when a particle crosses the boundary between the nodes
* \arg from and \arg to.
*/
template <typename Particle>
EProcessReturn DoBoundaryCrossing(Particle&, environment::BaseNodeType const& from,
environment::BaseNodeType const& to);
};
template <class T>
std::true_type is_process_impl(BoundaryCrossingProcess<T> const* impl);
} // namespace corsika::process
#endif
...@@ -11,6 +11,7 @@ set ( ...@@ -11,6 +11,7 @@ set (
set ( set (
CORSIKAprocesssequence_HEADERS CORSIKAprocesssequence_HEADERS
BaseProcess.h BaseProcess.h
BoundaryCrossingProcess.h
ContinuousProcess.h ContinuousProcess.h
InteractionProcess.h InteractionProcess.h
DecayProcess.h DecayProcess.h
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define _include_ProcessSequence_h_ #define _include_ProcessSequence_h_
#include <corsika/process/BaseProcess.h> #include <corsika/process/BaseProcess.h>
#include <corsika/process/BoundaryCrossingProcess.h>
#include <corsika/process/ContinuousProcess.h> #include <corsika/process/ContinuousProcess.h>
#include <corsika/process/DecayProcess.h> #include <corsika/process/DecayProcess.h>
#include <corsika/process/InteractionProcess.h> #include <corsika/process/InteractionProcess.h>
...@@ -70,6 +71,24 @@ namespace corsika::process { ...@@ -70,6 +71,24 @@ namespace corsika::process {
// example for a trait-based call: // example for a trait-based call:
// void Hello() const { detail::CallHello<T1,T2>::Call(A, B); } // void Hello() const { detail::CallHello<T1,T2>::Call(A, B); }
template <typename Particle>
EProcessReturn DoBoundaryCrossing(Particle& p, environment::BaseNodeType const& from,
environment::BaseNodeType const& to) {
EProcessReturn ret = EProcessReturn::eOk;
if constexpr (std::is_base_of<BoundaryCrossingProcess<T1type>, T1type>::value ||
is_process_sequence<T1>::value) {
ret |= A.DoBoundaryCrossing(p, from, to);
}
if constexpr (std::is_base_of<BoundaryCrossingProcess<T2type>, T2type>::value ||
is_process_sequence<T2>::value) {
ret |= B.DoBoundaryCrossing(p, from, to);
}
return ret;
}
template <typename Particle, typename Track, typename Stack> template <typename Particle, typename Track, typename Stack>
EProcessReturn DoContinuous(Particle& p, Track& t, Stack& s) { EProcessReturn DoContinuous(Particle& p, Track& t, Stack& s) {
EProcessReturn ret = EProcessReturn::eOk; EProcessReturn ret = EProcessReturn::eOk;
......
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