13 #include <corsika/framework/process/InteractionProcess.hpp> 16 #include <boost/type_index.hpp> 30 template <
typename TStack>
34 using stack_view_type =
typename TStack::stack_view_type;
44 template <
typename TInteractionProcess>
46 : concept_{std::make_unique<ConcreteModel<TInteractionProcess>>(std::move(obj))} {
47 CORSIKA_LOG_DEBUG(
"creating DynamicInteractionProcess from {}",
48 boost::typeindex::type_id<TInteractionProcess>().pretty_name());
51 static_assert(is_interaction_process_v<TInteractionProcess>);
55 static_assert(!is_continuous_process_v<TInteractionProcess>);
56 static_assert(!is_decay_process_v<TInteractionProcess>);
57 static_assert(!is_stack_process_v<TInteractionProcess>);
58 static_assert(!is_cascade_equations_process_v<TInteractionProcess>);
59 static_assert(!is_secondaries_process_v<TInteractionProcess>);
60 static_assert(!is_boundary_process_v<TInteractionProcess>);
61 static_assert(!is_cascade_equations_process_v<TInteractionProcess>);
65 void doInteraction(stack_view_type& view, Code projectileId, Code targetId,
67 return concept_->doInteraction(view, projectileId, targetId, projectileP4,
75 return concept_->getCrossSection(projectileId, targetId, projectileP4, targetP4);
79 struct IInteractionModel {
80 virtual ~IInteractionModel() =
default;
87 template <
typename TModel>
88 struct ConcreteModel final : IInteractionModel {
89 ConcreteModel(std::shared_ptr<TModel> obj) noexcept
90 : model_{std::move(obj)} {}
92 void doInteraction(stack_view_type& view, Code projectileId, Code targetId,
95 return model_->doInteraction(view, projectileId, targetId, projectileP4,
102 return model_->getCrossSection(projectileId, targetId, projectileP4, targetP4);
106 std::shared_ptr<TModel> model_;
109 std::unique_ptr<IInteractionModel> concept_;
Import and extend the phys::units package.
DynamicInteractionProcess(std::shared_ptr< TInteractionProcess > obj)
Create new DynamicInteractionProcess.
This class allows selecting/using different InteractionProcesses at runtime without recompiling the p...
CORSIKA8 logging utilities.
Description of physical four-vectors.
`, since they are used everywhere as integral part of the framework.
CrossSectionType getCrossSection(Code projectileId, Code targetId, FourMomentum const &projectileP4, FourMomentum const &targetP4) const
forwards arguments to getCrossSection() of wrapped instance
Interface to particle properties.
void doInteraction(stack_view_type &view, Code projectileId, Code targetId, FourMomentum const &projectileP4, FourMomentum const &targetP4)
forwards arguments to doInteraction() of wrapped instance
Process describing the interaction of particles.
General FourVector object.