Remove fmt: convert I* files to std::format (part 4)#11618
Closed
brianlball wants to merge 1 commit into
Closed
Conversation
Convert InternalHeatGains.cc, IceThermalStorage.cc, and ICEngineElectricGenerator.cc from EnergyPlus::format to std::format and replace the custom {:.NR} flag with standard specifiers ({:.Nf} for |v|>=0.1, {:.NE} for tiny values, {:.1f} for counts). Continues the remove-fmt campaign (#11553, #11588, #11592). Display-only; numeric results byte-identical to develop.
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Continues the remove-
fmtcampaign (#11553, #11588, #11592). Converts theI*source files from
EnergyPlus::format/fmt::formatto C++20std::formatandreplaces the custom
{:.NR}flag with standard specifiers.Scope
0
{R}/{T}and 0EnergyPlus::formatremain in these files. The DoubleWrapper /Fortran-format machinery in
IOFiles.hhis left untouched (later PR).Specifier mapping (the bit to sanity-check)
Following the A–H precedent, chosen to minimize regression diffs:
{:.NR}for |v| >= 0.1 (the common case) ->{:.Nf}— reproduces the old fixedoutput exactly, so zero diff.
{:.NE}— matches the old scientificmantissa with no truncation; avoids
{:.Nf}rounding it to0.000.{:.1f}— matches the old 1-decimal echo.Note on
{:#G}/{:G}: this PR doesn't use it, but that's not a departure fromthe campaign convention. None of the I* fields are the
m3/s/Wsizing/flow classthat #11553's
{:G}normalization targets — these are density/count echo fieldswhose baseline was fixed
{:.NR}, so{:.Nf}/{:.NE}reproduce them exactly while{:#G}would reveal extra sig figs and add avoidable small diffs. (The{:#G}->{:.5f}revert in #11592,bd0c1a1048, is the precedent for preferring a fixedspec where it matches and avoids platform-divergence risk.)
Verification (energyplus-regressions vs develop, local)
The 10 big are irreducible
x.x5people-count flips — old{R}rounds half-up,std::formatrounds half-to-even. Same benign class accepted in Remove fmt - Part 2: Remove{R}, Files A-D #11588/Remove fmt - Part 3: Remove {R}, Files E-H #11592.the specifier choices.
Indentation note
Whitespace-only line changes are clang-format v19 reflow:
std::formatis 7 charsshorter than
EnergyPlus::format, so wrapped calls collapse under the 150-collimit.
pre-commit run clang-formatpasses clean.Question for review
Is the
{:.Nf}/{:.NE}/{:.1f}mapping the approach you want for this valueclass, and are the 10 half-even count-flip diffs acceptable (consistent with prior
parts)?