From: Wolfgang Bangerth Date: Wed, 18 Dec 2024 03:38:25 +0000 (-0700) Subject: Avoid another incorrect use of std::is_trivial. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a8ae8276edc9801f200105aac6012276610ed77;p=dealii.git Avoid another incorrect use of std::is_trivial. --- 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.