]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify some code. 4687/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 3 Aug 2017 12:54:46 +0000 (06:54 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 3 Aug 2017 12:54:46 +0000 (06:54 -0600)
If you can write code in one line instead of two, then that's worth it :-)

source/fe/fe_tools.cc

index d5a640f3051780c4361bced2002e358f92a03b41..df9ba2c500c4bcc55edb3b859cb6f1f823547f56 100644 (file)
@@ -2917,13 +2917,10 @@ namespace FETools
   void
   hierarchic_to_lexicographic_numbering (unsigned int degree, std::vector<unsigned int> &h2l)
   {
-    // number of support points in each
-    // direction
+    // number of support points in each direction
     const unsigned int n = degree+1;
 
-    unsigned int dofs_per_cell = n;
-    for (unsigned int i=1; i<dim; ++i)
-      dofs_per_cell *= n;
+    const unsigned int dofs_per_cell = Utilities::fixed_power<dim>(n);
 
     // Assert size maches degree
     AssertDimension (h2l.size(), dofs_per_cell);

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.