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<SparseMatrix<number> >::value
* @endcode
static std::true_type
check(const BlockMatrixBase<T> *);
- /**
- * Overload returning true if the class is derived from
- * BlockSparsityPatternBase, which is what block sparsity patterns do.
- */
- template <typename T>
- static std::true_type
- check(const BlockSparsityPatternBase<T> *);
-
/**
* Overload for BlockSparseMatrixEZ, which is the only block matrix not
* derived from BlockMatrixBase at the time of writing this class.
check(const BlockSparseMatrixEZ<T> *);
/**
- * 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
* 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<T> or is one of the other block matrix
- * or block sparsity pattern types).
+ * types).
*/
static const bool value =
std::is_same<decltype(check(std::declval<MatrixType *>())),
template <typename MatrixType>
const bool IsBlockMatrix<MatrixType>::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 <typename MatrixType>
+struct IsBlockSparsityPattern
+{
+private:
+ /**
+ * Overload returning true if the class is derived from
+ * BlockSparsityPatternBase, which is what block sparsity patterns do.
+ */
+ template <typename T>
+ static std::true_type
+ check(const BlockSparsityPatternBase<T> *);
+
+ /**
+ * 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<T>).
+ */
+ static const bool value =
+ std::is_same<decltype(check(std::declval<MatrixType *>())),
+ std::true_type>::value;
+};
+
+// instantiation of the static member
+template <typename MatrixType>
+const bool IsBlockSparsityPattern<MatrixType>::value;
+
+
+
template <typename number>
template <typename MatrixType>
inline void
std::integral_constant<bool, IsBlockMatrix<MatrixType>::value>());
}
+
+
template <typename number>
template <typename MatrixType, typename VectorType>
inline void
std::integral_constant<bool, IsBlockMatrix<MatrixType>::value>());
}
+
+
template <typename number>
template <typename SparsityPatternType>
inline void
sparsity_pattern,
keep_constrained_entries,
dof_mask,
- std::integral_constant<bool, IsBlockMatrix<SparsityPatternType>::value>());
+ std::integral_constant<
+ bool,
+ IsBlockSparsityPattern<SparsityPatternType>::value>());
}
DEAL_II_NAMESPACE_CLOSE