25#ifndef DUMUX_MULTIDOMAIN_TRAITS_HH
26#define DUMUX_MULTIDOMAIN_TRAITS_HH
33#include <dune/common/fmatrix.hh>
34#include <dune/common/indices.hh>
36#include <dune/istl/bcrsmatrix.hh>
37#include <dune/istl/multitypeblockvector.hh>
38#include <dune/istl/multitypeblockmatrix.hh>
49template<
class Scalar,
class... JacobianBlocks>
53 template<
bool...>
struct boolPack;
54 template<
bool... bools>
55 using all_true = std::is_same<boolPack<bools...,
true>, boolPack<
true, bools...>>;
57 static_assert(all_true<isBCRSMatrix<JacobianBlocks>::value...>::value,
"Jacobian blocks have to be BCRSMatrices!");
59 template<std::
size_t id>
60 using JacobianDiagBlock =
typename std::tuple_element_t<id, std::tuple<JacobianBlocks...>>;
62 template<std::
size_t id>
63 static constexpr decltype(
auto) numEq()
64 {
return JacobianDiagBlock<id>::block_type::rows; }
66 template <std::
size_t id,
class I>
struct makeRow;
68 template <std::size_t id, std::size_t... Is>
69 struct makeRow<id, std::index_sequence<Is...>>
71 using type = Dune::MultiTypeBlockVector<Dune::BCRSMatrix<Dune::FieldMatrix<Scalar, numEq<id>(), numEq<Is>()>>...>;
74 template <
class I>
struct makeMatrix;
76 template <std::size_t... Is>
77 struct makeMatrix<std::index_sequence<Is...>>
79 using type = Dune::MultiTypeBlockMatrix<
typename makeRow<Is, std::index_sequence<Is...>>
::type...>;
82 using Indices = std::index_sequence_for<JacobianBlocks...>;
84 using type =
typename makeMatrix<Indices>::type;
88template<
template<std::
size_t>
class T,
class Indices>
91 template<std::
size_t i>
98template<
template<std::
size_t>
class T,
class Indices>
101 template<std::
size_t i>
108template<
template<std::
size_t>
class SubDomainDiagBlocks,
class Indices,
class Scalar>
111 template<
typename... MatrixBlocks>
144template<
typename... SubDomainTypeTags>
153 template<std::
size_t id>
154 using SubDomainTypeTag =
typename std::tuple_element_t<id, std::tuple<SubDomainTypeTags...>>;
157 using Indices = std::make_index_sequence<numSubDomains>;
160 template<std::
size_t id>
164 template<std::
size_t id>
168 template<std::
size_t id>
178 template<std::
size_t id>
181 using Index = Dune::index_constant<id>;
185 using FVGridGeometry [[deprecated(
"Use GridGeometry instead. FVGridGeometry will be removed after 3.1!")]] =
GridGeometry;
216 template<
template<std::
size_t>
class T>
220 template<
template<std::
size_t>
class T>
224 template<
template<std::
size_t>
class T>
Type traits to be used with matrix types.
Utilities for template meta programming.
make the local view function available whenever we use the grid geometry
Definition adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:149
Property to specify the type of scalar values.
Definition common/properties.hh:53
The DUNE grid type.
Definition common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition common/properties.hh:69
A class helping models to define input and output fields.
Definition common/properties.hh:78
Type of the global jacobian matrix.
Definition common/properties.hh:82
Vector containing all primary variable vector of the grid.
Definition common/properties.hh:84
Definition common/properties.hh:150
The grid variables object managing variable data on the grid (volvars/fluxvars cache).
Definition common/properties.hh:190
a helper class to create a multitype matrix given the diagonal matrix blocks
Definition traits.hh:51
typename makeMatrix< Indices >::type type
Definition traits.hh:84
helper alias to create a tuple of shared_ptr<...> from an indexed type
Definition traits.hh:90
std::shared_ptr< T< i > > PtrType
Definition traits.hh:92
typename makeFromIndexedType< std::tuple, PtrType, Indices >::type type
Definition traits.hh:94
helper alias to create a tuple of shared_ptr<const ...> from an indexed type
Definition traits.hh:100
typename makeFromIndexedType< std::tuple, PtrType, Indices >::type type
Definition traits.hh:104
std::shared_ptr< const T< i > > PtrType
Definition traits.hh:102
helper alias to create the JacobianMatrix type
Definition traits.hh:110
typename createMultiTypeBlockMatrixType< Scalar, MatrixBlocks... >::type::type M
Definition traits.hh:112
typename makeFromIndexedType< M, SubDomainDiagBlocks, Indices >::type type
Definition traits.hh:114
static constexpr std::size_t numSubDomains
Definition traits.hh:148
typename makeFromIndexedType< std::common_type_t, SubDomainScalar, Indices >::type Scalar
the scalar type
Definition traits.hh:200
typename makeFromIndexedType< Dune::MultiTypeBlockVector, SubDomainSolutionVector, Indices >::type SolutionVector
the solution vector type
Definition traits.hh:203
typename Detail::MultiDomainTupleSharedPtr< T, Indices >::type TupleOfSharedPtr
helper alias to create tuple<std::shared_ptr<...>> from indexed type
Definition traits.hh:221
typename makeFromIndexedType< std::tuple, T, Indices >::type Tuple
helper alias to create tuple<...> from indexed type
Definition traits.hh:217
typename Detail::MultiDomainMatrixType< SubDomainJacobianMatrix, Indices, Scalar >::type JacobianMatrix
the jacobian type
Definition traits.hh:206
typename Detail::MultiDomainTupleSharedPtrConst< T, Indices >::type TupleOfSharedPtrConst
helper alias to create tuple<std::shared_ptr<const ...>> from indexed type
Definition traits.hh:225
GetPropType< SubDomainTypeTag< id >, Properties::GridGeometry > GridGeometry
Definition traits.hh:184
SubDomainTypeTag< id > TypeTag
Definition traits.hh:182
Dune::index_constant< id > Index
Definition traits.hh:181
GetPropType< SubDomainTypeTag< id >, Properties::IOFields > IOFields
Definition traits.hh:188
GetPropType< SubDomainTypeTag< id >, Properties::Problem > Problem
Definition traits.hh:186
GetPropType< SubDomainTypeTag< id >, Properties::GridVariables > GridVariables
Definition traits.hh:187
GetPropType< SubDomainTypeTag< id >, Properties::Grid > Grid
Definition traits.hh:183
GetPropType< SubDomainTypeTag< id >, Properties::SolutionVector > SolutionVector
Definition traits.hh:189
Declares all properties used in Dumux.