From 5f818d43966a1c20ac94921cab8cf0db67053686 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Wed, 13 Oct 2021 13:41:26 +0200 Subject: [PATCH] missing files --- .../process/CascadeEquationsProcess.hpp | 60 +++++++++++++++++++ .../process/CascadeEquationsProcess.hpp | 55 +++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 corsika/detail/framework/process/CascadeEquationsProcess.hpp create mode 100644 corsika/framework/process/CascadeEquationsProcess.hpp diff --git a/corsika/detail/framework/process/CascadeEquationsProcess.hpp b/corsika/detail/framework/process/CascadeEquationsProcess.hpp new file mode 100644 index 000000000..94e973c78 --- /dev/null +++ b/corsika/detail/framework/process/CascadeEquationsProcess.hpp @@ -0,0 +1,60 @@ +/* + * (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu + * + * 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. + */ + +#pragma once + +#include <corsika/framework/process/ProcessTraits.hpp> +#include <corsika/framework/utility/HasMethodSignature.hpp> + +/** + * @file CascadeEquationsProcess.hpp + */ + +namespace corsika { + + /** + * traits test for CascadeEquationsProcess::doCascadeEquations method. + */ + template <class TProcess, typename TReturn, typename... TArg> + struct has_method_doCascadeEquations + : public detail::has_method_signature<TReturn, TArg...> { + + //! method signature + using detail::has_method_signature<TReturn, TArg...>::testSignature; + + //! the default value + template <class T> + static std::false_type test(...); + + //! templated parameter option + template <class T> + static decltype(testSignature(&T::template doCascadeEquations<TArg...>)) test( + std::nullptr_t); + + //! non templated parameter option + template <class T> + static decltype(testSignature(&T::doCascadeEquations)) test(std::nullptr_t); + + public: + /** + * @name traits results + * @{ + */ + using type = decltype(test<std::decay_t<TProcess>>(nullptr)); + static const bool value = type::value; + //! @} + }; + + /** + * value traits type. + */ + template <class TProcess, typename TReturn, typename... TArg> + bool constexpr has_method_doCascadeEquations_v = + has_method_doCascadeEquations<TProcess, TReturn, TArg...>::value; + +} // namespace corsika diff --git a/corsika/framework/process/CascadeEquationsProcess.hpp b/corsika/framework/process/CascadeEquationsProcess.hpp new file mode 100644 index 000000000..5e92389f6 --- /dev/null +++ b/corsika/framework/process/CascadeEquationsProcess.hpp @@ -0,0 +1,55 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * 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. + */ + +#pragma once + +#include <corsika/framework/process/BaseProcess.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> + +#include <corsika/detail/framework/process/CascadeEquationsProcess.hpp> // for extra traits, method/interface checking + +namespace corsika { + + /** + * @ingroup Processes + * @{ + * + * Processes executing cascade-equations calculations. + * + * Create a new CascadeEquationsProcess, e.g. for XYModel, via: + * @code{.cpp} + * class XYModel : public CascadeEquationsProcess<XYModel> {}; + * @endcode + * + * and provide the necessary interface method: + * @code{.cpp} + * template <typename TStack> + * void doCascadeEquations(TStack& stack); + * @endcode + * + * Cascade equation processes may generate new particles on the stack. They also + * typically generate output. + */ + + template <typename TDerived> + class CascadeEquationsProcess : public BaseProcess<TDerived> { + public: + }; + + /** + * ProcessTraits specialization to flag CascadeEquationsProcess objects. + */ + template <typename TProcess> + struct is_cascade_equations_process< + TProcess, std::enable_if_t<std::is_base_of_v< + CascadeEquationsProcess<typename std::decay_t<TProcess>>, + typename std::decay_t<TProcess>>>> : std::true_type {}; + + //! @} + +} // namespace corsika -- GitLab