3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
staggeredtraits.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
26#ifndef DUMUX_STAGGERED_MULTIDOMAIN_TRAITS_HH
27#define DUMUX_STAGGERED_MULTIDOMAIN_TRAITS_HH
28
29#include <type_traits>
30#include <tuple>
31#include <utility>
32
33#include <dune/common/fmatrix.hh>
34#include <dune/common/indices.hh>
35
36#include <dune/istl/bcrsmatrix.hh>
37#include <dune/istl/multitypeblockvector.hh>
38#include <dune/istl/multitypeblockmatrix.hh>
39
42
43#include "traits.hh"
44
45namespace Dumux {
46namespace Detail {
47namespace Staggered {
48
50template<template<std::size_t> class SubDomainTypeTag, std::size_t i>
53
54template<template<std::size_t> class SubDomainTypeTag>
55struct SubDomainFVGridGeometryImpl<SubDomainTypeTag, 0>
56{ using type = typename GetPropType<SubDomainTypeTag<0>, Properties::GridGeometry>::FaceFVGridGeometryType; };
57
58template<template<std::size_t> class SubDomainTypeTag>
59struct SubDomainFVGridGeometryImpl<SubDomainTypeTag, 1>
60{ using type = typename GetPropType<SubDomainTypeTag<0>, Properties::GridGeometry>::CellCenterFVGridGeometryType; };
62
64template<template<std::size_t> class SubDomainTypeTag, std::size_t i>
67
68template<template<std::size_t> class SubDomainTypeTag>
69struct SubDomainGridVariablesImpl<SubDomainTypeTag, 0>
70{ using type = typename GetPropType<SubDomainTypeTag<0>, Properties::GridVariables>::FaceGridVariablesType; };
71
72template<template<std::size_t> class SubDomainTypeTag>
73struct SubDomainGridVariablesImpl<SubDomainTypeTag, 1>
74{ using type = typename GetPropType<SubDomainTypeTag<0>, Properties::GridVariables>::CellCenterGridVariablesType; };
76
78template<template<std::size_t> class SubDomainTypeTag, std::size_t i>
81
82template<template<std::size_t> class SubDomainTypeTag>
83struct SubDomainPrimaryVariablesImpl<SubDomainTypeTag, 0>
85
86template<template<std::size_t> class SubDomainTypeTag>
87struct SubDomainPrimaryVariablesImpl<SubDomainTypeTag, 1>
90
91template<class Scalar, int numEq>
93{
94 private:
95 using MatrixBlock = typename Dune::FieldMatrix<Scalar, numEq, numEq>;
96 public:
98};
99
101template<template<std::size_t> class SubDomainTypeTag, std::size_t i>
104
105template<template<std::size_t> class SubDomainTypeTag>
106struct SubDomainJacobianMatrixImpl<SubDomainTypeTag, 0>
108 getPropValue<SubDomainTypeTag<0>, Properties::NumEqFace>()>::type; };
109
110template<template<std::size_t> class SubDomainTypeTag>
111struct SubDomainJacobianMatrixImpl<SubDomainTypeTag, 1>
113 getPropValue<SubDomainTypeTag<0>, Properties::NumEqCellCenter>()>::type; };
115
117template<template<std::size_t> class SubDomainTypeTag, std::size_t i>
120
121template<template<std::size_t> class SubDomainTypeTag>
122struct SubDomainSolutionVectorImpl<SubDomainTypeTag, 0>
124
125template<template<std::size_t> class SubDomainTypeTag>
126struct SubDomainSolutionVectorImpl<SubDomainTypeTag, 1>
129
130} // end namespace Staggered
131} // end namespace Detail
132
133/*
134 * \ingroup MultiDomain
135 * \ingroup StaggeredDiscretization
136 * \brief A traits class every multidomain model has to provide
137 * \tparam SubDomainTypeTags the TypeTags of the sub domain problems
138 * \note should export the types
139 * \code
140 * //! the type tag of the sub domain problem with id
141 * template<std::size_t id>
142 * using SubDomainTypeTag = ...
143 *
144 * //! the index to access sub domain matrices and vectors
145 * //! to use with multitype matrices and vectors
146 * template<std::size_t id>
147 * using DomainIdx = ...
148 *
149 * //! the scalar type
150 * using Scalar = ...
151 *
152 * //! the solution vector type
153 * using SolutionVector = ...
154 *
155 * //! the jacobian type
156 * using JacobianMatrix = ...
157 * \endcode
158 */
159template<typename... SubDomainTypeTags>
161{
163 static constexpr std::size_t numSubDomains = sizeof...(SubDomainTypeTags);
164
165private:
166
168 template<std::size_t id>
169 using SubDomainTypeTag = typename std::tuple_element_t<id, std::tuple<SubDomainTypeTags...>>;
170
172 using Indices = std::make_index_sequence<numSubDomains>;
173
175 template<std::size_t id>
177
178 template<std::size_t id>
180
181 template<std::size_t id>
183
184public:
185
186 /*
187 * \brief sub domain types
188 */
189 //\{
190
191 template<std::size_t id>
193 {
194 using Index = Dune::index_constant<id>;
195 using TypeTag = SubDomainTypeTag<id>;
201 };
202
203 //\}
204
205 /*
206 * \brief multi domain types
207 */
208 //\{
209
212
215
218
219 //\}
220
221 /*
222 * \brief helper aliases to contruct derived tuple types
223 */
224 //\{
225
227 template<template<std::size_t> class T>
229
231 template<template<std::size_t> class T>
233
235 template<template<std::size_t> class T>
237
238 //\}
239};
240
241} //end namespace Dumux
242
243#endif
Type traits to be used with matrix types.
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
Property to specify the type of scalar values.
Definition: common/properties.hh:43
A vector of primary variables.
Definition: common/properties.hh:49
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:57
Type of the global jacobian matrix.
Definition: common/properties.hh:67
Vector containing all primary variable vector of the grid.
Definition: common/properties.hh:69
Definition: common/properties.hh:102
The grid variables object managing variable data on the grid (volvars/fluxvars cache)
Definition: common/properties.hh:123
The number of equations for cell-centered dofs.
Definition: common/properties.hh:216
The number of equations for face dofs.
Definition: common/properties.hh:218
The solution vector type for cell-centered dofs.
Definition: common/properties.hh:220
The solution vector type for face dofs.
Definition: common/properties.hh:222
The primary variables container type for cell-centered dofs.
Definition: common/properties.hh:226
The primary variables container type for face dofs.
Definition: common/properties.hh:228
Definition: matrix.hh:32
Definition: utility.hh:40
GetPropType< SubDomainTypeTag< i >, Properties::GridGeometry > type
Definition: staggeredtraits.hh:52
typename GetPropType< SubDomainTypeTag< 0 >, Properties::GridGeometry >::FaceFVGridGeometryType type
Definition: staggeredtraits.hh:56
typename GetPropType< SubDomainTypeTag< 0 >, Properties::GridGeometry >::CellCenterFVGridGeometryType type
Definition: staggeredtraits.hh:60
GetPropType< SubDomainTypeTag< i >, Properties::GridVariables > type
Definition: staggeredtraits.hh:66
typename GetPropType< SubDomainTypeTag< 0 >, Properties::GridVariables >::FaceGridVariablesType type
Definition: staggeredtraits.hh:70
typename GetPropType< SubDomainTypeTag< 0 >, Properties::GridVariables >::CellCenterGridVariablesType type
Definition: staggeredtraits.hh:74
GetPropType< SubDomainTypeTag< i >, Properties::PrimaryVariables > type
Definition: staggeredtraits.hh:80
GetPropType< SubDomainTypeTag< 0 >, Properties::FacePrimaryVariables > type
Definition: staggeredtraits.hh:84
GetPropType< SubDomainTypeTag< 0 >, Properties::CellCenterPrimaryVariables > type
Definition: staggeredtraits.hh:88
Definition: staggeredtraits.hh:93
typename Dune::BCRSMatrix< MatrixBlock > type
Definition: staggeredtraits.hh:97
GetPropType< SubDomainTypeTag< i >, Properties::JacobianMatrix > type
Definition: staggeredtraits.hh:103
typename JacobianTypeImpl< GetPropType< SubDomainTypeTag< 0 >, Properties::Scalar >, getPropValue< SubDomainTypeTag< 0 >, Properties::NumEqFace >()>::type type
Definition: staggeredtraits.hh:108
typename JacobianTypeImpl< GetPropType< SubDomainTypeTag< 1 >, Properties::Scalar >, getPropValue< SubDomainTypeTag< 0 >, Properties::NumEqCellCenter >()>::type type
Definition: staggeredtraits.hh:113
GetPropType< SubDomainTypeTag< i >, Properties::SolutionVector > type
Definition: staggeredtraits.hh:119
GetPropType< SubDomainTypeTag< 0 >, Properties::FaceSolutionVector > type
Definition: staggeredtraits.hh:123
GetPropType< SubDomainTypeTag< 0 >, Properties::CellCenterSolutionVector > type
Definition: staggeredtraits.hh:127
Definition: staggeredtraits.hh:161
typename Detail::MultiDomainTupleSharedPtr< T, Indices >::type TupleOfSharedPtr
helper alias to create tuple<std::shared_ptr<...>> from indexed type
Definition: staggeredtraits.hh:232
typename Detail::MultiDomainMatrixType< SubDomainJacobianMatrix, Indices, Scalar >::type JacobianMatrix
the jacobian type
Definition: staggeredtraits.hh:217
typename makeFromIndexedType< std::tuple, T, Indices >::type Tuple
helper alias to create tuple<...> from indexed type
Definition: staggeredtraits.hh:228
typename makeFromIndexedType< Dune::MultiTypeBlockVector, SubDomainSolutionVector, Indices >::type SolutionVector
the solution vector type
Definition: staggeredtraits.hh:214
typename makeFromIndexedType< std::common_type_t, SubDomainScalar, Indices >::type Scalar
the scalar type
Definition: staggeredtraits.hh:211
typename Detail::MultiDomainTupleSharedPtrConst< T, Indices >::type TupleOfSharedPtrConst
helper alias to create tuple<std::shared_ptr<const ...>> from indexed type
Definition: staggeredtraits.hh:236
static constexpr std::size_t numSubDomains
the number of subdomains
Definition: staggeredtraits.hh:163
Definition: staggeredtraits.hh:193
SubDomainTypeTag< id > TypeTag
Definition: staggeredtraits.hh:195
typename Detail::Staggered::SubDomainFVGridGeometryImpl< SubDomainTypeTag, id >::type GridGeometry
Definition: staggeredtraits.hh:197
GetPropType< SubDomainTypeTag< id >, Properties::Problem > Problem
Definition: staggeredtraits.hh:196
typename Detail::Staggered::SubDomainSolutionVectorImpl< SubDomainTypeTag, id >::type SolutionVector
Definition: staggeredtraits.hh:199
Dune::index_constant< id > Index
Definition: staggeredtraits.hh:194
typename Detail::Staggered::SubDomainGridVariablesImpl< SubDomainTypeTag, id >::type GridVariables
Definition: staggeredtraits.hh:198
typename Detail::Staggered::SubDomainPrimaryVariablesImpl< SubDomainTypeTag, id >::type PrimaryVariables
Definition: staggeredtraits.hh:200
typename makeFromIndexedType< std::tuple, PtrType, Indices >::type type
Definition: multidomain/traits.hh:89
typename makeFromIndexedType< std::tuple, PtrType, Indices >::type type
Definition: multidomain/traits.hh:99
typename makeFromIndexedType< M, SubDomainDiagBlocks, Indices >::type type
Definition: multidomain/traits.hh:109
Declares all properties used in Dumux.
Traits for multidomain problems.