From: guido Date: Tue, 10 Feb 2004 07:47:20 +0000 (+0000) Subject: preliminary version of new function X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ad54ba5ae5010b64f0e7fbb686e69b6af86a738;p=dealii-svn.git preliminary version of new function git-svn-id: https://svn.dealii.org/trunk@8449 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/sparsity_pattern.h b/deal.II/lac/include/lac/sparsity_pattern.h index 3211efb90a..a70c8bc0f0 100644 --- a/deal.II/lac/include/lac/sparsity_pattern.h +++ b/deal.II/lac/include/lac/sparsity_pattern.h @@ -643,32 +643,6 @@ class SparsityPattern : public Subscriptor */ void symmetrize (); - /** - * Print the sparsity of the matrix - * in a format that gnuplot understands - * and which can be used to plot the - * sparsity pattern in a graphical - * way. The format consists of pairs - * i j of nonzero elements, each - * representing one entry of this - * matrix, one per line of the output - * file. Indices are counted from - * zero on, as usual. Since sparsity - * patterns are printed in the same - * way as matrices are displayed, we - * print the negative of the column - * index, which means that the - * (0,0) element is in the top left - * rather than in the bottom left - * corner. - * - * Print the sparsity pattern in - * gnuplot by setting the data style - * to dots or points and use the - * plot command. - */ - void print_gnuplot (std::ostream &out) const; - /** * Return number of rows of this * matrix, which equals the dimension @@ -756,58 +730,6 @@ class SparsityPattern : public Subscriptor */ bool optimize_diagonal () const; - /** - * This is kind of an expert mode. Get - * access to the rowstart array, but - * read-only. - * - * Use of this function is highly - * deprecated. Use @p{row_length} - * and @p{column_number} instead. - * - * Though the return value is declared - * const, you should be aware that it - * may change if you call any nonconstant - * function of objects which operate on - * it. - * - * You should use this interface very - * carefully and only if you are absolutely - * sure to know what you do. You should - * also note that the structure of these - * arrays may change over time. - * If you change the layout yourself, you - * should also rename this function to - * avoid programs relying on outdated - * information! */ - const unsigned int * get_rowstart_indices () const; - - /** - * @deprecated. Use @p{row_length} - * and @p{column_number} instead. - * - * This is kind of an expert mode: get - * access to the colnums array, but - * readonly. - * - * Though the return value is declared - * const, you should be aware that it - * may change if you call any nonconstant - * function of objects which operate on - * it. - * - * You should use this interface very - * carefully and only if you are absolutely - * sure to know what you do. You should - * also note that the structure of these - * arrays may change over time. - * If you change the layout yourself, you - * should also rename this function to - * avoid programs relying on outdated - * information! - */ - const unsigned int * get_column_numbers () const; - /** * Write the data of this object * en bloc to a file. This is @@ -855,6 +777,41 @@ class SparsityPattern : public Subscriptor */ void block_read (std::istream &in); + /** + * Print the sparsity of the + * matrix. The output consists of + * terms [i,j] for each + * allocated entry. No linefeeds + * are added. + */ + void print (std::ostream &out) const; + + /** + * Print the sparsity of the matrix + * in a format that gnuplot understands + * and which can be used to plot the + * sparsity pattern in a graphical + * way. The format consists of pairs + * i j of nonzero elements, each + * representing one entry of this + * matrix, one per line of the output + * file. Indices are counted from + * zero on, as usual. Since sparsity + * patterns are printed in the same + * way as matrices are displayed, we + * print the negative of the column + * index, which means that the + * (0,0) element is in the top left + * rather than in the bottom left + * corner. + * + * Print the sparsity pattern in + * gnuplot by setting the data style + * to dots or points and use the + * plot command. + */ + void print_gnuplot (std::ostream &out) const; + /** * Determine an estimate for the * memory consumption (in bytes) @@ -863,6 +820,58 @@ class SparsityPattern : public Subscriptor */ unsigned int memory_consumption () const; + /** + * This is kind of an expert mode. Get + * access to the rowstart array, but + * read-only. + * + * Use of this function is highly + * deprecated. Use @p{row_length} + * and @p{column_number} instead. + * + * Though the return value is declared + * const, you should be aware that it + * may change if you call any nonconstant + * function of objects which operate on + * it. + * + * You should use this interface very + * carefully and only if you are absolutely + * sure to know what you do. You should + * also note that the structure of these + * arrays may change over time. + * If you change the layout yourself, you + * should also rename this function to + * avoid programs relying on outdated + * information! */ + const unsigned int * get_rowstart_indices () const; + + /** + * @deprecated. Use @p{row_length} + * and @p{column_number} instead. + * + * This is kind of an expert mode: get + * access to the colnums array, but + * readonly. + * + * Though the return value is declared + * const, you should be aware that it + * may change if you call any nonconstant + * function of objects which operate on + * it. + * + * You should use this interface very + * carefully and only if you are absolutely + * sure to know what you do. You should + * also note that the structure of these + * arrays may change over time. + * If you change the layout yourself, you + * should also rename this function to + * avoid programs relying on outdated + * information! + */ + const unsigned int * get_column_numbers () const; + /** * Exception */ diff --git a/deal.II/lac/source/sparsity_pattern.cc b/deal.II/lac/source/sparsity_pattern.cc index dc0992e623..aa3aa9007f 100644 --- a/deal.II/lac/source/sparsity_pattern.cc +++ b/deal.II/lac/source/sparsity_pattern.cc @@ -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 @@ -754,6 +754,17 @@ SparsityPattern::symmetrize () +void +SparsityPattern::print (std::ostream &out) const +{ + Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); + const_iterator e = begin(); + + AssertThrow (out, ExcIO()); +} + + + void SparsityPattern::print_gnuplot (std::ostream &out) const {