]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make the logic in step-50's main() function simpler.
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 13 May 2020 21:23:00 +0000 (15:23 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 14 May 2020 20:26:27 +0000 (14:26 -0600)
examples/step-50/step-50.cc

index 4f031dfa353866dbf0d4a08717353866ed7fefc3..7e92b77d7dc883101efd04b08e05cb72dc7d797c 100644 (file)
@@ -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)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.