From 16d51e1324c7e3fcd49ec08ab6e7d194d7fe98d9 Mon Sep 17 00:00:00 2001 From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu> Date: Tue, 12 Feb 2019 18:30:29 +0100 Subject: [PATCH] set nodes at beginning of cascade --- Documentation/Examples/cascade_example.cc | 6 ------ Framework/Cascade/Cascade.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Documentation/Examples/cascade_example.cc b/Documentation/Examples/cascade_example.cc index f9d1e95a..b9e5990e 100644 --- a/Documentation/Examples/cascade_example.cc +++ b/Documentation/Examples/cascade_example.cc @@ -36,9 +36,6 @@ #include <corsika/utl/CorsikaFenv.h> -#include <boost/type_index.hpp> -using boost::typeindex::type_id_with_cvr; - #include <iostream> #include <limits> #include <typeinfo> @@ -267,9 +264,6 @@ int main() { // auto sequence = p0 << sibyll << decay << hadronicElastic << cut << trackWriter; auto sequence = p0 << sibyll << sibyllNuc << decay << cut << trackWriter; - // cout << "decltype(sequence)=" << type_id_with_cvr<decltype(sequence)>().pretty_name() - // << "\n"; - // setup particle stack, and add primary particle setup::Stack stack; stack.Clear(); diff --git a/Framework/Cascade/Cascade.h b/Framework/Cascade/Cascade.h index 3880fba0..e2cc4ef6 100644 --- a/Framework/Cascade/Cascade.h +++ b/Framework/Cascade/Cascade.h @@ -77,12 +77,28 @@ namespace corsika::cascade { fProcessSequence.Init(); fStack.Init(); } + + /** + * set the nodes for all particles on the stack according to their numerical + * position + */ + void SetNodes() { + std::for_each(fStack.begin(), fStack.end(), [&](auto& p) { + auto const* numericalNode = + fEnvironment.GetUniverse()->GetContainingNode(p.GetPosition()); + p.SetNode(numericalNode); + + std::cout << "initial node " << p.GetNode() << std::endl; + }); + } /** * The Run function is the main simulation loop, which processes * particles from the Stack until the Stack is empty. */ void Run() { + SetNodes(); + while (!fStack.IsEmpty()) { while (!fStack.IsEmpty()) { auto pNext = fStack.GetNextParticle(); -- GitLab