From 4443e70ce0a1e45bd06a57de262e80afdc11d365 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 13 May 2020 15:23:00 -0600 Subject: [PATCH] Make the logic in step-50's main() function simpler. --- examples/step-50/step-50.cc | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index 4f031dfa35..7e92b77d7d 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -1488,15 +1488,28 @@ int main(int argc, char *argv[]) try { - if (settings.dimension == 2) - { - LaplaceProblem<2, 2> test(settings); - test.run(); - } - else if (settings.dimension == 3) + constexpr unsigned int fe_degree = 2; + + switch (settings.dimension) { - LaplaceProblem<3, 2> test(settings); - test.run(); + case 2: + { + LaplaceProblem<2, fe_degree> test(settings); + test.run(); + + break; + } + + case 3: + { + LaplaceProblem<3, fe_degree> test(settings); + test.run(); + + break; + } + + default: + Assert(false, ExcMessage("This program only works in 2d and 3d.")); } } catch (std::exception &exc) -- 2.39.5