]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Discard zero entries in the constraint matrix when calling 'close'.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 17 Feb 1999 10:25:55 +0000 (10:25 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 17 Feb 1999 10:25:55 +0000 (10:25 +0000)
git-svn-id: https://svn.dealii.org/trunk@832 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/dofs/dof_constraints.cc

index 396b7ad1cfe18071438fc7689268c9e4ff1a8bf8..38180a324d52dd6ea5cc54cc66427b0a50d07594 100644 (file)
@@ -8,7 +8,7 @@
 #include <lac/dvector.h>
 #include <iostream>
 #include <algorithm>
-
+#include <numeric>
 
 
 
@@ -84,11 +84,22 @@ void ConstraintMatrix::close () {
   Assert (sorted==false, ExcMatrixIsClosed());
 
                                   // sort the entries in the different lines
+                                  // and strip zero entries
   vector<ConstraintLine>::iterator line = lines.begin(),
                                   endl = lines.end();
   for (; line!=endl; ++line)
-    sort (line->entries.begin(), line->entries.end());
-
+    {
+                                      // first remove zero entries
+      line->entries.erase (remove_if (line->entries.begin(),
+                                     line->entries.end(),
+                                     compose1 (bind2nd (equal_to<double>(), 0),
+                                               select2nd<pair<unsigned int,double> >())),
+                           line->entries.end());
+
+                                      // now sort the remainder
+      sort (line->entries.begin(), line->entries.end());
+    };
+  
                                   // sort the lines
   sort (lines.begin(), lines.end());
   

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.