]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Implement a block-to-global transformation function.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 18 May 2000 11:51:39 +0000 (11:51 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 18 May 2000 11:51:39 +0000 (11:51 +0000)
git-svn-id: https://svn.dealii.org/trunk@2885 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/block_indices.h

index 9034ee849340c8e65ce51176d2eede947a46a677..f64fb4ea0b8d72dda09b16b26810b96558a806e5 100644 (file)
@@ -66,7 +66,15 @@ class BlockIndices
                                      * the block, the second the
                                      * index within that.
                                      */
-    pair<unsigned int,unsigned int> global_to_local (const unsigned int i) const;
+    pair<unsigned int,unsigned int>
+    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<n_blocks>::global_to_local (const unsigned int i) const
 };
 
 
+template <int n_blocks>
+inline
+unsigned int
+BlockIndices<n_blocks>::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 <int n_blocks>
 inline

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.