From faa8cfa13f796e5ea22c64df751e7b7aa814fc63 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 5 Nov 2012 00:56:21 +0000 Subject: [PATCH] Partial merge from the parallel_mg branch: Introduce a distribute_local_to_global function that writes a single element into a vector. git-svn-id: https://svn.dealii.org/trunk@27381 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/lac/constraint_matrix.h | 64 ++++++++++++++----- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/deal.II/include/deal.II/lac/constraint_matrix.h b/deal.II/include/deal.II/lac/constraint_matrix.h index a79738f20e..6baf697998 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.h @@ -1055,7 +1055,16 @@ class ConstraintMatrix : public Subscriptor VectorType &global_vector, const FullMatrix &local_matrix) const; - + /** + * Enter a single value into a + * result vector, obeying constraints. + */ + template + void + distribute_local_to_global (unsigned int index, + double value, + VectorType &global_vector) const; + /** * This function takes a pointer to a * vector of local contributions (@p @@ -1983,30 +1992,36 @@ ConstraintMatrix::can_store_line (unsigned int line_index) const -template +template inline -void -ConstraintMatrix:: -distribute_local_to_global (const InVector &local_vector, - const std::vector &local_dof_indices, - OutVector &global_vector) const +void ConstraintMatrix::distribute_local_to_global ( + unsigned int index, + double value, + VectorType &global_vector) const { - Assert (local_vector.size() == local_dof_indices.size(), - ExcDimensionMismatch(local_vector.size(), local_dof_indices.size())); - distribute_local_to_global (local_vector.begin(), local_vector.end(), - local_dof_indices.begin(), global_vector); + Assert (sorted == true, ExcMatrixNotClosed()); + + if (is_constrained(index) == false) + global_vector(index) += value; + else + { + const ConstraintLine& position = + lines[lines_cache[calculate_line_index(index)]]; + for (unsigned int j=0; j inline -void ConstraintMatrix:: - distribute_local_to_global (ForwardIteratorVec local_vector_begin, - ForwardIteratorVec local_vector_end, - ForwardIteratorInd local_indices_begin, - VectorType &global_vector) const +void ConstraintMatrix::distribute_local_to_global ( + ForwardIteratorVec local_vector_begin, + ForwardIteratorVec local_vector_end, + ForwardIteratorInd local_indices_begin, + VectorType &global_vector) const { Assert (sorted == true, ExcMatrixNotClosed()); for ( ; local_vector_begin != local_vector_end; @@ -2026,6 +2041,21 @@ void ConstraintMatrix:: } +template +inline +void +ConstraintMatrix::distribute_local_to_global ( + const InVector &local_vector, + const std::vector &local_dof_indices, + OutVector &global_vector) const +{ + Assert (local_vector.size() == local_dof_indices.size(), + ExcDimensionMismatch(local_vector.size(), local_dof_indices.size())); + distribute_local_to_global (local_vector.begin(), local_vector.end(), + local_dof_indices.begin(), global_vector); +} + + template -- 2.39.5