From f764e7ff9a713f238bafec0647f8c200319d0a20 Mon Sep 17 00:00:00 2001 From: AAAlvesJr <aalvesju@gmail.com> Date: Mon, 30 Nov 2020 21:32:31 +0100 Subject: [PATCH] [refactory-2020] stack implementations: !290 headers --- corsika/framework/stack/CombinedStack.hpp | 6 ++--- corsika/framework/stack/SecondaryView.hpp | 2 +- corsika/framework/stack/Stack.hpp | 28 +++++++++++------------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/corsika/framework/stack/CombinedStack.hpp b/corsika/framework/stack/CombinedStack.hpp index 2e43a9425..10b2f903c 100644 --- a/corsika/framework/stack/CombinedStack.hpp +++ b/corsika/framework/stack/CombinedStack.hpp @@ -66,13 +66,13 @@ namespace corsika { } template <typename... Args1> - void setParticleData(PI_C& p, const std::tuple<Args1...> vA) { + void setParticleData(pi_a_type& p, const std::tuple<Args1...> vA) { // static_assert(MT<I>::has_not, "error"); pi_a_type::setParticleData(static_cast<pi_a_type&>(p), vA); // original stack pi_b_type::setParticleData(static_cast<pi_b_type&>(p)); // addon stack } template <typename... Args1, typename... Args2> - void setParticleData(PI_C& p, const std::tuple<Args1...> vA, const std::tuple<Args2...> vB) { + void setParticleData(pi_c_type& p, const std::tuple<Args1...> vA, const std::tuple<Args2...> vB) { pi_a_type::setParticleData(static_cast<pi_a_type&>(p), vA); pi_b_type::setParticleData(static_cast<pi_b_type&>(p), vB); @@ -80,7 +80,7 @@ namespace corsika { ///@} std::string as_string() const { - return fmt::format("[[{}][{}]]", PI_A::as_string(), pi_b_type::as_string()); + return fmt::format("[[{}][{}]]", pi_a_type::as_string(), pi_b_type::as_string()); } private: diff --git a/corsika/framework/stack/SecondaryView.hpp b/corsika/framework/stack/SecondaryView.hpp index 6fd7c2093..7986159db 100644 --- a/corsika/framework/stack/SecondaryView.hpp +++ b/corsika/framework/stack/SecondaryView.hpp @@ -549,4 +549,4 @@ namespace corsika { } // namespace corsika -#include <corsika/detail/framework/stack/SecondaryView.inl> +//#include <corsika/detail/framework/stack/SecondaryView.inl> diff --git a/corsika/framework/stack/Stack.hpp b/corsika/framework/stack/Stack.hpp index ad1e378d7..1d00b2a88 100644 --- a/corsika/framework/stack/Stack.hpp +++ b/corsika/framework/stack/Stack.hpp @@ -239,24 +239,24 @@ namespace corsika { */ template <typename... TArgs> stack_iterator_type addParticle(const TArgs... v) { - C8LOG_TRACE("Stack::AddParticle"); + //C8LOG_TRACE("Stack::AddParticle"); data_.incrementSize(); deleted_.push_back(false); return stack_iterator_type(*this, getSize() - 1, v...); } void swap(stack_iterator_type a, stack_iterator_type b) { - C8LOG_TRACE("Stack::Swap"); + //C8LOG_TRACE("Stack::Swap"); swap(a.getIndex(), b.getIndex()); } void copy(stack_iterator_type a, stack_iterator_type b) { - C8LOG_TRACE("Stack::Copy"); + //C8LOG_TRACE("Stack::Copy"); copy(a.getIndex(), b.getIndex()); } - void copy(stack_iterator_type a, stack_iterator_type b) { - C8LOG_TRACE("Stack::Copy"); + void copy(const_stack_iterator_type a, stack_iterator_type b) { + //C8LOG_TRACE("Stack::Copy"); data_.copy(a.getIndex(), b.getIndex()); if (deleted_[b.getIndex()] && !deleted_[a.getIndex()]) nDeleted_--; if (!deleted_[b.getIndex()] && deleted_[a.getIndex()]) nDeleted_++; @@ -264,7 +264,7 @@ namespace corsika { } void erase(stack_iterator_type p) { - C8LOG_TRACE("Stack::Delete"); + //C8LOG_TRACE("Stack::Delete"); if (this->isEmpty()) { /*error*/ throw std::runtime_error("Stack, cannot delete entry since size is zero"); } @@ -276,7 +276,7 @@ namespace corsika { /** * delete this particle */ - void erase(ParticleInterfaceType p) { + void erase(particle_interface_type p) { this->erase(p.getIterator()); } @@ -295,11 +295,11 @@ namespace corsika { return isDeleted(p.getIndex()); } - bool isDeleted(const ConstStackIterator& p) const { + bool isDeleted(const const_stack_iterator_type& p) const { return isDeleted(p.getIndex()); } - bool isDeleted(const ParticleInterfaceType& p) const { + bool isDeleted(const particle_interface_type& p) const { return isDeleted(p.getIterator()); } @@ -311,7 +311,7 @@ namespace corsika { bool purgeLastIfDeleted() { if (!deleted_.back()) return false; // the last particle is not marked for deletion. Do nothing. - C8LOG_TRACE("Stack::purgeLastIfDeleted: yes"); + //C8LOG_TRACE("Stack::purgeLastIfDeleted: yes"); data_.decrementSize(); nDeleted_--; deleted_.pop_back(); @@ -371,19 +371,19 @@ namespace corsika { */ template <typename... TArgs> stack_iterator_type addSecondary(stack_iterator_type& parent, const TArgs... v) { - C8LOG_TRACE("Stack::AddSecondary"); + //C8LOG_TRACE("Stack::AddSecondary"); data_.incrementSize(); deleted_.push_back(false); return stack_iterator_type(*this, getSize() - 1, parent, v...); } void swap(unsigned int a, unsigned int b) { - C8LOG_TRACE("Stack::Swap(unsigned int)"); + //C8LOG_TRACE("Stack::Swap(unsigned int)"); data_.swap(a, b); std::swap(deleted_[a], deleted_[b]); } void copy(unsigned int a, unsigned int b) { - C8LOG_TRACE("Stack::Copy"); + //C8LOG_TRACE("Stack::Copy"); data_.copy(a, b); if (deleted_[b] && !deleted_[a]) nDeleted_--; if (!deleted_[b] && deleted_[a]) nDeleted_++; @@ -423,7 +423,7 @@ namespace corsika { * should just be identiy. See class SecondaryView for an alternative implementation. */ unsigned int getIndexFromIterator(const unsigned int vI) const { - // this is too much: C8LOG_TRACE("Stack::getIndexFromIterator({})={}", vI, vI); + // this is too much: //C8LOG_TRACE("Stack::getIndexFromIterator({})={}", vI, vI); return vI; } -- GitLab