In contrast to the class MPI::BlockVector, this class is based on a localized version of the vectors, which means that the whole vector is stored on each processor. Note that matrix vector products with this block vector class do only work in case the program is run on only one processor, since the Trilinos matrices are inherently parallel.
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 | ( | ) | [inline] |
Default constructor. Generate an empty vector without any blocks.
BlockVector< Number >::BlockVector | ( | const std::vector< Epetra_Map > & | InputMaps | ) | [inline] |
BlockVector< Number >::BlockVector | ( | const MPI::BlockVector & | V | ) | [inline] |
Copy-Constructor. Set all the properties of the parallel vector to those of the given argument and copy the elements.
References reinit().
BlockVector< Number >::BlockVector | ( | const BlockVector & | V | ) | [inline] |
Copy-Constructor. Set all the properties of the parallel vector to those of the given argument and copy the elements.
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 unsigned int | num_blocks | ) | [inline] |
Creates a block vector consisting of num_blocks
components, but there is no content in the individual components and the user has to fill appropriate data using a reinit of the blocks.
References reinit().
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 BlockVector.reinit().
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& TrilinosWrappers::BlockVector::operator= | ( | const value_type | s | ) |
Copy operator: fill all components of the vector that are locally stored with the given scalar value.
BlockVector& TrilinosWrappers::BlockVector::operator= | ( | const MPI::BlockVector & | V | ) |
Copy operator for a distributed Trilinos vector to a localized one.
BlockVector& TrilinosWrappers::BlockVector::operator= | ( | const BlockVector & | V | ) |
Copy operator for arguments of the same type.
BlockVector& TrilinosWrappers::BlockVector::operator= | ( | const ::::BlockVector< Number > & | V | ) | [inline] |
Another copy function. This one takes a deal.II block vector and copies it into a TrilinosWrappers block vector. Note that the number of blocks has to be the same in the vector as in the input vector. Use the reinit() command for resizing the BlockVector or for changing the internal structure of the block components.
Since Trilinos only works on doubles, this function is limited to accept only one possible number type in the deal.II vector.
void TrilinosWrappers::BlockVector::reinit | ( | const std::vector< Epetra_Map > & | input_maps, | |
const bool | fast = false | |||
) |
Reinitialize the BlockVector to contain as many blocks as there are Epetra_Maps given in the input argument, according to the parallel distribution of the individual components described in the maps.
If fast==false
, the vector is filled with zeros.
Referenced by BlockVector().
void TrilinosWrappers::BlockVector::reinit | ( | const std::vector< unsigned int > & | N, | |
const bool | fast = false | |||
) |
Reinitialize the BlockVector to contain as many blocks as there are elements in the first argument, and with the respective sizes. Since no distribution map is given, all vectors are local vectors.
If fast==false
, the vector is filled with zeros.
void TrilinosWrappers::BlockVector::reinit | ( | const MPI::BlockVector & | V | ) |
Reinit the function according to a distributed block vector. The elements will be copied in this process.
void TrilinosWrappers::BlockVector::reinit | ( | const BlockVector & | V, | |
const bool | fast = false | |||
) |
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() on one of the blocks, then subsequent actions on this object may yield unpredictable results since they may be routed to the wrong block.
Change the number of blocks to num_blocks
. The individual blocks will get initialized with zero size, so it is assumed that the user resizes the individual blocks by herself in an appropriate way, and calls collect_sizes
afterwards.
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(), BlockVectorBase< Vector >::block(), BlockVectorBase< VectorType >::n_blocks(), BlockVectorBase< Vector >::n_blocks(), and Vector< Number >::swap().
Referenced by swap().