version 3.10-dev
assemblerview.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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_MULTIDOMAIN_ASSEMBLER_VIEW_HH
14#define DUMUX_MULTIDOMAIN_ASSEMBLER_VIEW_HH
15
16#include <dune/common/hybridutilities.hh>
17#include <dune/common/std/type_traits.hh>
18
19namespace Dumux {
20
29template<typename MDAssembler, std::size_t domainId>
31{
32 static constexpr Dune::index_constant<domainId> myId{};
33
34 template<class A>
35 using HasStaticIsImplicitCheck = decltype(A::isImplicit());
36
37 template<class A>
38 static constexpr bool hasStaticIsImplicit = Dune::Std::is_detected<HasStaticIsImplicitCheck, A>::value;
39
40public:
41 using CouplingManager = typename MDAssembler::CouplingManager;
42 using SolutionVector = typename MDAssembler::SolutionVector;
43
44 MultiDomainAssemblerSubDomainView(MDAssembler& assembler, Dune::index_constant<domainId>)
45 : assembler_{assembler}
46 {}
47
48 template<std::size_t i>
49 auto localResidual(Dune::index_constant<i> id) const { return assembler_.localResidual(id); }
50 auto localResidual() const { return assembler_.localResidual(myId); }
51
52 template<std::size_t i>
53 const auto& problem(Dune::index_constant<i> id) const { return assembler_.problem(id); }
54 const auto& problem() const { return assembler_.problem(myId); }
55
56 template<std::size_t i>
57 const auto& gridGeometry(Dune::index_constant<i> id) const { return assembler_.gridGeometry(id); }
58 const auto& gridGeometry() const { return assembler_.gridGeometry(myId); }
59
60 template<std::size_t i>
61 const auto& gridVariables(Dune::index_constant<i> id) const { return assembler_.gridVariables(id); }
62 const auto& gridVariables() const { return assembler_.gridVariables(myId); }
63
64 const auto& prevSol() const { return assembler_.prevSol(); }
65 bool isStationaryProblem() const { return assembler_.isStationaryProblem(); }
66
67 template<class A = MDAssembler, typename std::enable_if_t<hasStaticIsImplicit<A>, int> = 0>
68 static constexpr bool isImplicit() { return MDAssembler::isImplicit(); }
69
70 template<class A = MDAssembler, typename std::enable_if_t<!hasStaticIsImplicit<A>, int> = 0>
71 bool isImplicit() const { return assembler_.isImplicit(); }
72
73private:
74 MDAssembler& assembler_;
75};
76
77} // end namespace Dumux
78
79#endif
Subdomain-specific view on a multidomain assembler. Allows retrieval of sub-domain specific objects w...
Definition: assemblerview.hh:31
bool isImplicit() const
Definition: assemblerview.hh:71
typename MDAssembler::CouplingManager CouplingManager
Definition: assemblerview.hh:41
const auto & gridVariables(Dune::index_constant< i > id) const
Definition: assemblerview.hh:61
const auto & gridGeometry(Dune::index_constant< i > id) const
Definition: assemblerview.hh:57
const auto & problem(Dune::index_constant< i > id) const
Definition: assemblerview.hh:53
MultiDomainAssemblerSubDomainView(MDAssembler &assembler, Dune::index_constant< domainId >)
Definition: assemblerview.hh:44
const auto & gridGeometry() const
Definition: assemblerview.hh:58
auto localResidual() const
Definition: assemblerview.hh:50
bool isStationaryProblem() const
Definition: assemblerview.hh:65
static constexpr bool isImplicit()
Definition: assemblerview.hh:68
const auto & prevSol() const
Definition: assemblerview.hh:64
const auto & problem() const
Definition: assemblerview.hh:54
auto localResidual(Dune::index_constant< i > id) const
Definition: assemblerview.hh:49
typename MDAssembler::SolutionVector SolutionVector
Definition: assemblerview.hh:42
const auto & gridVariables() const
Definition: assemblerview.hh:62
Definition: adapt.hh:17