Skip to content
Snippets Groups Projects
Commit 0ff04286 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

QzScan: merge in two fcts

parent ffa80557
No related branches found
No related tags found
1 merge request!960Various simplifications
...@@ -69,7 +69,13 @@ QzScan* QzScan::clone() const ...@@ -69,7 +69,13 @@ QzScan* QzScan::clone() const
//! Generates simulation elements for specular simulations //! Generates simulation elements for specular simulations
std::vector<SpecularElement> QzScan::generateElements() const std::vector<SpecularElement> QzScan::generateElements() const
{ {
const std::vector<double> qz = generateQzVector(); const auto samples = m_resolution->generateSamples(m_qs->binCenters());
std::vector<double> qz;
qz.reserve(numberOfElements());
for (size_t i = 0, size_out = samples.size(); i < size_out; ++i)
for (size_t j = 0, size_in = samples[i].size(); j < size_in; ++j)
qz.push_back(samples[i][j].value);
std::vector<SpecularElement> result; std::vector<SpecularElement> result;
result.reserve(qz.size()); result.reserve(qz.size());
...@@ -104,7 +110,7 @@ std::vector<double> QzScan::createIntensities(const std::vector<SpecularElement> ...@@ -104,7 +110,7 @@ std::vector<double> QzScan::createIntensities(const std::vector<SpecularElement>
const size_t axis_size = m_qs->size(); const size_t axis_size = m_qs->size();
std::vector<double> result(axis_size, 0.0); std::vector<double> result(axis_size, 0.0);
const auto samples = applyQResolution(); const auto samples = m_resolution->generateSamples(m_qs->binCenters());
size_t elem_pos = 0; size_t elem_pos = 0;
for (size_t i = 0; i < axis_size; ++i) { for (size_t i = 0; i < axis_size; ++i) {
...@@ -151,20 +157,3 @@ void QzScan::setAbsoluteQResolution(const IRangedDistribution& distr, ...@@ -151,20 +157,3 @@ void QzScan::setAbsoluteQResolution(const IRangedDistribution& distr,
ScanResolution::scanAbsoluteResolution(distr, std_dev)); ScanResolution::scanAbsoluteResolution(distr, std_dev));
setQResolution(*resolution); setQResolution(*resolution);
} }
std::vector<double> QzScan::generateQzVector() const
{
const auto samples = applyQResolution();
std::vector<double> result;
result.reserve(numberOfElements());
for (size_t i = 0, size_out = samples.size(); i < size_out; ++i)
for (size_t j = 0, size_in = samples[i].size(); j < size_in; ++j)
result.push_back(samples[i][j].value);
return result;
}
std::vector<std::vector<ParameterSample>> QzScan::applyQResolution() const
{
return m_resolution->generateSamples(m_qs->binCenters());
}
...@@ -91,9 +91,6 @@ public: ...@@ -91,9 +91,6 @@ public:
private: private:
QzScan(IAxis* qs_nm); QzScan(IAxis* qs_nm);
std::vector<double> generateQzVector() const;
std::vector<std::vector<ParameterSample>> applyQResolution() const;
const std::unique_ptr<IAxis> m_qs; const std::unique_ptr<IAxis> m_qs;
std::unique_ptr<ScanResolution> m_resolution; std::unique_ptr<ScanResolution> m_resolution;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment