IAP GITLAB

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • AirShowerPhysics/corsika
  • rulrich/corsika
  • AAAlvesJr/corsika
  • Andre/corsika
  • arrabito/corsika
  • Nikos/corsika
  • olheiser73/corsika
  • AirShowerPhysics/papers/corsika
  • pranav/corsika
9 results
Show changes
Showing
with 199 additions and 166 deletions
/*
* (c) Copyright 2018 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -76,49 +75,55 @@ namespace corsika {
template <typename TCondition, typename TSequence, typename USequence, int IndexStart,
int IndexProcess1, int IndexProcess2>
template <typename TParticle, typename TTrack>
inline ProcessReturn SwitchProcessSequence<
TCondition, TSequence, USequence, IndexStart, IndexProcess1,
IndexProcess2>::doContinuous(TParticle& particle, TTrack& vT,
ContinuousProcessIndex const idLimit) {
if (select_(particle)) {
template <typename TParticle>
inline ProcessReturn SwitchProcessSequence<TCondition, TSequence, USequence, IndexStart,
IndexProcess1, IndexProcess2>::
doContinuous(Step<TParticle>& step,
[[maybe_unused]] ContinuousProcessIndex const idLimit) {
if (select_(step.getParticlePre())) {
if constexpr (process1_type::is_process_sequence) {
return A_.doContinuous(particle, vT, idLimit);
return A_.doContinuous(step, idLimit);
}
if constexpr (is_continuous_process_v<process1_type>) {
static_assert(
has_method_doContinuous_v<TSequence, ProcessReturn, TParticle&, TTrack&> ||
has_method_doContinuous_v<TSequence, ProcessReturn, TParticle&,
TTrack const&> ||
has_method_doContinuous_v<TSequence, ProcessReturn, TParticle const&,
TTrack const&>,
"TDerived has no method with correct signature \"ProcessReturn "
"doContinuous(TParticle[const]&,TTrack[const]&,bool)\" required for "
"ContinuousProcess<TDerived>. ");
return A_.doContinuous(particle, vT,
idLimit == ContinuousProcessIndex(IndexProcess1));
// static_assert(
// has_method_doContinuous_v<TSequence, ProcessReturn, TParticle&,
// TTrack&> ||
// has_method_doContinuous_v<TSequence, ProcessReturn, TParticle&,
// TTrack const&> ||
// has_method_doContinuous_v<TSequence, ProcessReturn, TParticle
// const&,
// TTrack const&>,
// "TDerived has no method with correct signature \"ProcessReturn "
// "doContinuous(TParticle[const]&,TTrack[const]&,bool)\" required for
// " "ContinuousProcess<TDerived>. ");
return A_.doContinuous(
step, idLimit == ContinuousProcessIndex(
static_cast<void const*>(std::addressof(A_))));
}
} else {
if constexpr (process2_type::is_process_sequence) {
return B_.doContinuous(particle, vT, idLimit);
return B_.doContinuous(step, idLimit);
}
if constexpr (is_continuous_process_v<process2_type>) {
// interface checking on USequence
static_assert(
has_method_doContinuous_v<USequence, ProcessReturn, TParticle&, TTrack&> ||
has_method_doContinuous_v<USequence, ProcessReturn, TParticle&,
TTrack const&> ||
has_method_doContinuous_v<USequence, ProcessReturn, TParticle const&,
TTrack const&>,
"TDerived has no method with correct signature \"ProcessReturn "
"doContinuous(TParticle [const]&,TTrack[const]&,bool)\" required for "
"ContinuousProcess<TDerived>. ");
return B_.doContinuous(particle, vT,
idLimit == ContinuousProcessIndex(IndexProcess2));
// static_assert(
// has_method_doContinuous_v<USequence, ProcessReturn, TParticle&,
// TTrack&> ||
// has_method_doContinuous_v<USequence, ProcessReturn, TParticle&,
// TTrack const&> ||
// has_method_doContinuous_v<USequence, ProcessReturn, TParticle
// const&,
// TTrack const&>,
// "TDerived has no method with correct signature \"ProcessReturn "
// "doContinuous(TParticle [const]&,TTrack[const]&,bool)\" required for
// " "ContinuousProcess<TDerived>. ");
return B_.doContinuous(
step, idLimit == ContinuousProcessIndex(
static_cast<void const*>(std::addressof(B_))));
}
}
return ProcessReturn::Ok;
......@@ -182,8 +187,9 @@ namespace corsika {
"getMaxStepLength(TParticle const&, TTrack const&)\" required for "
"ContinuousProcess<TDerived>. ");
return ContinuousProcessStepLength(A_.getMaxStepLength(particle, vTrack),
ContinuousProcessIndex(IndexProcess1));
return ContinuousProcessStepLength(
A_.getMaxStepLength(particle, vTrack),
ContinuousProcessIndex(static_cast<void const*>(std::addressof(A_))));
}
} else {
if constexpr (process2_type::is_process_sequence) {
......@@ -198,8 +204,9 @@ namespace corsika {
"getMaxStepLength(TParticle const&, TTrack const&)\" required for "
"ContinuousProcess<TDerived>. ");
return ContinuousProcessStepLength(B_.getMaxStepLength(particle, vTrack),
ContinuousProcessIndex(IndexProcess2));
return ContinuousProcessStepLength(
B_.getMaxStepLength(particle, vTrack),
ContinuousProcessIndex(static_cast<void const*>(std::addressof(B_))));
}
}
......@@ -210,10 +217,10 @@ namespace corsika {
template <typename TCondition, typename TSequence, typename USequence, int IndexStart,
int IndexProcess1, int IndexProcess2>
template <typename TParticle>
CrossSectionType SwitchProcessSequence<
TCondition, TSequence, USequence, IndexStart, IndexProcess1,
IndexProcess2>::getCrossSection(TParticle const& projectile, Code const targetId,
FourMomentum const& targetP4) const {
CrossSectionType SwitchProcessSequence<TCondition, TSequence, USequence, IndexStart,
IndexProcess1, IndexProcess2>::
getCrossSection(TParticle const& projectile, [[maybe_unused]] Code const targetId,
[[maybe_unused]] FourMomentum const& targetP4) const {
if (select_(projectile)) {
if constexpr (is_interaction_process_v<process1_type>) {
......@@ -231,7 +238,7 @@ namespace corsika {
return A_.getCrossSection(projectile, projectile.getPID(),
{projectile.getEnergy(), projectile.getMomentum()});
}
} else if (process1_type::is_process_sequence) {
} else if constexpr (process1_type::is_process_sequence) {
return A_.getCrossSection(projectile, targetId, targetP4);
}
......@@ -250,7 +257,7 @@ namespace corsika {
} else {
return B_.getCrossSection(projectile, targetId, targetP4);
}
} else if (process2_type::is_process_sequence) {
} else if constexpr (process2_type::is_process_sequence) {
return B_.getCrossSection(projectile, targetId, targetP4);
}
}
......@@ -401,7 +408,7 @@ namespace corsika {
}
// check if we should execute THIS process and then EXIT
if (cx_select <= cx_sum) {
if (cx_select < cx_sum) {
if constexpr (has_signature_cx1) {
......
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* (c) Copyright 2018 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*----------------------------------------------------------------------------
*
* Copyright (C) 2021 Antonio Augusto Alves Junior
*
* This file is part of RandomIterator.
*
* RandomIterator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RandomIterator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RandomIterator. If not, see <http://www.gnu.org/licenses/>.
*
*---------------------------------------------------------------------------*/
*
* Copyright (C) 2021 - 2024 Antonio Augusto Alves Junior
*
* This file is part of RandomIterator.
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------------*/
/*
* RandomIterator.h
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
/*
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
/*
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
/*
......
/*----------------------------------------------------------------------------
*
* Copyright (C) 2021 Antonio Augusto Alves Junior
*
* This file is part of RandomIterator.
*
* RandomIterator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RandomIterator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RandomIterator. If not, see <http://www.gnu.org/licenses/>.
*
*---------------------------------------------------------------------------*/
*
* Copyright (C) 2021 - 2024 Antonio Augusto Alves Junior
*
* This file is part of RandomIterator.
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------------*/
/*
* Macros.h
*
......
......@@ -286,7 +286,7 @@ namespace random_iterator_r123 {
static inline std::array<Ftype, CollType::static_size> u01all(CollType in) {
std::array<Ftype, CollType::static_size> ret;
size_t i = 0;
for (auto e : in) { ret[i++] = u01<Ftype>(e); }
for (auto const e : in) { ret[i++] = u01<Ftype>(e); }
return ret;
}
......@@ -300,7 +300,7 @@ namespace random_iterator_r123 {
static inline std::array<Ftype, CollType::static_size> uneg11all(CollType in) {
std::array<Ftype, CollType::static_size> ret;
size_t i = 0;
for (auto e : in) { ret[i++] = uneg11<Ftype>(e); }
for (auto const e : in) { ret[i++] = uneg11<Ftype>(e); }
return ret;
}
......@@ -314,7 +314,7 @@ namespace random_iterator_r123 {
static inline std::array<Ftype, CollType::static_size> u01fixedptall(CollType in) {
std::array<Ftype, CollType::static_size> ret;
size_t i = 0;
for (auto e : in) { ret[i++] = u01fixedpt<Ftype>(e); }
for (auto const e : in) { ret[i++] = u01fixedpt<Ftype>(e); }
return ret;
}
#endif // __cplusplus >= 201103L
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
/*
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
/*
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
/*
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
/*
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
/*
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
 
/*
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
/*
......
/*----------------------------------------------------------------------------
*
* Copyright (C) 2021 Antonio Augusto Alves Junior
*
* This file is part of RandomIterator.
*
* RandomIterator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RandomIterator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RandomIterator. If not, see <http://www.gnu.org/licenses/>.
*
*---------------------------------------------------------------------------*/
*
* Copyright (C) 2021 - 2024 Antonio Augusto Alves Junior
*
* This file is part of RandomIterator.
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------------*/
/*
* mulhilo64.h
*
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
/*
......@@ -391,6 +390,7 @@ namespace random_iterator {
void _init_dec(const char* s);
void _init_oct(const char* s);
#if defined(__powerpc64__) || defined(__x86_64__)
static inline uint128_t mul128(uint128_t const x, uint128_t const y) {
uint128_t z;
#ifdef __powerpc64__
......@@ -401,6 +401,7 @@ namespace random_iterator {
z.UPPER += (x.UPPER * y.LOWER) + (x.LOWER * y.UPPER);
return z;
}
#endif
#ifdef __BIG_ENDIAN__
uint64_t UPPER, LOWER;
......
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
/*
......@@ -211,11 +210,11 @@ namespace random_iterator {
}
inline bool uint128_t::operator>=(const uint128_t& rhs) const {
return ((*this > rhs) | (*this == rhs));
return ((*this > rhs) || (*this == rhs));
}
inline bool uint128_t::operator<=(const uint128_t& rhs) const {
return ((*this < rhs) | (*this == rhs));
return ((*this < rhs) || (*this == rhs));
}
inline uint128_t uint128_t::operator+(const uint128_t& rhs) const {
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......