24#ifndef DUMUX_MULTIDOMAIN_FV_PROBLEM_HH
25#define DUMUX_MULTIDOMAIN_FV_PROBLEM_HH
31#include <dune/common/hybridutilities.hh>
32#include <dune/common/indices.hh>
43template<
class MDTraits>
46 using SolutionVector =
typename MDTraits::SolutionVector;
47 static constexpr std::size_t numSubDomains = MDTraits::numSubDomains;
49 template<std::
size_t i>
50 using GridGeometry =
typename MDTraits::template SubDomain<i>::GridGeometry;
51 using GridGeometries =
typename MDTraits::template Tuple<GridGeometry>;
55 template<std::
size_t i>
56 using Type =
typename MDTraits::template SubDomain<i>::Problem;
59 template<std::
size_t i>
63 using TupleType =
typename MDTraits::template Tuple<PtrType>;
68 [[deprecated(
"Will be removed after release 3.5. Use one of the constructors instead.")]]
77 using namespace Dune::Hybrid;
78 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
80 constexpr auto i = std::decay_t<
decltype(id)>::value;
81 std::get<i>(problems_) = std::make_shared<Type<i>>(gridGeometries.template get<i>());
90 : problems_(std::move(problemTuple))
99 using namespace Dune::Hybrid;
100 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
102 elementAt(problems_,
id)->applyInitialSolution(sol[
id]);
107 template<std::
size_t i>
109 {
return *std::get<i>(problems_); }
112 template<std::
size_t i>
114 {
return *std::get<i>(problems_); }
117 template<std::
size_t i>
118 const PtrType<i>&
get(Dune::index_constant<i>
id = Dune::index_constant<i>{})
const
119 {
return std::get<i>(problems_); }
122 template<std::
size_t i>
124 {
return std::get<i>(problems_); }
127 template<std::
size_t i>
128 [[deprecated(
"Will be removed after release 3.5. Use one of the constructors instead.")]]
129 void set(
PtrType<i> p, Dune::index_constant<i>
id = Dune::index_constant<i>{})
130 { Dune::Hybrid::elementAt(problems_, Dune::index_constant<i>{}) = p; }
136 [[deprecated(
"Use asTuple. Will be removed after release 3.5")]]
138 {
return problems_; }
144 {
return problems_; }
150 {
return problems_; }
A multidomain wrapper for multiple grid geometries.
Definition: multidomain/fvgridgeometry.hh:58
A multidomain wrapper for multiple problems.
Definition: multidomain/fvproblem.hh:45
std::shared_ptr< Type< i > > PtrType
export pointer types the stored type
Definition: multidomain/fvproblem.hh:60
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:123
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:118
MultiDomainFVProblem(TupleType problemTuple)
Construct wrapper from a tuple of problems.
Definition: multidomain/fvproblem.hh:89
typename MDTraits::template SubDomain< i >::Problem Type
export base types of the stored type
Definition: multidomain/fvproblem.hh:56
MultiDomainFVProblem(MultiDomainFVGridGeometry< MDTraits > gridGeometries)
Contruct the problem.
Definition: multidomain/fvproblem.hh:75
const Type< i > & operator[](Dune::index_constant< i > id) const
return the problem for domain with index i
Definition: multidomain/fvproblem.hh:108
typename MDTraits::template Tuple< PtrType > TupleType
export type of tuple of pointers
Definition: multidomain/fvproblem.hh:63
MultiDomainFVProblem()=default
The default constructor.
TupleType getTuple()
return the grid variables tuple we are wrapping
Definition: multidomain/fvproblem.hh:137
void applyInitialSolution(SolutionVector &sol) const
Applies the initial solution for all degrees of freedom of the grid.
Definition: multidomain/fvproblem.hh:97
const TupleType & asTuple() const
Access the underlying tuple representation.
Definition: multidomain/fvproblem.hh:149
TupleType & asTuple()
Access the underlying tuple representation.
Definition: multidomain/fvproblem.hh:143
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:129
Multidomain wrapper for multiple grid geometries.