From 4fb49b2fa6b21b2ac423ae5f5f6869c5a7ff5922 Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 25 Apr 2006 21:31:24 +0000 Subject: [PATCH] BlockSparsityPattern::row_length. git-svn-id: https://svn.dealii.org/trunk@12896 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.html | 9 +++++++ .../lac/include/lac/block_sparsity_pattern.h | 27 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/deal.II/doc/news/changes.html b/deal.II/doc/news/changes.html index dd02cde18d..3ae3abe42c 100644 --- a/deal.II/doc/news/changes.html +++ b/deal.II/doc/news/changes.html @@ -442,6 +442,15 @@ inconvenience this causes.
    +
  1. New: The function BlockSparsityPattern::row_length adds up + the row lengths of the individual blocks of a block matrix for + a given row. +
    + (WB 2006/04/25) +

    + +
  2. New: There is a new class IdentityMatrix that represents an efficient version of the matrix with ones on the diagonal and diff --git a/deal.II/lac/include/lac/block_sparsity_pattern.h b/deal.II/lac/include/lac/block_sparsity_pattern.h index 1a4613068e..a537e9ebe5 100644 --- a/deal.II/lac/include/lac/block_sparsity_pattern.h +++ b/deal.II/lac/include/lac/block_sparsity_pattern.h @@ -294,6 +294,14 @@ class BlockSparsityPatternBase : public Subscriptor * position may be non-zero. */ bool exists (const unsigned int i, const unsigned int j) const; + + /** + * Number of entries in a + * specific row, added up over + * all the blocks that form this + * row. + */ + unsigned int row_length (const unsigned int row) const; /** * Return the number of nonzero @@ -615,6 +623,25 @@ BlockSparsityPatternBase::exists (const unsigned int i, +template +inline +unsigned int +BlockSparsityPatternBase:: +row_length (const unsigned int row) const +{ + const std::pair + row_index = row_indices.global_to_local (row); + + unsigned int c = 0; + + for (unsigned int b=0; brow_length (row_index.second); + + return c; +} + + + template inline unsigned int -- 2.39.5