From 1ea65ba5cd92f207ac5a2c2be5e0c4c106d5e32e Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 20 Aug 2008 13:06:50 +0000 Subject: [PATCH] Simplify copying elements into Trilinos in the same way. git-svn-id: https://svn.dealii.org/trunk@16609 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-31/step-31.cc | 31 ++++++++++------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/deal.II/examples/step-31/step-31.cc b/deal.II/examples/step-31/step-31.cc index 8c9599a55b..c99e0061d4 100644 --- a/deal.II/examples/step-31/step-31.cc +++ b/deal.II/examples/step-31/step-31.cc @@ -170,26 +170,17 @@ void PreconditionerTrilinosAmg::initialize ( for (unsigned int row=0; rowrow_length (row); - - row_indices.resize (row_lengths[row], 0); - values.resize (row_lengths[row], 0.); - - unsigned int col_counter = 0; - for (unsigned int col=0; colcolumn_number (row, col); - if (std::abs(matrix (row, col_index)) > 1e-13) - { - row_indices[col_counter] = - sparsity_pattern->column_number (row, col); - values[col_counter] = - matrix (row, row_indices[col_counter]); - ++col_counter; - } - } - Assert (col_counter == static_cast(row_lengths[row]), + unsigned int index = 0; + for (SparseMatrix::const_iterator p = matrix.begin(row); + p != matrix.end(row); ++p) + if (std::abs(p->value()) > 1e-13) + { + row_indices[index] = p->column(); + values[index] = p->value(); + ++index; + } + + Assert (index == static_cast(row_lengths[row]), ExcMessage("Filtering out zeros could not " "be successfully finished!")); -- 2.39.5