From 1c1ead865bff4f2464ed20700e506296a1233a46 Mon Sep 17 00:00:00 2001 From: amirroth Date: Wed, 11 Dec 2024 16:06:57 -0500 Subject: [PATCH] Moving a few more std::find's to loops --- src/EnergyPlus/ScheduleManager.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index f1295a8d6de..2ced5155d54 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -1035,9 +1035,11 @@ namespace Sched { } // Have processed all named days, check to make sure all given - if (std::find(allDays.begin(), allDays.end(), false) != allDays.end()) { + for (int iDayType = iDayType_Sun; iDayType < (int)DayType::Num; ++iDayType) { + if (allDays[iDayType] == true) continue; ShowSevereError(state, format("{}: {}=\"{}\", Missing some day assignments", routineName, CurrentModuleObject, Alphas(1))); ErrorsFound = true; + break; } } NumRegWeekSchedules = Count; @@ -1369,18 +1371,21 @@ namespace Sched { } For_exit:; - if (std::find(&allDays[iDayType_Sun], &allDays[(int)DayType::Num], false) != &allDays[(int)DayType::Num]) { + for (int iDayType = iDayType_Sun; iDayType < (int)DayType::Num; ++iDayType) { + if (allDays[iDayType] == true) continue; + ShowWarningCustom(state, eoh, format("has missing day types in Through={}", CurrentThrough)); ShowContinueError(state, format("Last \"For\" field={}", LastFor)); std::string errmsg = "Missing day types=,"; - for (int kDayType = 1; kDayType < (int)DayType::Num; ++kDayType) { - if (allDays[kDayType]) continue; - errmsg.erase(errmsg.length() - 1); - errmsg = format("{} \"{}\",-", errmsg, dayTypeNames[kDayType]); + for (int kDayType = iDayType_Sun; kDayType < (int)DayType::Num; ++kDayType) { + if (allDays[kDayType]) continue; + errmsg.erase(errmsg.length() - 1); + errmsg = format("{} \"{}\",-", errmsg, dayTypeNames[kDayType]); } errmsg.erase(errmsg.length() - 2); ShowContinueError(state, errmsg); ShowContinueError(state, "Missing day types will have 0.0 as Schedule Values"); + break; } }