From fe46032a84abfa4bacb635644a4d3bb0ccb8fb02 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 7 May 2001 16:43:58 +0000 Subject: [PATCH] Function to query the size of a block. git-svn-id: https://svn.dealii.org/trunk@4552 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/block_indices.h | 26 +++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/deal.II/lac/include/lac/block_indices.h b/deal.II/lac/include/lac/block_indices.h index c24528f541..8b9e830248 100644 --- a/deal.II/lac/include/lac/block_indices.h +++ b/deal.II/lac/include/lac/block_indices.h @@ -99,6 +99,12 @@ class BlockIndices */ unsigned int total_size () const; + /** + * Return the size of the @p{i}th + * block. + */ + unsigned int block_size (const unsigned int i) const + /** * Copy operator. */ @@ -148,8 +154,9 @@ class BlockIndices inline BlockIndices::BlockIndices (unsigned int n_blocks) - : n_blocks(n_blocks), - start_indices(n_blocks+1) + : + n_blocks(n_blocks), + start_indices(n_blocks+1) { for (unsigned int i=0; i<=n_blocks; ++i) start_indices[i] = 0; @@ -159,8 +166,9 @@ BlockIndices::BlockIndices (unsigned int n_blocks) inline BlockIndices::BlockIndices (const std::vector &n) - : n_blocks(n.size()), - start_indices(n.size()+1) + : + n_blocks(n.size()), + start_indices(n.size()+1) { reinit (n); }; @@ -239,6 +247,16 @@ BlockIndices::total_size () const +inline +unsigned int +BlockIndices::block_size (const unsigned int block) const +{ + Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks)); + return start_indices[block+1]-start_indices[block]; +}; + + + inline BlockIndices & BlockIndices::operator = (const BlockIndices &b) -- 2.39.5