From ca6fac52c5d7608dfce254715bba2e667c351c00 Mon Sep 17 00:00:00 2001 From: James Paul Turner Date: Mon, 27 Nov 2023 15:53:55 +0000 Subject: [PATCH] Fix baseline and intervention out files clobbering. --- src/HealthGPS/healthgps.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/HealthGPS/healthgps.cpp b/src/HealthGPS/healthgps.cpp index 5612e538a..31e00b66a 100644 --- a/src/HealthGPS/healthgps.cpp +++ b/src/HealthGPS/healthgps.cpp @@ -159,7 +159,9 @@ void HealthGPS::initialise_population() { std::vector keys = { "Age", "Gender", "Sector", "Income", "Carbohydrate", "Fat", "Protein", "Sodium", "PhysicalActivity", "EnergyIntake", "Height", "Weight"}; - std::ofstream file(fmt::format("initialise_{}.csv", context_.time_now())); + std::string scenario = + context_.scenario().type() == ScenarioType::baseline ? "baseline" : "intervention"; + std::ofstream file(fmt::format("initialise_{}_{}.csv", scenario, context_.time_now())); for (const auto &key : keys) { file << key.to_string() << ","; @@ -204,7 +206,9 @@ void HealthGPS::update_population() { std::vector keys = { "Age", "Gender", "Sector", "Income", "Carbohydrate", "Fat", "Protein", "Sodium", "PhysicalActivity", "EnergyIntake", "Height", "Weight"}; - std::ofstream file(fmt::format("update_{}.csv", context_.time_now())); + std::string scenario = + context_.scenario().type() == ScenarioType::baseline ? "baseline" : "intervention"; + std::ofstream file(fmt::format("update_{}_{}.csv", scenario, context_.time_now())); for (const auto &key : keys) { file << key.to_string() << ",";