From: bangerth Date: Thu, 31 Jul 2008 17:29:18 +0000 (+0000) Subject: Implement CompressedSparsityPattern::print. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4966faa4d97646990a0d9caa6545d8ae0240ee0a;p=dealii-svn.git Implement CompressedSparsityPattern::print. git-svn-id: https://svn.dealii.org/trunk@16466 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 20065bbda1..a66dfc5a5b 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -199,12 +199,21 @@ inconvenience this causes.

lac

    +
  1. +

    + Fixed: There is now a function CompressedSparsityPattern::print, in analogy + to SparsityPattern::print +
    + (WB 2008/07/31) +

  2. +
  3. Fixed: The FullMatrix::copy_from(FullMatrix,bool) function had a bug that resulted in an exception being triggered whenever the given matrix had rows where the diagonal element is zero and the second parameter to the function was set to true. This is now fixed. +
    (WB 2008/07/30)

diff --git a/deal.II/lac/include/lac/compressed_sparsity_pattern.h b/deal.II/lac/include/lac/compressed_sparsity_pattern.h index 0a4e6dba2c..92e4e91ea7 100644 --- a/deal.II/lac/include/lac/compressed_sparsity_pattern.h +++ b/deal.II/lac/include/lac/compressed_sparsity_pattern.h @@ -211,6 +211,17 @@ class CompressedSparsityPattern : public Subscriptor */ void symmetrize (); + /** + * Print the sparsity of the + * matrix. The output consists of + * one line per row of the format + * [i,j1,j2,j3,...]. i + * is the row number and + * jn are the allocated + * columns in this row. + */ + void print (std::ostream &out) const; + /** * Print the sparsity of the matrix in a * format that @p gnuplot understands and diff --git a/deal.II/lac/source/compressed_sparsity_pattern.cc b/deal.II/lac/source/compressed_sparsity_pattern.cc index 34a78c3e19..bf48e0818a 100644 --- a/deal.II/lac/source/compressed_sparsity_pattern.cc +++ b/deal.II/lac/source/compressed_sparsity_pattern.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -329,6 +329,29 @@ CompressedSparsityPattern::symmetrize () +void +CompressedSparsityPattern::print (std::ostream &out) const +{ + for (unsigned int row=0; row::const_iterator + j=lines[row].entries.begin(); + j != lines[row].entries.end(); ++j) + out << *j << ' '; + + out << std::endl; + } + + AssertThrow (out, ExcIO()); +} + + + void CompressedSparsityPattern::print_gnuplot (std::ostream &out) const { @@ -345,8 +368,7 @@ CompressedSparsityPattern::print_gnuplot (std::ostream &out) const // x-y, that is we have to exchange // the order of output out << *j << " " << -static_cast(row) << std::endl; - } - + } AssertThrow (out, ExcIO()); }