dune-istl 2.12-git
Loading...
Searching...
No Matches
defaultmatrixvectortraits.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5
6#ifndef DUNE_ISTL_DEFAULT_MATRIX_VECTOR_TRAITS_HH
7#define DUNE_ISTL_DEFAULT_MATRIX_VECTOR_TRAITS_HH
8
9#include <memory>
10
12
14{
15 template<class, class, class> class BCRSMatrix;
16 template<class, class, class> class Matrix;
17} // end namespace Dune::Experimental
18
19namespace Dune {
20
21// forward declarations
22template<class, class> class BCRSMatrix;
23template<class, class> class BDMatrix;
24template<class, class> class BlockVector;
25template<class, class> class BTDMatrix;
26template<class, int> class DiagonalMatrix;
27template<class> class DynamicMatrix;
28template<class, class> class DynamicVector;
29template<class, int, int> class FieldMatrix;
30template<class, int> class FieldVector;
31template<class, class> class Matrix;
32template<class, class...> class MultiTypeBlockMatrix;
33template<class...> class MultiTypeBlockVector;
34template<class, int> class ScaledIdentityMatrix;
35
46template<class Matrix>
48
50template<class LO>
51 requires requires{ typename LO::domain_type; typename LO::range_type; }
53{
54 using domain_type = typename LO::domain_type;
55 using range_type = typename LO::range_type;
56};
57
59template<Concept::Number N>
65
67template<class T, int n, int m>
73
75template<class T>
83
85template<class T, int n>
91
93template<class T, int n>
99
101template<class T, class A>
103{
104 // In case of recursive deduction (e.g., BCRSMatrix<FieldMatrix, Allocator<FieldMatrix>>)
105 // the allocator needs to be converted to the sub-block allocator type too (e.g.,
106 // Allocator<FieldVector>). Note that matrix allocator is assumed to be the same as
107 // the domain/range type of allocators
108
110 typename std::allocator_traits<A>::template rebind_alloc<typename DefaultMatrixVectorTraits<T>::domain_type>>;
112 typename std::allocator_traits<A>::template rebind_alloc<typename DefaultMatrixVectorTraits<T>::range_type>>;
113};
114
116template<class T, class A>
118 : public DefaultMatrixVectorTraits<BCRSMatrix<T,A>>
119{};
120
122template<class T, class A>
124 : public DefaultMatrixVectorTraits<BCRSMatrix<T,A>>
125{};
126
128template<class T, class A>
130 : public DefaultMatrixVectorTraits<BCRSMatrix<T,A>>
131{};
132
134template<class T, class P, class A>
135struct DefaultMatrixVectorTraits<Experimental::Matrix<T,P,A>>
136 : public DefaultMatrixVectorTraits<BCRSMatrix<T,A>>
137{};
138
139
140
142template<class T, class I, class A>
143struct DefaultMatrixVectorTraits<Experimental::BCRSMatrix<T,I,A>>
144 : public DefaultMatrixVectorTraits<BCRSMatrix<T,A>>
145{};
146
147namespace Impl
148{
149 template <class V>
150 struct MultiTypeDefaultMatrixVectorTraits;
151
152 // to make the `DefaultMatrixVectorTraits` work with `MultiTypeBlockMatrix`, we need to add
153 // an intermediate step for the rows, which are typically `MultiTypeBlockVector`
154 template<class FirstBlock, class... Blocks>
155 struct MultiTypeDefaultMatrixVectorTraits<MultiTypeBlockVector<FirstBlock, Blocks...>>
156 {
157 using domain_type = MultiTypeBlockVector<
160 using range_type = typename DefaultMatrixVectorTraits<FirstBlock>::range_type;
161 };
162
163} // end namespace Impl
164
166template<class FirstRow, class... Rows>
168{
169 using domain_type = typename Impl::MultiTypeDefaultMatrixVectorTraits<FirstRow>::domain_type;
171 typename Impl::MultiTypeDefaultMatrixVectorTraits<FirstRow>::range_type,
172 typename Impl::MultiTypeDefaultMatrixVectorTraits<Rows>::range_type... >;
173};
174
175} // end namespace Dune
176
177#endif // DUNE_ISTL_DEFAULT_MATRIX_VECTOR_TRAITS_HH
Definition defaultmatrixvectortraits.hh:14
static constexpr size_type N()
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:468
A block-diagonal matrix.
Definition bdmatrix.hh:33
A Vector class to support different block types.
Definition multitypeblockvector.hh:59
A Matrix class to support different block types.
Definition multitypeblockmatrix.hh:46
A block-tridiagonal matrix.
Definition btdmatrix.hh:31
A vector of blocks with memory management.
Definition bvector.hh:392
Block compressed row storage matrix.
Definition experimental/bcrsmatrix.hh:82
Owning matrix container built on top of MatrixView.
Definition experimental/matrix.hh:44
A generic dynamic dense matrix.
Definition matrix.hh:561
A multiple of the identity matrix of static size.
Definition scaledidmatrix.hh:42
Definition defaultmatrixvectortraits.hh:47
typename LO::domain_type domain_type
Definition defaultmatrixvectortraits.hh:54
typename LO::range_type range_type
Definition defaultmatrixvectortraits.hh:55
N range_type
Definition defaultmatrixvectortraits.hh:63
N domain_type
Definition defaultmatrixvectortraits.hh:62
typename Impl::MultiTypeDefaultMatrixVectorTraits< FirstRow >::domain_type domain_type
Definition defaultmatrixvectortraits.hh:169