From 2398c52b39a6b262cc054059e7eb100ea7d960f9 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 31 Jul 2008 17:46:43 +0000 Subject: [PATCH] Implement CompressedSetSparsityPattern::print. git-svn-id: https://svn.dealii.org/trunk@16470 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 5 ++-- .../lac/compressed_set_sparsity_pattern.h | 11 ++++++++ .../source/compressed_set_sparsity_pattern.cc | 26 ++++++++++++++++++- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index a66dfc5a5b..e0839a3138 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -201,8 +201,9 @@ inconvenience this causes.
  1. - Fixed: There is now a function CompressedSparsityPattern::print, in analogy - to SparsityPattern::print + Fixed: There are now functions CompressedSparsityPattern::print and + CompressedSetSparsityPattern::print, in analogy + to SparsityPattern::print .
    (WB 2008/07/31)

  2. diff --git a/deal.II/lac/include/lac/compressed_set_sparsity_pattern.h b/deal.II/lac/include/lac/compressed_set_sparsity_pattern.h index 1d6f79e251..82e9491ac3 100644 --- a/deal.II/lac/include/lac/compressed_set_sparsity_pattern.h +++ b/deal.II/lac/include/lac/compressed_set_sparsity_pattern.h @@ -234,6 +234,17 @@ class CompressedSetSparsityPattern : 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_set_sparsity_pattern.cc b/deal.II/lac/source/compressed_set_sparsity_pattern.cc index fd50f31fca..1a17d19548 100644 --- a/deal.II/lac/source/compressed_set_sparsity_pattern.cc +++ b/deal.II/lac/source/compressed_set_sparsity_pattern.cc @@ -2,7 +2,7 @@ // $Id: compressed_sparsity_pattern.cc 14038 2006-10-23 02:46:34Z bangerth $ // 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 @@ -165,9 +165,33 @@ CompressedSetSparsityPattern::symmetrize () +void +CompressedSetSparsityPattern::print (std::ostream &out) const +{ + AssertThrow (out, ExcIO()); + + 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 CompressedSetSparsityPattern::print_gnuplot (std::ostream &out) const { + AssertThrow (out, ExcIO()); + for (unsigned int row=0; row::const_iterator -- 2.39.5