From 9832ec3d0672d674e7ef212e93f7f2f5f9fbe06b Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 16 Mar 2004 20:18:01 +0000 Subject: [PATCH] Avoid excessive accesses to vector elements, since this really grinds PETSc to a halt. Don't know what I thought of this code in the first place anyhow... git-svn-id: https://svn.dealii.org/trunk@8789 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/dofs/dof_constraints.templates.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/deal.II/deal.II/include/dofs/dof_constraints.templates.h b/deal.II/deal.II/include/dofs/dof_constraints.templates.h index f32ee76c44..d32a004c7b 100644 --- a/deal.II/deal.II/include/dofs/dof_constraints.templates.h +++ b/deal.II/deal.II/include/dofs/dof_constraints.templates.h @@ -906,16 +906,15 @@ ConstraintMatrix::distribute (VectorType &vec) const std::vector::const_iterator next_constraint = lines.begin(); for (; next_constraint != lines.end(); ++next_constraint) { - // make entry in line - // next_constraint.line first - // set it to zero - vec(next_constraint->line) = 0.; - // then add the different - // contributions + // fill entry in line + // next_constraint.line by adding the + // different contributions + double new_value = 0; for (unsigned int i=0; ientries.size(); ++i) - vec(next_constraint->line) += (vec(next_constraint->entries[i].first) * - next_constraint->entries[i].second); - }; + new_value += (vec(next_constraint->entries[i].first) * + next_constraint->entries[i].second); + vec(next_constraint->line) = new_value; + } } -- 2.39.5