From 2ea52fe80ebd4a9982724a23b2bfc63add7be8f5 Mon Sep 17 00:00:00 2001 From: kronbichler Date: Tue, 25 Feb 2014 08:02:52 +0000 Subject: [PATCH] Improve speed a little more by using add_entries in distributed version of Cuthill_McKee renumbering. Add some assertions. git-svn-id: https://svn.dealii.org/trunk@32549 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/full_matrix.h | 2 +- deal.II/source/dofs/dof_renumbering.cc | 6 +++++- deal.II/source/lac/lapack_full_matrix.cc | 4 +++- deal.II/source/lac/sparsity_pattern.cc | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/deal.II/include/deal.II/lac/full_matrix.h b/deal.II/include/deal.II/lac/full_matrix.h index fc5793e53e..3ebef4e653 100644 --- a/deal.II/include/deal.II/lac/full_matrix.h +++ b/deal.II/include/deal.II/lac/full_matrix.h @@ -1195,7 +1195,7 @@ FullMatrix::operator = (const number d) (void)d; // removes -Wunused-parameter warning in optimized mode if (this->n_elements() != 0) - std::memset (&this->values[0], 0, this->n_elements()*sizeof(number)); + this->reset_values(); return *this; } diff --git a/deal.II/source/dofs/dof_renumbering.cc b/deal.II/source/dofs/dof_renumbering.cc index 2e8f6497d8..d341ce93fc 100644 --- a/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/source/dofs/dof_renumbering.cc @@ -420,13 +420,17 @@ namespace DoFRenumbering row_lengths[i] = csp.row_length(locally_owned.nth_index_in_set(i)); sparsity.reinit(locally_owned.n_elements(), locally_owned.n_elements(), row_lengths); + std::vector row_entries; for (unsigned int i=0; i::operator = (const double d) Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); if (this->n_elements() != 0) - std::fill (this->values.begin(), this->values.end(), number()); + this->reset_values(); state = LAPACKSupport::matrix; return *this; @@ -551,6 +551,7 @@ LAPACKFullMatrix::apply_lu_factorization(Vector &v, Assert(state == lu, ExcState(state)); Assert(this->n_rows() == this->n_cols(), LACExceptions::ExcNotQuadratic()); + AssertDimension(this->n_rows(), v.size()); const char *trans = transposed ? &T : &N; const int nn = this->n_cols(); @@ -573,6 +574,7 @@ LAPACKFullMatrix::apply_lu_factorization(LAPACKFullMatrix &B, Assert(state == lu, ExcState(state)); Assert(B.state == matrix, ExcState(state)); Assert(this->n_rows() == this->n_cols(), LACExceptions::ExcNotQuadratic()); + AssertDimension(this->n_rows(), B.n_rows()); const char *trans = transposed ? &T : &N; const int nn = this->n_cols(); diff --git a/deal.II/source/lac/sparsity_pattern.cc b/deal.II/source/lac/sparsity_pattern.cc index 63841efa32..3db6cd5c21 100644 --- a/deal.II/source/lac/sparsity_pattern.cc +++ b/deal.II/source/lac/sparsity_pattern.cc @@ -789,7 +789,8 @@ SparsityPattern::add_entries (const size_type row, { ForwardIterator it = begin; bool has_larger_entries = false; - std::size_t k=rowstart[row]; + // skip diagonal + std::size_t k=rowstart[row]+store_diagonal_first_in_row; for ( ; k