From 0350c18e6465feba0cf5a4a311d9af6afd5587e0 Mon Sep 17 00:00:00 2001 From: AAAlvesJr <aalvesju@gmail.com> Date: Fri, 4 Dec 2020 23:50:18 +0100 Subject: [PATCH] [refactory-2020] stack implementations: more cleaning up --- .../detail/framework/stack/CombinedStack.inl | 20 ++-- .../detail/stack/NuclearStackExtension.inl | 28 +++--- corsika/detail/stack/SuperStupidStack.inl | 99 +++++++++++++++++++ corsika/framework/stack/CombinedStack.hpp | 73 +++----------- corsika/framework/stack/ParticleBase.hpp | 22 +++-- corsika/framework/stack/SecondaryView.hpp | 76 +++++++------- corsika/framework/stack/Stack.hpp | 82 +++++++-------- .../stack/StackIteratorInterface.hpp | 18 ++-- corsika/stack/DummyStack.hpp | 17 ++-- corsika/stack/GeometryNodeStackExtension.hpp | 33 ++++--- corsika/stack/NuclearStackExtension.hpp | 54 +++++----- corsika/stack/SuperStupidStack.hpp | 60 +++-------- 12 files changed, 304 insertions(+), 278 deletions(-) create mode 100644 corsika/detail/stack/SuperStupidStack.inl diff --git a/corsika/detail/framework/stack/CombinedStack.inl b/corsika/detail/framework/stack/CombinedStack.inl index 400684153..f14caf0c7 100644 --- a/corsika/detail/framework/stack/CombinedStack.inl +++ b/corsika/detail/framework/stack/CombinedStack.inl @@ -19,7 +19,7 @@ namespace corsika { template <template <typename> class TParticleInterfaceA, template <typename> class TParticleInterfaceB, typename TStackIterator> template <typename... TArgs1> - void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(std::tuple<TArgs1...> const vA) { + inline void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(std::tuple<TArgs1...> const vA) { pi_a_type::setParticleData(vA); pi_b_type::setParticleData(); } @@ -27,7 +27,7 @@ namespace corsika { template <template <typename> class TParticleInterfaceA, template <typename> class TParticleInterfaceB, typename TStackIterator> template <typename... TArgs1, typename... TArgs2> - void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(std::tuple<TArgs1...> const vA, std::tuple<TArgs2...> const vB) { + inline void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(std::tuple<TArgs1...> const vA, std::tuple<TArgs2...> const vB) { pi_a_type::setParticleData(vA); pi_b_type::setParticleData(vB); } @@ -35,7 +35,7 @@ namespace corsika { template <template <typename> class TParticleInterfaceA, template <typename> class TParticleInterfaceB, typename TStackIterator> template <typename... TArgs1> - void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(pi_a_type& p, std::tuple<TArgs1...> const vA) { + inline void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(pi_a_type& p, std::tuple<TArgs1...> const 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 @@ -44,7 +44,7 @@ namespace corsika { template <template <typename> class TParticleInterfaceA, template <typename> class TParticleInterfaceB,typename TStackIterator> template <typename... TArgs1, typename... TArgs2> - void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(pi_c_type& p, std::tuple<TArgs1...> const vA, + inline void CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::setParticleData(pi_c_type& p, std::tuple<TArgs1...> const vA, std::tuple<TArgs2...> const vB) { pi_a_type::setParticleData(static_cast<pi_a_type&>(p), vA); @@ -54,18 +54,18 @@ namespace corsika { ///@} template <template <typename> class TParticleInterfaceA, template <typename> class TParticleInterfaceB, typename TStackIterator> - std::string CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::as_string() const { + inline std::string CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, TStackIterator>::as_string() const { return fmt::format("[[{}][{}]]", pi_a_type::as_string(), pi_b_type::as_string()); } template <typename Stack1Impl, typename Stack2Impl> - void CombinedStackImpl< Stack1Impl, Stack2Impl>::clear() { + inline void CombinedStackImpl< Stack1Impl, Stack2Impl>::clear() { Stack1Impl::clear(); Stack2Impl::clear(); } template <typename Stack1Impl, typename Stack2Impl> - void CombinedStackImpl< Stack1Impl, Stack2Impl>::copy(const unsigned int i1, const unsigned int i2) { + inline void CombinedStackImpl< Stack1Impl, Stack2Impl>::copy(const unsigned int i1, const unsigned int i2) { if (i1 >= getSize() || i2 >= getSize()) { std::ostringstream err; err << "CombinedStack: trying to access data beyond size of stack!"; @@ -76,7 +76,7 @@ namespace corsika { } template <typename Stack1Impl, typename Stack2Impl> - void CombinedStackImpl< Stack1Impl, Stack2Impl>::swap(const unsigned int i1, const unsigned int i2) { + inline void CombinedStackImpl< Stack1Impl, Stack2Impl>::swap(const unsigned int i1, const unsigned int i2) { if (i1 >= getSize() || i2 >= getSize()) { std::ostringstream err; err << "CombinedStack: trying to access data beyond size of stack!"; @@ -87,13 +87,13 @@ namespace corsika { } template <typename Stack1Impl, typename Stack2Impl> - void CombinedStackImpl< Stack1Impl, Stack2Impl>::incrementSize() { + inline void CombinedStackImpl< Stack1Impl, Stack2Impl>::incrementSize() { Stack1Impl::incrementSize(); Stack2Impl::incrementSize(); } template <typename Stack1Impl, typename Stack2Impl> - void CombinedStackImpl< Stack1Impl, Stack2Impl>::decrementSize() { + inline void CombinedStackImpl< Stack1Impl, Stack2Impl>::decrementSize() { Stack1Impl::decrementSize(); Stack2Impl::decrementSize(); } diff --git a/corsika/detail/stack/NuclearStackExtension.inl b/corsika/detail/stack/NuclearStackExtension.inl index 3cba30ed7..00ead317f 100644 --- a/corsika/detail/stack/NuclearStackExtension.inl +++ b/corsika/detail/stack/NuclearStackExtension.inl @@ -23,7 +23,7 @@ namespace corsika::nuclear_stack { template <template <typename> class InnerParticleInterface, typename StackIteratorInterface> -void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::setParticleData(particle_data_type const& v) +inline void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::setParticleData(particle_data_type const& v) { if (std::get<0>(v) == Code::Nucleus) { @@ -38,7 +38,7 @@ void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::s template <template <typename> class InnerParticleInterface, typename StackIteratorInterface> -void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::setParticleData(altenative_particle_data_type const& v) +inline void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::setParticleData(altenative_particle_data_type const& v) { const unsigned short A = std::get<5>(v); const unsigned short Z = std::get<6>(v); @@ -58,7 +58,7 @@ void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::s template <template <typename> class InnerParticleInterface, typename StackIteratorInterface> -void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::setParticleData(super_type& p, particle_data_type const& v) { +inline void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::setParticleData(super_type& p, particle_data_type const& v) { if (std::get<0>(v) == Code::Nucleus) { std::ostringstream err; err << "NuclearStackExtension: no A and Z specified for new Nucleus!"; @@ -74,7 +74,7 @@ void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::s template <template <typename> class InnerParticleInterface, typename StackIteratorInterface> -void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::setParticleData(super_type& p, altenative_particle_data_type const& v) { +inline void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::setParticleData(super_type& p, altenative_particle_data_type const& v) { const unsigned short A = std::get<5>(v); const unsigned short Z = std::get<6>(v); @@ -96,7 +96,7 @@ void NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::s template <template <typename> class InnerParticleInterface, typename StackIteratorInterface> -std::string NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::as_string() const { +inline std::string NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::as_string() const { return fmt::format( "{}, nuc({})", super_type::as_string(), (isNucleus() ? fmt::format("A={}, Z={}", getNuclearA(), getNuclearZ()) @@ -106,7 +106,7 @@ std::string NuclearParticleInterface< InnerParticleInterface,StackIteratorInterf template <template <typename> class InnerParticleInterface, typename StackIteratorInterface> -HEPMassType NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::getMass() const { +inline HEPMassType NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::getMass() const { if (super_type::getPID() == Code::Nucleus) return getNucleusMass(getNuclearA(), getNuclearZ()); return super_type::getMass(); @@ -114,20 +114,20 @@ HEPMassType NuclearParticleInterface< InnerParticleInterface,StackIteratorInterf template <template <typename> class InnerParticleInterface, typename StackIteratorInterface> -int16_t NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::getChargeNumber() const { +inline int16_t NuclearParticleInterface< InnerParticleInterface,StackIteratorInterface>::getChargeNumber() const { if (super_type::getPID() == Code::Nucleus) return getNuclearZ(); return super_type::getChargeNumber(); } template <typename InnerStackImpl> -int NuclearStackExtensionImpl<InnerStackImpl>::getNucleusNextRef(){ +inline int NuclearStackExtensionImpl<InnerStackImpl>::getNucleusNextRef(){ nuclearA_.push_back(0); nuclearZ_.push_back(0); return nuclearA_.size() - 1; } template <typename InnerStackImpl> -int NuclearStackExtensionImpl<InnerStackImpl>::getNucleusRef(const unsigned int i) const { +inline int NuclearStackExtensionImpl<InnerStackImpl>::getNucleusRef(const unsigned int i) const { if (nucleusRef_[i] >= 0) return nucleusRef_[i]; std::ostringstream err; err << "NuclearStackExtension: no nucleus at ref=" << i; @@ -135,7 +135,7 @@ int NuclearStackExtensionImpl<InnerStackImpl>::getNucleusRef(const unsigned int } template <typename InnerStackImpl> -void NuclearStackExtensionImpl<InnerStackImpl>::copy(const unsigned int i1, const unsigned int i2) { +inline void NuclearStackExtensionImpl<InnerStackImpl>::copy(const unsigned int i1, const unsigned int i2) { // index range check if (i1 >= getSize() || i2 >= getSize()) { std::ostringstream err; @@ -177,7 +177,7 @@ void NuclearStackExtensionImpl<InnerStackImpl>::copy(const unsigned int i1, cons } template <typename InnerStackImpl> -void NuclearStackExtensionImpl<InnerStackImpl>::clear() { +inline void NuclearStackExtensionImpl<InnerStackImpl>::clear() { super_type::clear(); nucleusRef_.clear(); nuclearA_.clear(); @@ -185,7 +185,7 @@ void NuclearStackExtensionImpl<InnerStackImpl>::clear() { } template <typename InnerStackImpl> -void NuclearStackExtensionImpl<InnerStackImpl>::swap(const unsigned int i1, const unsigned int i2) { +inline void NuclearStackExtensionImpl<InnerStackImpl>::swap(const unsigned int i1, const unsigned int i2) { // index range check if (i1 >= getSize() || i2 >= getSize()) { std::ostringstream err; @@ -200,13 +200,13 @@ void NuclearStackExtensionImpl<InnerStackImpl>::swap(const unsigned int i1, cons template <typename InnerStackImpl> -void NuclearStackExtensionImpl<InnerStackImpl>::incrementSize() { +inline void NuclearStackExtensionImpl<InnerStackImpl>::incrementSize() { super_type::incrementSize(); nucleusRef_.push_back(-1); } template <typename InnerStackImpl> -void NuclearStackExtensionImpl<InnerStackImpl>::decrementSize() { +inline void NuclearStackExtensionImpl<InnerStackImpl>::decrementSize() { super_type::decrementSize(); if (nucleusRef_.size() > 0) { const int ref = nucleusRef_.back(); diff --git a/corsika/detail/stack/SuperStupidStack.inl b/corsika/detail/stack/SuperStupidStack.inl new file mode 100644 index 000000000..6b003d5de --- /dev/null +++ b/corsika/detail/stack/SuperStupidStack.inl @@ -0,0 +1,99 @@ +/* + * (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. + */ + +#pragma once + +#include <corsika/framework/core/ParticleProperties.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/framework/stack/Stack.hpp> + +#include <corsika/framework/geometry/Point.hpp> +#include <corsika/framework/geometry/RootCoordinateSystem.hpp> // remove +#include <corsika/framework/geometry/Vector.hpp> + +#include <string> +#include <tuple> +#include <vector> + +namespace corsika::simple_stack { + +template <typename StackIteratorInterface> +void ParticleInterface<StackIteratorInterface>::setParticleData(std::tuple<corsika::Code, HEPEnergyType, MomentumVector, + corsika::Point, TimeType> const& v) { +this->setPID(std::get<0>(v)); +this->setEnergy(std::get<1>(v)); +this->setMomentum(std::get<2>(v)); +this->setPosition(std::get<3>(v)); +this->setTime(std::get<4>(v)); +} + + +template <typename StackIteratorInterface> +void ParticleInterface<StackIteratorInterface>::setParticleData(ParticleInterface<StackIteratorInterface> const&, + std::tuple<corsika::Code, HEPEnergyType, MomentumVector, + corsika::Point, TimeType> const& v) { +this->setPID(std::get<0>(v)); +this->setEnergy(std::get<1>(v)); +this->setMomentum(std::get<2>(v)); +this->setPosition(std::get<3>(v)); +this->setTime(std::get<4>(v)); +} + +inline void SuperStupidStackImpl::clear() { + dataPID_.clear(); + dataE_.clear(); + momentum_.clear(); + position_.clear(); + time_.clear(); + } + +inline void SuperStupidStackImpl::copy(size_t i1, size_t i2) { + dataPID_[i2] = dataPID_[i1]; + dataE_[i2] = dataE_[i1]; + momentum_[i2] = momentum_[i1]; + position_[i2] = position_[i1]; + time_[i2] = time_[i1]; + } + +inline void SuperStupidStackImpl::swap(size_t i1, size_t i2) { + std::swap(dataPID_[i2], dataPID_[i1]); + std::swap(dataE_[i2], dataE_[i1]); + std::swap(momentum_[i2], momentum_[i1]); + std::swap(position_[i2], position_[i1]); + std::swap(time_[i2], time_[i1]); + } + + +inline void SuperStupidStackImpl::incrementSize() { + using corsika::Code; + using corsika::Point; + + dataPID_.push_back(Code::Unknown); + dataE_.push_back(0 * electronvolt); + + CoordinateSystemPtr const& dummyCS = get_root_CoordinateSystem(); + + momentum_.push_back( + momentum_type(dummyCS, {0 * electronvolt, 0 * electronvolt, 0 * electronvolt})); + + position_.push_back(Point(dummyCS, {0 * meter, 0 * meter, 0 * meter})); + time_.push_back(0 * second); + } + +inline void SuperStupidStackImpl::decrementSize() { + if (dataE_.size() > 0) { + dataPID_.pop_back(); + dataE_.pop_back(); + momentum_.pop_back(); + position_.pop_back(); + time_.pop_back(); + } + } + + +} // namespace corsika::simple_stack diff --git a/corsika/framework/stack/CombinedStack.hpp b/corsika/framework/stack/CombinedStack.hpp index da77f01d1..77d0e11ea 100644 --- a/corsika/framework/stack/CombinedStack.hpp +++ b/corsika/framework/stack/CombinedStack.hpp @@ -67,37 +67,21 @@ namespace corsika { */ template <typename... TArgs1> - void setParticleData(std::tuple<TArgs1...> const vA); - /* { - pi_a_type::setParticleData(vA); - pi_b_type::setParticleData(); - }*/ + inline void setParticleData(std::tuple<TArgs1...> const vA); + template <typename... TArgs1, typename... TArgs2> - void setParticleData(std::tuple<TArgs1...> const vA, std::tuple<TArgs2...> const vB); /*{ - pi_a_type::setParticleData(vA); - pi_b_type::setParticleData(vB); - }*/ + inline void setParticleData(std::tuple<TArgs1...> const vA, std::tuple<TArgs2...> const vB); template <typename... TArgs1> - void setParticleData(pi_a_type& p, std::tuple<TArgs1...> const 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 - }*/ + inline void setParticleData(pi_a_type& p, std::tuple<TArgs1...> const vA); template <typename... TArgs1, typename... TArgs2> - void setParticleData(pi_c_type& p, std::tuple<TArgs1...> const vA, - std::tuple<TArgs2...> const vB);/* { - - pi_a_type::setParticleData(static_cast<pi_a_type&>(p), vA); - pi_b_type::setParticleData(static_cast<pi_b_type&>(p), vB); - }*/ + inline void setParticleData(pi_c_type& p, std::tuple<TArgs1...> const vA, + std::tuple<TArgs2...> const vB); ///@} - std::string as_string() const;/* { - return fmt::format("[[{}][{}]]", pi_a_type::as_string(), pi_b_type::as_string()); - }*/ + inline std::string as_string() const; private: protected: @@ -117,49 +101,24 @@ namespace corsika { public: - void clear();/* { - Stack1Impl::clear(); - Stack2Impl::clear(); - }*/ + inline void clear(); - unsigned int getSize() const { return Stack1Impl::getSize(); } - unsigned int getCapacity() const { return Stack1Impl::getCapacity(); } + inline unsigned int getSize() const { return Stack1Impl::getSize(); } + inline unsigned int getCapacity() const { return Stack1Impl::getCapacity(); } /** * Function to copy particle at location i1 in stack to i2 */ - void copy(const unsigned int i1, const unsigned int i2);/* { - if (i1 >= getSize() || i2 >= getSize()) { - std::ostringstream err; - err << "CombinedStack: trying to access data beyond size of stack!"; - throw std::runtime_error(err.str()); - } - Stack1Impl::copy(i1, i2); - Stack2Impl::copy(i1, i2); - }*/ + inline void copy(const unsigned int i1, const unsigned int i2); /** * Function to copy particle at location i2 in stack to i1 */ - void swap(const unsigned int i1, const unsigned int i2);/* { - if (i1 >= getSize() || i2 >= getSize()) { - std::ostringstream err; - err << "CombinedStack: trying to access data beyond size of stack!"; - throw std::runtime_error(err.str()); - } - Stack1Impl::swap(i1, i2); - Stack2Impl::swap(i1, i2); - }*/ - - void incrementSize();/* { - Stack1Impl::incrementSize(); - Stack2Impl::incrementSize(); - }*/ - - void decrementSize();/* { - Stack1Impl::decrementSize(); - Stack2Impl::decrementSize(); - }*/ + inline void swap(const unsigned int i1, const unsigned int i2); + + inline void incrementSize(); + + inline void decrementSize(); }; // end class CombinedStackImpl diff --git a/corsika/framework/stack/ParticleBase.hpp b/corsika/framework/stack/ParticleBase.hpp index 1a051f80b..cc43e649b 100644 --- a/corsika/framework/stack/ParticleBase.hpp +++ b/corsika/framework/stack/ParticleBase.hpp @@ -61,12 +61,13 @@ namespace corsika { * Delete this particle on the stack. The corresponding iterator * will be invalidated by this operation */ - void erase() { this->getIterator().getStack().erase(this->getIterator()); } + inline void erase() { this->getIterator().getStack().erase(this->getIterator()); } /** * Method to retrieve the status of the Particle. Is it already deleted? Or not. */ - bool isErased() const { return this->getIterator().getStack().isErased(this->getIterator()); } + + inline bool isErased() const { return this->getIterator().getStack().isErased(this->getIterator()); } /** * Add a secondary particle based on *this on the stack @param @@ -74,7 +75,7 @@ namespace corsika { * function description in the user defined ParticleInterface::AddSecondary(...) */ template <typename... TArgs> - stack_iterator_type addSecondary(const TArgs... args) { + inline stack_iterator_type addSecondary(const TArgs... args) { return this->getStack().addSecondary(this->getIterator(), args...); } @@ -84,11 +85,11 @@ namespace corsika { /** * return the corresponding StackIterator for this particle */ - stack_iterator_type& getIterator() { + inline stack_iterator_type& getIterator() { return static_cast<stack_iterator_type&>(*this); } - const stack_iterator_type& getIterator() const { + inline const stack_iterator_type& getIterator() const { return static_cast<const stack_iterator_type&>(*this); } @@ -99,26 +100,27 @@ namespace corsika { and getStackData to retrieve data @{ */ - auto& getStackData() { + inline auto& getStackData() { return this->getIterator().getStackData(); } - const auto& getStackData() const { + inline const auto& getStackData() const { return this->getIterator().getStackData(); } - auto& getStack() { + inline auto& getStack() { return this->getIterator().getStack(); } - const auto& getStack() const { + inline const auto& getStack() const { return this->getIterator().getStack(); } /** * return the index number of the underlying iterator object */ - std::size_t getIndex() const { + + inline std::size_t getIndex() const { return this->getIterator().getIndexFromIterator(); } ///@} diff --git a/corsika/framework/stack/SecondaryView.hpp b/corsika/framework/stack/SecondaryView.hpp index 45369e0e9..2843cd83f 100644 --- a/corsika/framework/stack/SecondaryView.hpp +++ b/corsika/framework/stack/SecondaryView.hpp @@ -174,7 +174,7 @@ namespace corsika { * SecondaryView is derived from. This projectile should not be * used to modify the Stack! */ - stack_value_iterator parent() + inline stack_value_iterator parent() const { // todo: check if this can't be Conststack_value_iterator return stack_value_iterator(inner_stack_, projectile_index_); } @@ -184,7 +184,7 @@ namespace corsika { * SecondaryView is derived from. This projectile should not be * used to modify the Stack! */ - stack_value_iterator asNewParent() const { + inline stack_value_iterator asNewParent() const { return stack_value_iterator(inner_stack_, projectile_index_); } @@ -192,7 +192,7 @@ namespace corsika { * This return a projectile of this SecondaryView, which can be * used to modify the SecondaryView */ - stack_view_iterator getProjectile() { + inline stack_view_iterator getProjectile() { // NOTE: 0 is special marker here for PROJECTILE, see getIndexFromIterator return stack_view_iterator(*this, 0); } @@ -200,18 +200,18 @@ namespace corsika { * Method to add a new secondary particle on this SecondaryView */ template <typename... Args> - stack_view_iterator addSecondary(const Args... v); + inline stack_view_iterator addSecondary(const Args... v); /** * overwrite Stack::getSize to return actual number of secondaries */ - unsigned int getSize() const { return indices_.size(); } + inline unsigned int getSize() const { return indices_.size(); } - unsigned int getEntries() const { + inline unsigned int getEntries() const { return getSize() - inner_stack_reference_type::getErased(); } - bool isEmpty() const { return getEntries() == 0; } + inline bool isEmpty() const { return getEntries() == 0; } /** * @name These are functions required by std containers and std loops @@ -221,42 +221,42 @@ namespace corsika { */ // NOTE: the "+1" is since "0" is special marker here for PROJECTILE, see // getIndexFromIterator - stack_view_iterator begin(); + inline stack_view_iterator begin(); - stack_view_iterator end() { return stack_view_iterator(*this, getSize() + 1); } + inline stack_view_iterator end() { return stack_view_iterator(*this, getSize() + 1); } - stack_view_iterator last(); + inline stack_view_iterator last(); - const_stack_view_iterator begin() const ; + inline const_stack_view_iterator begin() const ; - const_stack_view_iterator end() const { return const_stack_view_iterator(*this, getSize() + 1); } + inline const_stack_view_iterator end() const { return const_stack_view_iterator(*this, getSize() + 1); } - const_stack_view_iterator last() const; + inline const_stack_view_iterator last() const; - const_stack_view_iterator cbegin() const; + inline const_stack_view_iterator cbegin() const; - auto cend() const { return const_stack_view_iterator(*this, getSize()); } + inline const_stack_view_iterator cend() const { return const_stack_view_iterator(*this, getSize()); } - const_stack_view_iterator clast() const; + inline const_stack_view_iterator clast() const; - stack_view_iterator at(unsigned int i) { return stack_view_iterator(*this, i); } + inline stack_view_iterator at(unsigned int i) { return stack_view_iterator(*this, i); } - const_stack_view_iterator at(unsigned int i) const { + inline const_stack_view_iterator at(unsigned int i) const { return const_stack_view_iterator(*this, i); } - stack_view_iterator first() { return stack_view_iterator{*this, 0}; } + inline stack_view_iterator first() { return stack_view_iterator{*this, 0}; } - const_stack_view_iterator cfirst() const { + inline const_stack_view_iterator cfirst() const { return const_stack_view_iterator{*this, 0}; } /// @} - void swap(stack_view_iterator a, stack_view_iterator b) ; + inline void swap(stack_view_iterator a, stack_view_iterator b) ; - void copy(stack_view_iterator a, stack_view_iterator b); + inline void copy(stack_view_iterator a, stack_view_iterator b); - void copy(const_stack_view_iterator a, stack_view_iterator b); + inline void copy(const_stack_view_iterator a, stack_view_iterator b); /** * need overwrite Stack::Delete, since we want to call @@ -270,13 +270,13 @@ namespace corsika { * remove the last particle. * */ - void erase(stack_view_iterator p); + inline void erase(stack_view_iterator p); /** * return next particle from stack, need to overwrtie Stack::getNextParticle to get * right reference */ - stack_view_iterator getNextParticle() { + inline stack_view_iterator getNextParticle() { while (purgeLastIfDeleted()) {} return last(); } @@ -287,26 +287,29 @@ namespace corsika { * need to re-implement for SecondaryView since stack_view_iterator types are a bit * different */ - bool isErased(const stack_view_iterator& p) const { + inline bool isErased(const stack_view_iterator& p) const { return isErased(p.getIndex() - 1); } - bool isErased(const const_stack_view_iterator& p) const { + inline bool isErased(const const_stack_view_iterator& p) const { return isErased(p.getIndex() - 1); } /** * delete this particle */ - bool isErased(const ParticleInterfaceType& p) const { + inline bool isErased(const ParticleInterfaceType& p) const { return isErased(p.getIterator()); } + inline bool isDeleted(const const_stack_view_iterator& p) const { + return isDeleted(p.getIndex() - 1); + } /** * Function to ultimatively remove the last entry from the stack, * if it was marked as deleted before. If this is not the case, * the function will just return false and do nothing. */ - bool purgeLastIfDeleted(); + inline bool purgeLastIfDeleted(); /** * Function to ultimatively remove all entries from the stack @@ -316,9 +319,9 @@ namespace corsika { * "gaps" in the stack are filled with entries from the back * (copied). */ - void purge() ; + inline void purge() ; - std::string as_string() const; + inline std::string as_string() const; protected: friend class StackIteratorInterface< @@ -341,11 +344,11 @@ namespace corsika { * stack_view_iterator::addSecondary via ParticleBase */ template <typename... Args> - stack_view_iterator addSecondary(stack_view_iterator& proj, const Args... v) ; + inline stack_view_iterator addSecondary(stack_view_iterator& proj, const Args... v) ; // forward to inner stack // this also checks the allowed bounds of 'i' - bool isErased(unsigned int i) const { + inline bool isErased(unsigned int i) const { if (i >= indices_.size()) return false; return inner_stack_.isErased(getIndexFromIterator(i + 1)); } @@ -355,7 +358,7 @@ namespace corsika { * function the conversion form iterator-index to stack-index is * performed. */ - unsigned int getIndexFromIterator(const unsigned int vI) const { + inline unsigned int getIndexFromIterator(const unsigned int vI) const { // this is too much: CORSIKA_LOG_TRACE("SecondaryView::getIndexFromIterator({})={}", // vI, (vI?indices_[vI-1]:projectile_index_)); if (vI == 0) return projectile_index_; @@ -387,7 +390,7 @@ namespace corsika { * is of course a reference into the SecondaryView itself. */ template <typename Particle> - auto new_secondary(Particle&&) const { + inline void new_secondary(Particle&&) const { CORSIKA_LOG_TRACE("DefaultSecondaryProducer::new_secondary(Particle&&)"); } @@ -400,7 +403,8 @@ namespace corsika { * itself. */ template <typename Particle> - DefaultSecondaryProducer(Particle const&) { + inline DefaultSecondaryProducer(Particle const&) { + CORSIKA_LOG_TRACE("DefaultSecondaryProducer::DefaultSecondaryProducer(Particle&)"); } }; diff --git a/corsika/framework/stack/Stack.hpp b/corsika/framework/stack/Stack.hpp index 4fc5b0a8c..d0d3b7f76 100644 --- a/corsika/framework/stack/Stack.hpp +++ b/corsika/framework/stack/Stack.hpp @@ -121,89 +121,89 @@ namespace corsika { * @name Most generic proxy methods for StackData data_ * @{ */ - unsigned int getCapacity() const { return data_.getCapacity(); } + inline unsigned int getCapacity() const { return data_.getCapacity(); } - unsigned int getErased() const { return nDeleted_; } + inline unsigned int getErased() const { return nDeleted_; } - unsigned int getEntries() const { return getSize() - getErased(); } + inline unsigned int getEntries() const { return getSize() - getErased(); } template <typename... TArgs> - void clear(TArgs... args); + inline void clear(TArgs... args); ///@} /** * @name These are functions required by std containers and std loops * @{ */ - stack_iterator_type begin(); + inline stack_iterator_type begin(); - stack_iterator_type end() ; + inline stack_iterator_type end() ; - stack_iterator_type last(); + inline stack_iterator_type last(); - const_stack_iterator_type begin() const; + inline const_stack_iterator_type begin() const; - const_stack_iterator_type end() const ; + inline const_stack_iterator_type end() const ; - const_stack_iterator_type last() const ; + inline const_stack_iterator_type last() const ; - const_stack_iterator_type cbegin() const; + inline const_stack_iterator_type cbegin() const; - const_stack_iterator_type cend() const; + inline const_stack_iterator_type cend() const; - const_stack_iterator_type clast() const; + inline const_stack_iterator_type clast() const; - stack_iterator_type at(unsigned int i); + inline stack_iterator_type at(unsigned int i); - const_stack_iterator_type at(unsigned int i) const; + inline const_stack_iterator_type at(unsigned int i) const; - stack_iterator_type first(); + inline stack_iterator_type first(); - const_stack_iterator_type cfirst() const; + inline const_stack_iterator_type cfirst() const; - stack_iterator_type getNextParticle(); + inline stack_iterator_type getNextParticle(); /** * increase stack size, create new particle at end of stack */ template <typename... TArgs> - stack_iterator_type addParticle(const TArgs... v) ; + inline stack_iterator_type addParticle(const TArgs... v) ; - void swap(stack_iterator_type a, stack_iterator_type b); + inline void swap(stack_iterator_type a, stack_iterator_type b); - void copy(stack_iterator_type a, stack_iterator_type b); + inline void copy(stack_iterator_type a, stack_iterator_type b); - void copy(const_stack_iterator_type a, stack_iterator_type b); + inline void copy(const_stack_iterator_type a, stack_iterator_type b); - void erase(stack_iterator_type p); + inline void erase(stack_iterator_type p); /** * delete this particle */ - void erase(particle_interface_type p); + inline void erase(particle_interface_type p); /** * check if there are no further non-deleted particles on stack */ - bool isEmpty(); + inline bool isEmpty(); /** * check if this particle was already deleted */ - bool isErased(const stack_iterator_type& p) const; + inline bool isErased(const stack_iterator_type& p) const; - bool isErased(const const_stack_iterator_type& p) const; + inline bool isErased(const const_stack_iterator_type& p) const; - bool isErased(const particle_interface_type& p) const; + inline bool isErased(const particle_interface_type& p) const; /** * Function to ultimatively remove the last entry from the stack, * if it was marked as deleted before. If this is not the case, * the function will just return false and do nothing. */ - bool purgeLastIfDeleted(); + inline bool purgeLastIfDeleted(); /** * Function to ultimatively remove all entries from the stack * marked as deleted. @@ -212,12 +212,12 @@ namespace corsika { * "gaps" in the stack are filled with entries from the back * (copied). */ - void purge(); + inline void purge(); - unsigned int getSize() const; + inline unsigned int getSize() const; - std::string as_string() const; + inline std::string as_string() const; protected: @@ -229,21 +229,21 @@ namespace corsika { * StackIterator::AddSecondary via ParticleBase */ template <typename... TArgs> - stack_iterator_type addSecondary(stack_iterator_type& parent, const TArgs... v) ; + inline stack_iterator_type addSecondary(stack_iterator_type& parent, const TArgs... v) ; - void swap(unsigned int const a, unsigned int const b); + inline void swap(unsigned int const a, unsigned int const b); - void copy(unsigned int const a, unsigned int const b); + inline void copy(unsigned int const a, unsigned int const b); - bool isErased(unsigned int const i) const; + inline bool isErased(unsigned int const i) const; - void erase(unsigned int const i) ; + inline void erase(unsigned int const i) ; /** * will remove from storage the element i. This is a helper * function for SecondaryView. */ - void purge(unsigned int i); + inline void purge(unsigned int i); /** * Function to perform eventual transformation from @@ -251,15 +251,15 @@ namespace corsika { * StackData data_. By default (and in almost all cases) this * should just be identiy. See class SecondaryView for an alternative implementation. */ - unsigned int getIndexFromIterator(const unsigned int vI) const; + inline unsigned int getIndexFromIterator(const unsigned int vI) const; /** * @name Return reference to StackData object data_ for data access * @{ */ - value_type& getStackData(); + inline value_type& getStackData(); - const value_type& getStackData() const; + inline const value_type& getStackData() const; friend class StackIteratorInterface<value_type, MParticleInterface, Stack>; friend class ConstStackIteratorInterface<value_type, MParticleInterface, Stack>; diff --git a/corsika/framework/stack/StackIteratorInterface.hpp b/corsika/framework/stack/StackIteratorInterface.hpp index 6a64e8534..5b60f1856 100644 --- a/corsika/framework/stack/StackIteratorInterface.hpp +++ b/corsika/framework/stack/StackIteratorInterface.hpp @@ -146,14 +146,14 @@ namespace corsika { /** @name Iterator interface @{ **/ - StackIteratorInterface& operator++() { + inline StackIteratorInterface& operator++() { do { ++index_; } while ( getStack().isErased(*this)); // this also check the allowed bounds of index_ return *this; } - StackIteratorInterface operator++(int) { + inline StackIteratorInterface operator++(int) { StackIteratorInterface tmp(*this); do { ++index_; @@ -161,19 +161,19 @@ namespace corsika { getStack().isErased(*this)); // this also check the allowed bounds of index_ return tmp; } - StackIteratorInterface operator+(int delta) const { + inline StackIteratorInterface operator+(int delta) const { return StackIteratorInterface(*data_, index_ + delta); } - bool operator==(StackIteratorInterface const& rhs) const { + inline bool operator==(StackIteratorInterface const& rhs) const { return index_ == rhs.index_; } - bool operator!=(StackIteratorInterface const& rhs) const { + inline bool operator!=(StackIteratorInterface const& rhs) const { return index_ != rhs.index_; } - bool operator==( + inline bool operator==( const ConstStackIteratorInterface<TStackData, TParticleInterface, TStackType>& rhs) const; // implemented below - bool operator!=( + inline bool operator!=( const ConstStackIteratorInterface<TStackData, TParticleInterface, TStackType>& rhs) const; // implemented below @@ -181,7 +181,7 @@ namespace corsika { * Convert iterator to value type, where value type is the user-provided particle * readout class **/ - particle_interface_type& operator*() { + inline particle_interface_type& operator*() { return static_cast<particle_interface_type&>(*this); } @@ -189,7 +189,7 @@ namespace corsika { * Convert iterator to const value type, where value type is the user-provided * particle readout class **/ - particle_interface_type const& operator*() const { + inline particle_interface_type const& operator*() const { return static_cast<particle_interface_type const&>(*this); } ///@} diff --git a/corsika/stack/DummyStack.hpp b/corsika/stack/DummyStack.hpp index d2f8323e8..3077bfaae 100644 --- a/corsika/stack/DummyStack.hpp +++ b/corsika/stack/DummyStack.hpp @@ -61,22 +61,21 @@ namespace corsika::dummy_stack { void init() { entries_ = 0; } - void clear() { entries_ = 0; } + inline void clear() { entries_ = 0; } - int getSize() const { return entries_; } - int getCapacity() const { return entries_; } + inline int getSize() const { return entries_; } + inline int getCapacity() const { return entries_; } /** * Function to copy particle at location i2 in stack to i1 */ - void copy(const int /*i1*/, const int /*i2*/) {} + inline void copy(const int /*i1*/, const int /*i2*/) {} - void incrementSize() { entries_++; } - void decrementSize() { entries_--; } + inline void incrementSize() { entries_++; } + inline void decrementSize() { entries_--; } - int getEntries() const { return entries_; } - - void setEntries(int entries = 0) { entries_ = entries; } + inline int getEntries() const { return entries_; } + inline void setEntries(int entries = 0) { entries_ = entries; } private: int entries_ = 0; diff --git a/corsika/stack/GeometryNodeStackExtension.hpp b/corsika/stack/GeometryNodeStackExtension.hpp index fe88d6f04..eed559c53 100644 --- a/corsika/stack/GeometryNodeStackExtension.hpp +++ b/corsika/stack/GeometryNodeStackExtension.hpp @@ -39,27 +39,28 @@ namespace corsika::node { typedef typename TEnvType::BaseNodeType node_type; // default version for particle-creation from input data - void setParticleData(const std::tuple<node_type const*> v) { + inline void setParticleData(const std::tuple<node_type const*> v) { setNode(std::get<0>(v)); } - void setParticleData(GeometryDataInterface& parent, + inline void setParticleData(GeometryDataInterface& parent, const std::tuple<node_type const*>) { setNode(parent.getNode()); // copy Node from parent particle! } - void setParticleData() { setNode(nullptr); } - void setParticleData(GeometryDataInterface& parent) { + inline void setParticleData() { setNode(nullptr); } + inline void setParticleData(GeometryDataInterface& parent) { setNode(parent.getNode()); // copy Node from parent particle! } - std::string as_string() const { + inline std::string as_string() const { return fmt::format("node={}", fmt::ptr(getNode())); } - void setNode(node_type const* v) { + inline void setNode(node_type const* v) { + super_type::getStackData().setNode(super_type::getIndex(), v); } - node_type const* getNode() const { + inline node_type const* getNode() const { return super_type::getStackData().getNode(super_type::getIndex()); } }; @@ -93,41 +94,41 @@ namespace corsika::node { operator=( GeometryData<TEnvType> && )= default; // these functions are needed for the Stack interface - void clear() { + inline void clear() { node_vector_.clear(); } - unsigned int getSize() const { + inline unsigned int getSize() const { return node_vector_.size(); } - unsigned int getCapacity() const { + inline unsigned int getCapacity() const { return node_vector_.size(); } - void copy(const int i1, const int i2) { + inline void copy(const int i1, const int i2) { node_vector_[i2] = node_vector_[i1]; } - void swap(const int i1, const int i2) { + inline void swap(const int i1, const int i2) { std::swap(node_vector_[i1], node_vector_[i2]); } // custom data access function - void setNode(const int i, node_type const* v) { + inline void setNode(const int i, node_type const* v) { node_vector_[i] = v; } - node_type const* getNode(const int i) const { + inline node_type const* getNode(const int i) const { return node_vector_[i]; } // these functions are also needed by the Stack interface - void incrementSize() { + inline void incrementSize() { node_vector_.push_back(nullptr); } - void decrementSize() { + inline void decrementSize() { if (node_vector_.size() > 0) { node_vector_.pop_back(); } } diff --git a/corsika/stack/NuclearStackExtension.hpp b/corsika/stack/NuclearStackExtension.hpp index c12096399..e594d414d 100644 --- a/corsika/stack/NuclearStackExtension.hpp +++ b/corsika/stack/NuclearStackExtension.hpp @@ -53,24 +53,24 @@ namespace corsika::nuclear_stack { unsigned short, unsigned short> altenative_particle_data_type; - void setParticleData(particle_data_type const& v) ; + inline void setParticleData(particle_data_type const& v) ; - void setParticleData(altenative_particle_data_type const& v); + inline void setParticleData(altenative_particle_data_type const& v); - void setParticleData(super_type& p, particle_data_type const& v); + inline void setParticleData(super_type& p, particle_data_type const& v); - void setParticleData(super_type& p, altenative_particle_data_type const& v); + inline void setParticleData(super_type& p, altenative_particle_data_type const& v); - std::string as_string() const; + inline std::string as_string() const; /** * @name individual setters * @{ */ - void setNuclearA(const unsigned short vA) { + inline void setNuclearA(const unsigned short vA) { super_type::getStackData().setNuclearA(super_type::getIndex(), vA); } - void setNuclearZ(const unsigned short vZ) { + inline void setNuclearZ(const unsigned short vZ) { super_type::getStackData().setNuclearZ(super_type::getIndex(), vZ); } /// @} @@ -79,10 +79,10 @@ namespace corsika::nuclear_stack { * @name individual getters * @{ */ - int getNuclearA() const { + inline int getNuclearA() const { return super_type::getStackData().getNuclearA(super_type::getIndex()); } - int getNuclearZ() const { + inline int getNuclearZ() const { return super_type::getStackData().getNuclearZ(super_type::getIndex()); } /// @} @@ -90,22 +90,22 @@ namespace corsika::nuclear_stack { /** * Overwrite normal getParticleMass function with nuclear version */ - HEPMassType getMass() const; + inline HEPMassType getMass() const; /** * Overwirte normal getChargeNumber function with nuclear version **/ - int16_t getChargeNumber() const; + inline int16_t getChargeNumber() const; - int getNucleusRef() const { + inline int getNucleusRef() const { return super_type::getStackData().getNucleusRef(super_type::getIndex()); } // LCOV_EXCL_LINE protected: - void setNucleusRef(const int vR) { + inline void setNucleusRef(const int vR) { super_type::getStackData().setNucleusRef(super_type::getIndex(), vR); } - bool isNucleus() const { + inline bool isNucleus() const { return super_type::getStackData().isNucleus(super_type::getIndex()); } }; @@ -148,45 +148,45 @@ namespace corsika::nuclear_stack { void dump() { super_type::dump(); } - void clear(); + inline void clear(); unsigned int getSize() const { return nucleusRef_.size(); } unsigned int getCapacity() const { return nucleusRef_.capacity(); } - void setNuclearA(const unsigned int i, const unsigned short vA) { + inline void setNuclearA(const unsigned int i, const unsigned short vA) { nuclearA_[getNucleusRef(i)] = vA; } - void setNuclearZ(const unsigned int i, const unsigned short vZ) { + inline void setNuclearZ(const unsigned int i, const unsigned short vZ) { nuclearZ_[getNucleusRef(i)] = vZ; } - void setNucleusRef(const unsigned int i, const int v) { nucleusRef_[i] = v; } + inline void setNucleusRef(const unsigned int i, const int v) { nucleusRef_[i] = v; } - int getNuclearA(const unsigned int i) const { return nuclearA_[getNucleusRef(i)]; } + inline int getNuclearA(const unsigned int i) const { return nuclearA_[getNucleusRef(i)]; } - int getNuclearZ(const unsigned int i) const { return nuclearZ_[getNucleusRef(i)]; } + inline int getNuclearZ(const unsigned int i) const { return nuclearZ_[getNucleusRef(i)]; } // this function will create new storage for Nuclear Properties, and return the // reference to it - int getNucleusNextRef() ; + inline int getNucleusNextRef() ; - int getNucleusRef(const unsigned int i) const; + inline int getNucleusRef(const unsigned int i) const; - bool isNucleus(const unsigned int i) const { return nucleusRef_[i] >= 0; } + inline bool isNucleus(const unsigned int i) const { return nucleusRef_[i] >= 0; } /** * Function to copy particle at location i1 in stack to i2 */ - void copy(const unsigned int i1, const unsigned int i2) ; + inline void copy(const unsigned int i1, const unsigned int i2) ; /** * Function to copy particle at location i2 in stack to i1 */ - void swap(const unsigned int i1, const unsigned int i2) ; + inline void swap(const unsigned int i1, const unsigned int i2) ; - void incrementSize() ; + inline void incrementSize() ; - void decrementSize() ; + inline void decrementSize() ; private: /// the actual memory to store particle data diff --git a/corsika/stack/SuperStupidStack.hpp b/corsika/stack/SuperStupidStack.hpp index a32ec7de6..abf79de5d 100644 --- a/corsika/stack/SuperStupidStack.hpp +++ b/corsika/stack/SuperStupidStack.hpp @@ -43,23 +43,23 @@ namespace corsika::simple_stack { } void setParticleData(std::tuple<corsika::Code, HEPEnergyType, MomentumVector, - corsika::Point, TimeType> const& v) { + corsika::Point, TimeType> const& v);/* { this->setPID(std::get<0>(v)); this->setEnergy(std::get<1>(v)); this->setMomentum(std::get<2>(v)); this->setPosition(std::get<3>(v)); this->setTime(std::get<4>(v)); - } + }*/ void setParticleData(ParticleInterface<StackIteratorInterface> const&, std::tuple<corsika::Code, HEPEnergyType, MomentumVector, - corsika::Point, TimeType> const& v) { + corsika::Point, TimeType> const& v);/* { this->setPID(std::get<0>(v)); this->setEnergy(std::get<1>(v)); this->setMomentum(std::get<2>(v)); this->setPosition(std::get<3>(v)); this->setTime(std::get<4>(v)); - } + }*/ /// individual setters void setPID(corsika::Code const id) { @@ -137,13 +137,7 @@ namespace corsika::simple_stack { void init() {} void dump() const {} - void clear() { - dataPID_.clear(); - dataE_.clear(); - momentum_.clear(); - position_.clear(); - time_.clear(); - } + inline void clear() ; unsigned int getSize() const { return dataPID_.size(); } unsigned int getCapacity() const { return dataPID_.size(); } @@ -173,51 +167,17 @@ namespace corsika::simple_stack { /** * Function to copy particle at location i2 in stack to i1 */ - void copy(size_t i1, size_t i2) { - dataPID_[i2] = dataPID_[i1]; - dataE_[i2] = dataE_[i1]; - momentum_[i2] = momentum_[i1]; - position_[i2] = position_[i1]; - time_[i2] = time_[i1]; - } + inline void copy(size_t i1, size_t i2); /** * FIXME: change to iterators. * Function to copy particle at location i2 in stack to i1 */ - void swap(size_t i1, size_t i2) { - std::swap(dataPID_[i2], dataPID_[i1]); - std::swap(dataE_[i2], dataE_[i1]); - std::swap(momentum_[i2], momentum_[i1]); - std::swap(position_[i2], position_[i1]); - std::swap(time_[i2], time_[i1]); - } - - void incrementSize() { - using corsika::Code; - using corsika::Point; + inline void swap(size_t i1, size_t i2); - dataPID_.push_back(Code::Unknown); - dataE_.push_back(0 * electronvolt); + inline void incrementSize() ; - CoordinateSystemPtr const& dummyCS = get_root_CoordinateSystem(); - - momentum_.push_back( - momentum_type(dummyCS, {0 * electronvolt, 0 * electronvolt, 0 * electronvolt})); - - position_.push_back(Point(dummyCS, {0 * meter, 0 * meter, 0 * meter})); - time_.push_back(0 * second); - } - - void decrementSize() { - if (dataE_.size() > 0) { - dataPID_.pop_back(); - dataE_.pop_back(); - momentum_.pop_back(); - position_.pop_back(); - time_.pop_back(); - } - } + inline void decrementSize() ; private: /// the actual memory to store particle data @@ -232,3 +192,5 @@ namespace corsika::simple_stack { typedef Stack<SuperStupidStackImpl, ParticleInterface> SuperStupidStack; } // namespace corsika::simple_stack + +#include <corsika/detail/stack/SuperStupidStack.inl> -- GitLab