From: Guido Kanschat Date: Fri, 19 Oct 2007 02:24:40 +0000 (+0000) Subject: add SparseMatrix::print_pattern X-Git-Tag: v8.0.0~9736 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5204319ec849c9d1dd5f8867e65e50c5e7245433;p=dealii.git add SparseMatrix::print_pattern git-svn-id: https://svn.dealii.org/trunk@15349 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/sparse_matrix.h b/deal.II/lac/include/lac/sparse_matrix.h index a01df8fda3..35d58d141f 100644 --- a/deal.II/lac/include/lac/sparse_matrix.h +++ b/deal.II/lac/include/lac/sparse_matrix.h @@ -1575,6 +1575,18 @@ class SparseMatrix : public virtual Subscriptor const char *zero_string = " ", const double denominator = 1.) const; + /** + * Print the actual pattern of + * the matrix. For each entry + * with an absolute value larger + * than threshold, a '*' is + * printed, a ':' for every value + * smaller and a '.' for every + * entry not allocated. + */ + void print_pattern(std::ostream& out, + const double threshold = 0.) const; + /** * Write the data of this object * en bloc to a file. This is diff --git a/deal.II/lac/include/lac/sparse_matrix.templates.h b/deal.II/lac/include/lac/sparse_matrix.templates.h index 8ba5136940..7361a2e1cd 100644 --- a/deal.II/lac/include/lac/sparse_matrix.templates.h +++ b/deal.II/lac/include/lac/sparse_matrix.templates.h @@ -1371,6 +1371,30 @@ void SparseMatrix::print_formatted (std::ostream &out, +template +void SparseMatrix::print_pattern (std::ostream &out, + const double threshold) const +{ + Assert (cols != 0, ExcNotInitialized()); + Assert (val != 0, ExcNotInitialized()); + + for (unsigned int i=0; ioperator()(i,j)]) > threshold) + out << '*'; + else + out << ':'; + out << std::endl; + }; + AssertThrow (out, ExcIO()); +} + + + template void SparseMatrix::block_write (std::ostream &out) const