IAP GITLAB

Commit ca4472ea authored by Ralf Ulrich's avatar Ralf Ulrich

stack -> vector

parent 137a1f0b
Pipeline #5254 passed with stages
in 18 minutes and 58 seconds
......@@ -37,10 +37,10 @@ namespace corsika {
template <typename TMediumInterface, template <typename> typename TMediumModelExtra,
typename... TModelArgs>
inline void LayeredSphericalAtmosphereBuilder<
TMediumInterface, TMediumModelExtra,
TModelArgs...>::addExponentialLayer(GrammageType b, LengthType c,
LengthType upperBoundary) {
inline typename LayeredSphericalAtmosphereBuilder<TMediumInterface, TMediumModelExtra,
TModelArgs...>::volume_tree_node*
LayeredSphericalAtmosphereBuilder<TMediumInterface, TMediumModelExtra, TModelArgs...>::
addExponentialLayer(GrammageType b, LengthType c, LengthType upperBoundary) {
auto const radius = planetRadius_ + upperBoundary;
checkRadius(radius);
......@@ -67,7 +67,8 @@ namespace corsika {
center_, rho0, -c, *composition_, planetRadius_);
}
layers_.push(std::move(node));
layers_.push_back(std::move(node));
return layers_.back().get();
}
template <typename TMediumInterface, template <typename> typename TMediumModelExtra,
......@@ -100,7 +101,7 @@ namespace corsika {
rho0, *composition_);
}
layers_.push(std::move(node));
layers_.push_back(std::move(node));
}
template <typename TMediumInterface, template <typename> typename TMediumModelExtra,
......@@ -134,7 +135,7 @@ namespace corsika {
node->template setModelProperties<SlidingPlanarTabular<TMediumInterface>>(
center_, funcRho, nBins, deltaHeight, *composition_, planetRadius_);
}
layers_.push(std::move(node));
layers_.push_back(std::move(node));
}
template <typename TMediumInterface, template <typename> typename TMediumModelExtra,
......@@ -155,10 +156,10 @@ namespace corsika {
auto* outmost = universe.get();
while (!layers_.empty()) {
auto l = std::move(layers_.top());
auto l = std::move(layers_.back());
auto* tmp = l.get();
outmost->addChild(std::move(l));
layers_.pop();
layers_.pop_back();
outmost = tmp;
}
}
......
......@@ -19,7 +19,7 @@
#include <corsika/detail/media/LayeredSphericalAtmosphereBuilder.hpp>
#include <memory>
#include <stack>
#include <vector>
#include <tuple>
#include <type_traits>
#include <functional>
......@@ -75,8 +75,12 @@ namespace corsika {
, additionalModelArgs_{args...} {}
public:
typedef typename VolumeTreeNode<TMediumInterface>::VTN_type volume_tree_node;
typedef typename VolumeTreeNode<TMediumInterface>::VTNUPtr volume_tree_node_uptr;
void setNuclearComposition(NuclearComposition const& composition);
void addExponentialLayer(GrammageType b, LengthType c, LengthType upperBoundary);
volume_tree_node* addExponentialLayer(GrammageType b, LengthType c,
LengthType upperBoundary);
void addLinearLayer(LengthType c, LengthType upperBoundary);
void addTabularLayer(std::function<MassDensityType(LengthType)> const& funcRho,
......@@ -102,8 +106,7 @@ namespace corsika {
LengthType planetRadius_;
std::tuple<TModelArgs...> const additionalModelArgs_;
std::stack<typename VolumeTreeNode<TMediumInterface>::VTNUPtr>
layers_; // innermost layer first
std::vector<volume_tree_node_uptr> layers_; // innermost layer first
}; // end class LayeredSphericalAtmosphereBuilder
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment