Commit 21610b38 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

disambiguate DepthProbeSimulation::m_depth_eles from ISimulation2D::m_eles

parent 0539cc17
......@@ -135,11 +135,11 @@ void DepthProbeSimulation::setBeamParameters(double lambda, const IAxis& alpha_a
void DepthProbeSimulation::initElementVector()
{
m_eles = generateElements(beam());
m_depth_eles = generateElements(beam());
if (!m_cache.empty())
return;
m_cache.resize(m_eles.size(), std::valarray<double>(0.0, zAxis()->size()));
m_cache.resize(m_depth_eles.size(), std::valarray<double>(0.0, zAxis()->size()));
}
std::vector<DepthProbeElement> DepthProbeSimulation::generateElements(const Beam& beam)
......@@ -163,8 +163,8 @@ std::vector<DepthProbeElement> DepthProbeSimulation::generateElements(const Beam
std::unique_ptr<IComputation>
DepthProbeSimulation::createComputation(const reSample& re_sample, size_t start, size_t n_elements)
{
ASSERT(start < m_eles.size() && start + n_elements <= m_eles.size());
const auto& begin = m_eles.begin() + static_cast<long>(start);
ASSERT(start < m_depth_eles.size() && start + n_elements <= m_depth_eles.size());
const auto& begin = m_depth_eles.begin() + static_cast<long>(start);
return std::make_unique<DepthProbeComputation>(re_sample, options(), progress(), begin,
begin + static_cast<long>(n_elements));
}
......@@ -176,7 +176,7 @@ void DepthProbeSimulation::validityCheck() const
throw std::runtime_error(
"Error in DepthProbeSimulation::validityCheck: no sample found in the simulation.");
const size_t data_size = m_eles.size();
const size_t data_size = m_depth_eles.size();
if (data_size != alphaAxis()->size())
throw std::runtime_error(
"Error in DepthProbeSimulation::validityCheck: length of simulation "
......@@ -185,7 +185,7 @@ void DepthProbeSimulation::validityCheck() const
void DepthProbeSimulation::checkCache() const
{
if (m_eles.size() != m_cache.size())
if (m_depth_eles.size() != m_cache.size())
throw std::runtime_error("Error in DepthProbeSimulation: the sizes of simulation element "
"vector and of its cache are different");
}
......@@ -206,7 +206,7 @@ void DepthProbeSimulation::normalize(size_t start_ind, size_t n_elements)
{
const double beam_intensity = beam().intensity();
for (size_t i = start_ind, stop_point = start_ind + n_elements; i < stop_point; ++i) {
auto& element = m_eles[i];
auto& element = m_depth_eles[i];
const double alpha_i = -element.alphaI();
const auto* footprint = beam().footprintFactor();
double intensity_factor = beam_intensity;
......@@ -226,15 +226,15 @@ void DepthProbeSimulation::addBackgroundIntensity(size_t, size_t)
void DepthProbeSimulation::addDataToCache(double weight)
{
checkCache();
for (size_t i = 0, size = m_eles.size(); i < size; ++i)
m_cache[i] += m_eles[i].getIntensities() * weight;
for (size_t i = 0, size = m_depth_eles.size(); i < size; ++i)
m_cache[i] += m_depth_eles[i].getIntensities() * weight;
}
void DepthProbeSimulation::moveDataFromCache()
{
checkCache();
for (size_t i = 0, size = m_eles.size(); i < size; ++i)
m_eles[i].setIntensities(std::move(m_cache[i]));
for (size_t i = 0, size = m_depth_eles.size(); i < size; ++i)
m_depth_eles[i].setIntensities(std::move(m_cache[i]));
m_cache.clear();
m_cache.shrink_to_fit();
}
......@@ -250,8 +250,8 @@ std::unique_ptr<Datafield> DepthProbeSimulation::createIntensityData() const
std::vector<double> out(frame->size());
size_t iout = 0;
for (size_t i = 0, size = m_eles.size(); i < size; ++i)
for (const double v: m_eles[i].getIntensities())
for (size_t i = 0, size = m_depth_eles.size(); i < size; ++i)
for (const double v: m_depth_eles[i].getIntensities())
out[iout++] = v;
return std::unique_ptr<Datafield>(new Datafield(frame, out));
......
......@@ -114,7 +114,7 @@ private:
std::unique_ptr<IAxis> m_alpha_axis;
std::unique_ptr<IAxis> m_z_axis;
std::vector<DepthProbeElement> m_eles;
std::vector<DepthProbeElement> m_depth_eles; // TODO remerge with ISimulation2D::m_eles
std::vector<std::valarray<double>> m_cache;
#endif
};
......
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