#include "bench_defs.hpp"
#include "run.hpp"

#include <cstdlib>
#include <iostream>
#include <string>
#include <tug/Simulation.hpp>
#include <vector>

using TugType = double;

int main(int argc, char **argv) {
  double timings[3];

  bool with_output = false;

  if (const char *out = std::getenv("BENCH_OUTPUT")) {
    std::cout << "Printing output to .csv files\n";
    with_output = true;
  } else {
    std::cout << "No output to .csv files\n";
    std::cout << "Set env variable 'BENCH_OUTPUT=1' to enable it\n";
  }

  if (with_output) {
    std::cout << "BARITE_200 started with output... ";
    timings[0] = run_bench(barite_200_input, "barite_200_output.csv");
    std::cout << "Runtime: " << timings[0] << " [ms]\n";

    std::cout << "BARITE_LARGE started with output... ";
    timings[1] = run_bench(barite_large_input, "barite_large_output.csv");
    std::cout << "Runtime: " << timings[1] << " [ms]\n";

    std::cout << "SURFEX started with output... ";
    timings[2] = run_bench(surfex_input, "surfex_output.csv");
    std::cout << "Runtime: " << timings[2] << " [ms]\n";
  } else {
    std::cout << "BARITE_200 started with no output... ";
    timings[0] = run_bench(barite_200_input);
    std::cout << " Runtime: " << timings[0] << " [ms]\n";

    std::cout << "BARITE_LARGE started with no output... ";
    timings[1] = run_bench(barite_large_input);
    std::cout << "Runtime: " << timings[1] << " [ms]\n";

    std::cout << "SURFEX started with no output... ";
    timings[2] = run_bench(surfex_input);
    std::cout << "Runtime: " << timings[2] << " [ms]\n";
  }

  return EXIT_SUCCESS;
}
