Skip to content

Remove fmt: convert J-R files to std::format (part 5)#11630

Merged
mitchute merged 11 commits into
developfrom
remove-fmt-part-5
Jun 12, 2026
Merged

Remove fmt: convert J-R files to std::format (part 5)#11630
mitchute merged 11 commits into
developfrom
remove-fmt-part-5

Conversation

@brianlball

@brianlball brianlball commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Part 5 of the Remove-fmt campaign (continues #11553 / #11588 / #11592, and #11619 for the I* files).

Scope — 35 source files, basenames J–R

Convert EnergyPlus::format / fmt::formatstd::format and remove the custom {R} flag ({:.NR}{:.Nf}).
LowTempRadiantSystem, Material, Micro{CHP,turbine}ElectricGenerator, MixedAir, OutdoorAirUnit, Output{Reports,ReportTabular}, OutsideEnergySources, PackagedThermalStorageCoil, PCMThermalStorage, Photovoltaic{s,ThermalCollectors}, PipeHeatTransfer, Plant{CentralGSHP,Chillers,ComponentTemperatureSources,CondLoopOperation,HeatExchangerFluidToFluid,LoopHeatPumpEIR,Utilities}, Plant/{Loop,LoopSide,PlantManager}, PondGroundHeatExchanger, PoweredInductionUnits, Psychrometrics, Pumps, PurchasedAirManager, PVWatts, RefrigeratedCase, RoomAirModel{AirflowNetwork,Manager,UserTempPattern}, RuntimeLanguageProcessor.

Conversions

  • 905 EnergyPlus::format + 5 fmt::format910 std::format
  • 669 {:.NR}{:.Nf}; 0 residual {R}

Convert EnergyPlus::format/fmt::format -> std::format and {:.NR} -> {:.Nf}
in 35 J-R source files. fmt::join and raw-enum format args are kept on their
fmt entry point (no std::formatter exists). Surface-report view factors stay
{:.2f} (matches the coarse {:.2R} baseline; {:#G} measured worse).

No numeric result diffs; remaining EIO/table diffs are display-precision only.
@brianlball brianlball added the Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring label Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 10d073b

Regression Summary
  • EIO: 130
  • Table Big Diffs: 41
  • Table Small Diffs: 58
  • ERR: 2
  • PERF_LOG: 1

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 10d073b

Regression Summary
  • EIO: 130
  • Table Big Diffs: 41
  • Table Small Diffs: 58
  • ERR: 2
  • PERF_LOG: 1

@jmarrec

jmarrec commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

CO2ControlDesignOARateTest fails

" ** ~~~ ** Minimum OA fraction = 2.9412E-003, Mech Vent OA fraction = 1.5603E-003",

-        "   **   ~~~   ** Minimum OA fraction = 2.9412E-003, Mech Vent OA fraction = 1.5603E-003",
+        "   **   ~~~   ** Minimum OA fraction = 0.0029, Mech Vent OA fraction = 0.0016",

@brianlball FYI

git apply << 'EOF'
diff --git a/tst/EnergyPlus/unit/MixedAir.unit.cc b/tst/EnergyPlus/unit/MixedAir.unit.cc
index 13cef0f122..679a4d8a5c 100644
--- a/tst/EnergyPlus/unit/MixedAir.unit.cc
+++ b/tst/EnergyPlus/unit/MixedAir.unit.cc
@@ -6844,7 +6844,7 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest)
         "1, Min OA fraction is used.",
         "   **   ~~~   ** This may be overriding desired ventilation controls. Check inputs for Minimum Outdoor Air Flow Rate, Minimum Outdoor Air "
         "Schedule Name and Controller:MechanicalVentilation",
-        "   **   ~~~   ** Minimum OA fraction = 2.9412E-003, Mech Vent OA fraction = 1.5603E-003",
+        "   **   ~~~   ** Minimum OA fraction = 0.0029, Mech Vent OA fraction = 0.0016",
         "   **   ~~~   **  Environment=, at Simulation time= 00:00 - 00:15",
     });

EOF

@brianlball, you can revert if you don't like it, just figured having CI running while it's nighttime would save you a bit of wait time when you wake up
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 05167b4

Regression Summary
  • EIO: 130
  • Table Big Diffs: 41
  • Table Small Diffs: 58
  • ERR: 2
  • PERF_LOG: 1

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 05167b4

Regression Summary
  • EIO: 130
  • Table Big Diffs: 41
  • Table Small Diffs: 58
  • ERR: 2
  • PERF_LOG: 1

View factors span 0-1 and dip below 0.1; {:.2f} truncated those cells
(2.34E-002 -> 0.02). {:#G} matches the parts 2/3 magnitude-spanning
precedent. Geometry columns (area/angles/vertices) stay {:.2f}.
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 270618b

Regression Summary
  • EIO: 183
  • Table Big Diffs: 81
  • Table Small Diffs: 28
  • ERR: 2
  • PERF_LOG: 1

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 270618b

Regression Summary
  • EIO: 183
  • Table Big Diffs: 81
  • Table Small Diffs: 28
  • ERR: 2
  • PERF_LOG: 1

View factors now render 0.500000 (6 sig figs) instead of 0.50.
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit ecde481

Regression Summary
  • EIO: 183
  • Table Big Diffs: 81
  • Table Small Diffs: 28
  • ERR: 2
  • PERF_LOG: 1

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit ecde481

Regression Summary
  • EIO: 183
  • Table Big Diffs: 81
  • Table Small Diffs: 28
  • ERR: 2
  • PERF_LOG: 1

std::format({:#G}, 0.5) renders 0.500000 on MSVC/libstdc++ but
0.50000 on macOS libc++, so there is no portable output and CI cannot
pass. {:.2f} is standardized across STLs and passed all platforms.
Restores the original part-5 state (byte-identical to a29e90c).
@brianlball

brianlball commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @jmarrec for catching CO2ControlDesignOARateTest and pushing the fix overnight, much appreciated.

Status: green on {:.2f}. Regression summary (CI run 27190988596, ubuntu-24.04 == macos-14, byte-identical):

Bucket Count
Table Big Diffs 41
Table Small Diffs 58
EIO 130
ERR 2
PERF_LOG 1
  • 0 numeric result diffs (ESO/MTR unchanged).
  • The 41 Table Big Diffs are all surface-details .eio echo cells ({:.2R}?{:.2f}): sub-0.1 view factors truncate, and a few Width/Height values flip on half-up vs half-even rounding. Display-only, no result impact.

Note on view factors: I briefly tried {:#G} here to preserve sub-0.1 precision and match the A?H spanning-column convention, but reverted ? std::format("{:#G}", 0.5) is not portable: 0.500000 on MSVC/libstdc++ vs 0.50000 on macOS libc++ (segfaulted the surface-details unit test on Mac). {:.2f} is standardized across STLs, so view factors stay {:.2f} and the sub-0.1 truncation is accepted as irreducible.

(CI re-running on b7daa3a, byte-identical to the green run linked above.)

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 97961b0

Regression Summary
  • EIO: 130
  • Table Big Diffs: 41
  • Table Small Diffs: 58
  • ERR: 2
  • PERF_LOG: 1

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 97961b0

Regression Summary
  • EIO: 130
  • Table Big Diffs: 41
  • Table Small Diffs: 58
  • ERR: 2
  • PERF_LOG: 1

@mitchute

mitchute commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

@brianlball it looks like there's still some EnergyPlus::format statements in the J-R block of files. Also, I checked and this is going to conflict with @jmarrec's #11620 pull request. That one is still showing some build failures, so I guess we'll go with this one first, if you're able to get to those remaining string format conversions before.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 2361378

Regression Summary
  • EIO: 130
  • Table Big Diffs: 41
  • Table Small Diffs: 58
  • ERR: 2
  • PERF_LOG: 1

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 2361378

Regression Summary
  • EIO: 130
  • Table Big Diffs: 41
  • Table Small Diffs: 58
  • ERR: 2
  • PERF_LOG: 1

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 300ec95

Regression Summary
  • EIO: 205
  • Table Small Diffs: 34
  • Table Big Diffs: 93
  • Audit: 13
  • ERR: 2
  • PERF_LOG: 1

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 300ec95

Regression Summary
  • EIO: 205
  • Table Small Diffs: 34
  • Table Big Diffs: 93
  • Audit: 13
  • ERR: 2
  • PERF_LOG: 1

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 78e2426

Regression Summary
  • EIO: 193
  • Table Small Diffs: 34
  • Table Big Diffs: 81
  • ERR: 2
  • PERF_LOG: 1

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 78e2426

Regression Summary
  • EIO: 193
  • Table Small Diffs: 34
  • Table Big Diffs: 81
  • ERR: 2
  • PERF_LOG: 1

@mitchute

Copy link
Copy Markdown
Collaborator

I think this one is ready to go. The big table and eio diffs are because we turned up the precision slightly in a few places, where it made sense.

Develop
Screenshot 2026-06-11 at 1 07 21 PM

This branch
Screenshot 2026-06-11 at 1 07 35 PM

If you have issues with this or other proposed changes here, let me know.

@jmarrec

jmarrec commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
HeatBalanceManager.cc
3032:                    constexpr const char *Format_731{" Warmup Convergence Information - Detailed, {},{},{},{:.10R},{:.10R}\n"};
3280:                constexpr const char *Format_731(" Warmup Convergence Information,{},{},{:.10R},{:.10R},{},{},{:.10R},{:.10R},{},{}\n")

GroundHeatExchangers/Slinky.cc
154:            ShowContinueError(state, EnergyPlus::format("...{}=[{:.3R}].", "Trench Depth", this->trenchDepth));
155:            ShowContinueError(state, EnergyPlus::format("...{}=[{:.3R}].", "Coil Depth", this->coilDepth));
177:        ShowContinueError(state, EnergyPlus::format("...{}=[{:.3R}].", "Pipe Thickness", this->pipe.thickness));
178:        ShowContinueError(state, EnergyPlus::format("...{}=[{:.3R}].", "Pipe Outer Diameter", this->pipe.outDia));

@mitchute

Copy link
Copy Markdown
Collaborator

Thanks, @jmarrec. 081f2fe

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit d88e2ac

Regression Summary
  • Table Small Diffs: 560
  • EIO: 740
  • Table Big Diffs: 81
  • ERR: 2
  • PERF_LOG: 1

@github-actions

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit d88e2ac

Regression Summary
  • Table Small Diffs: 558
  • EIO: 736
  • Table Big Diffs: 81
  • ERR: 2
  • PERF_LOG: 1

@mitchute

Copy link
Copy Markdown
Collaborator

Thanks @brianlball. This one is ready to go. Merging.

@mitchute mitchute merged commit befcfcb into develop Jun 12, 2026
11 checks passed
@mitchute mitchute deleted the remove-fmt-part-5 branch June 12, 2026 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants