From: Wolfgang Bangerth Date: Wed, 13 May 2020 21:23:00 +0000 (-0600) Subject: Make the logic in step-50's main() function simpler. X-Git-Tag: v9.2.0-rc2~7^2~12 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4443e70ce0a1e45bd06a57de262e80afdc11d365;p=dealii.git Make the logic in step-50's main() function simpler. --- 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)