GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 102 111 91.9%
Functions: 502 775 64.8%
Branches: 477 640 74.5%

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 CCTpfaDiscretization
10 * \brief The local (stencil) volume variables class for cell centered tpfa models
11 */
12 #ifndef DUMUX_DISCRETIZATION_CCTPFA_ELEMENT_VOLUMEVARIABLES_HH
13 #define DUMUX_DISCRETIZATION_CCTPFA_ELEMENT_VOLUMEVARIABLES_HH
14
15 #include <algorithm>
16 #include <type_traits>
17 #include <vector>
18 #include <utility>
19
20 #include <dumux/discretization/cellcentered/elementsolution.hh>
21
22 namespace Dumux {
23
24 /*!
25 * \ingroup CCTpfaDiscretization
26 * \brief The local (stencil) volume variables class for cell centered tpfa models
27 * \note The class is specialized for versions with and without caching
28 * \tparam GVV the grid volume variables type
29 * \tparam cachingEnabled if the cache is enabled
30 */
31 template<class GVV, bool cachingEnabled>
32 class CCTpfaElementVolumeVariables
33 {};
34
35 /*!
36 * \ingroup CCTpfaDiscretization
37 * \brief The local (stencil) volume variables class for cell centered tpfa models with caching
38 * \note the volume variables are stored for the whole grid view in the corresponding GridVolumeVariables class
39 */
40 template<class GVV>
41
6/12
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 54 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 54 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 54 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 54 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 54 times.
✗ Branch 17 not taken.
17041972 class CCTpfaElementVolumeVariables<GVV, /*cachingEnabled*/true>
42 {
43 public:
44 //! export type of the grid volume variables
45 using GridVolumeVariables = GVV;
46
47 //! export type of the volume variables
48 using VolumeVariables = typename GridVolumeVariables::VolumeVariables;
49
50 //! Constructor
51 CCTpfaElementVolumeVariables(const GridVolumeVariables& gridVolVars)
52 : gridVolVarsPtr_(&gridVolVars)
53
125/157
✓ Branch 1 taken 180484 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 180484 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1233890 times.
✓ Branch 7 taken 180484 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1233890 times.
✓ Branch 10 taken 180484 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1233890 times.
✓ Branch 13 taken 180484 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 1233890 times.
✓ Branch 16 taken 9262945 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1233890 times.
✓ Branch 19 taken 9262945 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 2786723 times.
✓ Branch 22 taken 9262945 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 2786723 times.
✓ Branch 25 taken 9262945 times.
✓ Branch 26 taken 3470 times.
✓ Branch 27 taken 2786723 times.
✓ Branch 28 taken 9262945 times.
✓ Branch 29 taken 3470 times.
✓ Branch 30 taken 2786723 times.
✓ Branch 31 taken 9643742 times.
✓ Branch 32 taken 3470 times.
✓ Branch 33 taken 2786723 times.
✓ Branch 34 taken 9643742 times.
✓ Branch 35 taken 3470 times.
✓ Branch 36 taken 1572629 times.
✓ Branch 37 taken 9643742 times.
✓ Branch 38 taken 3470 times.
✓ Branch 39 taken 1572629 times.
✓ Branch 40 taken 9643742 times.
✓ Branch 41 taken 3470 times.
✓ Branch 42 taken 1572629 times.
✓ Branch 43 taken 9643742 times.
✓ Branch 44 taken 3470 times.
✓ Branch 45 taken 1572629 times.
✓ Branch 46 taken 5208754 times.
✓ Branch 47 taken 3470 times.
✓ Branch 48 taken 1572629 times.
✓ Branch 49 taken 5208754 times.
✓ Branch 50 taken 3470 times.
✓ Branch 51 taken 10558231 times.
✓ Branch 52 taken 5208754 times.
✓ Branch 53 taken 3470 times.
✓ Branch 54 taken 10558231 times.
✓ Branch 55 taken 5208754 times.
✓ Branch 56 taken 173500 times.
✓ Branch 57 taken 10558231 times.
✓ Branch 58 taken 5208754 times.
✓ Branch 59 taken 173500 times.
✓ Branch 60 taken 10558231 times.
✓ Branch 61 taken 709312 times.
✓ Branch 62 taken 173500 times.
✓ Branch 63 taken 10558231 times.
✓ Branch 64 taken 709312 times.
✓ Branch 65 taken 173500 times.
✓ Branch 66 taken 10558131 times.
✓ Branch 67 taken 709312 times.
✓ Branch 68 taken 173500 times.
✓ Branch 69 taken 10558131 times.
✓ Branch 70 taken 709312 times.
✓ Branch 71 taken 173500 times.
✓ Branch 72 taken 10558131 times.
✓ Branch 73 taken 709312 times.
✓ Branch 74 taken 173500 times.
✓ Branch 75 taken 10558131 times.
✓ Branch 76 taken 324324 times.
✓ Branch 77 taken 173500 times.
✓ Branch 78 taken 10558131 times.
✓ Branch 79 taken 324324 times.
✓ Branch 80 taken 173500 times.
✓ Branch 81 taken 5547 times.
✓ Branch 82 taken 324324 times.
✓ Branch 83 taken 173500 times.
✓ Branch 84 taken 5547 times.
✓ Branch 85 taken 324324 times.
✓ Branch 86 taken 800000 times.
✓ Branch 87 taken 5547 times.
✓ Branch 88 taken 324324 times.
✓ Branch 89 taken 800000 times.
✓ Branch 90 taken 5547 times.
✓ Branch 91 taken 5000 times.
✓ Branch 92 taken 800000 times.
✓ Branch 93 taken 5547 times.
✓ Branch 94 taken 5000 times.
✓ Branch 95 taken 800000 times.
✓ Branch 96 taken 930106 times.
✓ Branch 97 taken 5000 times.
✓ Branch 98 taken 800000 times.
✓ Branch 99 taken 930106 times.
✓ Branch 100 taken 5000 times.
✓ Branch 101 taken 800000 times.
✓ Branch 102 taken 930106 times.
✓ Branch 103 taken 5000 times.
✓ Branch 104 taken 800000 times.
✓ Branch 105 taken 930106 times.
✗ Branch 106 not taken.
✓ Branch 107 taken 800000 times.
✓ Branch 108 taken 930106 times.
✗ Branch 109 not taken.
✓ Branch 110 taken 800000 times.
✓ Branch 111 taken 15642 times.
✗ Branch 112 not taken.
✓ Branch 113 taken 800000 times.
✓ Branch 114 taken 15642 times.
✗ Branch 115 not taken.
✓ Branch 116 taken 1744 times.
✓ Branch 117 taken 15642 times.
✗ Branch 118 not taken.
✓ Branch 119 taken 1744 times.
✓ Branch 120 taken 15642 times.
✗ Branch 121 not taken.
✓ Branch 122 taken 1744 times.
✓ Branch 123 taken 15642 times.
✗ Branch 124 not taken.
✓ Branch 125 taken 1744 times.
✗ Branch 126 not taken.
✓ Branch 128 taken 1744 times.
✗ Branch 129 not taken.
✓ Branch 131 taken 1735 times.
✗ Branch 132 not taken.
✓ Branch 134 taken 1735 times.
✗ Branch 135 not taken.
✓ Branch 137 taken 1735 times.
✗ Branch 138 not taken.
✓ Branch 140 taken 1735 times.
✗ Branch 141 not taken.
✓ Branch 143 taken 1735 times.
✗ Branch 144 not taken.
✓ Branch 146 taken 8000 times.
✗ Branch 147 not taken.
✓ Branch 149 taken 8000 times.
✗ Branch 150 not taken.
✓ Branch 152 taken 8000 times.
✗ Branch 153 not taken.
✓ Branch 155 taken 8000 times.
✗ Branch 156 not taken.
✓ Branch 158 taken 8000 times.
✗ Branch 159 not taken.
✓ Branch 166 taken 101 times.
✗ Branch 167 not taken.
✓ Branch 169 taken 101 times.
✗ Branch 170 not taken.
✓ Branch 172 taken 101 times.
✗ Branch 173 not taken.
✓ Branch 175 taken 101 times.
✗ Branch 176 not taken.
✓ Branch 178 taken 101 times.
✗ Branch 179 not taken.
291099840 , numScv_(gridVolVars.problem().gridGeometry().numScv())
54 {}
55
56 //! operator for the access with an scv
57 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value, int> = 0>
58 1921984671 const VolumeVariables& operator [](const SubControlVolume& scv) const
59 {
60
2/4
✓ Branch 0 taken 1647588872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1647588872 times.
✗ Branch 3 not taken.
3843969342 if (scv.dofIndex() < numScv_)
61 5765954013 return gridVolVars().volVars(scv.dofIndex());
62 else
63 return boundaryVolumeVariables_[getLocalIdx_(scv.dofIndex())];
64 }
65
66 //! operator for the access with an index
67 2910229810 const VolumeVariables& operator [](const std::size_t scvIdx) const
68 {
69
2/2
✓ Branch 0 taken 2329854837 times.
✓ Branch 1 taken 1699148 times.
2910229810 if (scvIdx < numScv_)
70 5816599004 return gridVolVars().volVars(scvIdx);
71 else
72 1930308 return boundaryVolumeVariables_[getLocalIdx_(scvIdx)];
73 }
74
75 /*!
76 * \brief bind the local view (r-value overload)
77 * This overload is called when an instance of this class is a temporary in the usage context
78 * This allows a usage like this: `const auto view = localView(...).bind(element);`
79 */
80 template<class FVElementGeometry, class SolutionVector>
81 9235737 CCTpfaElementVolumeVariables bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
82 const FVElementGeometry& fvGeometry,
83 const SolutionVector& sol) &&
84 {
85 9235737 this->bind_(element, fvGeometry, sol);
86 18471474 return std::move(*this);
87 }
88
89 template<class FVElementGeometry, class SolutionVector>
90 void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
91 const FVElementGeometry& fvGeometry,
92 const SolutionVector& sol) &
93
4/11
✓ Branch 1 taken 1150172 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 54 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2500 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 13 taken 1735 times.
✗ Branch 14 not taken.
30356304 { this->bind_(element, fvGeometry, sol); }
94
95 /*!
96 * \brief bind the local view (r-value overload)
97 * This overload is called when an instance of this class is a temporary in the usage context
98 * This allows a usage like this: `const auto view = localView(...).bind(element);`
99 */
100 template<class FVElementGeometry, class SolutionVector>
101 CCTpfaElementVolumeVariables bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
102 const FVElementGeometry& fvGeometry,
103 const SolutionVector& sol) &&
104 {
105 966862 this->bindElement_(element, fvGeometry, sol);
106 1933724 return std::move(*this);
107 }
108
109 template<class FVElementGeometry, class SolutionVector>
110 void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
111 const FVElementGeometry& fvGeometry,
112 const SolutionVector& sol) &
113
1/2
✓ Branch 1 taken 1205120 times.
✗ Branch 2 not taken.
6430079 { this->bindElement_(element, fvGeometry, sol); }
114
115 //! The global volume variables object we are a restriction of
116 const GridVolumeVariables& gridVolVars() const
117 { return *gridVolVarsPtr_; }
118
119 private:
120
121 //! Clear all local storage
122 void clear_()
123 {
124 10056870 boundaryVolVarIndices_.clear();
125
5/6
✓ Branch 0 taken 7793 times.
✓ Branch 1 taken 1849221 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3170917 times.
✓ Branch 4 taken 125 times.
✓ Branch 5 taken 379 times.
5028435 boundaryVolumeVariables_.clear();
126 }
127
128 //! precompute all boundary volume variables in a stencil of an element, the remaining ones are cached
129 template<class FVElementGeometry, class SolutionVector>
130 53964112 void bind_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
131 const FVElementGeometry& fvGeometry,
132 const SolutionVector& sol)
133 {
134
4/4
✓ Branch 0 taken 5028435 times.
✓ Branch 1 taken 32343341 times.
✓ Branch 2 taken 5028435 times.
✓ Branch 3 taken 32343341 times.
107928224 if (!fvGeometry.hasBoundaryScvf())
135 return;
136
137
2/2
✓ Branch 0 taken 7918 times.
✓ Branch 1 taken 5020517 times.
8474204 clear_();
138 16948408 boundaryVolVarIndices_.reserve(fvGeometry.numScvf());
139 16948408 boundaryVolumeVariables_.reserve(fvGeometry.numScvf());
140
141
6/6
✓ Branch 0 taken 26303925 times.
✓ Branch 1 taken 5028435 times.
✓ Branch 2 taken 26303925 times.
✓ Branch 3 taken 5028435 times.
✓ Branch 4 taken 20872252 times.
✓ Branch 5 taken 5431673 times.
63306846 for (const auto& scvf : scvfs(fvGeometry))
142 {
143
2/2
✓ Branch 0 taken 20872252 times.
✓ Branch 1 taken 5431673 times.
46358438 if (!scvf.boundary())
144 37137394 continue;
145
146 // check if boundary is a pure dirichlet boundary
147 9221044 const auto& problem = gridVolVars().problem();
148
2/2
✓ Branch 0 taken 183835 times.
✓ Branch 1 taken 3854396 times.
9221044 const auto bcTypes = problem.boundaryTypes(element, scvf);
149
4/4
✓ Branch 0 taken 256046 times.
✓ Branch 1 taken 5175627 times.
✓ Branch 2 taken 256046 times.
✓ Branch 3 taken 5175627 times.
18442088 if (bcTypes.hasOnlyDirichlet())
150 {
151
2/2
✓ Branch 0 taken 62349 times.
✓ Branch 1 taken 1874 times.
462558 const auto dirichletPriVars = elementSolution<FVElementGeometry>(problem.dirichlet(element, scvf));
152 743858 auto&& scvI = fvGeometry.scv(scvf.insideScvIdx());
153
154 371929 VolumeVariables volVars;
155 371929 volVars.update(dirichletPriVars,
156 problem,
157 element,
158 scvI);
159
160 371929 boundaryVolumeVariables_.emplace_back(std::move(volVars));
161 743858 boundaryVolVarIndices_.push_back(scvf.outsideScvIdx());
162 }
163 }
164 }
165
166 //! precompute the volume variables of an element - do nothing: volVars are cached
167 template<class FVElementGeometry, class SolutionVector>
168 void bindElement_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
169 const FVElementGeometry& fvGeometry,
170 const SolutionVector& sol)
171 {}
172
173 const GridVolumeVariables* gridVolVarsPtr_;
174
175 //! map a global scv index to the local storage index
176 1699148 int getLocalIdx_(const int volVarIdx) const
177 {
178 5097444 auto it = std::find(boundaryVolVarIndices_.begin(), boundaryVolVarIndices_.end(), volVarIdx);
179
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 1467988 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1467988 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1467988 times.
5097444 assert(it != boundaryVolVarIndices_.end() && "Could not find the current volume variables for volVarIdx!");
180 5097444 return std::distance(boundaryVolVarIndices_.begin(), it);
181 }
182
183 std::vector<std::size_t> boundaryVolVarIndices_;
184 std::vector<VolumeVariables> boundaryVolumeVariables_;
185 const std::size_t numScv_;
186 };
187
188 /*!
189 * \ingroup CCTpfaDiscretization
190 * \brief The local (stencil) volume variables class for cell centered tpfa models with caching
191 */
192 template<class GVV>
193
6/12
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
348510 class CCTpfaElementVolumeVariables<GVV, /*cachingEnabled*/false>
194 {
195 public:
196 //! export type of the grid volume variables
197 using GridVolumeVariables = GVV;
198
199 //! export type of the volume variables
200 using VolumeVariables = typename GridVolumeVariables::VolumeVariables;
201
202 //! Constructor
203 CCTpfaElementVolumeVariables(const GridVolumeVariables& gridVolVars)
204
44/88
✓ Branch 1 taken 1779 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 41430 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 41730 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 19816384 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 19820642 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 19820906 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 20197721 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 20158059 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 20207807 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 423474 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 423474 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 423474 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 254083 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 519622 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 469622 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 469500 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 469500 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 475236 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 275884 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 6098 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 6098 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 6048 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 6048 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 55781 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 55781 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 55781 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 55781 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 55781 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 55781 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 50000 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 50000 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 50000 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 964000 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 964000 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 964000 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 964000 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 964000 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 964000 times.
✗ Branch 113 not taken.
✓ Branch 115 taken 100 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 100 times.
✗ Branch 119 not taken.
✓ Branch 121 taken 100 times.
✗ Branch 122 not taken.
✓ Branch 127 taken 1 times.
✗ Branch 128 not taken.
✓ Branch 130 taken 1 times.
✗ Branch 131 not taken.
✓ Branch 133 taken 1 times.
✗ Branch 134 not taken.
130603902 : gridVolVarsPtr_(&gridVolVars) {}
205
206 /*!
207 * \brief bind the local view (r-value overload)
208 * This overload is called when an instance of this class is a temporary in the usage context
209 * This allows a usage like this: `const auto view = localView(...).bind(element);`
210 */
211 template<class FVElementGeometry, class SolutionVector>
212 105599 CCTpfaElementVolumeVariables bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
213 const FVElementGeometry& fvGeometry,
214 const SolutionVector& sol) &&
215 {
216 105599 this->bind_(element, fvGeometry, sol);
217 211198 return std::move(*this);
218 }
219
220 template<class FVElementGeometry, class SolutionVector>
221 void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
222 const FVElementGeometry& fvGeometry,
223 const SolutionVector& sol) &
224
6/14
✓ Branch 1 taken 559686 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 87340 times.
✓ Branch 5 taken 36914 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 76900 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 17 taken 100 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 1928 times.
✗ Branch 21 not taken.
22536675 { this->bind_(element, fvGeometry, sol); }
225
226 /*!
227 * \brief bind the local view (r-value overload)
228 * This overload is called when an instance of this class is a temporary in the usage context
229 * This allows a usage like this: `const auto view = localView(...).bind(element);`
230 */
231 template<class FVElementGeometry, class SolutionVector>
232 6316 CCTpfaElementVolumeVariables bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
233 const FVElementGeometry& fvGeometry,
234 const SolutionVector& sol) &&
235 {
236 6316 this->bindElement_(element, fvGeometry, sol);
237 12632 return std::move(*this);
238 }
239
240 template<class FVElementGeometry, class SolutionVector>
241 void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
242 const FVElementGeometry& fvGeometry,
243 const SolutionVector& sol) &
244
7/10
✓ Branch 1 taken 984874 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 26045 times.
✓ Branch 5 taken 3498302 times.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 21216 times.
✓ Branch 8 taken 7756 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1100 times.
✗ Branch 11 not taken.
25456431 { this->bindElement_(element, fvGeometry, sol); }
245
246 //! access operator with scv
247 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value, int> = 0>
248 const VolumeVariables& operator [](const SubControlVolume& scv) const
249
41/56
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4079 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 4079 times.
✓ Branch 6 taken 1512 times.
✓ Branch 7 taken 10584 times.
✓ Branch 8 taken 1512 times.
✓ Branch 9 taken 10584 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 400 times.
✓ Branch 16 taken 18192 times.
✓ Branch 17 taken 8275587 times.
✓ Branch 18 taken 287232 times.
✓ Branch 19 taken 8506467 times.
✓ Branch 20 taken 697277 times.
✓ Branch 21 taken 794274 times.
✓ Branch 22 taken 509645 times.
✓ Branch 23 taken 562994 times.
✓ Branch 24 taken 81408 times.
✓ Branch 25 taken 17000 times.
✓ Branch 26 taken 8175508 times.
✓ Branch 27 taken 47800 times.
✓ Branch 28 taken 8252308 times.
✓ Branch 29 taken 30800 times.
✓ Branch 30 taken 76800 times.
✗ Branch 31 not taken.
✗ Branch 34 not taken.
✓ Branch 35 taken 77688 times.
✗ Branch 36 not taken.
✓ Branch 37 taken 77688 times.
✓ Branch 40 taken 150000 times.
✓ Branch 41 taken 119124 times.
✓ Branch 42 taken 150000 times.
✓ Branch 43 taken 119124 times.
✗ Branch 44 not taken.
✓ Branch 45 taken 268304 times.
✗ Branch 46 not taken.
✓ Branch 47 taken 303664 times.
✗ Branch 48 not taken.
✓ Branch 49 taken 47648 times.
✗ Branch 50 not taken.
✓ Branch 51 taken 12288 times.
✗ Branch 62 not taken.
✓ Branch 63 taken 11562 times.
✗ Branch 64 not taken.
✓ Branch 65 taken 975562 times.
✗ Branch 66 not taken.
✓ Branch 67 taken 964000 times.
✓ Branch 74 taken 150000 times.
✗ Branch 75 not taken.
✓ Branch 76 taken 150000 times.
✗ Branch 77 not taken.
✓ Branch 84 taken 2892000 times.
✗ Branch 85 not taken.
✓ Branch 86 taken 2892000 times.
✗ Branch 87 not taken.
708067306 { return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
250
251 //! access operator with scv
252 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value, int> = 0>
253 VolumeVariables& operator [](const SubControlVolume& scv)
254
10/16
✓ Branch 5 taken 19456 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1671150 times.
✓ Branch 8 taken 19456 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1671150 times.
✓ Branch 11 taken 33000 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 303347 times.
✓ Branch 14 taken 33000 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 303347 times.
✓ Branch 17 taken 1254177 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 1254177 times.
✗ Branch 21 not taken.
44598678 { return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
255
256 //! access operator with scv index
257 const VolumeVariables& operator [](std::size_t scvIdx) const
258
135/147
✓ Branch 1 taken 48 times.
✓ Branch 2 taken 9984 times.
✓ Branch 3 taken 48 times.
✓ Branch 4 taken 11406147 times.
✓ Branch 5 taken 19486712 times.
✓ Branch 6 taken 11396163 times.
✓ Branch 7 taken 19808046 times.
✓ Branch 8 taken 304538 times.
✓ Branch 9 taken 5103988 times.
✓ Branch 10 taken 41472028 times.
✓ Branch 11 taken 8804502 times.
✓ Branch 12 taken 43651178 times.
✓ Branch 13 taken 7855982 times.
✓ Branch 14 taken 3866456 times.
✓ Branch 15 taken 37912890 times.
✓ Branch 16 taken 1395376 times.
✓ Branch 17 taken 34814085 times.
✓ Branch 18 taken 30008195 times.
✓ Branch 19 taken 39969806 times.
✓ Branch 20 taken 33197641 times.
✓ Branch 21 taken 44289680 times.
✓ Branch 22 taken 5714221 times.
✓ Branch 23 taken 23853255 times.
✓ Branch 24 taken 15078029 times.
✓ Branch 25 taken 28852572 times.
✓ Branch 26 taken 35607617 times.
✓ Branch 27 taken 25660212 times.
✓ Branch 28 taken 25055977 times.
✓ Branch 29 taken 17338997 times.
✓ Branch 30 taken 44052541 times.
✓ Branch 31 taken 34787903 times.
✓ Branch 32 taken 80096427 times.
✓ Branch 33 taken 34941570 times.
✓ Branch 34 taken 41218095 times.
✓ Branch 35 taken 7063085 times.
✓ Branch 36 taken 10043032 times.
✓ Branch 37 taken 7653041 times.
✓ Branch 38 taken 6890587 times.
✓ Branch 39 taken 10612604 times.
✓ Branch 40 taken 53693074 times.
✓ Branch 41 taken 52000706 times.
✓ Branch 42 taken 55180498 times.
✓ Branch 43 taken 44127508 times.
✓ Branch 44 taken 27963249 times.
✓ Branch 45 taken 56214544 times.
✓ Branch 46 taken 27207015 times.
✓ Branch 47 taken 60979230 times.
✓ Branch 48 taken 2948283 times.
✓ Branch 49 taken 8051831 times.
✓ Branch 50 taken 3700322 times.
✓ Branch 51 taken 3025656 times.
✓ Branch 52 taken 1491990 times.
✓ Branch 53 taken 1368697 times.
✓ Branch 54 taken 89797620 times.
✓ Branch 55 taken 93771144 times.
✓ Branch 56 taken 89857773 times.
✓ Branch 57 taken 93060932 times.
✓ Branch 58 taken 726896 times.
✓ Branch 59 taken 87012401 times.
✓ Branch 60 taken 3544568 times.
✓ Branch 61 taken 102927098 times.
✓ Branch 62 taken 2985120 times.
✓ Branch 63 taken 17451016 times.
✓ Branch 64 taken 106148 times.
✓ Branch 65 taken 7465529 times.
✓ Branch 66 taken 5596 times.
✓ Branch 67 taken 6706168 times.
✓ Branch 68 taken 6646 times.
✓ Branch 69 taken 119462 times.
✓ Branch 70 taken 1122 times.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✓ Branch 73 taken 8136 times.
✓ Branch 74 taken 20936 times.
✓ Branch 75 taken 52406 times.
✓ Branch 76 taken 34232 times.
✓ Branch 77 taken 56030 times.
✓ Branch 78 taken 13297 times.
✓ Branch 79 taken 27495 times.
✓ Branch 80 taken 71814 times.
✓ Branch 81 taken 16815 times.
✓ Branch 82 taken 73325 times.
✓ Branch 83 taken 1080 times.
✓ Branch 84 taken 1518 times.
✓ Branch 85 taken 6 times.
✓ Branch 86 taken 27978 times.
✓ Branch 87 taken 27978 times.
✓ Branch 88 taken 27972 times.
✓ Branch 89 taken 34308 times.
✓ Branch 90 taken 121248 times.
✓ Branch 91 taken 1325346 times.
✓ Branch 92 taken 1366224 times.
✓ Branch 93 taken 1319010 times.
✓ Branch 94 taken 1279660 times.
✓ Branch 95 taken 531012 times.
✓ Branch 96 taken 830556 times.
✓ Branch 97 taken 567300 times.
✓ Branch 98 taken 2007200 times.
✓ Branch 99 taken 499720 times.
✓ Branch 100 taken 2020844 times.
✓ Branch 101 taken 491404 times.
✓ Branch 102 taken 809716 times.
✓ Branch 103 taken 538067 times.
✓ Branch 104 taken 706964 times.
✓ Branch 105 taken 510095 times.
✓ Branch 106 taken 706764 times.
✓ Branch 107 taken 2763 times.
✓ Branch 108 taken 39056 times.
✓ Branch 109 taken 1214091 times.
✓ Branch 110 taken 39056 times.
✓ Branch 111 taken 1211328 times.
✓ Branch 113 taken 36288 times.
✓ Branch 114 taken 1211328 times.
✓ Branch 115 taken 36288 times.
✓ Branch 116 taken 1211328 times.
✗ Branch 117 not taken.
✓ Branch 118 taken 502725 times.
✓ Branch 119 taken 708603 times.
✓ Branch 120 taken 502725 times.
✓ Branch 121 taken 708603 times.
✗ Branch 123 not taken.
✓ Branch 124 taken 1211328 times.
✗ Branch 125 not taken.
✓ Branch 126 taken 1211328 times.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✗ Branch 134 not taken.
✓ Branch 135 taken 11232 times.
✗ Branch 136 not taken.
✓ Branch 137 taken 11232 times.
✗ Branch 142 not taken.
✓ Branch 143 taken 11232 times.
✗ Branch 144 not taken.
✓ Branch 145 taken 11232 times.
✓ Branch 152 taken 72576 times.
✓ Branch 153 taken 2422656 times.
✓ Branch 154 taken 72576 times.
✓ Branch 155 taken 2422656 times.
✓ Branch 160 taken 1081704 times.
✓ Branch 161 taken 3836184 times.
✓ Branch 162 taken 1081704 times.
✓ Branch 163 taken 3836184 times.
✓ Branch 165 taken 1005450 times.
✓ Branch 166 taken 1417206 times.
✓ Branch 167 taken 1005450 times.
✓ Branch 168 taken 1417206 times.
1612781566 { return volumeVariables_[getLocalIdx_(scvIdx)]; }
259
260 //! access operator with scv index
261 VolumeVariables& operator [](std::size_t scvIdx)
262
4/8
✗ Branch 1 not taken.
✓ Branch 2 taken 34460 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 34460 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1056 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1056 times.
1574476 { return volumeVariables_[getLocalIdx_(scvIdx)]; }
263
264 //! The global volume variables object we are a restriction of
265 const GridVolumeVariables& gridVolVars() const
266 { return *gridVolVarsPtr_; }
267
268 private:
269 //! Clear all local storage
270 void clear_()
271 {
272 97217922 volVarIndices_.clear();
273
15/16
✓ Branch 0 taken 1044523 times.
✓ Branch 1 taken 19511865 times.
✓ Branch 2 taken 4604064 times.
✓ Branch 3 taken 20083405 times.
✓ Branch 4 taken 157168 times.
✓ Branch 5 taken 432734 times.
✓ Branch 6 taken 76849 times.
✓ Branch 7 taken 680734 times.
✓ Branch 8 taken 25049 times.
✓ Branch 9 taken 964013 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1020045 times.
✓ Branch 12 taken 99 times.
✓ Branch 13 taken 301 times.
✓ Branch 14 taken 1927 times.
✓ Branch 15 taken 6185 times.
48608961 volumeVariables_.clear();
274 }
275
276 //! Prepares the volume variables within the element stencil
277 template<class FVElementGeometry, class SolutionVector>
278 24996667 void bind_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
279 const FVElementGeometry& fvGeometry,
280 const SolutionVector& sol)
281 {
282
2/2
✓ Branch 0 taken 1162688 times.
✓ Branch 1 taken 21798414 times.
24996667 clear_();
283
284 24996667 const auto& problem = gridVolVars().problem();
285 24996667 const auto& gridGeometry = fvGeometry.gridGeometry();
286 49993334 const auto globalI = gridGeometry.elementMapper().index(element);
287 49993334 const auto& connectivityMapI = gridGeometry.connectivityMap()[globalI];
288 24996667 const auto numDofs = connectivityMapI.size() + 1;
289
290 // resize local containers to the required size (for internal elements)
291 24996667 volumeVariables_.resize(numDofs);
292 24996667 volVarIndices_.resize(numDofs);
293 24996667 int localIdx = 0;
294
295 // update the volume variables of the element at hand
296
1/2
✓ Branch 0 taken 16589712 times.
✗ Branch 1 not taken.
24996667 auto&& scvI = fvGeometry.scv(globalI);
297 25002715 volumeVariables_[localIdx].update(elementSolution(element, sol, gridGeometry),
298 problem,
299 element,
300 scvI);
301 24996667 volVarIndices_[localIdx] = scvI.dofIndex();
302 24996667 ++localIdx;
303
304 // Update the volume variables of the neighboring elements
305
4/4
✓ Branch 0 taken 69486638 times.
✓ Branch 1 taken 22961102 times.
✓ Branch 2 taken 69486638 times.
✓ Branch 3 taken 22961102 times.
227513721 for (const auto& dataJ : connectivityMapI)
306 {
307
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 41887468 times.
✗ Branch 2 not taken.
91242600 const auto& elementJ = gridGeometry.element(dataJ.globalJ);
308
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 45353384 times.
✗ Branch 2 not taken.
76261860 auto&& scvJ = fvGeometry.scv(dataJ.globalJ);
309
4/7
✓ Branch 1 taken 12084702 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 29557844 times.
✓ Branch 4 taken 12084702 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 11400222 times.
✗ Branch 8 not taken.
152535996 volumeVariables_[localIdx].update(elementSolution(elementJ, sol, gridGeometry),
310 problem,
311 elementJ,
312 scvJ);
313 152523720 volVarIndices_[localIdx] = scvJ.dofIndex();
314 76261860 ++localIdx;
315 }
316
317
4/4
✓ Branch 0 taken 3275119 times.
✓ Branch 1 taken 19685983 times.
✓ Branch 2 taken 744708 times.
✓ Branch 3 taken 5626682 times.
31368057 if (fvGeometry.hasBoundaryScvf())
318 {
319 // Update boundary volume variables
320
6/6
✓ Branch 0 taken 13561937 times.
✓ Branch 1 taken 3275119 times.
✓ Branch 2 taken 13561937 times.
✓ Branch 3 taken 3275119 times.
✓ Branch 4 taken 2198428 times.
✓ Branch 5 taken 756676 times.
20925779 for (auto&& scvf : scvfs(fvGeometry))
321 {
322 // if we are not on a boundary, skip to the next scvf
323
2/2
✓ Branch 0 taken 8391266 times.
✓ Branch 1 taken 5170671 times.
14086773 if (!scvf.boundary())
324 8760150 continue;
325
326 // check if boundary is a pure dirichlet boundary
327
2/2
✓ Branch 0 taken 2935761 times.
✓ Branch 1 taken 75079 times.
5326623 const auto bcTypes = problem.boundaryTypes(element, scvf);
328
4/4
✓ Branch 0 taken 605847 times.
✓ Branch 1 taken 4564824 times.
✓ Branch 2 taken 605847 times.
✓ Branch 3 taken 4564824 times.
10653246 if (bcTypes.hasOnlyDirichlet())
329 {
330
2/2
✓ Branch 0 taken 6259 times.
✓ Branch 1 taken 21587 times.
1169782 const auto dirichletPriVars = elementSolution<FVElementGeometry>(problem.dirichlet(element, scvf));
331
332 658500 volumeVariables_.resize(localIdx+1);
333 658500 volVarIndices_.resize(localIdx+1);
334 1317000 volumeVariables_[localIdx].update(dirichletPriVars,
335 problem,
336 element,
337 scvI);
338 1317000 volVarIndices_[localIdx] = scvf.outsideScvIdx();
339 658500 ++localIdx;
340 }
341 }
342 }
343
344 //! Check if user added additional DOF dependencies, i.e. the residual of DOF globalI depends
345 //! on additional DOFs not included in the discretization schemes' occupation pattern
346 // const auto& additionalDofDependencies = problem.getAdditionalDofDependencies(globalI);
347 // if (!additionalDofDependencies.empty())
348 // {
349 // volumeVariables_.resize(volumeVariables_.size() + additionalDofDependencies.size());
350 // volVarIndices_.resize(volVarIndices_.size() + additionalDofDependencies.size());
351 // for (auto globalJ : additionalDofDependencies)
352 // {
353 // const auto& elementJ = gridGeometry.element(globalJ);
354 // auto&& scvJ = fvGeometry.scv(globalJ);
355
356 // volumeVariables_[localIdx].update(elementSolution(elementJ, sol, gridGeometry),
357 // problem,
358 // elementJ,
359 // scvJ);
360 // volVarIndices_[localIdx] = scvJ.dofIndex();
361 // ++localIdx;
362 // }
363 // }
364 24996667 }
365
366 template<class FVElementGeometry, class SolutionVector>
367 27515623 void bindElement_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
368 const FVElementGeometry& fvGeometry,
369 const SolutionVector& sol)
370 {
371
2/2
✓ Branch 0 taken 4746991 times.
✓ Branch 1 taken 20900868 times.
27515623 clear_();
372
373 55031246 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
374 27515623 volumeVariables_.resize(1);
375 27515623 volVarIndices_.resize(1);
376
377 // update the volume variables of the element
378
1/2
✓ Branch 0 taken 18180779 times.
✗ Branch 1 not taken.
27515623 auto&& scv = fvGeometry.scv(eIdx);
379 49643203 volumeVariables_[0].update(elementSolution(element, sol, fvGeometry.gridGeometry()),
380 27515623 gridVolVars().problem(),
381 element,
382 scv);
383 55031236 volVarIndices_[0] = scv.dofIndex();
384 27515618 }
385
386 const GridVolumeVariables* gridVolVarsPtr_;
387
388 //! map a global scv index to the local storage index
389 2903743295 int getLocalIdx_(const int volVarIdx) const
390 {
391 8711229885 auto it = std::find(volVarIndices_.begin(), volVarIndices_.end(), volVarIdx);
392
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 2724941162 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2724941162 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2724941162 times.
8711229885 assert(it != volVarIndices_.end() && "Could not find the current volume variables for volVarIdx!");
393 8711229885 return std::distance(volVarIndices_.begin(), it);
394 }
395
396 std::vector<std::size_t> volVarIndices_;
397 std::vector<VolumeVariables> volumeVariables_;
398 };
399
400 } // end namespace Dumux
401
402 #endif
403