From c09950ca5588831102f9d8d7250554d314c3d749 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 7 Jul 2017 19:52:28 -0400 Subject: [PATCH] de-templatize SparsityPattern::copy_from. This template is instantiated for only SparsityPattern and is overloaded for DynamicSparsityPattern, so it is a bit simpler to just overload a non-template method. --- include/deal.II/lac/sparsity_pattern.h | 16 ++++++++------- source/lac/sparsity_pattern.cc | 27 ++++++++++++-------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/include/deal.II/lac/sparsity_pattern.h b/include/deal.II/lac/sparsity_pattern.h index 369a58c554..f6f6f53b04 100644 --- a/include/deal.II/lac/sparsity_pattern.h +++ b/include/deal.II/lac/sparsity_pattern.h @@ -38,6 +38,7 @@ DEAL_II_NAMESPACE_OPEN class SparsityPattern; +class DynamicSparsityPattern; class ChunkSparsityPattern; template class FullMatrix; template class SparseMatrix; @@ -630,15 +631,16 @@ public: const ForwardIterator end); /** - * Copy data from an object of type DynamicSparsityPattern. Although not a - * compressed sparsity pattern, this function is also instantiated if the - * argument is of type SparsityPattern (i.e., the current class). Previous - * content of this object is lost, and the sparsity pattern is in compressed - * mode afterwards. + * Copy data from a DynamicSparsityPattern. Previous content of this object + * is lost, and the sparsity pattern is in compressed mode afterwards. */ - template - void copy_from (const SparsityPatternType &dsp); + void copy_from (const DynamicSparsityPattern &dsp); + /** + * Copy data from a SparsityPattern. Previous content of this object is + * lost, and the sparsity pattern is in compressed mode afterwards. + */ + void copy_from (const SparsityPattern &sp); /** * Take a full matrix and use its nonzero entries to generate a sparse diff --git a/source/lac/sparsity_pattern.cc b/source/lac/sparsity_pattern.cc index bc35387af8..3a51a46b96 100644 --- a/source/lac/sparsity_pattern.cc +++ b/source/lac/sparsity_pattern.cc @@ -482,33 +482,32 @@ SparsityPattern::compress () -template void -SparsityPattern::copy_from (const SparsityPatternType &dsp) +SparsityPattern::copy_from (const SparsityPattern &sp) { // first determine row lengths for each row. if the matrix is quadratic, // then we might have to add an additional entry for the diagonal, if that // is not yet present. as we have to call compress anyway later on, don't // bother to check whether that diagonal entry is in a certain row or not - const bool do_diag_optimize = (dsp.n_rows() == dsp.n_cols()); - std::vector row_lengths (dsp.n_rows()); - for (size_type i=0; i row_lengths (sp.n_rows()); + for (size_type i=0; i void SparsityPattern::copy_from (const DynamicSparsityPattern &dsp) { @@ -1038,7 +1036,6 @@ SparsityPattern::memory_consumption () const // explicit instantiations -template void SparsityPattern::copy_from (const SparsityPattern &); template void SparsityPattern::copy_from (const FullMatrix &); template void SparsityPattern::copy_from (const FullMatrix &); -- 2.39.5