]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Function to query the size of a block.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 7 May 2001 16:43:58 +0000 (16:43 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 7 May 2001 16:43:58 +0000 (16:43 +0000)
git-svn-id: https://svn.dealii.org/trunk@4552 0785d39b-7218-0410-832d-ea1e28bc413d

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

index c24528f541b32cc591282dfb5558b3ef20317472..8b9e8302484992065ae81b251843054b02088f8a 100644 (file)
@@ -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<unsigned int> &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)

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.