From ddb84ce9538788c1ae3015e4329fc88c09510388 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 18 May 2000 11:51:39 +0000 Subject: [PATCH] Implement a block-to-global transformation function. git-svn-id: https://svn.dealii.org/trunk@2885 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/block_indices.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/deal.II/lac/include/lac/block_indices.h b/deal.II/lac/include/lac/block_indices.h index 9034ee8493..f64fb4ea0b 100644 --- a/deal.II/lac/include/lac/block_indices.h +++ b/deal.II/lac/include/lac/block_indices.h @@ -66,7 +66,15 @@ class BlockIndices * the block, the second the * index within that. */ - pair global_to_local (const unsigned int i) const; + pair + global_to_local (const unsigned int i) const; + + /** + * Return the global index of + * #index# in block #block#. + */ + unsigned int local_to_global (const unsigned int block, + const unsigned int index) const; /** * Return the total number of @@ -157,6 +165,20 @@ BlockIndices::global_to_local (const unsigned int i) const }; +template +inline +unsigned int +BlockIndices::local_to_global (const unsigned int block, + const unsigned int index) const +{ + Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks)); + Assert (index < start_indices[block+1]-start_indices[block], + ExcIndexRange (index, 0, start_indices[block+1]-start_indices[block])); + + return start_indices[block]+index; +}; + + template inline -- 2.39.5