From 2557d724486c3bc550209e6f9ff687f7271b288e Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Mon, 24 Jun 2013 07:03:16 +0000 Subject: [PATCH] also print diagonal element at end of line git-svn-id: https://svn.dealii.org/trunk@29857 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/sparse_matrix.h | 56 ++++++++++++--------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/deal.II/include/deal.II/lac/sparse_matrix.h b/deal.II/include/deal.II/lac/sparse_matrix.h index 9c234289fe..6ff14dd249 100644 --- a/deal.II/include/deal.II/lac/sparse_matrix.h +++ b/deal.II/include/deal.II/lac/sparse_matrix.h @@ -2478,29 +2478,39 @@ void SparseMatrix::print (STREAM &out, bool across, bool diagonal_first) number diagonal; for (size_type i=0; irows; ++i) - for (size_type j=cols->rowstart[i]; jrowstart[i+1]; ++j) - { - if (!diagonal_first && i == cols->colnums[j]) - { - diagonal = val[j]; - hanging_diagonal = true; - } - else - { - if (hanging_diagonal && cols->colnums[j]>i) - { - if (across) - out << ' ' << i << ',' << i << ':' << diagonal; - else - out << '(' << i << ',' << i << ") " << diagonal << std::endl; - hanging_diagonal = false; - } - if (across) - out << ' ' << i << ',' << cols->colnums[j] << ':' << val[j]; - else - out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl; - } - } + { + for (size_type j=cols->rowstart[i]; jrowstart[i+1]; ++j) + { + if (!diagonal_first && i == cols->colnums[j]) + { + diagonal = val[j]; + hanging_diagonal = true; + } + else + { + if (hanging_diagonal && cols->colnums[j]>i) + { + if (across) + out << ' ' << i << ',' << i << ':' << diagonal; + else + out << '(' << i << ',' << i << ") " << diagonal << std::endl; + hanging_diagonal = false; + } + if (across) + out << ' ' << i << ',' << cols->colnums[j] << ':' << val[j]; + else + out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl; + } + } + if (hanging_diagonal) + { + if (across) + out << ' ' << i << ',' << i << ':' << diagonal; + else + out << '(' << i << ',' << i << ") " << diagonal << std::endl; + hanging_diagonal = false; + } + } if (across) out << std::endl; } -- 2.39.5