IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 3471b6cd authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by Ralf Ulrich
Browse files

renamed to InteractionLengthModifier

parent a45b4c22
No related branches found
No related tags found
1 merge request!351Adding wrapper process to modify interaction lengths
...@@ -16,22 +16,22 @@ ...@@ -16,22 +16,22 @@
namespace corsika { namespace corsika {
template <class TUnderlyingProcess> template <class TUnderlyingProcess>
inline IntLengthModifyingProcess<TUnderlyingProcess>::IntLengthModifyingProcess( inline InteractionLengthModifier<TUnderlyingProcess>::InteractionLengthModifier(
TUnderlyingProcess&& process, TUnderlyingProcess&& process,
std::function<IntLengthModifyingProcess::functor_signature> modifier) std::function<InteractionLengthModifier::functor_signature> modifier)
: process_{std::move(process)} : process_{std::move(process)}
, modifier_{std::move(modifier)} {} , modifier_{std::move(modifier)} {}
template <class TUnderlyingProcess> template <class TUnderlyingProcess>
template <typename TSecondaryView> template <typename TSecondaryView>
inline void IntLengthModifyingProcess<TUnderlyingProcess>::doInteraction( inline void InteractionLengthModifier<TUnderlyingProcess>::doInteraction(
TSecondaryView& view) { TSecondaryView& view) {
process_.doInteraction(view); process_.doInteraction(view);
} }
template <class TUnderlyingProcess> template <class TUnderlyingProcess>
template <typename TParticle> template <typename TParticle>
inline GrammageType IntLengthModifyingProcess<TUnderlyingProcess>::getInteractionLength( inline GrammageType InteractionLengthModifier<TUnderlyingProcess>::getInteractionLength(
TParticle const& particle) { TParticle const& particle) {
GrammageType const original = process_.getInteractionLength(particle); GrammageType const original = process_.getInteractionLength(particle);
Code const pid = particle.getPID(); Code const pid = particle.getPID();
...@@ -42,12 +42,12 @@ namespace corsika { ...@@ -42,12 +42,12 @@ namespace corsika {
template <class TUnderlyingProcess> template <class TUnderlyingProcess>
inline TUnderlyingProcess const& inline TUnderlyingProcess const&
IntLengthModifyingProcess<TUnderlyingProcess>::getProcess() const { InteractionLengthModifier<TUnderlyingProcess>::getProcess() const {
return process_; return process_;
} }
template <class TUnderlyingProcess> template <class TUnderlyingProcess>
inline TUnderlyingProcess& IntLengthModifyingProcess<TUnderlyingProcess>::getProcess() { inline TUnderlyingProcess& InteractionLengthModifier<TUnderlyingProcess>::getProcess() {
return process_; return process_;
} }
......
...@@ -23,8 +23,8 @@ namespace corsika { ...@@ -23,8 +23,8 @@ namespace corsika {
* length returned by the underlying process in a user-defined way. * * length returned by the underlying process in a user-defined way. *
*/ */
template <class TUnderlyingProcess> template <class TUnderlyingProcess>
class IntLengthModifyingProcess class InteractionLengthModifier
: public InteractionProcess<IntLengthModifyingProcess<TUnderlyingProcess>> { : public InteractionProcess<InteractionLengthModifier<TUnderlyingProcess>> {
//! identity function as default modifier //! identity function as default modifier
static auto constexpr non_modifying_functor = [](GrammageType original, corsika::Code, static auto constexpr non_modifying_functor = [](GrammageType original, corsika::Code,
...@@ -39,7 +39,7 @@ namespace corsika { ...@@ -39,7 +39,7 @@ namespace corsika {
* Create wrapper around InteractionProcess. Note that the passed process object * Create wrapper around InteractionProcess. Note that the passed process object
* itself may no longer be used, only through this class. * itself may no longer be used, only through this class.
*/ */
IntLengthModifyingProcess(TUnderlyingProcess&& process, InteractionLengthModifier(TUnderlyingProcess&& process,
std::function<functor_signature> modifier); std::function<functor_signature> modifier);
//! wrapper around internal process doInteraction //! wrapper around internal process doInteraction
...@@ -63,4 +63,4 @@ namespace corsika { ...@@ -63,4 +63,4 @@ namespace corsika {
} // namespace corsika } // namespace corsika
#include <corsika/detail/framework/process/IntLengthModifyingProcess.inl> #include <corsika/detail/framework/process/InteractionLengthModifier.inl>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* the license. * the license.
*/ */
#include <corsika/framework/process/IntLengthModifyingProcess.hpp> #include <corsika/framework/process/InteractionLengthModifier.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/core/PhysicalUnits.hpp>
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
...@@ -40,7 +40,7 @@ struct DummyParticle { ...@@ -40,7 +40,7 @@ struct DummyParticle {
Code getPID() const { return Code::MuPlus; } Code getPID() const { return Code::MuPlus; }
}; };
TEST_CASE("IntLengthModifyingProcess", "[process]") { TEST_CASE("InteractionLengthModifier", "[process]") {
DummyProcess u; DummyProcess u;
u.id = 38; u.id = 38;
...@@ -48,8 +48,8 @@ TEST_CASE("IntLengthModifyingProcess", "[process]") { ...@@ -48,8 +48,8 @@ TEST_CASE("IntLengthModifyingProcess", "[process]") {
return orig * 2; return orig * 2;
}; };
IntLengthModifyingProcess mod{std::move(u), modifier}; InteractionLengthModifier mod{std::move(u), modifier};
REQUIRE(std::is_same_v<decltype(mod), IntLengthModifyingProcess<DummyProcess>>); REQUIRE(std::is_same_v<decltype(mod), InteractionLengthModifier<DummyProcess>>);
SECTION("getInteractionLength") { SECTION("getInteractionLength") {
DummyParticle const p; DummyParticle const p;
......
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