From: Wolfgang Bangerth Date: Mon, 8 Jun 1998 01:08:50 +0000 (+0000) Subject: Make apply_boundary_values faster by about a factor of two by using that the rows... X-Git-Tag: v8.0.0~22867 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fcca83c64766737dec95c4a6efa85cc5e4e3030;p=dealii.git Make apply_boundary_values faster by about a factor of two by using that the rows in a sparse matrix are sorted according to the column numbers. git-svn-id: https://svn.dealii.org/trunk@387 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/numerics/matrices.cc b/deal.II/deal.II/source/numerics/matrices.cc index ce7f1c71f2..e0fd60f975 100644 --- a/deal.II/deal.II/source/numerics/matrices.cc +++ b/deal.II/deal.II/source/numerics/matrices.cc @@ -343,6 +343,10 @@ void MatrixTools::apply_boundary_values (const map &boundary_va dSMatrix &matrix, dVector &solution, dVector &right_hand_side) { + Assert (matrix.n() == matrix.m(), + ExcDimensionsDontMatch(matrix.n(), matrix.m())); + Assert (matrix.n() == right_hand_side.size(), + ExcDimensionsDontMatch(matrix.n(), right_hand_side.size())); // if no boundary values are to be applied // simply return if (boundary_values.size() == 0) @@ -362,12 +366,17 @@ void MatrixTools::apply_boundary_values (const map &boundary_va // for each boundary dof: // set entries of this line - // to zero + // 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->first]; j::apply_boundary_values (const map &boundary_va // do the Gauss step for (unsigned int row=0; row