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

c'tor(axes) to simplify

parent 17d21b51
No related branches found
No related tags found
1 merge request!891simplify in axes and coords context; standardize use of 'rank' vs 'sizes'
...@@ -18,17 +18,12 @@ ...@@ -18,17 +18,12 @@
std::unique_ptr<Powerfield<double>> GUI::Util::IO::binifyAxes(const Powerfield<double>& data) std::unique_ptr<Powerfield<double>> GUI::Util::IO::binifyAxes(const Powerfield<double>& data)
{ {
std::unique_ptr<Powerfield<double>> result; std::vector<IAxis*> axes;
if (data.rank() == 1) { for (size_t i=0; i<data.rank(); ++i)
const IAxis& X = data.axis(0); axes.emplace_back(data.axis(i).clone());
result.reset(new Powerfield<double>(FixedBinAxis(X.axisName(), X.size(), 0., X.size())));
} else if (data.rank() == 2) { auto result = std::make_unique<Powerfield<double>>(axes);
const IAxis& X = data.axis(0);
const IAxis& Y = data.axis(1);
result.reset(new Powerfield<double>(FixedBinAxis(X.axisName(), X.size(), 0., X.size()),
FixedBinAxis(Y.axisName(), Y.size(), 0., Y.size())));
} else
ASSERT(0);
result->setRawDataVector(data.getRawDataVector()); result->setRawDataVector(data.getRawDataVector());
return result; return result;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment