From b8565a9f8c679eb2526acd7f7f37dd9c2b7656fe Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Wed, 11 Feb 2004 12:58:31 +0000 Subject: [PATCH] print function git-svn-id: https://svn.dealii.org/trunk@8458 0785d39b-7218-0410-832d-ea1e28bc413d --- .../lac/include/lac/block_sparsity_pattern.h | 14 ++++++++- deal.II/lac/source/block_sparsity_pattern.cc | 29 +++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/deal.II/lac/include/lac/block_sparsity_pattern.h b/deal.II/lac/include/lac/block_sparsity_pattern.h index a0a1be0856..65dbbc9a0c 100644 --- a/deal.II/lac/include/lac/block_sparsity_pattern.h +++ b/deal.II/lac/include/lac/block_sparsity_pattern.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -316,6 +316,18 @@ class BlockSparsityPatternBase : public Subscriptor */ unsigned int n_nonzero_elements () const; + /** + * 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; + + /** * Exception */ diff --git a/deal.II/lac/source/block_sparsity_pattern.cc b/deal.II/lac/source/block_sparsity_pattern.cc index 316639cbd2..a9035836d0 100644 --- a/deal.II/lac/source/block_sparsity_pattern.cc +++ b/deal.II/lac/source/block_sparsity_pattern.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2000, 2001, 2002, 2003 by the deal authors +// Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -233,6 +233,32 @@ BlockSparsityPatternBase::n_nonzero_elements () const +template +void +BlockSparsityPatternBase::print(std::ostream& out) const +{ + unsigned int k=0; + for (unsigned int ib=0;ib