From c365b15155c31042e5f84f92bf927854cfc3eede Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 8 Jan 2013 03:48:57 +0000 Subject: [PATCH] First step towards getting rid of the last occurrence of SparseMatrix::global_value. git-svn-id: https://svn.dealii.org/trunk@27972 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/numerics/matrix_tools.cc | 34 ++++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/deal.II/source/numerics/matrix_tools.cc b/deal.II/source/numerics/matrix_tools.cc index c207c009b1..9e33193338 100644 --- a/deal.II/source/numerics/matrix_tools.cc +++ b/deal.II/source/numerics/matrix_tools.cc @@ -2286,6 +2286,11 @@ namespace MatrixTools const SparsityPattern &transpose_sparsity = sparsity_pattern.block (block_index.first, block_row); + SparseMatrix &this_matrix + = matrix.block(block_row, block_index.first); + SparseMatrix &transpose_matrix + = matrix.block(block_index.first, block_row); + // traverse the row of // the transpose block // to find the @@ -2350,23 +2355,16 @@ namespace MatrixTools [this_sparsity.get_rowstart_indices()[row+1]], block_index.second); - // check whether this line has - // an entry in the regarding column - // (check for ==dof_number and - // != next_row, since if - // row==dof_number-1, *p is a - // past-the-end pointer but points - // to dof_number anyway...) + // check whether this line has an entry in the + // regarding column (check for ==dof_number and != + // next_row, since if row==dof_number-1, *p is a + // past-the-end pointer but points to dof_number + // anyway...) // - // there should be - // such an entry! - // note, however, - // that this - // assertion will - // fail sometimes - // if the sparsity - // pattern is not - // symmetric! + // there should be such an entry! we know this because + // we have assumed that the sparsity pattern is + // symmetric and we only walk over those rows for + // which the current row has a column entry Assert ((*p == block_index.second) && (p != &this_sparsity.get_column_numbers() [this_sparsity.get_rowstart_indices()[row+1]]), @@ -2380,11 +2378,11 @@ namespace MatrixTools // correct right hand side right_hand_side.block(block_row)(row) - -= matrix.block(block_row,block_index.first).global_entry(global_entry) / + -= this_matrix.global_entry(global_entry) / diagonal_entry * new_rhs; // set matrix entry to zero - matrix.block(block_row,block_index.first).global_entry(global_entry) = 0.; + this_matrix.global_entry(global_entry) = 0.; } } } -- 2.39.5