]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid static function
authorDaniel Arndt <arndtd@ornl.gov>
Sat, 11 May 2019 16:31:20 +0000 (12:31 -0400)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 11 May 2019 16:54:05 +0000 (18:54 +0200)
examples/step-43/step-43.cc

index 9f7f7621a4b168cfd1791920348a6feb2ab9361f..1e5478f8691b9d80cb9ba03a3c120b17363532b8 100644 (file)
@@ -226,20 +226,12 @@ namespace Step43
 
     private:
       static std::vector<Point<dim>> centers;
-
-      static std::vector<Point<dim>> get_centers();
     };
 
 
 
     template <int dim>
-    std::vector<Point<dim>>
-      KInverse<dim>::centers = KInverse<dim>::get_centers();
-
-
-    template <int dim>
-    std::vector<Point<dim>> KInverse<dim>::get_centers()
-    {
+    std::vector<Point<dim>> KInverse<dim>::centers = []() {
       const unsigned int N =
         (dim == 2 ? 40 : (dim == 3 ? 100 : throw ExcNotImplemented()));
 
@@ -249,7 +241,7 @@ namespace Step43
           centers_list[i][d] = static_cast<double>(rand()) / RAND_MAX;
 
       return centers_list;
-    }
+    }();
 
 
 

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.