]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Avoid excessive accesses to vector elements, since this really grinds PETSc to
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 16 Mar 2004 20:18:01 +0000 (20:18 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 16 Mar 2004 20:18:01 +0000 (20:18 +0000)
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

deal.II/deal.II/include/dofs/dof_constraints.templates.h

index f32ee76c44e04bd61b8190fc52167d53965c932a..d32a004c7b2c59824a07a15a06b292b5ac59bd61 100644 (file)
@@ -906,16 +906,15 @@ ConstraintMatrix::distribute (VectorType &vec) const
   std::vector<ConstraintLine>::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; i<next_constraint->entries.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;
+    }
 }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.