From: David Wells Date: Sat, 18 Apr 2015 15:57:07 +0000 (-0400) Subject: Consistently name block_sizes as such. X-Git-Tag: v8.3.0-rc1~245^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c0db6bc5e0f8912d91cdc5c879ac963064f0791;p=dealii.git Consistently name block_sizes as such. It was referred to as "n" or "N" in some functions. --- diff --git a/include/deal.II/lac/block_indices.h b/include/deal.II/lac/block_indices.h index cd338b7efa..554268ef18 100644 --- a/include/deal.II/lac/block_indices.h +++ b/include/deal.II/lac/block_indices.h @@ -65,9 +65,10 @@ public: /** * Constructor. Initialize the number of entries in each block @p i as - * n[i]. The number of blocks will be the size of the vector + * block_sizes[i]. The number of blocks will be the size of @p + * block_sizes. */ - BlockIndices (const std::vector &n); + BlockIndices (const std::vector &block_sizes); /** * Specialized constructor for a structure with blocks of equal size. @@ -83,10 +84,11 @@ public: /** * Reinitialize the number of indices within each block from the given - * argument. The number of blocks will be adjusted to the size of @p n and - * the size of block @p i is set to n[i]. + * argument. The number of blocks will be adjusted to the size of + * block_sizes and the size of block @p i is set to + * block_sizes[i]. */ - void reinit (const std::vector &n); + void reinit (const std::vector &block_sizes); /** * Add another block of given size to the end of the block structure. @@ -306,16 +308,16 @@ BlockIndices::reinit (const unsigned int nb, inline void -BlockIndices::reinit (const std::vector &n) +BlockIndices::reinit (const std::vector &block_sizes) { - if (start_indices.size() != n.size()+1) + if (start_indices.size() != block_sizes.size()+1) { - n_blocks = static_cast(n.size()); + n_blocks = static_cast(block_sizes.size()); start_indices.resize(n_blocks+1); } start_indices[0] = 0; for (size_type i=1; i<=n_blocks; ++i) - start_indices[i] = start_indices[i-1] + n[i-1]; + start_indices[i] = start_indices[i-1] + block_sizes[i-1]; } @@ -343,12 +345,12 @@ BlockIndices::BlockIndices ( inline -BlockIndices::BlockIndices (const std::vector &n) +BlockIndices::BlockIndices (const std::vector &block_sizes) : - n_blocks(static_cast(n.size())), - start_indices(n.size()+1) + n_blocks(static_cast(block_sizes.size())), + start_indices(block_sizes.size()+1) { - reinit (n); + reinit (block_sizes); } diff --git a/include/deal.II/lac/block_vector.h b/include/deal.II/lac/block_vector.h index 4493d0aa6f..4d176b67b2 100644 --- a/include/deal.II/lac/block_vector.h +++ b/include/deal.II/lac/block_vector.h @@ -146,15 +146,16 @@ public: BlockVector (const BlockIndices &block_indices); /** - * Constructor. Set the number of blocks to n.size(). Initialize - * the vector with the elements pointed to by the range of iterators given - * as second and third argument. Apart from the first argument, this - * constructor is in complete analogy to the respective constructor of the - * std::vector class, but the first argument is needed in order to - * know how to subdivide the block vector into different blocks. + * Constructor. Set the number of blocks to block_sizes.size(). + * Initialize the vector with the elements pointed to by the range of + * iterators given as second and third argument. Apart from the first + * argument, this constructor is in complete analogy to the respective + * constructor of the std::vector class, but the first argument is + * needed in order to know how to subdivide the block vector into different + * blocks. */ template - BlockVector (const std::vector &n, + BlockVector (const std::vector &block_sizes, const InputIterator first, const InputIterator end); @@ -243,7 +244,7 @@ public: * reinit() on one of the blocks, then subsequent actions on this object may * yield unpredictable results since they may be routed to the wrong block. */ - void reinit (const std::vector &N, + void reinit (const std::vector &block_sizes, const bool fast=false); /** @@ -353,7 +354,7 @@ public: template template -BlockVector::BlockVector (const std::vector &n, +BlockVector::BlockVector (const std::vector &block_sizes, const InputIterator first, const InputIterator end) { @@ -361,12 +362,12 @@ BlockVector::BlockVector (const std::vector &n, // don't initialize them as we will // copy elements soon (void)end; - reinit (n, true); + reinit (block_sizes, true); InputIterator start = first; - for (size_type b=0; b(n[b])); + std::advance (end, static_cast(block_sizes[b])); std::copy (start, end, this->block(b).begin()); start = end; }; diff --git a/include/deal.II/lac/block_vector.templates.h b/include/deal.II/lac/block_vector.templates.h index 16e020dd69..d89831e31d 100644 --- a/include/deal.II/lac/block_vector.templates.h +++ b/include/deal.II/lac/block_vector.templates.h @@ -35,9 +35,9 @@ BlockVector::BlockVector (const unsigned int n_blocks, template -BlockVector::BlockVector (const std::vector &n) +BlockVector::BlockVector (const std::vector &block_sizes) { - reinit (n, false); + reinit (block_sizes, false); } @@ -96,21 +96,21 @@ void BlockVector::reinit (const unsigned int n_bl, const size_type bl_sz, const bool fast) { - std::vector n(n_bl, bl_sz); - reinit(n, fast); + std::vector block_sizes(n_bl, bl_sz); + reinit(block_sizes, fast); } template -void BlockVector::reinit (const std::vector &n, +void BlockVector::reinit (const std::vector &block_sizes, const bool fast) { - this->block_indices.reinit (n); + this->block_indices.reinit (block_sizes); if (this->components.size() != this->n_blocks()) this->components.resize(this->n_blocks()); for (size_type i=0; in_blocks(); ++i) - this->components[i].reinit(n[i], fast); + this->components[i].reinit(block_sizes[i], fast); }