From: Wolfgang Bangerth Date: Thu, 18 May 2000 11:51:39 +0000 (+0000) Subject: Implement a block-to-global transformation function. X-Git-Tag: v8.0.0~20520 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eae65bdef06e13c9b45dc0db14e5a711fc466b85;p=dealii.git Implement a block-to-global transformation function. git-svn-id: https://svn.dealii.org/trunk@2885 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 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