Skip to content

Commit

Permalink
Remove RoundSigDigits and TrimSigDigits, use libfmt
Browse files Browse the repository at this point in the history
* Remove the RoundSigDigits and TrimSigDigits functions
  * They were over used and misused for integer->string conversions
* Merge any string concatenations that used Round/Trim functions
  into libfmt operations
* Overall binary is ~2% smaller
* Diff set still needs to be formatted
  • Loading branch information
lefticus committed Nov 13, 2020
1 parent 283b640 commit 16efb27
Show file tree
Hide file tree
Showing 208 changed files with 5,610 additions and 8,273 deletions.
10 changes: 4 additions & 6 deletions src/EnergyPlus/AirLoopHVACDOAS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ namespace AirLoopHVACDOAS {
if (!(CompNum == 1 || CompNum == state.dataAirLoop->OutsideAirSys(thisDOAS.m_OASystemNum).NumComponents)) {
ShowSevereError(state, "The fan placement is either first as blow through or last as draw through in" + CurrentModuleObject +
" = " + state.dataAirLoop->OutsideAirSys(thisDOAS.m_OASystemNum).ComponentName(CompNum));
ShowContinueError(state, "The current position is number " + General::RoundSigDigits(CompNum));
ShowContinueError(state, format("The current position is number {}", CompNum));
errorsFound = true;
}
} else if (SELECT_CASE_var == "FAN:COMPONENTMODEL") {
Expand All @@ -461,7 +461,7 @@ namespace AirLoopHVACDOAS {
if (!(CompNum == 1 || CompNum == state.dataAirLoop->OutsideAirSys(thisDOAS.m_OASystemNum).NumComponents)) {
ShowSevereError(state, "The fan placement is either first as blow through or last as draw through in" + CurrentModuleObject +
" = " + state.dataAirLoop->OutsideAirSys(thisDOAS.m_OASystemNum).ComponentName(CompNum));
ShowContinueError(state, "The current position is number " + General::RoundSigDigits(CompNum));
ShowContinueError(state, format("The current position is number {}", CompNum));
errorsFound = true;
}
} else if (SELECT_CASE_var == "COIL:COOLING:WATER") {
Expand Down Expand Up @@ -743,8 +743,7 @@ namespace AirLoopHVACDOAS {
thisDOAS.NumOfAirLoops = fields.at("number_of_airloophvac"); //
if (thisDOAS.NumOfAirLoops < 1) {
cFieldName = "Number of AirLoopHVAC";
ShowSevereError(state, cCurrentModuleObject + ", \"" + thisDOAS.Name + "\" " + cFieldName + " = " +
General::TrimSigDigits(thisDOAS.NumOfAirLoops));
ShowSevereError(state, fmt::format("{}, \"{}\" {} = {}", cCurrentModuleObject, thisDOAS.Name, cFieldName, thisDOAS.NumOfAirLoops));
ShowContinueError(state, " The minimum value should be 1.");
errorsFound = true;
}
Expand Down Expand Up @@ -1022,8 +1021,7 @@ namespace AirLoopHVACDOAS {
if (loop.ConveCount == 0) {
++loop.ConveCount;
ShowWarningError(state, "Convergence limit is above 1.0e-6 for unit=" + loop.Name);
ShowContinueErrorTimeStamp(state, "The max difference of node temperatures between AirLoopDOAS outlet and OA mixer inlet =" +
General::RoundSigDigits(maxDiff, 6));
ShowContinueErrorTimeStamp(state, format("The max difference of node temperatures between AirLoopDOAS outlet and OA mixer inlet ={:.6R}", maxDiff));
} else {
++loop.ConveCount;
ShowRecurringWarningErrorAtEnd(loop.Name +
Expand Down
9 changes: 3 additions & 6 deletions src/EnergyPlus/AirflowNetwork/src/Properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,15 @@ namespace AirflowNetwork {
if (lowerLimitErrIdx == 0) {
ShowWarningMessage(state, "Air temperature below lower limit of -20C for conductivity calculation");
}
ShowRecurringWarningErrorAtEnd("Air temperature below lower limit of -20C for conductivity calculation. "
"Air temperature of " + General::RoundSigDigits(LowerLimit, 1) +
" used for conductivity calculation.",
ShowRecurringWarningErrorAtEnd(format("Air temperature below lower limit of -20C for conductivity calculation. Air temperature of {:.1R} used for conductivity calculation.", LowerLimit),
lowerLimitErrIdx);
T = LowerLimit;
} else if (T > UpperLimit) {
if (upperLimitErrIdx == 0) {
ShowWarningMessage(state, "Air temperature above upper limit of 70C for conductivity calculation");
}
ShowRecurringWarningErrorAtEnd("Air temperature below lower limit of 70C for conductivity calculation. "
"Air temperature of " + General::RoundSigDigits(UpperLimit, 1) +
" used for conductivity calculation.",
ShowRecurringWarningErrorAtEnd(format("Air temperature above upper limit of 70C for conductivity calculation. Air temperature of {:.1R} used for conductivity calculation.",
UpperLimit),
upperLimitErrIdx);
T = UpperLimit;
}
Expand Down
Loading

4 comments on commit 16efb27

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove_round_trim_cleanup_formatting (lefticus) - x86_64-MacOS-10.15-clang-11.0.0: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

integration Test Summary

  • Passed: 2
  • Failed: 717

regression Test Summary

  • Passed: 715
  • Failed: 2

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove_round_trim_cleanup_formatting (lefticus) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

integration Test Summary

  • Passed: 2
  • Failed: 720

regression Test Summary

  • Passed: 735
  • Failed: 2

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove_round_trim_cleanup_formatting (lefticus) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove_round_trim_cleanup_formatting (lefticus) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: Build Failed

Failures:\n

integration Test Summary

  • Passed: 2
  • Failed: 720

Build Badge Test Badge Coverage Badge

Please sign in to comment.