-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce Optional_string usage #9232
Changes from all commits
8183874
83efd71
bd5a9b5
b56833f
47da64f
fe06238
8f40a07
40e1996
06eedf8
788b2db
6fdd943
5c07508
04503db
4a0936a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15523,7 +15523,7 @@ void GetFanIndexForTwoSpeedCoil( | |
if (state.dataAirSystemsData->PrimaryAirSystems(FoundAirSysNum).Branch(FoundBranch).Comp(CompNum).CompType_Num == | ||
SimAirServingZones::CompType::Fan_Simple_VAV) { | ||
SupplyFanName = state.dataAirSystemsData->PrimaryAirSystems(FoundAirSysNum).Branch(FoundBranch).Comp(CompNum).Name; | ||
Fans::GetFanIndex(state, SupplyFanName, SupplyFanIndex, ErrorsFound, ObjexxFCL::Optional_string_const()); | ||
Fans::GetFanIndex(state, SupplyFanName, SupplyFanIndex, ErrorsFound); | ||
SupplyFan_TypeNum = DataHVACGlobals::FanType_SimpleVAV; | ||
break; | ||
// these are specified in SimAirServingZones and need to be moved to a Data* file. UnitarySystem=19 | ||
|
@@ -15687,8 +15687,8 @@ void GetDXCoilIndex(EnergyPlusData &state, | |
std::string const &DXCoilName, | ||
int &DXCoilIndex, | ||
bool &ErrorsFound, | ||
Optional_string_const ThisObjectType, | ||
Optional_bool_const SuppressWarning) | ||
std::string_view const ThisObjectType, | ||
bool const SuppressWarning) | ||
{ | ||
|
||
// SUBROUTINE INFORMATION: | ||
|
@@ -15706,11 +15706,10 @@ void GetDXCoilIndex(EnergyPlusData &state, | |
|
||
DXCoilIndex = UtilityRoutines::FindItemInList(DXCoilName, state.dataDXCoils->DXCoil); | ||
if (DXCoilIndex == 0) { | ||
if (present(SuppressWarning)) { | ||
if (!SuppressWarning) { | ||
// No warning printed if only searching for the existence of a DX Coil | ||
} else { | ||
if (present(ThisObjectType)) { | ||
ShowSevereError(state, ThisObjectType + ", GetDXCoilIndex: DX Coil not found=" + DXCoilName); | ||
if (!ThisObjectType.empty()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then the call to |
||
ShowSevereError(state, fmt::format("{}, GetDXCoilIndex: DX Coil not found={}", ThisObjectType, DXCoilName)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And finally the string handling is changed to something compatible with |
||
} else { | ||
ShowSevereError(state, "GetDXCoilIndex: DX Coil not found=" + DXCoilName); | ||
} | ||
|
@@ -15720,7 +15719,7 @@ void GetDXCoilIndex(EnergyPlusData &state, | |
} | ||
|
||
std::string | ||
GetDXCoilName(EnergyPlusData &state, int &DXCoilIndex, bool &ErrorsFound, Optional_string_const ThisObjectType, Optional_bool_const SuppressWarning) | ||
GetDXCoilName(EnergyPlusData &state, int &DXCoilIndex, bool &ErrorsFound, std::string_view const ThisObjectType, bool const SuppressWarning) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Functions like this should not be necessary. This should just be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These functions should hopefully only get called during the input phase, but (a) good point and (b) I agree. |
||
{ | ||
|
||
// SUBROUTINE INFORMATION: | ||
|
@@ -15737,20 +15736,18 @@ GetDXCoilName(EnergyPlusData &state, int &DXCoilIndex, bool &ErrorsFound, Option | |
} | ||
|
||
if (DXCoilIndex == 0) { | ||
if (present(SuppressWarning)) { | ||
if (!SuppressWarning) { | ||
// No warning printed if only searching for the existence of a DX Coil | ||
} else { | ||
if (present(ThisObjectType)) { | ||
ShowSevereError(state, ThisObjectType + ", GetDXCoilIndex: DX Coil not found "); | ||
if (!ThisObjectType.empty()) { | ||
ShowSevereError(state, fmt::format("{}, GetDXCoilIndex: DX Coil not found ", ThisObjectType)); | ||
} else { | ||
ShowSevereError(state, "GetDXCoilIndex: DX Coil not found "); | ||
} | ||
} | ||
ErrorsFound = true; | ||
return " "; | ||
return " "; // This does not seem great | ||
|
||
} else { | ||
|
||
return state.dataDXCoils->DXCoil(DXCoilIndex).Name; | ||
} | ||
} | ||
|
@@ -18395,7 +18392,7 @@ void CalcVRFCoilCapModFac(EnergyPlusData &state, | |
if (present(CoilIndex)) { | ||
CoilNum = CoilIndex; | ||
} else { | ||
GetDXCoilIndex(state, CoilName, CoilNum, ErrorsFound, ObjexxFCL::Optional_string_const(), ObjexxFCL::Optional_bool_const()); | ||
GetDXCoilIndex(state, CoilName, CoilNum, ErrorsFound, {}, true); | ||
} | ||
|
||
BFC_rate = state.dataDXCoils->DXCoil(CoilNum).RateBFVRFIUEvap; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -708,11 +708,11 @@ namespace DXCoils { | |
std::string const &DXCoilName, | ||
int &DXCoilIndex, | ||
bool &ErrorsFound, | ||
Optional_string_const ThisObjectType, | ||
Optional_bool_const SuppressWarning); | ||
std::string_view const ThisObjectType = {}, | ||
bool const SuppressWarning = false); | ||
|
||
std::string GetDXCoilName( | ||
EnergyPlusData &state, int &DXCoilIndex, bool &ErrorsFound, Optional_string_const ThisObjectType, Optional_bool_const SuppressWarning); | ||
EnergyPlusData &state, int &DXCoilIndex, bool &ErrorsFound, std::string_view const ThisObjectType = {}, bool const SuppressWarning = false); | ||
|
||
Real64 GetCoilCapacity(EnergyPlusData &state, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing. |
||
std::string const &CoilType, // must match coil types in this module | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is a good example of the easier changes. The argument is only used for errors, so the argument type is changed first.