Typedef the base class for simpler access to its own typedefs.
Typedef the type of the underlying vector.
Reimplemented from BlockVectorBase< Vector >.
Import the typedefs from the base class.
Reimplemented from BlockVectorBase< Vector >.
Reimplemented from BlockVectorBase< Vector >.
Reimplemented from BlockVectorBase< Vector >.
Reimplemented from BlockVectorBase< Vector >.
Reimplemented from BlockVectorBase< Vector >.
Reimplemented from BlockVectorBase< Vector >.
Reimplemented from BlockVectorBase< Vector >.
Reimplemented from BlockVectorBase< Vector >.
BlockVector< Number >::BlockVector | ( | const unsigned int | num_blocks = 0 , |
|
const unsigned int | block_size = 0 | |||
) | [inline, explicit] |
Constructor. There are three ways to use this constructor. First, without any arguments, it generates an object with no blocks. Given one argument, it initializes num_blocks
blocks, but these blocks have size zero. The third variant finally initializes all blocks to the same size block_size
.
Confer the other constructor further down if you intend to use blocks of different sizes.
References reinit().
BlockVector< Number >::BlockVector | ( | const BlockVector & | V | ) | [inline] |
Copy-Constructor. Dimension set to that of V, all components are copied from V
References BlockVectorBase< VectorType >::block_indices, BlockVectorBase< Vector >::block_indices, BlockVectorBase< VectorType >::components, BlockVectorBase< Vector >::components, BlockVectorBase< Vector >::n_blocks(), and BlockVectorBase< VectorType >::n_blocks().
BlockVector< Number >::BlockVector | ( | const MPI::BlockVector & | v | ) | [inline, explicit] |
Copy-constructor: copy the values from a PETSc wrapper parallel block vector class.
Note that due to the communication model of MPI, all processes have to actually perform this operation, even if they do not use the result. It is not sufficient if only one processor tries to copy the elements from the other processors over to its own process space.
References BlockVectorBase< VectorType >::block(), BlockVectorBase< Vector >::block_indices, BlockVectorBase< Vector >::components, BlockVectorBase< VectorType >::get_block_indices(), BlockVectorBase< Vector >::n_blocks(), and BlockIndices::size().
BlockVector< Number >::BlockVector | ( | const std::vector< unsigned int > & | n | ) | [inline] |
Constructor. Set the number of blocks to n.size()
and initialize each block with n[i]
zero elements.
References reinit().
BlockVector< InputIterator >::BlockVector | ( | const std::vector< unsigned int > & | n, | |
const InputIterator | first, | |||
const InputIterator | end | |||
) | [inline] |
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.
References Assert, BlockVectorBase< Vector >::block(), and reinit().
BlockVector< Number >::~BlockVector | ( | ) | [inline] |
Destructor. Clears memory
BlockVector & BlockVector< Number >::operator= | ( | const value_type | s | ) | [inline] |
Copy operator: fill all components of the vector with the given scalar value.
References BlockVectorBase< Vector >::operator=().
BlockVector & BlockVector< Number >::operator= | ( | const BlockVector & | V | ) | [inline] |
Copy operator for arguments of the same type.
References BlockVectorBase< Vector >::operator=().
BlockVector & BlockVector< Number >::operator= | ( | const MPI::BlockVector & | v | ) | [inline] |
Copy all the elements of the parallel block vector v
into this local vector. Note that due to the communication model of MPI, all processes have to actually perform this operation, even if they do not use the result. It is not sufficient if only one processor tries to copy the elements from the other processors over to its own process space.
References BlockVectorBase< Vector >::operator=().
void BlockVector< Number >::reinit | ( | const unsigned int | num_blocks, | |
const unsigned int | block_size, | |||
const bool | fast = false | |||
) | [inline] |
Reinitialize the BlockVector to contain num_blocks
blocks of size block_size
each.
If fast==false
, the vector is filled with zeros.
Referenced by BlockVector(), and reinit().
void BlockVector< Number >::reinit | ( | const std::vector< unsigned int > & | N, | |
const bool | fast = false | |||
) | [inline] |
Reinitialize the BlockVector such that it contains block_sizes.size()
blocks. Each block is reinitialized to dimension block_sizes[i]
.
If the number of blocks is the same as before this function was called, all vectors remain the same and reinit() is called for each vector.
If fast==false
, the vector is filled with zeros.
Note that you must call this (or the other reinit() functions) function, rather than calling the reinit() functions of an individual block, to allow the block vector to update its caches of vector sizes. If you call 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.
References BlockVectorBase< Vector >::block_indices, BlockVectorBase< Vector >::components, BlockVectorBase< Vector >::n_blocks(), reinit(), and BlockIndices::reinit().
void BlockVector< Number >::reinit | ( | const BlockVector & | V, | |
const bool | fast = false | |||
) | [inline] |
Change the dimension to that of the vector V
. The same applies as for the other reinit() function.
The elements of V
are not copied, i.e. this function is the same as calling reinit (V.size(), fast)
.
Note that you must call this (or the other reinit() functions) function, rather than calling the reinit() functions of an individual block, to allow the block vector to update its caches of vector sizes. If you call reinit() of one of the blocks, then subsequent actions of this object may yield unpredictable results since they may be routed to the wrong block.
References BlockVectorBase< VectorType >::block(), BlockVectorBase< Vector >::block(), BlockVectorBase< Vector >::block_indices, BlockVectorBase< Vector >::components, BlockVectorBase< VectorType >::get_block_indices(), BlockVectorBase< Vector >::n_blocks(), and Vector< Number >::reinit().
void BlockVector< Number >::swap | ( | BlockVector & | v | ) | [inline] |
Swap the contents of this vector and the other vector v
. One could do this operation with a temporary variable and copying over the data elements, but this function is significantly more efficient since it only swaps the pointers to the data of the two vectors and therefore does not need to allocate temporary storage and move data around.
Limitation: right now this function only works if both vectors have the same number of blocks. If needed, the numbers of blocks should be exchanged, too.
This function is analog to the the swap() function of all C++ standard containers. Also, there is a global function swap(u,v) that simply calls u.swap(v)
, again in analogy to standard functions.
References Assert, BlockVectorBase< VectorType >::block_indices, BlockVectorBase< Vector >::block_indices, BlockVectorBase< VectorType >::components, BlockVectorBase< Vector >::components, BlockVectorBase< VectorType >::n_blocks(), BlockVectorBase< Vector >::n_blocks(), and swap().
Referenced by swap().