From 8a8ae8276edc9801f200105aac6012276610ed77 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 17 Dec 2024 20:38:25 -0700 Subject: [PATCH] Avoid another incorrect use of std::is_trivial. --- include/deal.II/lac/sparse_matrix.templates.h | 37 +++---------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index 2af8a963a4..67b0c9c74f 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -160,30 +160,6 @@ SparseMatrix::~SparseMatrix() -namespace internal -{ - namespace SparseMatrixImplementation - { - using size_type = types::global_dof_index; - - template - std::enable_if_t> - zero_subrange(const size_type begin, const size_type end, T *dst) - { - std::memset(dst + begin, 0, (end - begin) * sizeof(T)); - } - - template - std::enable_if_t> - zero_subrange(const size_type begin, const size_type end, T *dst) - { - std::fill(dst + begin, dst + end, 0); - } - } // namespace SparseMatrixImplementation -} // namespace internal - - - template SparseMatrix & SparseMatrix::operator=(const double d) @@ -210,18 +186,13 @@ SparseMatrix::operator=(const double d) parallel::apply_to_subranges( 0U, matrix_size, - [this](const size_type begin, const size_type end) { - internal::SparseMatrixImplementation::zero_subrange(begin, - end, - val.get()); + [values = this->val.get()](const size_type begin, const size_type end) { + std::fill(values + begin, values + end, number(0.)); }, grain_size); else if (matrix_size > 0) { - if constexpr (std::is_trivial_v) - std::memset(val.get(), 0, matrix_size * sizeof(number)); - else - std::fill(val.get(), val.get() + matrix_size, 0); + std::fill(val.get(), val.get() + matrix_size, 0); } return *this; @@ -477,6 +448,8 @@ namespace internal { namespace SparseMatrixImplementation { + using size_type = types::global_dof_index; + /** * Perform a vmult using the SparseMatrix data structures, but only using * a subinterval for the row indices. -- 2.39.5