From 561f4ca12e56306e4764588a13071e176c39c2c7 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Wed, 29 Oct 2025 14:48:08 +0100 Subject: [PATCH 1/2] add default case to switch statement --- src/mg_solver/HpMultiGrid.H | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mg_solver/HpMultiGrid.H b/src/mg_solver/HpMultiGrid.H index 5cf1c67f84..215e364225 100644 --- a/src/mg_solver/HpMultiGrid.H +++ b/src/mg_solver/HpMultiGrid.H @@ -185,8 +185,9 @@ public: return 2; case 3: return 1; + default: + return 0; } - return 0; } /** \brief Return the number of acf components used for a given system type @@ -200,9 +201,9 @@ public: case 2: return 2; case 3: + default: return 0; } - return 0; } /** When applying Dirichlet boundary conditions, shift boundary value by offset number of cells */ From 67db97400824e12c582c3a7fe4f4828b28fd0de8 Mon Sep 17 00:00:00 2001 From: lucafedeli88 Date: Thu, 30 Oct 2025 00:17:41 +0100 Subject: [PATCH 2/2] abort if system_type is not what is expected --- src/mg_solver/HpMultiGrid.H | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mg_solver/HpMultiGrid.H b/src/mg_solver/HpMultiGrid.H index 215e364225..8dac50a104 100644 --- a/src/mg_solver/HpMultiGrid.H +++ b/src/mg_solver/HpMultiGrid.H @@ -186,8 +186,9 @@ public: case 3: return 1; default: - return 0; + amrex::Abort(std::to_string(system_type) + " is not a valid system_type!"); } + return 0; //unreachable } /** \brief Return the number of acf components used for a given system type @@ -201,9 +202,11 @@ public: case 2: return 2; case 3: - default: return 0; + default: + amrex::Abort(std::to_string(system_type) + " is not a valid system_type!"); } + return 0; //unreachable } /** When applying Dirichlet boundary conditions, shift boundary value by offset number of cells */