Matrix and Vector classes that support a block recursive structure capable of representing the natural structure from Finite Element discretisations.
More...
Collaboration diagram for Sparse Matrix and Vector classes:
Matrix and Vector classes that support a block recursive structure capable of representing the natural structure from Finite Element discretisations.
The interface of our matrices is designed according to what they represent from a mathematical point of view. The vector classes are representations of vector spaces:
FieldVector represents a vector space where the field is represented by a numeric type (e.g. double, float, complex). is known at compile time.
BlockVector represents a vector space where W is itself a vector space.
VariableBlockVector represents a vector space having a two-level block structure of the form , i.e. it is constructed from vector spaces, .
The matrix classes represent linear maps from vector space to vector space the recursive block structure of the matrix rows and columns immediately follows from the recursive block structure of the vectors representing the domain and range of the mapping, respectively:
FieldMatrix represents a linear map where and are vector spaces over the same field represented by a numerix type.
BCRSMatrix represents a linear map where and where W is itself a vector space.
using Dune::MultiTypeBlockVector< Args >::field_type = Std::detected_t<std::common_type_t, typename FieldTraits< std::decay_t<Args> >::field_type...>
The type used for scalars.
Use the std::common_type_t of the Args' field_type and use nonesuch if no implementation of std::common_type is provided for the given field_type arguments.
using Dune::MultiTypeBlockVector< Args >::real_type = Std::detected_t<std::common_type_t, typename FieldTraits< std::decay_t<Args> >::real_type...>
The type used for real values.
Use the std::common_type_t of the Args' real_type and use nonesuch if no implementation of std::common_type is provided for the given real_type arguments.
typename std::enable_if_t< Dune::IsNumber< M >::value > *
sfinae = nullptr
)
inline
Get the number of nonzero fields in the matrix.
This is not the number of nonzero blocks, but the number of non zero scalar entries (on blocklevel 1) if the matrix is viewed as a flat matrix.
For FieldMatrix this is simply the number of columns times the number of rows, for a BCRSMatrix<FieldMatrix<K,n,m>> this is the number of nonzero blocks time n*m.
This method mimics the behavior of normal vector access with square brackets like, e.g., v[5] = 1. The problem is that the return type is different for each value of the argument in the brackets. Therefore we implement a trick using std::integral_constant. To access the first entry of a MultiTypeBlockVector named v write
The name '_0' used here as a static replacement of the integer number zero is arbitrary. Any other variable name can be used. If you don't like the separate variable, you can writee