![]() |
MFEM v4.10.0
Finite element discretization library
|
Class representing an array of Vectors with generally different sizes. More...
#include <multivector.hpp>
Public Member Functions | |
| MultiVector ()=default | |
| Create an empty MultiVector with zero blocks. | |
| MultiVector (int num_blocks) | |
| Create a MultiVector with num_blocks blocks. The individual Vector blocks are default initialized, i.e. they all have size zero. | |
| MultiVector (const Array< int > &vector_sizes) | |
| Construct a MultiVector with number of blocks and individual block Vector sizes given by vector_sizes. | |
| MultiVector (const Array< int > &vector_sizes, MemoryType mt) | |
| Construct a MultiVector with number of blocks and individual block Vector sizes given by vector_sizes. All Vector blocks use the MemoryType mt. | |
| MultiVector (Vector &base, const Array< int > &vector_sizes) | |
| Construct a MultiVector referencing data within a given monolithic Vector base. | |
| template<typename... VectorTypes, std::enable_if_t< std::conjunction_v< std::is_convertible< VectorTypes &, Vector & >... >, bool > = true> | |
| MultiVector (VectorTypes &...vs) | |
| Construct a MultiVector referencing multiple Vectors given as arguments. | |
| template<typename... VectorTypes, std::enable_if_t< std::conjunction_v< std::is_convertible< const VectorTypes &, const Vector & >... >, bool > = true> | |
| MultiVector (const VectorTypes &...vs) | |
| Construct a MultiVector referencing multiple const Vectors given as arguments. Individual blocks are read-only; non-const operator[] will generate an error. | |
| int | NumBlocks () const |
| Return the number of Vectors in the MultiVector. | |
| void | SetNumBlocks (int num_blocks) |
| Set the number of Vectors in the MultiVector. Existing Vector blocks will remain unmodified. New Vector blocks will be default initialized, i.e. they all have size zero. | |
| Vector & | operator[] (int i) |
| Read-write access to the i-th Vector. Generates an error if the i-th block is read-only, i.e. it is a pointer to a const Vector. | |
| const Vector & | operator[] (int i) const |
| Read-only access to the i-th Vector. | |
| void | SetSizes (const Array< int > &vector_sizes) |
| Update the MultiVector according to the given vector_sizes. | |
| void | SetSizes (const Array< int > &vector_sizes, MemoryType mt) |
| Update the MultiVector according to the given vector_sizes and MemoryType mt. | |
| void | MakeRef (Vector &base, const Array< int > &vector_sizes) |
| Update the MultiVector to reference data within a given monolithic Vector base. | |
| void | MakeRef (int i, Vector &base, int offset, int size) |
| Update the i-th MultiVector block to reference data within the given monolithic Vector base at the given offset and with the given size. | |
| template<typename... VectorTypes, std::enable_if_t< std::conjunction_v< std::is_convertible< VectorTypes &, Vector & >... >, bool > = true> | |
| void | MakeRef (VectorTypes &...vs) |
| Update the MultiVector to reference multiple Vectors given as arguments. | |
| template<typename... VectorTypes, std::enable_if_t< std::conjunction_v< std::is_convertible< const VectorTypes &, const Vector & >... >, bool > = true> | |
| void | MakeRef (const VectorTypes &...vs) |
| Update the MultiVector to reference multiple const Vectors given as arguments. Individual blocks are read-only; non-const operator[] will generate an error. | |
| void | MakeRef (int i, Vector &v) |
| Update the i-th MultiVector block to reference the given Vector v. | |
| void | MakeRef (int i, const Vector &v) |
| Update the i-th MultiVector block to reference the given const Vector v. The block becomes read-only. | |
Class representing an array of Vectors with generally different sizes.
This class is similar to BlockVector with the following two main differences:
Internally, each Vector block is represented as one of the following three options:
Definition at line 42 of file multivector.hpp.
|
default |
Create an empty MultiVector with zero blocks.
|
inline |
Create a MultiVector with num_blocks blocks. The individual Vector blocks are default initialized, i.e. they all have size zero.
Definition at line 53 of file multivector.hpp.
| mfem::MultiVector::MultiVector | ( | const Array< int > & | vector_sizes | ) |
Construct a MultiVector with number of blocks and individual block Vector sizes given by vector_sizes.
Definition at line 17 of file multivector.cpp.
| mfem::MultiVector::MultiVector | ( | const Array< int > & | vector_sizes, |
| MemoryType | mt ) |
Construct a MultiVector with number of blocks and individual block Vector sizes given by vector_sizes. All Vector blocks use the MemoryType mt.
Definition at line 22 of file multivector.cpp.
Construct a MultiVector referencing data within a given monolithic Vector base.
With this constructor, the Memory flags of base and of the individual Vector blocks may need to be explicitly synchronized when data is moved between host and device.
Definition at line 27 of file multivector.cpp.
|
inline |
Construct a MultiVector referencing multiple Vectors given as arguments.
The VectorTypes reference arguments are expected to be static_cast-able to (Vector &) which is the case if the types are derived from Vector, e.g. HypreParVector, GridFunction, etc.
With this constructor, operations on individual Vector blocks are performed directly on the objects vs. In particular, there is no need to synchronize the Memory flags of vs and the ones of the individual Vector blocks when data is moved between host and device.
Definition at line 92 of file multivector.hpp.
|
inline |
Construct a MultiVector referencing multiple const Vectors given as arguments. Individual blocks are read-only; non-const operator[] will generate an error.
Definition at line 102 of file multivector.hpp.
|
inline |
Update the MultiVector to reference multiple const Vectors given as arguments. Individual blocks are read-only; non-const operator[] will generate an error.
Definition at line 236 of file multivector.hpp.
|
inline |
Update the i-th MultiVector block to reference the given const Vector v. The block becomes read-only.
Definition at line 191 of file multivector.hpp.
|
inline |
Update the i-th MultiVector block to reference data within the given monolithic Vector base at the given offset and with the given size.
After calling this method, the Memory flags of base and of the i-th Vector block may need to be explicitly synchronized when data is moved between host and device.
Definition at line 148 of file multivector.hpp.
|
inline |
Update the i-th MultiVector block to reference the given Vector v.
After calling this method, operations on the i-th Vector block are performed directly on the Vector v. In particular, there is no need to synchronize the Memory flags of v and the ones of the i-th Vector blocks when data is moved between host and device.
Definition at line 187 of file multivector.hpp.
Update the MultiVector to reference data within a given monolithic Vector base.
After calling this method, the Memory flags of base and of the individual Vector blocks may need to be explicitly synchronized when data is moved between host and device.
Definition at line 50 of file multivector.cpp.
|
inline |
Update the MultiVector to reference multiple Vectors given as arguments.
The VectorTypes reference arguments are expected to be static_cast-able to (Vector &) which is the case if the types are derived from Vector, e.g. HypreParVector, GridFunction, etc.
After calling this method, operations on individual Vector blocks are performed directly on the objects vs. In particular, there is no need to synchronize the Memory flags of vs and the ones of the individual Vector blocks when data is moved between host and device.
Definition at line 218 of file multivector.hpp.
|
inline |
Return the number of Vectors in the MultiVector.
Definition at line 105 of file multivector.hpp.
|
inline |
Read-write access to the i-th Vector. Generates an error if the i-th block is read-only, i.e. it is a pointer to a const Vector.
Definition at line 196 of file multivector.hpp.
|
inline |
Read-only access to the i-th Vector.
Definition at line 205 of file multivector.hpp.
|
inline |
Set the number of Vectors in the MultiVector. Existing Vector blocks will remain unmodified. New Vector blocks will be default initialized, i.e. they all have size zero.
Definition at line 110 of file multivector.hpp.
| void mfem::MultiVector::SetSizes | ( | const Array< int > & | vector_sizes | ) |
Update the MultiVector according to the given vector_sizes.
This method can be used to add or remove blocks. The individual Vector sizes are updated using the method Vector::SetSize(int).
Definition at line 32 of file multivector.cpp.
| void mfem::MultiVector::SetSizes | ( | const Array< int > & | vector_sizes, |
| MemoryType | mt ) |
Update the MultiVector according to the given vector_sizes and MemoryType mt.
This method can be used to add or remove blocks. The individual Vector sizes and MemoryType are updated using the method Vector::SetSize(int, MemoryType).
Definition at line 41 of file multivector.cpp.