From e8ba8c019b418a26330645e18508d14e9636bf5e Mon Sep 17 00:00:00 2001 From: Andrew Myers Date: Mon, 6 Oct 2025 14:37:52 -0700 Subject: [PATCH 1/2] Implement 5-day work week --- src/Utils.H | 5 +++++ src/Utils.cpp | 7 ++++++- src/main.cpp | 11 +++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Utils.H b/src/Utils.H index fbaaef3d..e45af4e7 100644 --- a/src/Utils.H +++ b/src/Utils.H @@ -94,7 +94,12 @@ struct ICType { /*! \brief Namespace with utility functions */ namespace Utils { +/*! \brief Read in test parameters in #ExaEpi::TestParams from input file */ void getTestParams(ExaEpi::TestParams& params, const std::string& prefix); + +/*! \brief returns whether day i is a work day */ +bool isWorkday (int i); + } } // namespace ExaEpi diff --git a/src/Utils.cpp b/src/Utils.cpp index ee389584..e16e9090 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -19,7 +19,6 @@ using namespace amrex; using namespace ExaEpi; -/*! \brief Read in test parameters in #ExaEpi::TestParams from input file */ void ExaEpi::Utils::getTestParams (TestParams& params, /*!< Test parameters */ const std::string& prefix /*!< ParmParse prefix */) { ParmParse pp(prefix); @@ -83,3 +82,9 @@ void ExaEpi::Utils::getTestParams (TestParams& params, /*!< Test parameters */ pp.query("fast", params.fast); } + +bool ExaEpi::Utils::isWorkday (int i) +{ + // right now we work on days 0-4, rest on 5-6 + return ( (i % 7) < 5 ); +} diff --git a/src/main.cpp b/src/main.cpp index 76656f35..8e096b2a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -494,10 +494,13 @@ void runAgent () { pc.moveAirTravel(censusData.unit_mf, air, censusData.demo); } - // Typical day - pc.morningCommute(mask_behavior); - pc.interactDay(mask_behavior); - pc.eveningCommute(mask_behavior); + // Process daytime / nighttime interactions. + // Only do daytime interactions on weekdays + if (ExaEpi::Utils::isWorkday(i)) { + pc.morningCommute(mask_behavior); + pc.interactDay(mask_behavior); + pc.eveningCommute(mask_behavior); + } pc.interactEvening(mask_behavior); pc.interactNight(mask_behavior); From f2f71d2fdd660e4043465146d0b703b48608bfac Mon Sep 17 00:00:00 2001 From: Andrew Myers Date: Mon, 6 Oct 2025 14:42:22 -0700 Subject: [PATCH 2/2] fix style --- src/Utils.H | 4 ++-- src/Utils.cpp | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Utils.H b/src/Utils.H index e45af4e7..6ce895b0 100644 --- a/src/Utils.H +++ b/src/Utils.H @@ -98,9 +98,9 @@ namespace Utils { void getTestParams(ExaEpi::TestParams& params, const std::string& prefix); /*! \brief returns whether day i is a work day */ -bool isWorkday (int i); +bool isWorkday(int i); -} +} // namespace Utils } // namespace ExaEpi #endif diff --git a/src/Utils.cpp b/src/Utils.cpp index e16e9090..bc93f730 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -83,8 +83,7 @@ void ExaEpi::Utils::getTestParams (TestParams& params, /*!< Test parameters */ pp.query("fast", params.fast); } -bool ExaEpi::Utils::isWorkday (int i) -{ +bool ExaEpi::Utils::isWorkday (int i) { // right now we work on days 0-4, rest on 5-6 - return ( (i % 7) < 5 ); + return ((i % 7) < 5); }