From: Wolfgang Bangerth Date: Wed, 25 Nov 2020 05:08:33 +0000 (-0700) Subject: Correct poor naming of a class. X-Git-Tag: v9.3.0-rc1~840^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a66074f279f075e91518714f0ac91143b9db6d1e;p=dealii.git Correct poor naming of a class. Specifically, the IsBlockMatrix class was also used to ask whether a class is a block sparsity pattern. That's poor programming style, but easy to fix by duplicating the class. --- diff --git a/include/deal.II/lac/affine_constraints.h b/include/deal.II/lac/affine_constraints.h index 03169d4b56..98b2cf8cd0 100644 --- a/include/deal.II/lac/affine_constraints.h +++ b/include/deal.II/lac/affine_constraints.h @@ -2280,8 +2280,8 @@ template class BlockSparseMatrixEZ; /** - * A class that can be used to determine whether a given type is a block - * matrix or block sparsity pattern type or not. For example, + * A "traits" class that can be used to determine whether a given type is a + * block matrix type or not. For example, * @code * IsBlockMatrix >::value * @endcode @@ -2309,14 +2309,6 @@ private: static std::true_type check(const BlockMatrixBase *); - /** - * Overload returning true if the class is derived from - * BlockSparsityPatternBase, which is what block sparsity patterns do. - */ - template - static std::true_type - check(const BlockSparsityPatternBase *); - /** * Overload for BlockSparseMatrixEZ, which is the only block matrix not * derived from BlockMatrixBase at the time of writing this class. @@ -2326,7 +2318,7 @@ private: check(const BlockSparseMatrixEZ *); /** - * Catch all for all other potential matrix types that are not block + * Catch all for all other potential types that are then apparently not block * matrices. */ static std::false_type @@ -2337,7 +2329,7 @@ public: * A statically computable value that indicates whether the template * argument to this class is a block matrix (in fact whether the type is * derived from BlockMatrixBase or is one of the other block matrix - * or block sparsity pattern types). + * types). */ static const bool value = std::is_same())), @@ -2348,6 +2340,51 @@ public: template const bool IsBlockMatrix::value; + +/** + * A class that can be used to determine whether a given type is a block + * sparsity pattern type or not. In this, it matches the IsBlockMatrix + * class. + * + * @see + * @ref GlossBlockLA "Block (linear algebra)" + */ +template +struct IsBlockSparsityPattern +{ +private: + /** + * Overload returning true if the class is derived from + * BlockSparsityPatternBase, which is what block sparsity patterns do. + */ + template + static std::true_type + check(const BlockSparsityPatternBase *); + + /** + * Catch all for all other potential types that are then apparently not block + * sparsity patterns. + */ + static std::false_type + check(...); + +public: + /** + * A statically computable value that indicates whether the template + * argument to this class is a block sparsity pattern (in fact whether the + * type is derived from BlockSparsityPatternBase). + */ + static const bool value = + std::is_same())), + std::true_type>::value; +}; + +// instantiation of the static member +template +const bool IsBlockSparsityPattern::value; + + + template template inline void @@ -2369,6 +2406,8 @@ AffineConstraints::distribute_local_to_global( std::integral_constant::value>()); } + + template template inline void @@ -2392,6 +2431,8 @@ AffineConstraints::distribute_local_to_global( std::integral_constant::value>()); } + + template template inline void @@ -2408,7 +2449,9 @@ AffineConstraints::add_entries_local_to_global( sparsity_pattern, keep_constrained_entries, dof_mask, - std::integral_constant::value>()); + std::integral_constant< + bool, + IsBlockSparsityPattern::value>()); } DEAL_II_NAMESPACE_CLOSE