IAP GITLAB

Skip to content
Snippets Groups Projects
Commit cad98a2c authored by Hans Dembinski's avatar Hans Dembinski
Browse files

restored SelectProcess and added static_assert on input types

parent 05644c69
No related branches found
No related tags found
1 merge request!158WIP: simplified process sequence based on std::tuple
Pipeline #924 failed
......@@ -68,7 +68,10 @@ namespace corsika::process {
public:
template <class... Us>
ProcessSequence(Us&&... us)
: storage_t(std::forward<Us>(us)...) {}
: storage_t(std::forward<Us>(us)...) {
static_assert((... && is_process_v<std::decay_t<Us>>),
"all arguments must be processes");
}
// example for a trait-based call:
// void Hello() const { detail::CallHello<T1,T2>::Call(A, B); }
......@@ -229,43 +232,22 @@ namespace corsika::process {
EProcessReturn SelectDecay(TParticle& vP, TSecondaries& vS,
corsika::units::si::InverseTimeType decay_select,
corsika::units::si::InverseTimeType& decay_inv_count) {
boost::ignore_unused(vP, vS, decay_select, decay_inv_count);
// if constexpr (t1ProcSeq) {
// // if A is a process sequence --> check inside
// const EProcessReturn ret = A.SelectDecay(vP, vS, decay_select,
// decay_inv_count);
// // if A did succeed, stop routine
// if (ret != EProcessReturn::eOk) { return ret; }
// } else if constexpr (std::is_base_of_v<DecayProcess<T1type>, T1type>) {
// // if this is not a ContinuousProcess --> evaluate probability
// decay_inv_count += A.GetInverseLifetime(vP);
// // check if we should execute THIS process and then EXIT
// if (decay_select < decay_inv_count) { // more pedagogical: rndm_select <
// // decay_inv_count / decay_inv_tot
// A.DoDecay(vS);
// return EProcessReturn::eDecayed;
// }
// } // end branch A
//
// if constexpr (t2ProcSeq) {
// // if A is a process sequence --> check inside
// const EProcessReturn ret = B.SelectDecay(vP, vS, decay_select,
// decay_inv_count);
// // if A did succeed, stop routine
// if (ret != EProcessReturn::eOk) { return ret; }
// } else if constexpr (std::is_base_of_v<DecayProcess<T2type>, T2type>) {
// // if this is not a ContinuousProcess --> evaluate probability
// decay_inv_count += B.GetInverseLifetime(vP);
// // check if we should execute THIS process and then EXIT
// if (decay_select < decay_inv_count) {
// B.DoDecay(vS);
// return EProcessReturn::eDecayed;
// }
// } // end branch B
return EProcessReturn::eOk;
EProcessReturn ret = EProcessReturn::eOk;
apply<DecayProcess>([&](auto&& proc) {
if (ret == EProcessReturn::eOk) {
// if this is not a ContinuousProcess --> evaluate probability
decay_inv_count += proc.GetInverseLifetime(vP);
// check if we should execute THIS process and then EXIT
if (decay_select < decay_inv_count) {
proc.DoDecay(vS);
ret = EProcessReturn::eDecayed;
}
}
});
return ret;
}
// TODO: this should be removed along with all Init() functions of the processes
void Init() {
boost::mp11::tuple_for_each(static_cast<storage_t&>(*this),
[](auto&& proc) { proc.Init(); });
......
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