From: Martin Kronbichler Date: Tue, 18 Aug 2009 11:46:07 +0000 (+0000) Subject: Add one more check for inhomogeneous constraints. Correct one mistake in distribute_l... X-Git-Tag: v8.0.0~7270 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc904228bbf2bf8dbb485c1beee55eb25c7dd215;p=dealii.git Add one more check for inhomogeneous constraints. Correct one mistake in distribute_local_to_global function. git-svn-id: https://svn.dealii.org/trunk@19298 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/constraint_matrix.h b/deal.II/lac/include/lac/constraint_matrix.h index 0a9dfa40a5..b1e6df9e78 100644 --- a/deal.II/lac/include/lac/constraint_matrix.h +++ b/deal.II/lac/include/lac/constraint_matrix.h @@ -609,6 +609,14 @@ class ConstraintMatrix : public Subscriptor */ unsigned int max_constraint_indirections () const; + /** + * Returns true in case the + * dof is constrained and there is a + * non-trivial inhomogeneous valeus set + * to the dof. + */ + bool is_inhomogeneously_constrained (const unsigned int index) const; + /** * Returns false if all * constraints in the ConstraintMatrix @@ -1694,6 +1702,26 @@ ConstraintMatrix::is_constrained (const unsigned int index) const (constraint_line_exists[index] == true)); } + + +inline +bool +ConstraintMatrix::is_inhomogeneously_constrained (const unsigned int index) const +{ + if (is_constrained(index) == false) + return false; + + ConstraintLine index_comparison; + index_comparison.line = index; + + const std::vector::const_iterator + position = std::lower_bound (lines.begin(), + lines.end(), + index_comparison); + Assert (position != lines.end(), ExcInternalError()); + return position->inhomogeneity != 0; +} + DEAL_II_NAMESPACE_CLOSE #endif diff --git a/deal.II/lac/include/lac/constraint_matrix.templates.h b/deal.II/lac/include/lac/constraint_matrix.templates.h index b0ac3ed4f8..2a94f08a07 100644 --- a/deal.II/lac/include/lac/constraint_matrix.templates.h +++ b/deal.II/lac/include/lac/constraint_matrix.templates.h @@ -797,7 +797,7 @@ distribute_local_to_global (const Vector &local_vector, { Assert (is_constrained(position_j->entries[q].first) == false, ExcMessage ("Tried to distribute to a fixed dof.")); - global_vector(position_j->entries[j].first) + global_vector(position_j->entries[q].first) -= val * position_j->entries[q].second * matrix_entry; } }