Remove fmt: convert I* files to std::format (part 4)#11619
Conversation
Convert InternalHeatGains.cc, IceThermalStorage.cc, and ICEngineElectricGenerator.cc from EnergyPlus::format to std::format and replace the custom {:.NR} flag with standard specifiers. Magnitude-spanning density columns use {:#G} (A-H precedent), preserving precision for sub-0.1 values; the always-tiny CO2 rate uses {:.4E}; people counts use {:.1f}. Continues the remove-fmt campaign (#11553, #11588, #11592). Display-only; numeric results byte-identical to develop.
|
|
CI looks good ✅All checks pass. I went through the regression artifacts from both Linux and macOS. The 10 "Big Diffs" are all people-count display changes in the
Most are a count landing on a The one risk worth checking, checked. These files switch the density columns Why the diff count is on the higher side: densities use
|
|
|
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
Per-field, following the A–H precedent and chosen to preserve the reported precision:
People/Floor Area, the per-areaZone Internal Gains Nominalfields) →{:#G}. The old{:.NR}switched toscientific below 0.1, so a plain
{:.Nf}would truncate small values(
3.531E-002→0.035, losing two sig figs).{:#G}preserves precision(
0.0353101), matching how A–H handles these EIO "Nominal" tables.{:.4E}— reproduces the baseline mantissa exactly(
3.8200E-008→3.8200E-08, only exponent width differs).{:.1f}— matches the old 1-decimal echo.{:.3f}(exact match).Verification (energyplus-regressions vs develop, local Windows)
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.{:#G}has documented MSVC-vs-gcc trailing-zero divergence; local run isWindows-only, so CI (ubuntu/macos) is the authoritative check on the density
outputs. A–H already ship
{:#G}broadly, so risk is low but non-zero.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 per-field mapping (
{:#G}densities /{:.4E}CO2 /{:.1f}counts) theapproach you want, and are the 10 half-even count-flip diffs acceptable (consistent
with prior parts)?