* Several vectors of data.
*
* The BlockVector is a collection of normal LAC-@p{Vector}s. Each of
- * the vectors inside can have a different size.
+ * the vectors inside can have a different size. The special case of a
+ * block vector with constant block size is supported by constructor
+ * and reinit functions.
*
* The functionality of @p{BlockVector} includes everything a @p{Vector}
* can do, plus the access to a single @p{Vector} inside the
* corresponding ``.templates.h'' file and instantiate the respective
* class yourself.
*
- * @author Guido Kanschat, 1999; Wolfgang Bangerth, 2000
+ * @author Wolfgang Bangerth, Guido Kanschat, 1999, 2000
*/
template <typename Number>
class BlockVector
typedef size_t size_type;
/**
- * Dummy-Constructor. Dimension=0
+ * Constructor. There are three
+ * ways to use this
+ * constructor. First, without
+ * any arguments, it generates
+ * an objetct with no
+ * blocks. Given one argument,
+ * it initializes @p{num_blocks}
+ * blocks, but these blocks have
+ * size zero. The third variant
+ * finally initializes all
+ * blocks to the same size
+ * @p{block_size}.
+ *
+ * Confer the other constructor
+ * further down if you intend to
+ * use blocks of different
+ * sizes.
*/
- BlockVector (unsigned int num_blocks = 0);
+ BlockVector (unsigned int num_blocks = 0,
+ unsigned int block_size = 0);
/**
* Copy-Constructor. Dimension set to
*/
~BlockVector ();
+ /**
+ * Reinitialize the BlockVector to
+ * contain @p{num_blocks} blocks of
+ * size @p{block_size} each.
+ *
+ * If @p{fast==false}, the vector
+ * is filled with zeros.
+ */
+ void reinit (const unsigned int num_blocks,
+ const unsigned int block_size,
+ const bool fast = false);
+
/**
* Reinitialize the BlockVector
* such that it contains
* has a potential to slow down a
* program considerably.
*
- * On @p{fast==false}, the vector is filled by
- * zeros.
+ * If @p{fast==false}, the vector
+ * is filled with zeros.
*/
void reinit (const vector<unsigned int> &N,
const bool fast=false);
template <typename Number>
-BlockVector<Number>::BlockVector (unsigned int num_blocks)
- : components(num_blocks),
- block_indices(num_blocks),
- num_blocks(num_blocks)
-{}
+BlockVector<Number>::BlockVector (unsigned int n_blocks,
+ unsigned int block_size)
+{
+ reinit (n_blocks, block_size);
+}
template <typename Number>
BlockVector<Number>::BlockVector (const vector<unsigned int> &n)
- : block_indices(num_blocks)
{
reinit (n, false);
}
// }
+template <typename Number>
+void BlockVector<Number>::reinit (const unsigned int n_bl,
+ const unsigned int bl_sz,
+ const bool fast)
+{
+ vector<unsigned int> n(n_bl, bl_sz);
+ reinit(n, fast);
+}
+
+
template <typename Number>
void BlockVector<Number>::reinit (const vector<unsigned int> &n,
const bool fast)