diff --git a/dumux/assembly/staggeredfvassembler.hh b/dumux/assembly/staggeredfvassembler.hh index cb424d8f81182c1511b5dc9cb0714a2827946828..6730bd0452922453c8c6f790da3fe752573b35ff 100644 --- a/dumux/assembly/staggeredfvassembler.hh +++ b/dumux/assembly/staggeredfvassembler.hh @@ -78,7 +78,7 @@ public: std::make_shared<CouplingManager>()) { static_assert(isImplicit, "Explicit assembler for stationary problem doesn't make sense!"); - this->couplingManager_->init(problem); + this->couplingManager_->setSubProblems(std::make_tuple(problem, problem)); } //! The constructor for instationary problems @@ -93,7 +93,7 @@ public: timeLoop) { static_assert(isImplicit, "Explicit assembler for stationary problem doesn't make sense!"); - this->couplingManager_->init(problem); + this->couplingManager_->setSubProblems(std::make_tuple(problem, problem)); } diff --git a/dumux/multidomain/boundary/stokesdarcy/couplingmanager.hh b/dumux/multidomain/boundary/stokesdarcy/couplingmanager.hh index 04b704f33e35d9634304f8240fa73d4d43b5a42a..b5f47e9f7bc22d2ae48f29f26ab5d1704114931d 100644 --- a/dumux/multidomain/boundary/stokesdarcy/couplingmanager.hh +++ b/dumux/multidomain/boundary/stokesdarcy/couplingmanager.hh @@ -141,7 +141,7 @@ public: if(Dune::FloatCmp::ne(stokesProblem->gravity(), darcyProblem->gravity())) DUNE_THROW(Dune::InvalidStateException, "Both models must use the same gravity vector"); - ParentType::init(std::make_tuple(stokesProblem, stokesProblem, darcyProblem)); + this->setSubProblems(std::make_tuple(stokesProblem, stokesProblem, darcyProblem)); this->curSol() = curSol; couplingData_ = std::make_shared<CouplingData>(*this); computeStencils(); diff --git a/dumux/multidomain/staggeredcouplingmanager.hh b/dumux/multidomain/staggeredcouplingmanager.hh index bc75a3c53fbaa428a6eac34516b8e5c3bf1e9f2b..687d641c79771e798fe2b5384815cd6bad95ffc0 100644 --- a/dumux/multidomain/staggeredcouplingmanager.hh +++ b/dumux/multidomain/staggeredcouplingmanager.hh @@ -69,23 +69,6 @@ public: static constexpr auto cellCenterIdx = Dune::index_constant<0>(); static constexpr auto faceIdx = Dune::index_constant<1>(); - void init(std::shared_ptr<const Problem<0>> problem) - { - problemTuple_ = std::make_tuple(problem, problem); - } - - template<class... Args> - void init(Args&&... args) - { - problemTuple_ = std::make_tuple(args...); - } - - void init(typename Traits::ProblemTuple&& problemTuple) - { - problemTuple_ = std::move(problemTuple); - } - - /*! * \copydoc ParentType::updateCouplingContext * @@ -134,8 +117,8 @@ public: const Element& elementI, Dune::index_constant<faceIdx> domainJ) const { - const auto& connectivityMap = problem(domainI).fvGridGeometry().connectivityMap(); - const auto eIdx = problem(domainI).fvGridGeometry().elementMapper().index(elementI); + const auto& connectivityMap = this->problem(domainI).fvGridGeometry().connectivityMap(); + const auto eIdx = this->problem(domainI).fvGridGeometry().elementMapper().index(elementI); return connectivityMap(domainI, domainJ, eIdx); } @@ -175,7 +158,7 @@ public: const SubControlVolumeFace& scvfI, Dune::index_constant<cellCenterIdx> domainJ) const { - const auto& connectivityMap = problem(domainI).fvGridGeometry().connectivityMap(); + const auto& connectivityMap = this->problem(domainI).fvGridGeometry().connectivityMap(); return connectivityMap(domainI, domainJ, scvfI.index()); } @@ -264,17 +247,6 @@ public: } - //! Return a reference to the problem - template<std::size_t id> - const Problem<id>& problem(Dune::index_constant<id> domainIdx) const - { - assert(std::get<id>(problemTuple_) && "No problem set. Call init() first!"); - return *std::get<id>(problemTuple_); - } - -private: - typename Traits::ProblemTuple problemTuple_; - }; template<class MDTraits> diff --git a/dumux/multidomain/staggeredtraits.hh b/dumux/multidomain/staggeredtraits.hh index 39fadb2691f302d34479e88128595fed28ffe6bb..eb34f23d326a4cdab1536cb65ed2ddcd87c0d7d0 100644 --- a/dumux/multidomain/staggeredtraits.hh +++ b/dumux/multidomain/staggeredtraits.hh @@ -99,7 +99,6 @@ private: template<std::size_t id> using SubDomainProblem = std::shared_ptr<const typename GET_PROP_TYPE(SubDomainTypeTag<id>, Problem)>; - template<std::size_t id> using SubDomainFVGridGeometry = std::shared_ptr<std::conditional_t<(id < 2), std::conditional_t<(id == 0), @@ -159,6 +158,10 @@ public: //! the tuple of grid variables using GridVariablesTuple = typename makeFromIndexedType<std::tuple, SubDomainGridVariables, Indices>::type; + + //! convenience alias to create tuple from type + template<template<std::size_t> class T> + using MakeTuple = typename makeFromIndexedType<std::tuple, T, Indices>::type; }; } //end namespace Dumux