Commit b7add2f3 authored by Damien L-G's avatar Damien L-G

Change semantics swap x and y files

parent 5e8e95b5
......@@ -14,8 +14,8 @@ using namespace noname;
static void BM_Eval(benchmark::State &state) {
std::string const prefix = "/scratch/"; // edit this line
std::string const fx = prefix + "T.csv";
std::string const fy = prefix + "p.csv";
std::string const fx = prefix + "p.csv";
std::string const fy = prefix + "T.csv";
std::string const fz = prefix + "h.csv";
auto extract_from = [](std::string const &filename,
std::vector<double> (*parse)(std::istream &)) {
......@@ -25,8 +25,7 @@ static void BM_Eval(benchmark::State &state) {
auto const x = extract_from(fx, parse_x);
auto const y = extract_from(fy, parse_y);
auto const z = extract_from(fz, parse_z);
auto const tz = transpose_z(x.size(), y.size(), z);
Spline2D<Bicubic> spline(x, y, tz);
Spline2D<Bicubic> spline(x, y, z);
// std::random_device gen(0);
// std::uniform_real_distribution<double> dist_x(x.front(), x.back());
// std::uniform_real_distribution<double> dist_y(y.front(), y.back());
......@@ -39,8 +38,8 @@ BENCHMARK(BM_Eval);
static void BM_EvalMap(benchmark::State &state) {
std::string const prefix = "/scratch/"; // edit this line
std::string const fx = prefix + "T.csv";
std::string const fy = prefix + "p.csv";
std::string const fx = prefix + "p.csv";
std::string const fy = prefix + "T.csv";
std::string const fz = prefix + "h.csv";
auto extract_from = [](std::string const &filename,
std::vector<double> (*parse)(std::istream &)) {
......
......@@ -6,8 +6,8 @@
int main() {
std::string const prefix = "/scratch/"; // edit this line
std::string const fx = prefix + "T.csv";
std::string const fy = prefix + "p.csv";
std::string const fx = prefix + "p.csv";
std::string const fy = prefix + "T.csv";
std::string const fz = prefix + "h.csv";
char const sep = '?';
std::string const k = sep + fx + sep + fy + sep + fz;
......
......@@ -96,9 +96,8 @@ Spline *Map<Spline>::get_spline(std::string const &which) {
auto const x = extract_from(filenames[0], parse_x);
auto const y = extract_from(filenames[1], parse_y);
auto const z = extract_from(filenames[2], parse_z);
auto const tz = transpose_z(x.size(), y.size(), z);
std::tie(it, std::ignore) =
_splines.insert({which, std::make_unique<Spline>(x, y, tz)});
_splines.insert({which, std::make_unique<Spline>(x, y, z)});
}
return (it->second).get();
}
......
......@@ -9,24 +9,24 @@
namespace noname {
static inline std::vector<double> parse_x(std::istream &is) {
std::vector<double> x;
static inline std::vector<double> parse_y(std::istream &is) {
std::vector<double> y;
for (std::string entry; std::getline(is, entry, ',');
is.ignore(std::numeric_limits<std::streamsize>::max(), '\n')) {
x.push_back(std::stod(entry));
y.push_back(std::stod(entry));
}
return x;
return y;
}
static inline std::vector<double> parse_y(std::istream &is) {
std::vector<double> y;
static inline std::vector<double> parse_x(std::istream &is) {
std::vector<double> x;
std::string line;
std::getline(is, line);
std::stringstream ss(line);
for (std::string entry; std::getline(ss, entry, ',');) {
y.push_back(std::stod(entry));
for (std::string entrx; std::getline(ss, entrx, ',');) {
x.push_back(std::stod(entrx));
}
return y;
return x;
}
static inline std::vector<double> parse_z(std::istream &is) {
......
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