FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0053 — SolverPlan LinearSolverText compares a string to "SPGMR" instead of the enum
ID 0053
Class ARCHITECTURE
Severity 1
Status ready

Models: —

Found: 2026-10-20 architecture review (a406e955); owner ruled "default ok" on the whole plan 2026-10-20

Source plan: plans/arch-2026-10-20/not-implemented/f9-sundials-solver-plan.md (workspace fhsim_workspace)

Kind: Bit for bit refactor. Take when passing; rides with: next feature in src/engine/integrator/.

Evidence

src/engine/integrator/linear/SolverPlan.cpp:294-307. The plan turns the enum into a string at :359 (linType = hasNewton ? ToString(plan.m_sundialsLinearSolver) : "none"), passes the string to LinearSolverText (:361), which compares it back:

std::string LinearSolverText(const std::string& linType, const std::string& preconditionerName,
IJacobianSystem* jacobian)
{
if (linType != "SPGMR") {

The enum SundialsLinearSolver is already in hand at the call site (plan.m_sundialsLinearSolver).

Effect

None for users. A rename of the enum text would silently change the branch taken. The "none" case (no Newton) shares the string path.

Possible fix

Pass the SundialsLinearSolver enum (and a flag for "no Newton") instead of the string. Log text unchanged.

Test that would prove it

SolverPlanTable_test.cpp and SolverPlan_test.cpp already pin the summary text; they must pass unchanged.

Risk

Very low; refactor with the summary text pinned by existing tests.