]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Avoid one use of SparseMatrix::global_entry in favor of using iterators.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 31 Dec 2012 02:23:25 +0000 (02:23 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 31 Dec 2012 02:23:25 +0000 (02:23 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_deprecated@27881 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/numerics/matrix_tools.cc

index 7d97af1459ca89fba43837768172d081f14fb11c..46e8f18dafd9ff3b2eb9261c92e2386b1c1948de 100644 (file)
@@ -1982,18 +1982,13 @@ namespace MatrixTools
         const unsigned int dof_number = dof->first;
         // for each boundary dof:
 
-        // set entries of this line
-        // to zero except for the diagonal
-        // entry. Note that the diagonal
-        // entry is always the first one
-        // for square matrices, i.e.
-        // we shall not set
-        // matrix.global_entry(
-        //     sparsity_rowstart[dof.first])
-        const unsigned int last = sparsity_rowstart[dof_number+1];
-        for (unsigned int j=sparsity_rowstart[dof_number]+1; j<last; ++j)
-          matrix.global_entry(j) = 0.;
-
+        // set entries of this line to zero except for the diagonal
+        // entry
+       for (typename SparseMatrix<number>::iterator
+              p = matrix.begin(dof_number);
+            p != matrix.end(dof_number); ++p)
+         if (p->column() != dof_number)
+           p->value() = 0.;
 
         // set right hand side to
         // wanted value: if main diagonal
@@ -2053,6 +2048,7 @@ namespace MatrixTools
             // since that is the
             // diagonal element and
             // thus the present row
+           const unsigned int last = sparsity_rowstart[dof_number+1];
             for (unsigned int j=sparsity_rowstart[dof_number]+1; j<last; ++j)
               {
                 const unsigned int row = sparsity_colnums[j];

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.