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 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 |
3/6✓ Branch 1 taken 15032219 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19619902 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 800000 times.
✗ Branch 8 not taken.
|
36765079 | 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 | this->bind(element, fvGeometry, elemVolVars); | ||
86 | 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 | 497259608 | const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const | |
126 | 137191198 | { return gridFluxVarsCache()[scvf]; } | |
127 | |||
128 | //! The global object we are a restriction of | ||
129 | 494237110 | const GridFluxVariablesCache& gridFluxVarsCache() const | |
130 |
1/2✓ Branch 1 taken 4009824 times.
✗ Branch 2 not taken.
|
489337110 | { 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 | 721120 | 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 | 23974260 | CCTpfaElementFluxVariablesCache(const GridFluxVariablesCache& global) | |
154 |
12/24✓ Branch 1 taken 522486 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 21488809 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 318882 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 254739 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 313100 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 312 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 6048 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 55781 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 50000 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 964000 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 100 times.
✗ Branch 32 not taken.
✓ Branch 35 taken 1 times.
✗ Branch 36 not taken.
|
23974260 | : 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 | 665371 | CCTpfaElementFluxVariablesCache bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
184 | const FVElementGeometry& fvGeometry, | ||
185 | const ElementVolumeVariables& elemVolVars) && | ||
186 | { | ||
187 |
7/14✓ Branch 1 taken 531286 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 78336 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 5073 times.
✗ Branch 10 not taken.
✓ Branch 13 taken 264 times.
✗ Branch 14 not taken.
✓ Branch 17 taken 312 times.
✗ Branch 18 not taken.
✓ Branch 21 taken 50000 times.
✗ Branch 22 not taken.
✓ Branch 25 taken 100 times.
✗ Branch 26 not taken.
|
665371 | this->bind_(element, fvGeometry, elemVolVars); |
188 | 665371 | return std::move(*this); | |
189 | } | ||
190 | |||
191 | //! Specialization for the global caching being enabled - do nothing here | ||
192 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
193 | 23464471 | void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
194 | const FVElementGeometry& fvGeometry, | ||
195 | const ElementVolumeVariables& elemVolVars) & | ||
196 |
5/8✓ Branch 5 taken 100 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1928 times.
✗ Branch 9 not taken.
✓ Branch 2 taken 36914 times.
✓ Branch 3 taken 76900 times.
✗ Branch 4 not taken.
✓ Branch 1 taken 40000 times.
|
23464471 | { 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 | 17327737 | 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 | 17327737 | const auto& problem = gridFluxVarsCache().problem(); | |
233 | 17327737 | const auto globalI = fvGeometry.gridGeometry().elementMapper().index(element); | |
234 | |||
235 | // instantiate filler class | ||
236 | 17327737 | FluxVariablesCacheFiller filler(problem); | |
237 | |||
238 | // let the filler class update the caches | ||
239 |
2/2✓ Branch 0 taken 121323114 times.
✓ Branch 1 taken 15890136 times.
|
149843437 | for (unsigned int localScvfIdx = 0; localScvfIdx < fluxVarsCache_.size(); ++localScvfIdx) |
240 | { | ||
241 |
3/3✓ Branch 1 taken 63499536 times.
✓ Branch 2 taken 48372698 times.
✓ Branch 0 taken 9450880 times.
|
132515700 | const auto& scvf = fvGeometry.scvf(globalScvfIndices_[localScvfIdx]); |
242 | |||
243 | 132515700 | const auto scvfInsideScvIdx = scvf.insideScvIdx(); | |
244 |
2/2✓ Branch 0 taken 63660816 times.
✓ Branch 1 taken 57662298 times.
|
168451512 | const auto& insideElement = scvfInsideScvIdx == globalI ? |
245 | element : | ||
246 | 63160152 | fvGeometry.gridGeometry().element(scvfInsideScvIdx); | |
247 | |||
248 |
1/2✓ Branch 1 taken 8269030 times.
✗ Branch 2 not taken.
|
132515700 | filler.fill(*this, fluxVarsCache_[localScvfIdx], insideElement, fvGeometry, elemVolVars, scvf); |
249 | } | ||
250 | } | ||
251 | 17327737 | } | |
252 | |||
253 | //! access operators in the case of no caching | ||
254 | template<class SubControlVolumeFace> | ||
255 | 521788245 | const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const | |
256 |
25/25✓ Branch 1 taken 74067924 times.
✓ Branch 2 taken 33714850 times.
✓ Branch 4 taken 13129547 times.
✓ Branch 5 taken 6731555 times.
✓ Branch 3 taken 10170907 times.
✓ Branch 6 taken 43333413 times.
✓ Branch 7 taken 43449304 times.
✓ Branch 10 taken 3016 times.
✓ Branch 11 taken 42700 times.
✓ Branch 8 taken 366912 times.
✓ Branch 13 taken 2888 times.
✓ Branch 14 taken 618796 times.
✓ Branch 16 taken 1273904 times.
✓ Branch 17 taken 6575 times.
✓ Branch 19 taken 2 times.
✓ Branch 20 taken 24982 times.
✓ Branch 9 taken 2964 times.
✓ Branch 15 taken 1879681 times.
✓ Branch 21 taken 11752 times.
✓ Branch 22 taken 11752 times.
✓ Branch 27 taken 1 times.
✓ Branch 28 taken 75935 times.
✓ Branch 18 taken 5616 times.
✓ Branch 23 taken 1 times.
✓ Branch 24 taken 36287 times.
|
521788245 | { 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 | 32252516 | const GridFluxVariablesCache& gridFluxVarsCache() const | |
265 | 30859414 | { 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 | 26210011 | void bind_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
304 | const FVElementGeometry& fvGeometry, | ||
305 | const ElementVolumeVariables& elemVolVars) | ||
306 | { | ||
307 | 26210011 | const auto& problem = gridFluxVarsCache().problem(); | |
308 | 26210011 | const auto& gridGeometry = fvGeometry.gridGeometry(); | |
309 | 26210011 | const auto globalI = gridGeometry.elementMapper().index(element); | |
310 | 26210011 | const auto& connectivityMapI = gridGeometry.connectivityMap()[globalI]; | |
311 | 26210011 | const auto numNeighbors = connectivityMapI.size(); | |
312 | |||
313 | // instantiate helper class to fill the caches | ||
314 | 26210011 | FluxVariablesCacheFiller filler(problem); | |
315 | |||
316 | // find the number of scv faces that need to be prepared | ||
317 | 26210011 | auto numScvf = fvGeometry.numScvf(); | |
318 |
2/2✓ Branch 0 taken 73663636 times.
✓ Branch 1 taken 24129842 times.
|
106819143 | for (unsigned int localIdxJ = 0; localIdxJ < numNeighbors; ++localIdxJ) |
319 | 80609132 | numScvf += connectivityMapI[localIdxJ].scvfsJ.size(); | |
320 | |||
321 | // fill the containers with the data on the scv faces inside the actual element | ||
322 | 26210011 | fluxVarsCache_.resize(numScvf); | |
323 | 26210011 | globalScvfIndices_.resize(numScvf); | |
324 | 26210011 | unsigned int localScvfIdx = 0; | |
325 |
2/2✓ Branch 0 taken 78489903 times.
✓ Branch 1 taken 24129842 times.
|
111783540 | for (auto&& scvf : scvfs(fvGeometry)) |
326 | { | ||
327 | 85573529 | filler.fill(*this, fluxVarsCache_[localScvfIdx], element, fvGeometry, elemVolVars, scvf, true); | |
328 | 85573529 | globalScvfIndices_[localScvfIdx] = scvf.index(); | |
329 | 85573529 | localScvfIdx++; | |
330 | } | ||
331 | |||
332 | // add required data on the scv faces in the neighboring elements | ||
333 |
2/2✓ Branch 0 taken 73663636 times.
✓ Branch 1 taken 24129842 times.
|
106819143 | for (unsigned int localIdxJ = 0; localIdxJ < numNeighbors; ++localIdxJ) |
334 | { | ||
335 | 80609132 | const auto elementJ = gridGeometry.element(connectivityMapI[localIdxJ].globalJ); | |
336 |
3/3✓ Branch 0 taken 69018836 times.
✓ Branch 1 taken 73663636 times.
✓ Branch 2 taken 4644800 times.
|
161218264 | for (auto scvfIdx : connectivityMapI[localIdxJ].scvfsJ) |
337 | { | ||
338 | 80609132 | auto&& scvfJ = fvGeometry.scvf(scvfIdx); | |
339 |
1/2✓ Branch 1 taken 1279220 times.
✗ Branch 2 not taken.
|
80609132 | filler.fill(*this, fluxVarsCache_[localScvfIdx], elementJ, fvGeometry, elemVolVars, scvfJ, true); |
340 | 80609132 | globalScvfIndices_[localScvfIdx] = scvfJ.index(); | |
341 | 80609132 | localScvfIdx++; | |
342 | } | ||
343 | } | ||
344 | 26210011 | } | |
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 | 521788245 | int getLocalScvfIdx_(const int scvfIdx) const | |
371 | { | ||
372 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 492302260 times.
|
521788245 | auto it = std::find(globalScvfIndices_.begin(), globalScvfIndices_.end(), scvfIdx); |
373 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 492302260 times.
|
521788245 | assert(it != globalScvfIndices_.end() && "Could not find the flux vars cache for scvfIdx"); |
374 | 521788245 | 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 |