From 7eb665bdb3faba19f27fdf7349f05e1104520e14 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 24 Oct 2023 11:08:18 -0600 Subject: [PATCH] Make a variable a member variable. --- include/deal.II/base/polynomial.h | 7 +++++++ source/base/polynomial.cc | 9 +-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/deal.II/base/polynomial.h b/include/deal.II/base/polynomial.h index 2f44aa63bc..7adedd9d4d 100644 --- a/include/deal.II/base/polynomial.h +++ b/include/deal.II/base/polynomial.h @@ -27,6 +27,7 @@ #include #include #include +#include #include DEAL_II_NAMESPACE_OPEN @@ -572,6 +573,12 @@ namespace Polynomials */ static std::vector>> recursive_coefficients; + + /** + * The mutex that guards read and write access to the + * `recursive_coefficients` array. + */ + static std::shared_mutex coefficients_lock; }; diff --git a/source/base/polynomial.cc b/source/base/polynomial.cc index 4dba286918..02b4004a5b 100644 --- a/source/base/polynomial.cc +++ b/source/base/polynomial.cc @@ -25,7 +25,6 @@ #include #include #include -#include 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>> Hierarchical::recursive_coefficients(20); + std::shared_mutex Hierarchical::coefficients_lock; Hierarchical::Hierarchical(const unsigned int k) -- 2.39.5