12#ifndef DUMUX_MULTIDOMAIN_FV_PROBLEM_HH
13#define DUMUX_MULTIDOMAIN_FV_PROBLEM_HH
19#include <dune/common/hybridutilities.hh>
20#include <dune/common/indices.hh>
31template<
class MDTraits>
34 using SolutionVector =
typename MDTraits::SolutionVector;
35 static constexpr std::size_t numSubDomains = MDTraits::numSubDomains;
37 template<std::
size_t i>
38 using GridGeometry =
typename MDTraits::template SubDomain<i>::GridGeometry;
39 using GridGeometries =
typename MDTraits::template Tuple<GridGeometry>;
43 template<std::
size_t i>
44 using Type =
typename MDTraits::template SubDomain<i>::Problem;
47 template<std::
size_t i>
51 using TupleType =
typename MDTraits::template Tuple<PtrType>;
59 using namespace Dune::Hybrid;
60 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
62 constexpr auto i = std::decay_t<
decltype(id)>::value;
63 std::get<i>(problems_) = std::make_shared<Type<i>>(gridGeometries.template get<i>());
72 : problems_(std::move(problemTuple))
81 using namespace Dune::Hybrid;
82 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
84 elementAt(problems_,
id)->applyInitialSolution(sol[
id]);
89 template<std::
size_t i>
91 {
return *std::get<i>(problems_); }
94 template<std::
size_t i>
96 {
return *std::get<i>(problems_); }
99 template<std::
size_t i>
100 const PtrType<i>&
get(Dune::index_constant<i>
id = Dune::index_constant<i>{})
const
101 {
return std::get<i>(problems_); }
104 template<std::
size_t i>
106 {
return std::get<i>(problems_); }
112 {
return problems_; }
118 {
return problems_; }
A multidomain wrapper for multiple grid geometries.
Definition: multidomain/fvgridgeometry.hh:46
A multidomain wrapper for multiple problems.
Definition: multidomain/fvproblem.hh:33
std::shared_ptr< Type< i > > PtrType
export pointer types the stored type
Definition: multidomain/fvproblem.hh:48
PtrType< i > & get(Dune::index_constant< i > id=Dune::index_constant< i >{})
access the problem ptr for domain with index i
Definition: multidomain/fvproblem.hh:105
const PtrType< i > & get(Dune::index_constant< i > id=Dune::index_constant< i >{}) const
access the problem ptr for domain with index i
Definition: multidomain/fvproblem.hh:100
MultiDomainFVProblem(TupleType problemTuple)
Construct wrapper from a tuple of problems.
Definition: multidomain/fvproblem.hh:71
typename MDTraits::template SubDomain< i >::Problem Type
export base types of the stored type
Definition: multidomain/fvproblem.hh:44
MultiDomainFVProblem(MultiDomainFVGridGeometry< MDTraits > gridGeometries)
Construct the problem.
Definition: multidomain/fvproblem.hh:57
const Type< i > & operator[](Dune::index_constant< i > id) const
return the problem for domain with index i
Definition: multidomain/fvproblem.hh:90
typename MDTraits::template Tuple< PtrType > TupleType
export type of tuple of pointers
Definition: multidomain/fvproblem.hh:51
void applyInitialSolution(SolutionVector &sol) const
Applies the initial solution for all degrees of freedom of the grid.
Definition: multidomain/fvproblem.hh:79
const TupleType & asTuple() const
Access the underlying tuple representation.
Definition: multidomain/fvproblem.hh:117
TupleType & asTuple()
Access the underlying tuple representation.
Definition: multidomain/fvproblem.hh:111
Multidomain wrapper for multiple grid geometries.