]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make a variable a member variable. 16181/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 24 Oct 2023 17:08:18 +0000 (11:08 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 24 Oct 2023 17:25:13 +0000 (11:25 -0600)
include/deal.II/base/polynomial.h
source/base/polynomial.cc

index 2f44aa63bc1395ca4f222166f1332a34a05f27f7..7adedd9d4dc0748439e2dcf6146c1b80b7461613 100644 (file)
@@ -27,6 +27,7 @@
 #include <array>
 #include <limits>
 #include <memory>
+#include <shared_mutex>
 #include <vector>
 
 DEAL_II_NAMESPACE_OPEN
@@ -572,6 +573,12 @@ namespace Polynomials
      */
     static std::vector<std::unique_ptr<const std::vector<double>>>
       recursive_coefficients;
+
+    /**
+     * The mutex that guards read and write access to the
+     * `recursive_coefficients` array.
+     */
+    static std::shared_mutex coefficients_lock;
   };
 
 
index 4dba2869184d00bfc4b341de0e2be660340c6441..02b4004a5b9aa74d4d64238a64ae3ed1e731faf5 100644 (file)
@@ -25,7 +25,6 @@
 #include <cmath>
 #include <limits>
 #include <memory>
-#include <shared_mutex>
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -847,18 +846,12 @@ namespace Polynomials
 
   // ------------------ class Hierarchical --------------- //
 
-  // have a lock that guarantees that at most one thread is changing and
-  // accessing the `recursive_coefficients array.
-  namespace
-  {
-    std::shared_mutex coefficients_lock;
-  }
-
   // Reserve space for polynomials up to degree 19. Should be sufficient
   // for the start.
   std::vector<std::unique_ptr<const std::vector<double>>>
     Hierarchical::recursive_coefficients(20);
 
+  std::shared_mutex Hierarchical::coefficients_lock;
 
 
   Hierarchical::Hierarchical(const unsigned int k)

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.