24#ifndef DUMUX_MULTIDOMAIN_PROBLEM_HH
25#define DUMUX_MULTIDOMAIN_PROBLEM_HH
31#include <dune/common/hybridutilities.hh>
32#include <dune/common/indices.hh>
41template<
class MDTraits>
44 using SolutionVector =
typename MDTraits::SolutionVector;
45 static constexpr std::size_t numSubDomains = MDTraits::numSubDomains;
47 template<std::
size_t i>
48 using GridGeometry =
typename MDTraits::template SubDomain<i>::GridGeometry;
49 using GridGeometries =
typename MDTraits::template Tuple<GridGeometry>;
53 template<std::
size_t i>
54 using Type =
typename MDTraits::template SubDomain<i>::Problem;
57 template<std::
size_t i>
61 using TupleType =
typename MDTraits::template Tuple<PtrType>;
74 using namespace Dune::Hybrid;
75 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
77 constexpr auto i = std::decay_t<
decltype(id)>::value;
78 elementAt(problems_,
id) = std::make_shared<Type<i>>(std::get<i>(gridGeometries));
88 using namespace Dune::Hybrid;
89 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
91 elementAt(problems_,
id)->applyInitialSolution(sol[
id]);
96 template<std::
size_t i>
98 {
return *Dune::Hybrid::elementAt(problems_,
id); }
101 template<std::
size_t i>
103 {
return *Dune::Hybrid::elementAt(problems_,
id); }
106 template<std::
size_t i>
108 {
return Dune::Hybrid::elementAt(problems_,
id); }
111 template<std::
size_t i>
112 void set(
PtrType<i> p, Dune::index_constant<i>
id = Dune::index_constant<i>{})
113 { Dune::Hybrid::elementAt(problems_, Dune::index_constant<i>{}) = p; }
120 {
return problems_; }
A multidomain wrapper for multiple problems.
Definition: multidomain/fvproblem.hh:43
std::shared_ptr< Type< i > > PtrType
export pointer types the stored type
Definition: multidomain/fvproblem.hh:58
typename MDTraits::template SubDomain< i >::Problem Type
export base types of the stored type
Definition: multidomain/fvproblem.hh:54
MultiDomainFVProblem(GridGeometries &&gridGeometries)
Contruct the problem.
Definition: multidomain/fvproblem.hh:72
const Type< i > & operator[](Dune::index_constant< i > id) const
return the problem for domain with index i
Definition: multidomain/fvproblem.hh:97
PtrType< i > get(Dune::index_constant< i > id=Dune::index_constant< i >{})
return the problem for domain with index i
Definition: multidomain/fvproblem.hh:107
typename MDTraits::template Tuple< PtrType > TupleType
export type of tuple of pointers
Definition: multidomain/fvproblem.hh:61
MultiDomainFVProblem()=default
The default constructor.
TupleType getTuple()
return the grid variables tuple we are wrapping
Definition: multidomain/fvproblem.hh:119
void applyInitialSolution(SolutionVector &sol) const
Applies the initial solution for all degrees of freedom of the grid.
Definition: multidomain/fvproblem.hh:86
void set(PtrType< i > p, Dune::index_constant< i > id=Dune::index_constant< i >{})
set the pointer for sub domain i
Definition: multidomain/fvproblem.hh:112