GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/multidomain/fvassembler.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 153 185 82.7%
Functions: 2383 7136 33.4%
Branches: 538 1487 36.2%

Line Branch Exec Source
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 //
7 /*!
8 * \file
9 * \ingroup MultiDomain
10 * \ingroup Assembly
11 * \brief A linear system assembler (residual and Jacobian) for finite volume schemes
12 * with multiple domains
13 */
14 #ifndef DUMUX_MULTIDOMAIN_FV_ASSEMBLER_HH
15 #define DUMUX_MULTIDOMAIN_FV_ASSEMBLER_HH
16
17 #include <type_traits>
18 #include <tuple>
19
20 #include <dune/common/hybridutilities.hh>
21 #include <dune/istl/matrixindexset.hh>
22
23 #include <dumux/common/exceptions.hh>
24 #include <dumux/common/properties.hh>
25 #include <dumux/common/timeloop.hh>
26 #include <dumux/common/typetraits/utility.hh>
27 #include <dumux/common/typetraits/periodic.hh>
28 #include <dumux/common/gridcapabilities.hh>
29 #include <dumux/discretization/method.hh>
30 #include <dumux/assembly/diffmethod.hh>
31 #include <dumux/assembly/jacobianpattern.hh>
32 #include <dumux/linear/parallelhelpers.hh>
33 #include <dumux/parallel/multithreading.hh>
34
35 #include "couplingjacobianpattern.hh"
36 #include "subdomaincclocalassembler.hh"
37 #include "subdomaincvfelocalassembler.hh"
38 #include "subdomainstaggeredlocalassembler.hh"
39 #include "subdomainfclocalassembler.hh"
40 #include "assemblerview.hh"
41
42 #include <dumux/discretization/method.hh>
43
44 namespace Dumux {
45
46 namespace Grid::Capabilities {
47
48 namespace Detail {
49 // helper for multi-domain models
50 template<class T, std::size_t... I>
51 bool allGridsSupportsMultithreadingImpl(const T& gridGeometries, std::index_sequence<I...>)
52 {
53
7/18
✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 25 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 25 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 25 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 25 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 25 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 25 times.
✗ Branch 20 not taken.
175 return (... && supportsMultithreading(std::get<I>(gridGeometries)->gridView()));
54 }
55 } // end namespace Detail
56
57 // helper for multi-domain models (all grids have to support multithreading)
58 template<class... GG>
59 bool allGridsSupportsMultithreading(const std::tuple<GG...>& gridGeometries)
60 {
61 26 return Detail::allGridsSupportsMultithreadingImpl<std::tuple<GG...>>(gridGeometries, std::make_index_sequence<sizeof...(GG)>());
62 }
63
64 } // end namespace Grid::Capabilities
65
66 /*!
67 * \ingroup MultiDomain
68 * \ingroup Assembly
69 * \brief trait that is specialized for coupling manager supporting multithreaded assembly
70 */
71 template<class CM>
72 struct CouplingManagerSupportsMultithreadedAssembly : public std::false_type
73 {};
74
75 /*!
76 * \ingroup MultiDomain
77 * \ingroup Assembly
78 * \brief A linear system assembler (residual and Jacobian) for finite volume schemes (box, tpfa, mpfa, ...)
79 * with multiple domains
80 * \tparam MDTraits the multidimensional traits
81 * \tparam diffMethod the differentiation method to residual compute derivatives
82 * \tparam useImplicitAssembly if to use an implicit or explicit time discretization
83 */
84 template<class MDTraits, class CMType, DiffMethod diffMethod, bool useImplicitAssembly = true>
85 class MultiDomainFVAssembler
86 {
87 template<std::size_t id>
88 using SubDomainTypeTag = typename MDTraits::template SubDomain<id>::TypeTag;
89
90 public:
91 using Traits = MDTraits;
92
93 using Scalar = typename MDTraits::Scalar;
94
95 //! TODO get rid of this GetPropType
96 template<std::size_t id>
97 using LocalResidual = GetPropType<SubDomainTypeTag<id>, Properties::LocalResidual>;
98
99 template<std::size_t id>
100 using GridVariables = typename MDTraits::template SubDomain<id>::GridVariables;
101
102 template<std::size_t id>
103 using GridGeometry = typename MDTraits::template SubDomain<id>::GridGeometry;
104
105 template<std::size_t id>
106 using Problem = typename MDTraits::template SubDomain<id>::Problem;
107
108 using JacobianMatrix = typename MDTraits::JacobianMatrix;
109 using SolutionVector = typename MDTraits::SolutionVector;
110 using ResidualType = typename MDTraits::ResidualVector;
111
112 using CouplingManager = CMType;
113
114 /*!
115 * \brief Returns true if the assembler considers implicit assembly.
116 */
117 static constexpr bool isImplicit()
118 { return useImplicitAssembly; }
119
120 private:
121
122 using ProblemTuple = typename MDTraits::template TupleOfSharedPtrConst<Problem>;
123 using GridGeometryTuple = typename MDTraits::template TupleOfSharedPtrConst<GridGeometry>;
124 using GridVariablesTuple = typename MDTraits::template TupleOfSharedPtr<GridVariables>;
125
126 using TimeLoop = TimeLoopBase<Scalar>;
127 using ThisType = MultiDomainFVAssembler<MDTraits, CouplingManager, diffMethod, isImplicit()>;
128
129 template<std::size_t id>
130 using SubDomainAssemblerView = MultiDomainAssemblerSubDomainView<ThisType, id>;
131
132 template<class DiscretizationMethod, std::size_t id>
133 struct SubDomainAssemblerType;
134
135 template<std::size_t id>
136 struct SubDomainAssemblerType<DiscretizationMethods::CCTpfa, id>
137 {
138 using type = SubDomainCCLocalAssembler<id, SubDomainTypeTag<id>, SubDomainAssemblerView<id>, diffMethod, isImplicit()>;
139 };
140
141 template<std::size_t id>
142 struct SubDomainAssemblerType<DiscretizationMethods::CCMpfa, id>
143 {
144 using type = SubDomainCCLocalAssembler<id, SubDomainTypeTag<id>, SubDomainAssemblerView<id>, diffMethod, isImplicit()>;
145 };
146
147 template<std::size_t id, class DM>
148 struct SubDomainAssemblerType<DiscretizationMethods::CVFE<DM>, id>
149 {
150 using type = SubDomainCVFELocalAssembler<id, SubDomainTypeTag<id>, SubDomainAssemblerView<id>, diffMethod, isImplicit()>;
151 };
152
153 template<std::size_t id>
154 struct SubDomainAssemblerType<DiscretizationMethods::Staggered, id>
155 {
156 using type = SubDomainStaggeredLocalAssembler<id, SubDomainTypeTag<id>, SubDomainAssemblerView<id>, diffMethod, isImplicit()>;
157 };
158
159 template<std::size_t id>
160 struct SubDomainAssemblerType<DiscretizationMethods::FCStaggered, id>
161 {
162 using type = SubDomainFaceCenteredLocalAssembler<id, SubDomainTypeTag<id>, SubDomainAssemblerView<id>, diffMethod, isImplicit()>;
163 };
164
165 template<std::size_t id>
166 using SubDomainAssembler = typename SubDomainAssemblerType<typename GridGeometry<id>::DiscretizationMethod, id>::type;
167
168 public:
169
170
171 /*!
172 * \brief The constructor for stationary problems
173 * \note the grid variables might be temporarily changed during assembly (if caching is enabled)
174 * it is however guaranteed that the state after assembly will be the same as before
175 */
176 122 MultiDomainFVAssembler(ProblemTuple problem,
177 GridGeometryTuple gridGeometry,
178 GridVariablesTuple gridVariables,
179 std::shared_ptr<CouplingManager> couplingManager)
180 : couplingManager_(couplingManager)
181 122 , problemTuple_(std::move(problem))
182 122 , gridGeometryTuple_(std::move(gridGeometry))
183 122 , gridVariablesTuple_(std::move(gridVariables))
184 , timeLoop_()
185 , isStationaryProblem_(true)
186
0/10
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
122 , warningIssued_(false)
187 {
188 static_assert(isImplicit(), "Explicit assembler for stationary problem doesn't make sense!");
189
1/2
✓ Branch 2 taken 122 times.
✗ Branch 3 not taken.
244 std::cout << "Instantiated assembler for a stationary problem." << std::endl;
190
191 122 enableMultithreading_ = CouplingManagerSupportsMultithreadedAssembly<CouplingManager>::value
192
1/2
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
21 && Grid::Capabilities::allGridsSupportsMultithreading(gridGeometryTuple_)
193 && !Multithreading::isSerial()
194
2/6
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
21 && getParam<bool>("Assembly.Multithreading", true);
195
196 143 maybeComputeColors_();
197 122 }
198
199 /*!
200 * \brief The constructor for instationary problems
201 * \note the grid variables might be temporarily changed during assembly (if caching is enabled)
202 * it is however guaranteed that the state after assembly will be the same as before
203 */
204 83 MultiDomainFVAssembler(ProblemTuple problem,
205 GridGeometryTuple gridGeometry,
206 GridVariablesTuple gridVariables,
207 std::shared_ptr<CouplingManager> couplingManager,
208 std::shared_ptr<const TimeLoop> timeLoop,
209 const SolutionVector& prevSol)
210 : couplingManager_(couplingManager)
211 83 , problemTuple_(std::move(problem))
212 83 , gridGeometryTuple_(std::move(gridGeometry))
213 83 , gridVariablesTuple_(std::move(gridVariables))
214 , timeLoop_(timeLoop)
215 , prevSol_(&prevSol)
216 , isStationaryProblem_(false)
217
0/10
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
83 , warningIssued_(false)
218 {
219
1/2
✓ Branch 2 taken 83 times.
✗ Branch 3 not taken.
166 std::cout << "Instantiated assembler for an instationary problem." << std::endl;
220
221 83 enableMultithreading_ = CouplingManagerSupportsMultithreadedAssembly<CouplingManager>::value
222
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
5 && Grid::Capabilities::allGridsSupportsMultithreading(gridGeometryTuple_)
223 && !Multithreading::isSerial()
224
5/9
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
5 && getParam<bool>("Assembly.Multithreading", true);
225
226 88 maybeComputeColors_();
227 83 }
228
229 /*!
230 * \brief Assembles the global Jacobian of the residual
231 * and the residual for the current solution.
232 */
233 9662 void assembleJacobianAndResidual(const SolutionVector& curSol)
234 {
235 9662 checkAssemblerState_();
236 9662 resetJacobian_();
237 9662 resetResidual_();
238
239 using namespace Dune::Hybrid;
240
1/2
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
133782 forEach(std::make_index_sequence<JacobianMatrix::N()>(), [&](const auto domainId)
241 {
242
0/27
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
34050 auto& jacRow = (*jacobian_)[domainId];
243
0/27
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
34050 auto& subRes = (*residual_)[domainId];
244 51075 this->assembleJacobianAndResidual_(domainId, jacRow, subRes, curSol);
245
246
6/12
✓ Branch 1 taken 17 times.
✓ Branch 2 taken 261 times.
✓ Branch 3 taken 652 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 42 times.
✓ Branch 6 taken 17 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 500 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
20003 const auto gridGeometry = std::get<domainId>(gridGeometryTuple_);
247
20/48
✓ Branch 0 taken 8125 times.
✓ Branch 1 taken 17 times.
✓ Branch 2 taken 8125 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8142 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6227 times.
✓ Branch 7 taken 278 times.
✓ Branch 8 taken 6227 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6505 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1178 times.
✓ Branch 13 taken 930 times.
✓ Branch 14 taken 1178 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 1847 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 6 times.
✓ Branch 19 taken 652 times.
✓ Branch 20 taken 6 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 6 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 42 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 542 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 542 times.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✓ Branch 34 taken 500 times.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
51075 enforcePeriodicConstraints_(domainId, jacRow, subRes, *gridGeometry, curSol[domainId]);
248 });
249 9662 }
250
251 //! compute the residuals using the internal residual
252 void assembleResidual(const SolutionVector& curSol)
253 {
254
0/6
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
807 resetResidual_();
255
2/14
✓ Branch 1 taken 99 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 99 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
1812 assembleResidual(*residual_, curSol);
256 }
257
258 //! assemble a residual r
259 906 void assembleResidual(ResidualType& r, const SolutionVector& curSol)
260 {
261 906 r = 0.0;
262
263 906 checkAssemblerState_();
264
265 // update the grid variables for the case of active caching
266 1812 updateGridVariables(curSol);
267
268 using namespace Dune::Hybrid;
269
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
5434 forEach(integralRange(Dune::Hybrid::size(r)), [&](const auto domainId)
270 {
271 1811 auto& subRes = r[domainId];
272 3621 this->assembleResidual_(domainId, subRes, curSol);
273 });
274 905 }
275
276 /*!
277 * \brief Tells the assembler which jacobian and residual to use.
278 * This also resizes the containers to the required sizes and sets the
279 * sparsity pattern of the jacobian matrix.
280 */
281 3 void setLinearSystem(std::shared_ptr<JacobianMatrix> A,
282 std::shared_ptr<ResidualType> r)
283 {
284 3 jacobian_ = A;
285 3 residual_ = r;
286
287 3 setJacobianBuildMode(*jacobian_);
288 9 setJacobianPattern_(*jacobian_);
289 9 setResidualSize_(*residual_);
290 3 }
291
292 /*!
293 * \brief The version without arguments uses the default constructor to create
294 * the jacobian and residual objects in this assembler if you don't need them outside this class
295 */
296 186 void setLinearSystem()
297 {
298
3/4
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 181 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 186 times.
191 jacobian_ = std::make_shared<JacobianMatrix>();
299
3/4
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 181 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 186 times.
191 residual_ = std::make_shared<ResidualType>();
300
301 186 setJacobianBuildMode(*jacobian_);
302 558 setJacobianPattern_(*jacobian_);
303 558 setResidualSize_(*residual_);
304 186 }
305
306 /*!
307 * \brief Sets the jacobian build mode
308 */
309 void setJacobianBuildMode(JacobianMatrix& jac) const
310 {
311 using namespace Dune::Hybrid;
312
0/4
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
189 forEach(std::make_index_sequence<JacobianMatrix::N()>(), [&](const auto i)
313 {
314
0/21
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
2006 forEach(jac[i], [&](auto& jacBlock)
315 {
316 using BlockType = std::decay_t<decltype(jacBlock)>;
317
6/12
✓ Branch 0 taken 389 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 382 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 151 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 66 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 17 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 10 times.
✗ Branch 11 not taken.
1015 if (jacBlock.buildMode() == BlockType::BuildMode::unknown)
318 1015 jacBlock.setBuildMode(BlockType::BuildMode::random);
319 else if (jacBlock.buildMode() != BlockType::BuildMode::random)
320 DUNE_THROW(Dune::NotImplemented, "Only BCRS matrices with random build mode are supported at the moment");
321 });
322 });
323 }
324
325 /*!
326 * \brief Resizes jacobian and residual and recomputes colors
327 */
328 void updateAfterGridAdaption()
329 {
330 setJacobianPattern_(*jacobian_);
331 setResidualSize_(*residual_);
332 maybeComputeColors_();
333 }
334
335 /*!
336 * \brief Updates the grid variables with the given solution
337 */
338 void updateGridVariables(const SolutionVector& curSol)
339 {
340 using namespace Dune::Hybrid;
341
5/8
✓ Branch 1 taken 19 times.
✓ Branch 2 taken 889 times.
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1050 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 1049 times.
✗ Branch 10 not taken.
7820 forEach(integralRange(Dune::Hybrid::size(gridVariablesTuple_)), [&](const auto domainId)
342 { this->gridVariables(domainId).update(curSol[domainId]); });
343 }
344
345 /*!
346 * \brief Resets the grid variables to the last time step
347 */
348 void resetTimeStep(const SolutionVector& curSol)
349 {
350 using namespace Dune::Hybrid;
351
2/6
✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
18 forEach(integralRange(Dune::Hybrid::size(gridVariablesTuple_)), [&](const auto domainId)
352 { this->gridVariables(domainId).resetTimeStep(curSol[domainId]); });
353 }
354
355 //! the number of dof locations of domain i
356 template<std::size_t i>
357 std::size_t numDofs(Dune::index_constant<i> domainId) const
358 776 { return std::get<domainId>(gridGeometryTuple_)->numDofs(); }
359
360 //! the problem of domain i
361 template<std::size_t i>
362 const auto& problem(Dune::index_constant<i> domainId) const
363
115/149
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 531079 times.
✓ Branch 4 taken 3270385 times.
✓ Branch 5 taken 531079 times.
✓ Branch 6 taken 3285226 times.
✓ Branch 7 taken 20463021 times.
✓ Branch 8 taken 3285226 times.
✓ Branch 9 taken 19931999 times.
✓ Branch 10 taken 1573224 times.
✓ Branch 11 taken 19931999 times.
✓ Branch 12 taken 1646449 times.
✓ Branch 13 taken 31107640 times.
✓ Branch 14 taken 1646449 times.
✓ Branch 15 taken 31108129 times.
✓ Branch 16 taken 5055667 times.
✓ Branch 17 taken 31108129 times.
✓ Branch 18 taken 7787621 times.
✓ Branch 19 taken 200087 times.
✓ Branch 20 taken 7787621 times.
✓ Branch 21 taken 199538 times.
✓ Branch 22 taken 5698275 times.
✓ Branch 23 taken 199538 times.
✓ Branch 24 taken 2734698 times.
✓ Branch 25 taken 8701299 times.
✓ Branch 26 taken 2734698 times.
✓ Branch 27 taken 11796 times.
✓ Branch 28 taken 15343916 times.
✓ Branch 29 taken 11796 times.
✓ Branch 30 taken 6652742 times.
✓ Branch 31 taken 9649125 times.
✓ Branch 32 taken 6652742 times.
✓ Branch 33 taken 1099753 times.
✓ Branch 34 taken 4314112 times.
✓ Branch 35 taken 1099753 times.
✓ Branch 36 taken 4313974 times.
✓ Branch 37 taken 19598113 times.
✓ Branch 38 taken 4313974 times.
✓ Branch 39 taken 16 times.
✓ Branch 40 taken 21428277 times.
✓ Branch 41 taken 16 times.
✓ Branch 42 taken 1504513 times.
✓ Branch 43 taken 19925941 times.
✓ Branch 44 taken 1504513 times.
✓ Branch 45 taken 2134 times.
✓ Branch 46 taken 10453843 times.
✓ Branch 47 taken 2134 times.
✓ Branch 48 taken 10128008 times.
✓ Branch 49 taken 325882 times.
✓ Branch 50 taken 10128008 times.
✓ Branch 51 taken 8 times.
✓ Branch 52 taken 1885016 times.
✓ Branch 53 taken 8 times.
✓ Branch 54 taken 942384 times.
✓ Branch 55 taken 1026497 times.
✓ Branch 56 taken 942384 times.
✓ Branch 57 taken 83857 times.
✓ Branch 58 taken 3095702 times.
✓ Branch 59 taken 83857 times.
✓ Branch 60 taken 2478961 times.
✓ Branch 61 taken 1179952 times.
✓ Branch 62 taken 2478961 times.
✓ Branch 63 taken 563032 times.
✓ Branch 64 taken 617137 times.
✓ Branch 65 taken 563032 times.
✓ Branch 66 taken 705441 times.
✓ Branch 67 taken 2805058 times.
✓ Branch 68 taken 705441 times.
✓ Branch 69 taken 2188178 times.
✓ Branch 70 taken 2527196 times.
✓ Branch 71 taken 2188178 times.
✓ Branch 72 taken 4288387 times.
✓ Branch 73 taken 488497 times.
✓ Branch 74 taken 4288387 times.
✓ Branch 75 taken 155647 times.
✓ Branch 76 taken 3125290 times.
✓ Branch 77 taken 155647 times.
✓ Branch 78 taken 56 times.
✓ Branch 79 taken 3390790 times.
✓ Branch 80 taken 56 times.
✗ Branch 81 not taken.
✓ Branch 82 taken 3862062 times.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✓ Branch 85 taken 3862047 times.
✗ Branch 86 not taken.
✓ Branch 87 taken 705015 times.
✓ Branch 88 taken 3536329 times.
✓ Branch 89 taken 705015 times.
✓ Branch 90 taken 2441107 times.
✓ Branch 91 taken 1772982 times.
✓ Branch 92 taken 2441107 times.
✓ Branch 93 taken 451102 times.
✓ Branch 94 taken 990880 times.
✓ Branch 95 taken 451102 times.
✗ Branch 96 not taken.
✓ Branch 97 taken 412953 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 412950 times.
✗ Branch 101 not taken.
✓ Branch 102 taken 1 times.
✓ Branch 103 taken 413110 times.
✓ Branch 104 taken 1 times.
✓ Branch 105 taken 159 times.
✓ Branch 106 taken 412945 times.
✓ Branch 107 taken 159 times.
✓ Branch 109 taken 412932 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 38917 times.
✗ Branch 113 not taken.
✓ Branch 115 taken 7 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 7 times.
✗ Branch 119 not taken.
✓ Branch 121 taken 5 times.
✗ Branch 122 not taken.
✓ Branch 124 taken 374004 times.
✗ Branch 125 not taken.
✓ Branch 127 taken 412916 times.
✗ Branch 128 not taken.
✓ Branch 130 taken 412916 times.
✗ Branch 131 not taken.
✓ Branch 133 taken 412915 times.
✗ Branch 134 not taken.
✓ Branch 136 taken 412914 times.
✗ Branch 137 not taken.
✓ Branch 139 taken 412914 times.
✗ Branch 140 not taken.
✓ Branch 142 taken 38912 times.
✗ Branch 143 not taken.
✓ Branch 148 taken 1 times.
✗ Branch 149 not taken.
✓ Branch 151 taken 1 times.
✗ Branch 152 not taken.
✓ Branch 154 taken 1 times.
✗ Branch 155 not taken.
✓ Branch 157 taken 1 times.
✗ Branch 158 not taken.
✓ Branch 160 taken 1 times.
✗ Branch 161 not taken.
✓ Branch 163 taken 1 times.
✗ Branch 164 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✗ Branch 187 not taken.
✗ Branch 188 not taken.
1856877309 { return *std::get<domainId>(problemTuple_); }
364
365 //! the finite volume grid geometry of domain i
366 template<std::size_t i>
367 const auto& gridGeometry(Dune::index_constant<i> domainId) const
368
84/142
✓ Branch 5 taken 1600204 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3523492 times.
✓ Branch 8 taken 1600204 times.
✓ Branch 9 taken 1 times.
✓ Branch 10 taken 3523492 times.
✓ Branch 11 taken 1608505 times.
✓ Branch 12 taken 5 times.
✓ Branch 13 taken 3523504 times.
✓ Branch 14 taken 9644936 times.
✓ Branch 15 taken 17 times.
✓ Branch 16 taken 4007235 times.
✓ Branch 17 taken 9644936 times.
✓ Branch 18 taken 13 times.
✓ Branch 19 taken 4026723 times.
✓ Branch 20 taken 10538131 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 4034686 times.
✓ Branch 23 taken 901512 times.
✓ Branch 24 taken 174104 times.
✓ Branch 25 taken 778056 times.
✓ Branch 26 taken 902408 times.
✓ Branch 27 taken 176732 times.
✓ Branch 28 taken 798117 times.
✓ Branch 29 taken 894 times.
✓ Branch 30 taken 176725 times.
✓ Branch 31 taken 794726 times.
✓ Branch 32 taken 1322 times.
✓ Branch 33 taken 807506 times.
✓ Branch 34 taken 793157 times.
✓ Branch 35 taken 12433 times.
✓ Branch 36 taken 999999 times.
✓ Branch 37 taken 794082 times.
✓ Branch 38 taken 12300 times.
✓ Branch 39 taken 995703 times.
✓ Branch 40 taken 1314621 times.
✓ Branch 41 taken 18532 times.
✓ Branch 42 taken 195703 times.
✓ Branch 43 taken 569826 times.
✓ Branch 44 taken 6532 times.
✓ Branch 45 taken 400 times.
✓ Branch 46 taken 536880 times.
✓ Branch 47 taken 5790 times.
✓ Branch 48 taken 400 times.
✓ Branch 49 taken 6201 times.
✓ Branch 50 taken 688 times.
✓ Branch 51 taken 808 times.
✓ Branch 52 taken 5897 times.
✗ Branch 53 not taken.
✓ Branch 54 taken 8899 times.
✓ Branch 55 taken 3 times.
✓ Branch 56 taken 3 times.
✓ Branch 57 taken 8019 times.
✗ Branch 58 not taken.
✓ Branch 59 taken 405 times.
✓ Branch 60 taken 7718 times.
✗ Branch 61 not taken.
✓ Branch 62 taken 709 times.
✗ Branch 63 not taken.
✓ Branch 64 taken 4 times.
✓ Branch 65 taken 304 times.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✓ Branch 68 taken 4 times.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✓ Branch 72 taken 50000 times.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✓ Branch 75 taken 50000 times.
✓ Branch 76 taken 28 times.
✓ Branch 77 taken 50000 times.
✓ Branch 78 taken 50000 times.
✓ Branch 79 taken 28 times.
✓ Branch 80 taken 50000 times.
✓ Branch 81 taken 964000 times.
✓ Branch 82 taken 28 times.
✓ Branch 83 taken 50000 times.
✓ Branch 84 taken 964000 times.
✓ Branch 85 taken 50616 times.
✓ Branch 86 taken 964000 times.
✓ Branch 87 taken 964000 times.
✓ Branch 88 taken 50616 times.
✓ Branch 89 taken 964000 times.
✗ Branch 90 not taken.
✓ Branch 91 taken 50616 times.
✓ Branch 92 taken 964000 times.
✗ Branch 93 not taken.
✓ Branch 94 taken 977489 times.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✓ Branch 97 taken 977989 times.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✓ Branch 100 taken 977489 times.
✓ Branch 101 taken 500 times.
✓ Branch 102 taken 500 times.
✗ Branch 103 not taken.
✓ Branch 104 taken 7 times.
✗ Branch 105 not taken.
✓ Branch 106 taken 1000 times.
✗ Branch 107 not taken.
✗ Branch 108 not taken.
✓ Branch 109 taken 7 times.
✓ Branch 110 taken 500 times.
✗ Branch 111 not taken.
✗ Branch 112 not taken.
✓ Branch 113 taken 7 times.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 120 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✗ Branch 151 not taken.
✗ Branch 152 not taken.
80493759 { return *std::get<domainId>(gridGeometryTuple_); }
369
370 //! the grid view of domain i
371 template<std::size_t i>
372 const auto& gridView(Dune::index_constant<i> domainId) const
373
18/46
✓ Branch 1 taken 5195 times.
✓ Branch 2 taken 1304 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5179 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1295 times.
✓ Branch 7 taken 23 times.
✓ Branch 8 taken 125 times.
✓ Branch 9 taken 5658 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 132 times.
✓ Branch 12 taken 5054 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 5 times.
✓ Branch 15 taken 637 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 843 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 638 times.
✓ Branch 20 taken 838 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 638 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 1500 times.
✓ Branch 25 taken 130 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 1629 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
36505 { return gridGeometry(domainId).gridView(); }
374
375 //! the grid variables of domain i
376 template<std::size_t i>
377 GridVariables<i>& gridVariables(Dune::index_constant<i> domainId)
378
54/142
✓ Branch 1 taken 889377 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 889377 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4598761 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 4735961 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 5058461 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 5058461 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 5167355 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 5776321 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 6065801 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 6967256 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 6967256 times.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✓ Branch 34 taken 15215889 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 15215889 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 15842389 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 15842389 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 15931025 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 15931025 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 15905725 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 14115509 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 14115509 times.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✓ Branch 61 taken 2162672 times.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✓ Branch 64 taken 2367494 times.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✓ Branch 67 taken 1418494 times.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✓ Branch 70 taken 1418494 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1293338 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 1292372 times.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✓ Branch 79 taken 1023012 times.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✓ Branch 82 taken 1030068 times.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✓ Branch 85 taken 1030068 times.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✓ Branch 88 taken 1030068 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 785428 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 785428 times.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✓ Branch 97 taken 785428 times.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✓ Branch 100 taken 1718884 times.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✓ Branch 103 taken 1110884 times.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✓ Branch 106 taken 1110884 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 1103176 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 1103176 times.
✗ Branch 113 not taken.
✓ Branch 115 taken 1103176 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 1108693 times.
✗ Branch 119 not taken.
✓ Branch 121 taken 1108693 times.
✗ Branch 122 not taken.
✓ Branch 124 taken 1108693 times.
✗ Branch 125 not taken.
✓ Branch 127 taken 144693 times.
✗ Branch 128 not taken.
✓ Branch 130 taken 144693 times.
✗ Branch 131 not taken.
✓ Branch 133 taken 144693 times.
✗ Branch 134 not taken.
✓ Branch 136 taken 1972693 times.
✗ Branch 137 not taken.
✓ Branch 139 taken 1972693 times.
✗ Branch 140 not taken.
✓ Branch 142 taken 1972693 times.
✗ Branch 143 not taken.
✓ Branch 145 taken 1966912 times.
✗ Branch 146 not taken.
✓ Branch 148 taken 1966912 times.
✗ Branch 149 not taken.
✓ Branch 151 taken 1966912 times.
✗ Branch 152 not taken.
✓ Branch 154 taken 1928000 times.
✗ Branch 155 not taken.
✓ Branch 157 taken 1928000 times.
✗ Branch 158 not taken.
✓ Branch 160 taken 1928000 times.
✗ Branch 161 not taken.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✗ Branch 169 not taken.
✗ Branch 170 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 178 not taken.
✗ Branch 179 not taken.
258631191 { return *std::get<domainId>(gridVariablesTuple_); }
379
380 //! the grid variables of domain i
381 template<std::size_t i>
382 const GridVariables<i>& gridVariables(Dune::index_constant<i> domainId) const
383
6/12
✓ Branch 1 taken 200 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 200 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 200 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 200 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 200 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 200 times.
✗ Branch 17 not taken.
1800 { return *std::get<domainId>(gridVariablesTuple_); }
384
385 //! the coupling manager
386 const CouplingManager& couplingManager() const
387 { return *couplingManager_; }
388
389 //! the full Jacobian matrix
390 JacobianMatrix& jacobian()
391
5/12
✗ Branch 0 not taken.
✓ Branch 1 taken 5930 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5910 times.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
26566 { return *jacobian_; }
392
393 //! the full residual vector
394 ResidualType& residual()
395
8/36
✓ Branch 1 taken 119 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 119 times.
✓ Branch 5 taken 2057 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2057 times.
✓ Branch 9 taken 13 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 13 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 1 times.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
19254 { return *residual_; }
396
397 //! the solution of the previous time step
398 const SolutionVector& prevSol() const
399 { return *prevSol_; }
400
401 /*!
402 * \brief Set time loop for instationary problems
403 * \note calling this turns this into a stationary assembler
404 */
405 void setTimeManager(std::shared_ptr<const TimeLoop> timeLoop)
406 { timeLoop_ = timeLoop; isStationaryProblem_ = !(static_cast<bool>(timeLoop)); }
407
408 /*!
409 * \brief Sets the solution from which to start the time integration. Has to be
410 * called prior to assembly for time-dependent problems.
411 */
412 void setPreviousSolution(const SolutionVector& u)
413 { prevSol_ = &u; }
414
415 /*!
416 * \brief Whether we are assembling a stationary or instationary problem
417 */
418 bool isStationaryProblem() const
419 { return isStationaryProblem_; }
420
421 /*!
422 * \brief Create a local residual object (used by the local assembler)
423 */
424 template<std::size_t i>
425 LocalResidual<i> localResidual(Dune::index_constant<i> domainId) const
426
21/42
✓ Branch 1 taken 6085874 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6085874 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6085874 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 15467116 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 15467116 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 15467116 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1521697 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1521697 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1521697 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 108330 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 108330 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 108330 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 163489 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 163489 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 163489 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 2892000 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 2892000 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 2892000 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 300 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 300 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 300 times.
✗ Branch 62 not taken.
83731734 { return LocalResidual<i>(std::get<domainId>(problemTuple_).get(), timeLoop_.get()); }
427
428 protected:
429 //! the coupling manager coupling the sub domains
430 std::shared_ptr<CouplingManager> couplingManager_;
431
432 private:
433 /*!
434 * \brief Sets the jacobian sparsity pattern.
435 */
436 void setJacobianPattern_(JacobianMatrix& jac) const
437 {
438 using namespace Dune::Hybrid;
439 218 forEach(std::make_index_sequence<JacobianMatrix::N()>(), [&](const auto domainI)
440 {
441
0/27
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
6094 forEach(integralRange(Dune::Hybrid::size(jac[domainI])), [&](const auto domainJ)
442 {
443
0/8
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
1076 const auto pattern = this->getJacobianPattern_(domainI, domainJ);
444
24/96
✓ Branch 1 taken 207 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 207 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 207 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 207 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 207 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 207 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 207 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 207 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 207 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 207 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 73 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 62 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 38 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 38 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 38 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 38 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 38 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 38 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 38 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 38 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 36 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 36 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 35 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 35 times.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
2651 pattern.exportIdx(jac[domainI][domainJ]);
445 });
446 });
447 }
448
449 /*!
450 * \brief Resizes the residual
451 */
452 void setResidualSize_(ResidualType& res) const
453 {
454 using namespace Dune::Hybrid;
455 1272 forEach(integralRange(Dune::Hybrid::size(res)), [&](const auto domainId)
456 777 { res[domainId].resize(this->numDofs(domainId)); });
457 }
458
459 // reset the residual vector to 0.0
460 10568 void resetResidual_()
461 {
462
2/2
✓ Branch 0 taken 21 times.
✓ Branch 1 taken 9037 times.
10568 if(!residual_)
463 {
464
2/4
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
21 residual_ = std::make_shared<ResidualType>();
465 42 setResidualSize_(*residual_);
466 }
467
468 21136 (*residual_) = 0.0;
469 10568 }
470
471 // reset the jacobian vector to 0.0
472 9662 void resetJacobian_()
473 {
474
2/2
✓ Branch 0 taken 21 times.
✓ Branch 1 taken 8131 times.
9662 if(!jacobian_)
475 {
476
2/4
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
21 jacobian_ = std::make_shared<JacobianMatrix>();
477 42 setJacobianBuildMode(*jacobian_);
478 42 setJacobianPattern_(*jacobian_);
479 }
480
481 19324 (*jacobian_) = 0.0;
482 9662 }
483
484 //! Computes the colors
485 void maybeComputeColors_()
486 {
487 if constexpr (CouplingManagerSupportsMultithreadedAssembly<CouplingManager>::value)
488
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
26 if (enableMultithreading_)
489
2/4
✓ Branch 1 taken 26 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 26 times.
✗ Branch 5 not taken.
52 couplingManager_->computeColorsForAssembly();
490 }
491
492 // check if the assembler is in a correct state for assembly
493 10568 void checkAssemblerState_() const
494 {
495
3/4
✓ Branch 0 taken 8728 times.
✓ Branch 1 taken 330 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8728 times.
10568 if (!isStationaryProblem_ && !prevSol_)
496 DUNE_THROW(Dune::InvalidStateException, "Assembling instationary problem but previous solution was not set!");
497
498
3/4
✓ Branch 0 taken 330 times.
✓ Branch 1 taken 8728 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 330 times.
10568 if (isStationaryProblem_ && prevSol_)
499 DUNE_THROW(Dune::InvalidStateException, "Assembling stationary problem but a previous solution was set."
500 << " Did you forget to set the timeLoop to make this problem instationary?");
501 10568 }
502
503 template<std::size_t i, class JacRow, class SubRes>
504 void assembleJacobianAndResidual_(Dune::index_constant<i> domainId, JacRow& jacRow, SubRes& subRes,
505 const SolutionVector& curSol)
506 {
507
0/18
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
114018529 assemble_(domainId, [&](const auto& element)
508 {
509
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
19000264 MultiDomainAssemblerSubDomainView view{*this, domainId};
510
2/9
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 40 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
65554757 SubDomainAssembler<i> subDomainAssembler(view, element, curSol, *couplingManager_);
511
10/13
✓ Branch 1 taken 4554256 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 232148 times.
✓ Branch 4 taken 9116980 times.
✓ Branch 5 taken 1241494 times.
✓ Branch 6 taken 457437 times.
✓ Branch 7 taken 476981 times.
✓ Branch 8 taken 652845 times.
✓ Branch 9 taken 57708 times.
✓ Branch 10 taken 1928000 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 964000 times.
✗ Branch 14 not taken.
21711152 subDomainAssembler.assembleJacobianAndResidual(jacRow, subRes, gridVariablesTuple_);
512 });
513 }
514
515 template<std::size_t i, class SubRes>
516 void assembleResidual_(Dune::index_constant<i> domainId, SubRes& subRes,
517 const SolutionVector& curSol)
518 {
519 36477809 assemble_(domainId, [&](const auto& element)
520 {
521 9119000 MultiDomainAssemblerSubDomainView view{*this, domainId};
522
3/10
✓ Branch 2 taken 232108 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 155227 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 232108 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
35442039 SubDomainAssembler<i> subDomainAssembler(view, element, curSol, *couplingManager_);
523
3/6
✓ Branch 1 taken 2011150 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7107849 times.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
9119000 subDomainAssembler.assembleResidual(subRes);
524 });
525 }
526
527 /*!
528 * \brief A method assembling something per element
529 * \note Handles exceptions for parallel runs
530 * \throws NumericalProblem on all processes if an exception is thrown during assembly
531 */
532 template<std::size_t i, class AssembleElementFunc>
533 37672 void assemble_(Dune::index_constant<i> domainId, AssembleElementFunc&& assembleElement) const
534 {
535 // a state that will be checked on all processes
536 37672 bool succeeded = false;
537
538 // try assembling using the local assembly function
539 try
540 {
541 if constexpr (CouplingManagerSupportsMultithreadedAssembly<CouplingManager>::value)
542 {
543
1/2
✓ Branch 0 taken 584 times.
✗ Branch 1 not taken.
1168 if (enableMultithreading_)
544 {
545
2/4
✓ Branch 1 taken 584 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 584 times.
✗ Branch 5 not taken.
2336 couplingManager_->assembleMultithreaded(
546 domainId, std::forward<AssembleElementFunc>(assembleElement)
547 );
548 584 return;
549 }
550 }
551
552 // fallback for coupling managers that don't support multithreaded assembly (yet)
553 // or if multithreaded assembly is disabled
554 // let the local assembler add the element contributions
555
17/19
✓ Branch 1 taken 14802 times.
✓ Branch 2 taken 1607767 times.
✓ Branch 3 taken 3446 times.
✓ Branch 4 taken 1622565 times.
✓ Branch 5 taken 3450 times.
✓ Branch 6 taken 19876556 times.
✓ Branch 7 taken 1609679 times.
✓ Branch 8 taken 1562104 times.
✓ Branch 9 taken 18037702 times.
✓ Branch 10 taken 266581 times.
✓ Branch 11 taken 1562104 times.
✓ Branch 12 taken 3706093 times.
✓ Branch 13 taken 2232 times.
✓ Branch 14 taken 5268197 times.
✓ Branch 15 taken 2232 times.
✓ Branch 17 taken 3706093 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 3706093 times.
✗ Branch 21 not taken.
50958382 for (const auto& element : elements(gridView(domainId)))
556
2/2
✓ Branch 1 taken 25177926 times.
✓ Branch 2 taken 1 times.
50355854 assembleElement(element);
557
558 // if we get here, everything worked well on this process
559 36502 succeeded = true;
560 }
561 // throw exception if a problem occurred
562 2 catch (NumericalProblem &e)
563 {
564
2/6
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
6 std::cout << "rank " << gridView(domainId).comm().rank()
565 2 << " caught an exception while assembling:" << e.what()
566
4/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
6 << "\n";
567 2 succeeded = false;
568 }
569
570 // make sure everything worked well on all processes
571
4/8
✗ Branch 0 not taken.
✓ Branch 1 taken 16020 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 18252 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 14556 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 12324 times.
73024 if (gridView(domainId).comm().size() > 1)
572 succeeded = gridView(domainId).comm().min(succeeded);
573
574 // if not succeeded rethrow the error on all processes
575
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 18251 times.
36504 if (!succeeded)
576
7/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 1 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
20 DUNE_THROW(NumericalProblem, "A process did not succeed in linearizing the system");
577 36502 }
578
579 // get diagonal block pattern
580 template<std::size_t i, std::size_t j, typename std::enable_if_t<(i==j), int> = 0>
581 Dune::MatrixIndexSet getJacobianPattern_(Dune::index_constant<i> domainI,
582 Dune::index_constant<j> domainJ) const
583 {
584
0/13
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
394 const auto& gg = gridGeometry(domainI);
585
0/13
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
394 auto pattern = getJacobianPattern<isImplicit()>(gg);
586
8/32
✓ Branch 1 taken 183 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 183 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 172 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 172 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 37 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 37 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 2 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 2 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
788 couplingManager_->extendJacobianPattern(domainI, pattern);
587 return pattern;
588 }
589
590 // get coupling block pattern
591 template<std::size_t i, std::size_t j, typename std::enable_if_t<(i!=j), int> = 0>
592 Dune::MatrixIndexSet getJacobianPattern_(Dune::index_constant<i> domainI,
593 Dune::index_constant<j> domainJ) const
594 {
595 1120 return getCouplingJacobianPattern<isImplicit()>(*couplingManager_,
596 domainI, gridGeometry(domainI),
597
8/80
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
2240 domainJ, gridGeometry(domainJ));
598 }
599
600 // build periodic constraints into the system matrix
601 template<std::size_t i, class JacRow, class Res, class GG, class Sol>
602 2978 void enforcePeriodicConstraints_(Dune::index_constant<i> domainI, JacRow& jacRow, Res& res, const GG& gridGeometry, const Sol& curSol)
603 {
604 if constexpr (Detail::hasPeriodicDofMap<GG>())
605 {
606
4/4
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 1489 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 20 times.
11992 for (const auto& m : gridGeometry.periodicDofMap())
607 {
608
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 20 times.
80 if (m.first < m.second)
609 {
610 40 auto& jac = jacRow[domainI];
611
612 // add the second row to the first
613 120 res[m.first] += res[m.second];
614
615 80 const auto end = jac[m.second].end();
616
4/4
✓ Branch 0 taken 176 times.
✓ Branch 1 taken 20 times.
✓ Branch 2 taken 176 times.
✓ Branch 3 taken 20 times.
744 for (auto it = jac[m.second].begin(); it != end; ++it)
617
5/10
✓ Branch 1 taken 176 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 176 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 176 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 176 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 176 times.
✗ Branch 14 not taken.
1760 jac[m.first][it.index()] += (*it);
618
619
620 // enforce the solution of the first periodic DOF to the second one
621 160 res[m.second] = curSol[m.second] - curSol[m.first];
622
623 // set derivatives accordingly in jacobian, i.e. id for m.second and -id for m.first
624 auto setMatrixBlock = [] (auto& matrixBlock, double diagValue)
625 {
626
0/4
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
160 for (int eIdx = 0; eIdx < matrixBlock.N(); ++eIdx)
627 160 matrixBlock[eIdx][eIdx] = diagValue;
628 };
629
630
3/4
✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
✓ Branch 2 taken 176 times.
✓ Branch 3 taken 20 times.
432 for (auto it = jac[m.second].begin(); it != end; ++it)
631 {
632
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 156 times.
352 auto& matrixBlock = *it;
633
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 156 times.
352 matrixBlock = 0.0;
634
635
4/4
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 156 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 156 times.
704 assert(matrixBlock.N() == matrixBlock.M());
636
4/4
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 156 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 156 times.
704 if(it.index() == m.second)
637 setMatrixBlock(matrixBlock, 1.0);
638
639
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 156 times.
352 if(it.index() == m.first)
640 setMatrixBlock(matrixBlock, -1.0);
641
642 }
643
644 using namespace Dune::Hybrid;
645
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
80 forEach(makeIncompleteIntegerSequence<JacRow::size(), domainI>(), [&](const auto couplingDomainId)
646 {
647 20 auto& jacCoupling = jacRow[couplingDomainId];
648
649
5/16
✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 40 times.
✓ Branch 6 taken 20 times.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
100 for (auto it = jacCoupling[m.second].begin(); it != jacCoupling[m.second].end(); ++it)
650 100 jacCoupling[m.first][it.index()] += (*it);
651
652
6/12
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 20 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
80 for (auto it = jacCoupling[m.second].begin(); it != jacCoupling[m.second].end(); ++it)
653 60 (*it) = 0.0;
654 });
655 }
656 }
657 }
658 2978 }
659
660 //! pointer to the problem to be solved
661 ProblemTuple problemTuple_;
662
663 //! the finite volume geometry of the grid
664 GridGeometryTuple gridGeometryTuple_;
665
666 //! the variables container for the grid
667 GridVariablesTuple gridVariablesTuple_;
668
669 //! the time loop for instationary problem assembly
670 std::shared_ptr<const TimeLoop> timeLoop_;
671
672 //! an observing pointer to the previous solution for instationary problems
673 const SolutionVector* prevSol_ = nullptr;
674
675 //! if this assembler is assembling an instationary problem
676 bool isStationaryProblem_;
677
678 //! shared pointers to the jacobian matrix and residual
679 std::shared_ptr<JacobianMatrix> jacobian_;
680 std::shared_ptr<ResidualType> residual_;
681
682 //! Issue a warning if the calculation is used in parallel with overlap. This could be a static local variable if it wasn't for g++7 yielding a linker error.
683 mutable bool warningIssued_;
684
685 //! if multithreaded assembly is enabled
686 bool enableMultithreading_ = false;
687 };
688
689 } // end namespace Dumux
690
691 #endif
692