Commit 52c81ec1 authored by Damien L-G's avatar Damien L-G

Transpose z data after parse

parent 8e3638f5
......@@ -40,6 +40,17 @@ static inline std::vector<double> parse_z(std::istream &is) {
return z;
}
static inline std::vector<double> transpose_z(int nx, int ny,
std::vector<double> const &z) {
std::vector<double> tz(z.size());
for (int i = 0; i < nx; ++i) {
for (int j = 0; j < ny; ++j) {
tz[j * nx + i] = z[i * ny + j];
}
}
return tz;
}
} // namespace noname
#endif
......@@ -111,10 +111,10 @@ Spline2D<Bicubic> *SplineMap::get_spline(std::string const &which) {
std::ifstream fs(filenames[1]);
return parse_y(fs);
}();
auto const z = [&filenames]() {
auto const z = transpose_z(x.size(), y.size(), [&filenames]() {
std::ifstream fs(filenames[2]);
return parse_z(fs);
}();
}());
std::tie(it, std::ignore) =
_splines.insert({key, std::make_unique<Spline2D<Bicubic>>(x, y, z)});
}
......
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