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 flux variables caches for an element | ||
11 | */ | ||
12 | #ifndef DUMUX_DISCRETIZATION_CCTPFA_ELEMENT_FLUXVARSCACHE_HH | ||
13 | #define DUMUX_DISCRETIZATION_CCTPFA_ELEMENT_FLUXVARSCACHE_HH | ||
14 | |||
15 | #include <algorithm> | ||
16 | #include <cassert> | ||
17 | #include <vector> | ||
18 | #include <utility> | ||
19 | |||
20 | #include <dune/common/exceptions.hh> | ||
21 | |||
22 | namespace Dumux { | ||
23 | |||
24 | /*! | ||
25 | * \ingroup CCTpfaDiscretization | ||
26 | * \brief The flux variables caches for an element | ||
27 | * \note The class is specialized for a version with and without caching | ||
28 | * If grid caching is enabled the flux caches are stored for the whole gridview in the corresponding | ||
29 | * GridFluxVariablesCache which is memory intensive but faster. For caching disabled the | ||
30 | * flux caches are locally computed for each element whenever needed. | ||
31 | */ | ||
32 | template<class GFVC, bool cachingEnabled> | ||
33 | class CCTpfaElementFluxVariablesCache; | ||
34 | |||
35 | /*! | ||
36 | * \ingroup CCTpfaDiscretization | ||
37 | * \brief The flux variables caches for an element with caching enabled | ||
38 | */ | ||
39 | template<class GFVC> | ||
40 | class CCTpfaElementFluxVariablesCache<GFVC, true> | ||
41 | { | ||
42 | //! the type of the flux variables cache filler | ||
43 | using FluxVariablesCacheFiller = typename GFVC::Traits::FluxVariablesCacheFiller; | ||
44 | |||
45 | public: | ||
46 | //! export the type of the grid flux variables cache | ||
47 | using GridFluxVariablesCache = GFVC; | ||
48 | |||
49 | //! export the type of the flux variables cache | ||
50 | using FluxVariablesCache = typename GFVC::FluxVariablesCache; | ||
51 | |||
52 | CCTpfaElementFluxVariablesCache(const GridFluxVariablesCache& global) | ||
53 | : gridFluxVarsCachePtr_(&global) {} | ||
54 | |||
55 | /*! | ||
56 | * \brief bind the local view (r-value overload) | ||
57 | * This overload is called when an instance of this class is a temporary in the usage context | ||
58 | * This allows a usage like this: `const auto view = localView(...).bind(element);` | ||
59 | */ | ||
60 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
61 | CCTpfaElementFluxVariablesCache bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | ||
62 | const FVElementGeometry& fvGeometry, | ||
63 | const ElementVolumeVariables& elemVolVars) && | ||
64 | { | ||
65 | this->bindElement(element, fvGeometry, elemVolVars); | ||
66 | return std::move(*this); | ||
67 | } | ||
68 | |||
69 | //! Specialization for the global caching being enabled - do nothing here | ||
70 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
71 | ✗ | void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
72 | const FVElementGeometry& fvGeometry, | ||
73 | ✗ | const ElementVolumeVariables& elemVolVars) & {} | |
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 ElementVolumeVariables> | ||
81 | ✗ | CCTpfaElementFluxVariablesCache bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
82 | const FVElementGeometry& fvGeometry, | ||
83 | const ElementVolumeVariables& elemVolVars) && | ||
84 | { | ||
85 | 1165814 | this->bind(element, fvGeometry, elemVolVars); | |
86 | 1165814 | return std::move(*this); | |
87 | } | ||
88 | |||
89 | //! Specialization for the global caching being enabled - do nothing here | ||
90 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
91 | ✗ | void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
92 | const FVElementGeometry& fvGeometry, | ||
93 | ✗ | const ElementVolumeVariables& elemVolVars) & {} | |
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 ElementVolumeVariables> | ||
101 | CCTpfaElementFluxVariablesCache bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | ||
102 | const FVElementGeometry& fvGeometry, | ||
103 | const ElementVolumeVariables& elemVolVars, | ||
104 | const typename FVElementGeometry::SubControlVolumeFace& scvf) && | ||
105 | { | ||
106 | this->bindScvf(element, fvGeometry, elemVolVars, scvf); | ||
107 | return std::move(*this); | ||
108 | } | ||
109 | |||
110 | //! Specialization for the global caching being enabled - do nothing here | ||
111 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
112 | void bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | ||
113 | const FVElementGeometry& fvGeometry, | ||
114 | const ElementVolumeVariables& elemVolVars, | ||
115 | const typename FVElementGeometry::SubControlVolumeFace& scvf) & {} | ||
116 | |||
117 | //! Specialization for the global caching being enabled - do nothing here | ||
118 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
119 | ✗ | void update(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
120 | const FVElementGeometry& fvGeometry, | ||
121 | ✗ | const ElementVolumeVariables& elemVolVars) {} | |
122 | |||
123 | //! access operators in the case of caching | ||
124 | template<class SubControlVolumeFace> | ||
125 | const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const | ||
126 |
3/6✓ Branch 0 taken 9056254 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20950878 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 11894624 times.
✗ Branch 5 not taken.
|
615856184 | { return gridFluxVarsCache()[scvf]; } |
127 | |||
128 | //! The global object we are a restriction of | ||
129 | ✗ | const GridFluxVariablesCache& gridFluxVarsCache() const | |
130 | ✗ | { return *gridFluxVarsCachePtr_; } | |
131 | |||
132 | private: | ||
133 | const GridFluxVariablesCache* gridFluxVarsCachePtr_; | ||
134 | }; | ||
135 | |||
136 | /*! | ||
137 | * \ingroup CCTpfaDiscretization | ||
138 | * \brief The flux variables caches for an element with caching disabled | ||
139 | */ | ||
140 | template<class GFVC> | ||
141 | 2150604 | class CCTpfaElementFluxVariablesCache<GFVC, false> | |
142 | { | ||
143 | //! the type of the flux variables cache filler | ||
144 | using FluxVariablesCacheFiller = typename GFVC::Traits::FluxVariablesCacheFiller; | ||
145 | |||
146 | public: | ||
147 | //! export the type of the grid flux variables cache | ||
148 | using GridFluxVariablesCache = GFVC; | ||
149 | |||
150 | //! export the type of the flux variables cache | ||
151 | using FluxVariablesCache = typename GFVC::FluxVariablesCache; | ||
152 | |||
153 | CCTpfaElementFluxVariablesCache(const GridFluxVariablesCache& global) | ||
154 |
36/72✓ Branch 1 taken 519886 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 519886 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 519886 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 21449353 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 21449353 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 21449353 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 318056 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 318056 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 318056 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 253913 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 253913 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 253913 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 270148 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 270148 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 270148 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 312 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 312 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 312 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 6048 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 6048 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 6048 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 55781 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 55781 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 55781 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 50000 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 50000 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 50000 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 964000 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 964000 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 964000 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 100 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 100 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 100 times.
✗ Branch 98 not taken.
✓ Branch 103 taken 1 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 1 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 1 times.
✗ Branch 110 not taken.
|
71662800 | : gridFluxVarsCachePtr_(&global) {} |
155 | |||
156 | /*! | ||
157 | * \brief bind the local view (r-value overload) | ||
158 | * This overload is called when an instance of this class is a temporary in the usage context | ||
159 | * This allows a usage like this: `const auto view = localView(...).bind(element);` | ||
160 | */ | ||
161 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
162 | CCTpfaElementFluxVariablesCache bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | ||
163 | const FVElementGeometry& fvGeometry, | ||
164 | const ElementVolumeVariables& elemVolVars) && | ||
165 | { | ||
166 | this->bindElement_(element, fvGeometry, elemVolVars); | ||
167 | return std::move(*this); | ||
168 | } | ||
169 | |||
170 | //! Specialization for the global caching being enabled - do nothing here | ||
171 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
172 | void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | ||
173 | const FVElementGeometry& fvGeometry, | ||
174 | const ElementVolumeVariables& elemVolVars) & | ||
175 | ✗ | { this->bindElement_(element, fvGeometry, elemVolVars); } | |
176 | |||
177 | /*! | ||
178 | * \brief bind the local view (r-value overload) | ||
179 | * This overload is called when an instance of this class is a temporary in the usage context | ||
180 | * This allows a usage like this: `const auto view = localView(...).bind(element);` | ||
181 | */ | ||
182 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
183 | 795204 | CCTpfaElementFluxVariablesCache bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
184 | const FVElementGeometry& fvGeometry, | ||
185 | const ElementVolumeVariables& elemVolVars) && | ||
186 | { | ||
187 | 795204 | this->bind_(element, fvGeometry, elemVolVars); | |
188 | 1590408 | return std::move(*this); | |
189 | } | ||
190 | |||
191 | //! Specialization for the global caching being enabled - do nothing here | ||
192 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
193 | void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | ||
194 | const FVElementGeometry& fvGeometry, | ||
195 | const ElementVolumeVariables& elemVolVars) & | ||
196 |
5/8✓ Branch 1 taken 40000 times.
✓ Branch 2 taken 36914 times.
✓ Branch 3 taken 76900 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 100 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1928 times.
✗ Branch 9 not taken.
|
23381237 | { this->bind_(element, fvGeometry, elemVolVars); } |
197 | |||
198 | /*! | ||
199 | * \brief bind the local view (r-value overload) | ||
200 | * This overload is called when an instance of this class is a temporary in the usage context | ||
201 | * This allows a usage like this: `const auto view = localView(...).bind(element);` | ||
202 | */ | ||
203 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
204 | CCTpfaElementFluxVariablesCache bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | ||
205 | const FVElementGeometry& fvGeometry, | ||
206 | const ElementVolumeVariables& elemVolVars, | ||
207 | const typename FVElementGeometry::SubControlVolumeFace& scvf) && | ||
208 | { | ||
209 | this->bindScvf_(element, fvGeometry, elemVolVars, scvf); | ||
210 | return std::move(*this); | ||
211 | } | ||
212 | |||
213 | //! Specialization for the global caching being enabled - do nothing here | ||
214 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
215 | void bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | ||
216 | const FVElementGeometry& fvGeometry, | ||
217 | const ElementVolumeVariables& elemVolVars, | ||
218 | const typename FVElementGeometry::SubControlVolumeFace& scvf) & | ||
219 | { this->bindScvf_(element, fvGeometry, elemVolVars, scvf); } | ||
220 | |||
221 | /*! | ||
222 | * \brief Update the transmissibilities if the volume variables have changed | ||
223 | * \note Results in undefined behaviour if called before bind() or with a different element | ||
224 | */ | ||
225 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
226 | 16873375 | void update(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
227 | const FVElementGeometry& fvGeometry, | ||
228 | const ElementVolumeVariables& elemVolVars) | ||
229 | { | ||
230 | if (FluxVariablesCacheFiller::isSolDependent) | ||
231 | { | ||
232 | 16873375 | const auto& problem = gridFluxVarsCache().problem(); | |
233 | 33746750 | const auto globalI = fvGeometry.gridGeometry().elementMapper().index(element); | |
234 | |||
235 | // instantiate filler class | ||
236 | 16873375 | FluxVariablesCacheFiller filler(problem); | |
237 | |||
238 | // let the filler class update the caches | ||
239 |
4/4✓ Branch 0 taken 119304338 times.
✓ Branch 1 taken 15632362 times.
✓ Branch 2 taken 119304338 times.
✓ Branch 3 taken 15632362 times.
|
213959809 | for (unsigned int localScvfIdx = 0; localScvfIdx < fluxVarsCache_.size(); ++localScvfIdx) |
240 | { | ||
241 |
4/4✓ Branch 0 taken 9450880 times.
✓ Branch 1 taken 9289600 times.
✓ Branch 2 taken 9450880 times.
✓ Branch 3 taken 9289600 times.
|
257926792 | const auto& scvf = fvGeometry.scvf(globalScvfIndices_[localScvfIdx]); |
242 | |||
243 |
2/2✓ Branch 0 taken 62643192 times.
✓ Branch 1 taken 56661146 times.
|
128963396 | const auto scvfInsideScvIdx = scvf.insideScvIdx(); |
244 |
2/2✓ Branch 0 taken 62643192 times.
✓ Branch 1 taken 56661146 times.
|
197086434 | const auto& insideElement = scvfInsideScvIdx == globalI ? |
245 | element : | ||
246 | 61405216 | fvGeometry.gridGeometry().element(scvfInsideScvIdx); | |
247 | |||
248 |
2/4✓ Branch 1 taken 6748246 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6748246 times.
✗ Branch 5 not taken.
|
257926792 | filler.fill(*this, fluxVarsCache_[localScvfIdx], insideElement, fvGeometry, elemVolVars, scvf); |
249 | } | ||
250 | } | ||
251 | 16873375 | } | |
252 | |||
253 | //! access operators in the case of no caching | ||
254 | template<class SubControlVolumeFace> | ||
255 | const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const | ||
256 |
39/39✓ Branch 1 taken 74888106 times.
✓ Branch 2 taken 33182272 times.
✓ Branch 3 taken 78790362 times.
✓ Branch 4 taken 39449359 times.
✓ Branch 5 taken 14019804 times.
✓ Branch 6 taken 13360556 times.
✓ Branch 7 taken 13031273 times.
✓ Branch 8 taken 50427818 times.
✓ Branch 9 taken 46358245 times.
✓ Branch 10 taken 43695541 times.
✓ Branch 11 taken 43444520 times.
✓ Branch 12 taken 361192 times.
✓ Branch 13 taken 2964 times.
✓ Branch 14 taken 3016 times.
✓ Branch 15 taken 45664 times.
✓ Branch 16 taken 3016 times.
✓ Branch 17 taken 45588 times.
✓ Branch 18 taken 7084 times.
✓ Branch 19 taken 614600 times.
✓ Branch 20 taken 1218412 times.
✓ Branch 21 taken 1211329 times.
✓ Branch 22 taken 1230480 times.
✓ Branch 23 taken 600576 times.
✓ Branch 24 taken 24768 times.
✓ Branch 25 taken 6576 times.
✓ Branch 26 taken 24263 times.
✓ Branch 27 taken 5618 times.
✓ Branch 28 taken 30598 times.
✓ Branch 29 taken 5617 times.
✓ Branch 30 taken 11951 times.
✓ Branch 31 taken 5616 times.
✓ Branch 32 taken 1 times.
✓ Branch 33 taken 36287 times.
✓ Branch 34 taken 1 times.
✓ Branch 35 taken 36287 times.
✓ Branch 36 taken 1 times.
✓ Branch 37 taken 36287 times.
✓ Branch 38 taken 1 times.
✓ Branch 39 taken 36287 times.
|
516583359 | { return fluxVarsCache_[getLocalScvfIdx_(scvf.index())]; } |
257 | |||
258 | //! access operators in the case of no caching | ||
259 | template<class SubControlVolumeFace> | ||
260 | FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) | ||
261 | { return fluxVarsCache_[getLocalScvfIdx_(scvf.index())]; } | ||
262 | |||
263 | //! The global object we are a restriction of | ||
264 | ✗ | const GridFluxVariablesCache& gridFluxVarsCache() const | |
265 | ✗ | { return *gridFluxVarsCachePtr_; } | |
266 | |||
267 | private: | ||
268 | |||
269 | /*! | ||
270 | * \brief Prepares the transmissibilities of the scv faces in an element | ||
271 | * \note the fvGeometry is assumed to be bound to the same element | ||
272 | * \note this function has to be called prior to flux calculations on the element. | ||
273 | */ | ||
274 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
275 | ✗ | void bindElement_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
276 | const FVElementGeometry& fvGeometry, | ||
277 | const ElementVolumeVariables& elemVolVars) | ||
278 | { | ||
279 | // resizing of the cache | ||
280 | ✗ | const auto numScvf = fvGeometry.numScvf(); | |
281 | ✗ | fluxVarsCache_.resize(numScvf); | |
282 | ✗ | globalScvfIndices_.resize(numScvf); | |
283 | |||
284 | // instantiate helper class to fill the caches | ||
285 | ✗ | FluxVariablesCacheFiller filler(gridFluxVarsCache().problem()); | |
286 | |||
287 | ✗ | std::size_t localScvfIdx = 0; | |
288 | // fill the containers | ||
289 | ✗ | for (auto&& scvf : scvfs(fvGeometry)) | |
290 | { | ||
291 | ✗ | filler.fill(*this, fluxVarsCache_[localScvfIdx], element, fvGeometry, elemVolVars, scvf, true); | |
292 | ✗ | globalScvfIndices_[localScvfIdx] = scvf.index(); | |
293 | ✗ | localScvfIdx++; | |
294 | } | ||
295 | ✗ | } | |
296 | |||
297 | /*! | ||
298 | * \brief Prepares the transmissibilities of the scv faces in the stencil of an element | ||
299 | * \note the fvGeometry is assumed to be bound to the same element | ||
300 | * \note this function has to be called prior to flux calculations on the element. | ||
301 | */ | ||
302 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
303 | 26078747 | void bind_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
304 | const FVElementGeometry& fvGeometry, | ||
305 | const ElementVolumeVariables& elemVolVars) | ||
306 | { | ||
307 | 26078747 | const auto& problem = gridFluxVarsCache().problem(); | |
308 | 26078747 | const auto& gridGeometry = fvGeometry.gridGeometry(); | |
309 | 52157494 | const auto globalI = gridGeometry.elementMapper().index(element); | |
310 | 52157494 | const auto& connectivityMapI = gridGeometry.connectivityMap()[globalI]; | |
311 | 26078747 | const auto numNeighbors = connectivityMapI.size(); | |
312 | |||
313 | // instantiate helper class to fill the caches | ||
314 | 26078747 | FluxVariablesCacheFiller filler(problem); | |
315 | |||
316 | // find the number of scv faces that need to be prepared | ||
317 | 26078747 | auto numScvf = fvGeometry.numScvf(); | |
318 |
2/2✓ Branch 0 taken 73313252 times.
✓ Branch 1 taken 24043182 times.
|
106167221 | for (unsigned int localIdxJ = 0; localIdxJ < numNeighbors; ++localIdxJ) |
319 | 160176948 | numScvf += connectivityMapI[localIdxJ].scvfsJ.size(); | |
320 | |||
321 | // fill the containers with the data on the scv faces inside the actual element | ||
322 | 26078747 | fluxVarsCache_.resize(numScvf); | |
323 | 26078747 | globalScvfIndices_.resize(numScvf); | |
324 | 26078747 | unsigned int localScvfIdx = 0; | |
325 |
4/4✓ Branch 0 taken 78147159 times.
✓ Branch 1 taken 24043182 times.
✓ Branch 2 taken 78147159 times.
✓ Branch 3 taken 24043182 times.
|
195890286 | for (auto&& scvf : scvfs(fvGeometry)) |
326 | { | ||
327 | 137220504 | filler.fill(*this, fluxVarsCache_[localScvfIdx], element, fvGeometry, elemVolVars, scvf, true); | |
328 | 85054021 | globalScvfIndices_[localScvfIdx] = scvf.index(); | |
329 | 85054021 | localScvfIdx++; | |
330 | } | ||
331 | |||
332 | // add required data on the scv faces in the neighboring elements | ||
333 |
2/2✓ Branch 0 taken 73313252 times.
✓ Branch 1 taken 24043182 times.
|
106167221 | for (unsigned int localIdxJ = 0; localIdxJ < numNeighbors; ++localIdxJ) |
334 | { | ||
335 | 179788856 | const auto elementJ = gridGeometry.element(connectivityMapI[localIdxJ].globalJ); | |
336 |
2/2✓ Branch 0 taken 73313252 times.
✓ Branch 1 taken 73313252 times.
|
399970798 | for (auto scvfIdx : connectivityMapI[localIdxJ].scvfsJ) |
337 | { | ||
338 | 80088474 | auto&& scvfJ = fvGeometry.scvf(scvfIdx); | |
339 |
2/4✓ Branch 1 taken 1110480 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1110480 times.
✗ Branch 5 not taken.
|
128197220 | filler.fill(*this, fluxVarsCache_[localScvfIdx], elementJ, fvGeometry, elemVolVars, scvfJ, true); |
340 | 80088474 | globalScvfIndices_[localScvfIdx] = scvfJ.index(); | |
341 | 80088474 | localScvfIdx++; | |
342 | } | ||
343 | } | ||
344 | 26078747 | } | |
345 | |||
346 | /*! | ||
347 | * \brief Prepares the transmissibilities of a single scv face | ||
348 | * \note the fvGeometry is assumed to be bound to the same element | ||
349 | * \note this function has to be called prior to flux calculations on the element. | ||
350 | */ | ||
351 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
352 | void bindScvf_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | ||
353 | const FVElementGeometry& fvGeometry, | ||
354 | const ElementVolumeVariables& elemVolVars, | ||
355 | const typename FVElementGeometry::SubControlVolumeFace& scvf) | ||
356 | { | ||
357 | fluxVarsCache_.resize(1); | ||
358 | globalScvfIndices_.resize(1); | ||
359 | |||
360 | // instantiate helper class to fill the caches | ||
361 | FluxVariablesCacheFiller filler(gridFluxVarsCache().problem()); | ||
362 | |||
363 | filler.fill(*this, fluxVarsCache_[0], element, fvGeometry, elemVolVars, scvf, true); | ||
364 | globalScvfIndices_[0] = scvf.index(); | ||
365 | } | ||
366 | |||
367 | const GridFluxVariablesCache* gridFluxVarsCachePtr_; | ||
368 | |||
369 | //! get index of scvf in the local container | ||
370 | 516885759 | int getLocalScvfIdx_(const int scvfIdx) const | |
371 | { | ||
372 | 1550657277 | auto it = std::find(globalScvfIndices_.begin(), globalScvfIndices_.end(), scvfIdx); | |
373 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 491525998 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 491525998 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 491525998 times.
|
1550657277 | assert(it != globalScvfIndices_.end() && "Could not find the flux vars cache for scvfIdx"); |
374 | 1550657277 | return std::distance(globalScvfIndices_.begin(), it); | |
375 | } | ||
376 | |||
377 | std::vector<FluxVariablesCache> fluxVarsCache_; | ||
378 | std::vector<std::size_t> globalScvfIndices_; | ||
379 | }; | ||
380 | |||
381 | } // end namespace Dumux | ||
382 | |||
383 | #endif | ||
384 |