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-FileCopyrightText: 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 |
5/10✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 13 taken 3 times.
✗ Branch 14 not taken.
✓ Branch 32 taken 1768 times.
✗ Branch 33 not taken.
✓ Branch 5 taken 64 times.
✗ Branch 6 not taken.
|
14472519 | 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 | 49556914 | CCTpfaElementVolumeVariables(const GridVolumeVariables& gridVolVars) | |
52 | 49556914 | : gridVolVarsPtr_(&gridVolVars) | |
53 |
18/23✓ Branch 2 taken 1233893 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 173500 times.
✓ Branch 7 taken 7889566 times.
✓ Branch 9 taken 800000 times.
✓ Branch 10 taken 825410 times.
✓ Branch 12 taken 3470 times.
✓ Branch 13 taken 339078 times.
✓ Branch 15 taken 1735 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 1744 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 8000 times.
✗ Branch 22 not taken.
✓ Branch 25 taken 101 times.
✗ Branch 26 not taken.
✓ Branch 1 taken 180586 times.
✓ Branch 4 taken 9262955 times.
✓ Branch 5 taken 2951661 times.
✓ Branch 8 taken 19456326 times.
✓ Branch 11 taken 6717 times.
✓ Branch 14 taken 937786 times.
✓ Branch 17 taken 15642 times.
|
49556914 | , 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 |
1/2✓ Branch 0 taken 1948523713 times.
✗ Branch 1 not taken.
|
2435101818 | const VolumeVariables& operator [](const SubControlVolume& scv) const |
59 | { | ||
60 |
1/2✓ Branch 0 taken 1948523713 times.
✗ Branch 1 not taken.
|
2435101818 | if (scv.dofIndex() < numScv_) |
61 | 2435101818 | return gridVolVars().volVars(scv.dofIndex()); | |
62 | else | ||
63 | ✗ | return boundaryVolumeVariables_[getLocalIdx_(scv.dofIndex())]; | |
64 | } | ||
65 | |||
66 | //! operator for the access with an index | ||
67 | 3783404454 | const VolumeVariables& operator [](const std::size_t scvIdx) const | |
68 | { | ||
69 |
2/2✓ Branch 0 taken 2808254299 times.
✓ Branch 1 taken 1869008 times.
|
3783404454 | if (scvIdx < numScv_) |
70 | 3781304286 | return gridVolVars().volVars(scvIdx); | |
71 | else | ||
72 | 2100168 | 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 | 7151951 | CCTpfaElementVolumeVariables bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
82 | const FVElementGeometry& fvGeometry, | ||
83 | const SolutionVector& sol) && | ||
84 | { | ||
85 |
3/6✓ Branch 1 taken 5873996 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1254313 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 23642 times.
✗ Branch 10 not taken.
|
7151951 | this->bind_(element, fvGeometry, sol); |
86 | 7151951 | return std::move(*this); | |
87 | } | ||
88 | |||
89 | template<class FVElementGeometry, class SolutionVector> | ||
90 | 41144817 | 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 1294815 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 67 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 13 taken 1735 times.
✗ Branch 14 not taken.
✓ Branch 6 taken 2500 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
41144817 | { 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 | 966862 | 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 | 966862 | return std::move(*this); | |
107 | } | ||
108 | |||
109 | template<class FVElementGeometry, class SolutionVector> | ||
110 | 1028444 | void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
111 | const FVElementGeometry& fvGeometry, | ||
112 | const SolutionVector& sol) & | ||
113 | 1028444 | { this->bindElement_(element, fvGeometry, sol); } | |
114 | |||
115 | //! The global volume variables object we are a restriction of | ||
116 | 4769289671 | const GridVolumeVariables& gridVolVars() const | |
117 |
8/13✓ Branch 1 taken 32 times.
✓ Branch 2 taken 67 times.
✓ Branch 4 taken 44 times.
✓ Branch 5 taken 11 times.
✓ Branch 7 taken 7 times.
✓ Branch 8 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
|
4760888854 | { return *gridVolVarsPtr_; } |
118 | |||
119 | private: | ||
120 | |||
121 | //! Clear all local storage | ||
122 | 7698703 | void clear_() | |
123 | { | ||
124 |
5/6✓ Branch 0 taken 11635 times.
✓ Branch 1 taken 1977311 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5709253 times.
✓ Branch 4 taken 125 times.
✓ Branch 5 taken 379 times.
|
7698703 | boundaryVolVarIndices_.clear(); |
125 |
5/6✓ Branch 0 taken 11635 times.
✓ Branch 1 taken 1977311 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5709253 times.
✓ Branch 4 taken 125 times.
✓ Branch 5 taken 379 times.
|
7698703 | boundaryVolumeVariables_.clear(); |
126 | 199384 | } | |
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 |
2/2✓ Branch 0 taken 7698703 times.
✓ Branch 1 taken 40598065 times.
|
75137404 | void bind_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, |
131 | const FVElementGeometry& fvGeometry, | ||
132 | const SolutionVector& sol) | ||
133 | { | ||
134 |
2/2✓ Branch 0 taken 7698703 times.
✓ Branch 1 taken 40598065 times.
|
75137404 | if (!fvGeometry.hasBoundaryScvf()) |
135 | return; | ||
136 | |||
137 | 13721022 | clear_(); | |
138 | 13721022 | boundaryVolVarIndices_.reserve(fvGeometry.numScvf()); | |
139 | 13721022 | boundaryVolumeVariables_.reserve(fvGeometry.numScvf()); | |
140 | |||
141 |
4/4✓ Branch 0 taken 33610356 times.
✓ Branch 1 taken 8400817 times.
✓ Branch 2 taken 42011173 times.
✓ Branch 3 taken 7698703 times.
|
91093152 | for (const auto& scvf : scvfs(fvGeometry)) |
142 | { | ||
143 | 62327472 | if (!scvf.boundary()) | |
144 | 62327472 | continue; | |
145 | |||
146 | // check if boundary is a pure dirichlet boundary | ||
147 |
2/3✓ Branch 0 taken 326098 times.
✓ Branch 1 taken 8026621 times.
✗ Branch 2 not taken.
|
15044658 | const auto& problem = gridVolVars().problem(); |
148 |
4/4✓ Branch 0 taken 326098 times.
✓ Branch 1 taken 8033095 times.
✓ Branch 2 taken 46336 times.
✓ Branch 3 taken 101205 times.
|
15211809 | const auto bcTypes = problem.boundaryTypes(element, scvf); |
149 |
2/2✓ Branch 0 taken 264632 times.
✓ Branch 1 taken 8136185 times.
|
15044658 | if (bcTypes.hasOnlyDirichlet()) |
150 | { | ||
151 |
5/6✓ Branch 0 taken 59 times.
✓ Branch 1 taken 200133 times.
✓ Branch 3 taken 183 times.
✓ Branch 4 taken 131776 times.
✓ Branch 2 taken 64440 times.
✗ Branch 5 not taken.
|
396113 | const auto dirichletPriVars = elementSolution<FVElementGeometry>(problem.dirichlet(element, scvf)); |
152 |
1/2✓ Branch 1 taken 264632 times.
✗ Branch 2 not taken.
|
380515 | auto&& scvI = fvGeometry.scv(scvf.insideScvIdx()); |
153 | |||
154 |
1/2✓ Branch 1 taken 9083 times.
✗ Branch 2 not taken.
|
380515 | VolumeVariables volVars; |
155 |
1/2✓ Branch 1 taken 255549 times.
✗ Branch 2 not taken.
|
380515 | volVars.update(dirichletPriVars, |
156 | problem, | ||
157 | element, | ||
158 | scvI); | ||
159 | |||
160 |
1/2✓ Branch 1 taken 264632 times.
✗ Branch 2 not taken.
|
380515 | boundaryVolumeVariables_.emplace_back(std::move(volVars)); |
161 |
1/2✓ Branch 1 taken 264632 times.
✗ Branch 2 not taken.
|
380515 | 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 | 1869008 | int getLocalIdx_(const int volVarIdx) const | |
177 | { | ||
178 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1637848 times.
|
1869008 | auto it = std::find(boundaryVolVarIndices_.begin(), boundaryVolVarIndices_.end(), volVarIdx); |
179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1637848 times.
|
1869008 | assert(it != boundaryVolVarIndices_.end() && "Could not find the current volume variables for volVarIdx!"); |
180 | 1869008 | 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 |
4/8✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 12 taken 1685 times.
✗ Branch 13 not taken.
✓ Branch 17 taken 264 times.
✗ Branch 18 not taken.
✓ Branch 28 taken 12 times.
✗ Branch 29 not taken.
|
264732 | 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 | 21893790 | CCTpfaElementVolumeVariables(const GridVolumeVariables& gridVolVars) | |
204 |
19/26✓ Branch 1 taken 1859 times.
✓ Branch 2 taken 50421 times.
✓ Branch 5 taken 5084 times.
✓ Branch 6 taken 50264 times.
✓ Branch 9 taken 312 times.
✓ Branch 10 taken 200804 times.
✓ Branch 12 taken 312 times.
✓ Branch 13 taken 50 times.
✓ Branch 15 taken 6048 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 55781 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 50000 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 964000 times.
✗ Branch 25 not taken.
✓ Branch 27 taken 100 times.
✗ Branch 28 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 4 taken 19805055 times.
✓ Branch 7 taken 385488 times.
✓ Branch 8 taken 5073 times.
✓ Branch 11 taken 312738 times.
✓ Branch 3 taken 300 times.
✗ Branch 14 not taken.
|
21893790 | : 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 | 55749 | CCTpfaElementVolumeVariables bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
213 | const FVElementGeometry& fvGeometry, | ||
214 | const SolutionVector& sol) && | ||
215 | { | ||
216 |
3/6✓ Branch 1 taken 5637 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 50012 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 100 times.
✗ Branch 10 not taken.
|
55749 | this->bind_(element, fvGeometry, sol); |
217 | 55749 | return std::move(*this); | |
218 | } | ||
219 | |||
220 | template<class FVElementGeometry, class SolutionVector> | ||
221 | 22992013 | 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 562286 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 87340 times.
✓ Branch 5 taken 36914 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ 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.
✗ Branch 6 not taken.
✓ Branch 9 taken 76900 times.
|
22992013 | { 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 |
2/4✓ Branch 1 taken 5036 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1280 times.
✗ Branch 6 not taken.
|
6316 | this->bindElement_(element, fvGeometry, sol); |
237 | 6316 | return std::move(*this); | |
238 | } | ||
239 | |||
240 | template<class FVElementGeometry, class SolutionVector> | ||
241 | 25754539 | 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 1016266 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 26345 times.
✓ Branch 5 taken 3498272 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1100 times.
✓ Branch 6 taken 5 times.
✓ Branch 8 taken 7756 times.
✓ Branch 7 taken 21216 times.
✗ Branch 11 not taken.
|
25754539 | { 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 | 64688360 | const VolumeVariables& operator [](const SubControlVolume& scv) const | |
249 |
24/31✓ Branch 11 taken 8192508 times.
✓ Branch 12 taken 118388 times.
✓ Branch 16 taken 345104 times.
✓ Branch 17 taken 269844 times.
✓ Branch 19 taken 408 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 456 times.
✗ Branch 23 not taken.
✓ Branch 7 taken 8463640 times.
✓ Branch 8 taken 826603 times.
✓ Branch 9 taken 10389 times.
✓ Branch 10 taken 635788 times.
✓ Branch 13 taken 100 times.
✓ Branch 14 taken 35360 times.
✓ Branch 15 taken 11568 times.
✓ Branch 18 taken 48544 times.
✓ Branch 21 taken 51168 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 11562 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 964000 times.
✓ Branch 32 taken 150000 times.
✗ Branch 33 not taken.
✓ Branch 36 taken 2892000 times.
✗ Branch 37 not taken.
✓ Branch 6 taken 400 times.
✗ Branch 5 not taken.
✓ Branch 3 taken 1512 times.
✓ Branch 4 taken 10584 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 4079 times.
|
355604933 | { 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 | 22399101 | VolumeVariables& operator [](const SubControlVolume& scv) | |
254 |
5/7✓ Branch 3 taken 1672750 times.
✓ Branch 4 taken 28288 times.
✓ Branch 5 taken 308029 times.
✓ Branch 2 taken 19520 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1254177 times.
✗ Branch 8 not taken.
|
22399101 | { return volumeVariables_[getLocalIdx_(scv.dofIndex())]; } |
255 | |||
256 | //! access operator with scv index | ||
257 | 712849931 | const VolumeVariables& operator [](std::size_t scvIdx) const | |
258 |
87/96✓ Branch 2 taken 17163542 times.
✓ Branch 3 taken 13839053 times.
✓ Branch 5 taken 11751624 times.
✓ Branch 6 taken 8229774 times.
✓ Branch 8 taken 53837814 times.
✓ Branch 9 taken 36312912 times.
✓ Branch 11 taken 54657594 times.
✓ Branch 12 taken 27404058 times.
✓ Branch 15 taken 16590578 times.
✓ Branch 16 taken 32795552 times.
✓ Branch 18 taken 7638525 times.
✓ Branch 19 taken 79483622 times.
✓ Branch 10 taken 43983805 times.
✓ Branch 13 taken 60535508 times.
✓ Branch 14 taken 5291404 times.
✓ Branch 17 taken 23861292 times.
✓ Branch 20 taken 39204058 times.
✓ Branch 7 taken 34052534 times.
✓ Branch 22 taken 47914153 times.
✓ Branch 23 taken 15090701 times.
✓ Branch 1 taken 5718024 times.
✓ Branch 4 taken 5462304 times.
✓ Branch 21 taken 1260808 times.
✓ Branch 24 taken 29382854 times.
✓ Branch 25 taken 21724794 times.
✓ Branch 28 taken 43426596 times.
✓ Branch 29 taken 604255 times.
✓ Branch 31 taken 2254948 times.
✓ Branch 32 taken 2909100 times.
✓ Branch 26 taken 9210102 times.
✓ Branch 30 taken 47255840 times.
✓ Branch 37 taken 781945 times.
✓ Branch 38 taken 79414216 times.
✓ Branch 40 taken 881208 times.
✓ Branch 41 taken 7666839 times.
✓ Branch 45 taken 34184 times.
✓ Branch 46 taken 72 times.
✓ Branch 27 taken 52855020 times.
✓ Branch 39 taken 2168440 times.
✓ Branch 42 taken 286128 times.
✓ Branch 43 taken 169900 times.
✓ Branch 33 taken 18573022 times.
✓ Branch 35 taken 89498926 times.
✓ Branch 36 taken 98878126 times.
✓ Branch 53 taken 34094 times.
✓ Branch 54 taken 28298 times.
✓ Branch 57 taken 1080 times.
✓ Branch 58 taken 60546 times.
✓ Branch 62 taken 1762036 times.
✓ Branch 63 taken 878816 times.
✓ Branch 65 taken 34884 times.
✓ Branch 66 taken 517223 times.
✓ Branch 70 taken 2534816 times.
✓ Branch 71 taken 27972 times.
✓ Branch 34 taken 1994073 times.
✗ Branch 50 not taken.
✓ Branch 51 taken 77585 times.
✓ Branch 61 taken 65268 times.
✓ Branch 67 taken 781544 times.
✓ Branch 44 taken 33458 times.
✓ Branch 48 taken 91 times.
✓ Branch 49 taken 21411 times.
✓ Branch 59 taken 155372 times.
✓ Branch 60 taken 1278624 times.
✓ Branch 68 taken 58707 times.
✓ Branch 64 taken 117068 times.
✓ Branch 69 taken 78704 times.
✓ Branch 73 taken 962204 times.
✓ Branch 74 taken 1572612 times.
✓ Branch 76 taken 36288 times.
✓ Branch 77 taken 2534816 times.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 92 not taken.
✓ Branch 93 taken 23504 times.
✓ Branch 103 taken 151872 times.
✓ Branch 104 taken 5069632 times.
✓ Branch 108 taken 4347064 times.
✓ Branch 109 taken 3145224 times.
✓ Branch 47 taken 90 times.
✓ Branch 52 taken 10644 times.
✓ Branch 72 taken 27972 times.
✓ Branch 79 taken 36288 times.
✓ Branch 80 taken 1211328 times.
✓ Branch 82 taken 502725 times.
✓ Branch 83 taken 708603 times.
✗ Branch 85 not taken.
✓ Branch 86 taken 1211328 times.
✗ Branch 91 not taken.
✗ Branch 96 not taken.
✓ Branch 97 taken 11232 times.
✓ Branch 107 taken 72576 times.
✓ Branch 110 taken 1005450 times.
✓ Branch 111 taken 1417206 times.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
|
1733725728 | { return volumeVariables_[getLocalIdx_(scvIdx)]; } |
259 | |||
260 | //! access operator with scv index | ||
261 | 1584388 | VolumeVariables& operator [](std::size_t scvIdx) | |
262 |
2/4✗ Branch 1 not taken.
✓ Branch 2 taken 44276 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1056 times.
|
1584388 | { return volumeVariables_[getLocalIdx_(scvIdx)]; } |
263 | |||
264 | //! The global volume variables object we are a restriction of | ||
265 | 43655963 | const GridVolumeVariables& gridVolVars() const | |
266 |
8/14✓ Branch 1 taken 123 times.
✓ Branch 2 taken 4 times.
✓ Branch 4 taken 134 times.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 27 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
|
14410116 | { return *gridVolVarsPtr_; } |
267 | |||
268 | private: | ||
269 | //! Clear all local storage | ||
270 | 48808617 | void clear_() | |
271 | { | ||
272 | 97617234 | volVarIndices_.clear(); | |
273 |
15/16✓ Branch 0 taken 1075788 times.
✓ Branch 1 taken 19550610 times.
✓ Branch 2 taken 4606682 times.
✓ Branch 3 taken 20123703 times.
✓ Branch 4 taken 157168 times.
✓ Branch 5 taken 475686 times.
✓ Branch 6 taken 76849 times.
✓ Branch 7 taken 724512 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.
|
48808617 | volumeVariables_.clear(); |
274 | } | ||
275 | |||
276 | //! Prepares the volume variables within the element stencil | ||
277 | template<class FVElementGeometry, class SolutionVector> | ||
278 |
2/2✓ Branch 0 taken 1165270 times.
✓ Branch 1 taken 21882492 times.
|
25127931 | void bind_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, |
279 | const FVElementGeometry& fvGeometry, | ||
280 | const SolutionVector& sol) | ||
281 | { | ||
282 | 25127931 | clear_(); | |
283 | |||
284 | 25127931 | const auto& problem = gridVolVars().problem(); | |
285 | 25127931 | const auto& gridGeometry = fvGeometry.gridGeometry(); | |
286 | 25127931 | const auto globalI = gridGeometry.elementMapper().index(element); | |
287 | 25127931 | const auto& connectivityMapI = gridGeometry.connectivityMap()[globalI]; | |
288 | 25127931 | const auto numDofs = connectivityMapI.size() + 1; | |
289 | |||
290 | // resize local containers to the required size (for internal elements) | ||
291 | 25127931 | volumeVariables_.resize(numDofs); | |
292 | 25127931 | volVarIndices_.resize(numDofs); | |
293 |
1/2✓ Branch 0 taken 16678872 times.
✗ Branch 1 not taken.
|
25127931 | int localIdx = 0; |
294 | |||
295 | // update the volume variables of the element at hand | ||
296 | 25127931 | auto&& scvI = fvGeometry.scv(globalI); | |
297 | 25127931 | volumeVariables_[localIdx].update(elementSolution(element, sol, gridGeometry), | |
298 | problem, | ||
299 | element, | ||
300 | scvI); | ||
301 | 25127931 | volVarIndices_[localIdx] = scvI.dofIndex(); | |
302 | 25127931 | ++localIdx; | |
303 | |||
304 | // Update the volume variables of the neighboring elements | ||
305 |
2/2✓ Branch 0 taken 69837022 times.
✓ Branch 1 taken 23047762 times.
|
101910449 | for (const auto& dataJ : connectivityMapI) |
306 | { | ||
307 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 247886 times.
|
76782518 | const auto& elementJ = gridGeometry.element(dataJ.globalJ); |
308 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45337438 times.
|
76782518 | auto&& scvJ = fvGeometry.scv(dataJ.globalJ); |
309 |
2/4✓ Branch 1 taken 11037760 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 11037760 times.
✗ Branch 5 not taken.
|
76823414 | volumeVariables_[localIdx].update(elementSolution(elementJ, sol, gridGeometry), |
310 | problem, | ||
311 | elementJ, | ||
312 | scvJ); | ||
313 | 76782518 | volVarIndices_[localIdx] = scvJ.dofIndex(); | |
314 | 76782518 | ++localIdx; | |
315 | } | ||
316 | |||
317 |
2/2✓ Branch 0 taken 3276987 times.
✓ Branch 1 taken 19770775 times.
|
25127931 | if (fvGeometry.hasBoundaryScvf()) |
318 | { | ||
319 | // Update boundary volume variables | ||
320 |
4/4✓ Branch 0 taken 8405834 times.
✓ Branch 1 taken 5163031 times.
✓ Branch 2 taken 13568865 times.
✓ Branch 3 taken 3276987 times.
|
17546106 | 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 8405834 times.
✓ Branch 1 taken 5163031 times.
|
14118481 | if (!scvf.boundary()) |
324 | 8793008 | continue; | |
325 | |||
326 | // check if boundary is a pure dirichlet boundary | ||
327 |
5/5✓ Branch 0 taken 578136 times.
✓ Branch 1 taken 4584895 times.
✓ Branch 2 taken 5316 times.
✓ Branch 3 taken 8396 times.
✓ Branch 4 taken 38094 times.
|
5345662 | const auto bcTypes = problem.boundaryTypes(element, scvf); |
328 |
2/2✓ Branch 0 taken 611827 times.
✓ Branch 1 taken 4551204 times.
|
5325473 | if (bcTypes.hasOnlyDirichlet()) |
329 | { | ||
330 |
5/6✓ Branch 1 taken 577899 times.
✓ Branch 2 taken 25960 times.
✓ Branch 4 taken 44160 times.
✗ Branch 5 not taken.
✓ Branch 3 taken 31264 times.
✓ Branch 0 taken 7968 times.
|
705505 | const auto dirichletPriVars = elementSolution<FVElementGeometry>(problem.dirichlet(element, scvf)); |
331 | |||
332 |
1/2✓ Branch 1 taken 611827 times.
✗ Branch 2 not taken.
|
667784 | volumeVariables_.resize(localIdx+1); |
333 |
1/2✓ Branch 1 taken 611827 times.
✗ Branch 2 not taken.
|
667784 | volVarIndices_.resize(localIdx+1); |
334 |
1/2✓ Branch 1 taken 580659 times.
✗ Branch 2 not taken.
|
667784 | volumeVariables_[localIdx].update(dirichletPriVars, |
335 | problem, | ||
336 | element, | ||
337 | scvI); | ||
338 | 667784 | volVarIndices_[localIdx] = scvf.outsideScvIdx(); | |
339 | 667784 | ++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 | 25127931 | } | |
365 | |||
366 | template<class FVElementGeometry, class SolutionVector> | ||
367 |
2/2✓ Branch 0 taken 4778292 times.
✓ Branch 1 taken 20982563 times.
|
27672397 | void bindElement_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, |
368 | const FVElementGeometry& fvGeometry, | ||
369 | const SolutionVector& sol) | ||
370 | { | ||
371 | 27672397 | clear_(); | |
372 | |||
373 | 27672397 | const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element); | |
374 | 27672397 | volumeVariables_.resize(1); | |
375 |
1/2✓ Branch 1 taken 18296275 times.
✗ Branch 2 not taken.
|
27672397 | volVarIndices_.resize(1); |
376 | |||
377 | // update the volume variables of the element | ||
378 | 27672397 | auto&& scv = fvGeometry.scv(eIdx); | |
379 | 27672397 | volumeVariables_[0].update(elementSolution(element, sol, fvGeometry.gridGeometry()), | |
380 | 27672397 | gridVolVars().problem(), | |
381 | element, | ||
382 | scv); | ||
383 | 27672392 | volVarIndices_[0] = scv.dofIndex(); | |
384 | 27672392 | } | |
385 | |||
386 | const GridVolumeVariables* gridVolVarsPtr_; | ||
387 | |||
388 | //! map a global scv index to the local storage index | ||
389 | 2935495616 | int getLocalIdx_(const int volVarIdx) const | |
390 | { | ||
391 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2728828727 times.
|
2935495616 | auto it = std::find(volVarIndices_.begin(), volVarIndices_.end(), volVarIdx); |
392 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2728828727 times.
|
2935495616 | assert(it != volVarIndices_.end() && "Could not find the current volume variables for volVarIdx!"); |
393 | 2935495616 | 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 |