From: Wolfgang Bangerth Date: Tue, 24 Oct 2023 17:08:18 +0000 (-0600) Subject: Make a variable a member variable. X-Git-Tag: relicensing~362^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7eb665bdb3faba19f27fdf7349f05e1104520e14;p=dealii.git Make a variable a member variable. --- 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)