From: wolf Date: Mon, 7 May 2001 16:43:58 +0000 (+0000) Subject: Function to query the size of a block. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=708759a6e541fd1fa37f7e3f4a216675554585c8;p=dealii-svn.git Function to query the size of a block. git-svn-id: https://svn.dealii.org/trunk@4552 0785d39b-7218-0410-832d-ea1e28bc413d --- 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)