From 814bf9a6c4c90446d940975a674cfb0a1e7e511e Mon Sep 17 00:00:00 2001 From: kronbichler Date: Sun, 9 Dec 2012 10:06:32 +0000 Subject: [PATCH] ConstraintMatrix can perform distribute_local_to_global also in non-closed form as long as there are no constraints without any errors (this enables the use of a ConstraintMatrix dummy when one wants to more quickly write into sparse matrices). git-svn-id: https://svn.dealii.org/trunk@27786 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/constraint_matrix.h | 15 ++++++++++++--- .../deal.II/lac/constraint_matrix.templates.h | 4 ++-- deal.II/source/lac/constraint_matrix.cc | 7 ------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/deal.II/include/deal.II/lac/constraint_matrix.h b/deal.II/include/deal.II/lac/constraint_matrix.h index 938b681f9e..103433b068 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.h @@ -1903,6 +1903,15 @@ ConstraintMatrix::set_inhomogeneity (const unsigned int line, +inline +unsigned int +ConstraintMatrix::n_constraints () const +{ + return lines.size(); +} + + + inline bool ConstraintMatrix::is_constrained (const unsigned int index) const @@ -1999,7 +2008,7 @@ void ConstraintMatrix::distribute_local_to_global ( const double value, VectorType &global_vector) const { - Assert (sorted == true, ExcMatrixNotClosed()); + Assert (lines.empty() || sorted == true, ExcMatrixNotClosed()); if (is_constrained(index) == false) global_vector(index) += value; @@ -2023,7 +2032,7 @@ void ConstraintMatrix::distribute_local_to_global ( ForwardIteratorInd local_indices_begin, VectorType &global_vector) const { - Assert (sorted == true, ExcMatrixNotClosed()); + Assert (lines.empty() || sorted == true, ExcMatrixNotClosed()); for ( ; local_vector_begin != local_vector_end; ++local_vector_begin, ++local_indices_begin) { @@ -2065,7 +2074,7 @@ void ConstraintMatrix::get_dof_values (const VectorType &global_vector, ForwardIteratorVec local_vector_begin, ForwardIteratorVec local_vector_end) const { - Assert (sorted == true, ExcMatrixNotClosed()); + Assert (lines.empty() || sorted == true, ExcMatrixNotClosed()); for ( ; local_vector_begin != local_vector_end; ++local_vector_begin, ++local_indices_begin) { diff --git a/deal.II/include/deal.II/lac/constraint_matrix.templates.h b/deal.II/include/deal.II/lac/constraint_matrix.templates.h index d7d0ca7548..8d7f1b552a 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.templates.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.templates.h @@ -818,7 +818,7 @@ distribute_local_to_global (const Vector &local_vector, AssertDimension (local_matrix.n(), local_dof_indices.size()); const unsigned int n_local_dofs = local_vector.size(); - if (lines.size() == 0) + if (lines.empty()) global_vector.add(local_dof_indices, local_vector); else for (unsigned int i=0; i