Commit 0539cc17 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

ISimulation2D: start accessor fcts for m_eles

parent 96abcaa0
...@@ -179,3 +179,18 @@ void ISimulation2D::initDistributionHandler() ...@@ -179,3 +179,18 @@ void ISimulation2D::initDistributionHandler()
} }
} }
} }
std::vector<std::unique_ptr<DiffuseElement>>& ISimulation2D::elements()
{
return m_eles;
}
const std::vector<std::unique_ptr<DiffuseElement>>& ISimulation2D::elements() const
{
return m_eles;
}
void ISimulation2D::element_emplace_back(std::unique_ptr<DiffuseElement>&& ele)
{
m_eles.emplace_back(std::move(ele));
}
...@@ -100,6 +100,10 @@ protected: ...@@ -100,6 +100,10 @@ protected:
std::vector<std::unique_ptr<DiffuseElement>> m_eles; std::vector<std::unique_ptr<DiffuseElement>> m_eles;
std::vector<double> m_cache; std::vector<double> m_cache;
std::vector<std::unique_ptr<DiffuseElement>>& elements();
const std::vector<std::unique_ptr<DiffuseElement>>& elements() const;
void element_emplace_back(std::unique_ptr<DiffuseElement>&&);
private: private:
std::unique_ptr<DetectorContext> m_detector_context; std::unique_ptr<DetectorContext> m_detector_context;
#endif // SWIG #endif // SWIG
......
...@@ -102,7 +102,7 @@ void OffspecSimulation::initElementVector() ...@@ -102,7 +102,7 @@ void OffspecSimulation::initElementVector()
beam2.setInclination(m_alpha_i_axis->bin(i).center()); beam2.setInclination(m_alpha_i_axis->bin(i).center());
std::vector<std::unique_ptr<DiffuseElement>> eles_i = generateElements(beam2); std::vector<std::unique_ptr<DiffuseElement>> eles_i = generateElements(beam2);
for (auto&& ele : eles_i) for (auto&& ele : eles_i)
m_eles.emplace_back(std::move(ele)); element_emplace_back(std::move(ele));
} }
if (m_cache.empty()) if (m_cache.empty())
m_cache.resize(m_eles.size(), 0.0); m_cache.resize(m_eles.size(), 0.0);
......
Supports Markdown
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