21 const std::vector<double>& x,
22 const std::vector<double>& T)
25 if (x.size() != T.size())
26 throw std::runtime_error(
"save_profile_csv: vector size mismatch");
30 fs::path fullPath(path);
31 if (fullPath.has_parent_path())
33 fs::create_directories(fullPath.parent_path());
37 std::ofstream file(fullPath);
39 throw std::runtime_error(
"save_profile_csv: cannot open file " + fullPath.string());
43 file << std::fixed << std::setprecision(6);
44 for (std::size_t i = 0; i < x.size(); ++i)
45 file << x[i] <<
"," << T[i] <<
"\n";
void save_profile_csv(const std::string &path, const std::vector< double > &x, const std::vector< double > &T)
Save a temperature profile (x, T) to a CSV file.