| 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 12246920 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1254627 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 800001 times.
✗ Branch 8 not taken.
|
15622620 | 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 | 222709604 | const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const | |
| 126 | 137191198 | { return gridFluxVarsCache()[scvf]; } | |
| 127 | |||
| 128 | //! The global object we are a restriction of | ||
| 129 | 219687106 | const GridFluxVariablesCache& gridFluxVarsCache() const | |
| 130 |
1/2✓ Branch 1 taken 4009824 times.
✗ Branch 2 not taken.
|
214787106 | { 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 | 553320 | 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 | 23423940 | CCTpfaElementFluxVariablesCache(const GridFluxVariablesCache& global) | |
| 154 |
12/24✓ Branch 1 taken 354086 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 21095289 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 319182 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 255039 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 324100 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.
|
23423940 | : 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 | 497271 | 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 362886 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 78336 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 5373 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.
|
497271 | this->bind_(element, fvGeometry, elemVolVars); |
| 188 | 497271 | return std::move(*this); | |
| 189 | } | ||
| 190 | |||
| 191 | //! Specialization for the global caching being enabled - do nothing here | ||
| 192 | template<class FVElementGeometry, class ElementVolumeVariables> | ||
| 193 | 23082251 | 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.
|
23082251 | { 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 | 16011001 | 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 | 16011001 | const auto& problem = gridFluxVarsCache().problem(); | |
| 233 | 16011001 | const auto globalI = fvGeometry.gridGeometry().elementMapper().index(element); | |
| 234 | |||
| 235 | // instantiate filler class | ||
| 236 | 16011001 | FluxVariablesCacheFiller filler(problem); | |
| 237 | |||
| 238 | // let the filler class update the caches | ||
| 239 |
2/2✓ Branch 0 taken 110761754 times.
✓ Branch 1 taken 14547800 times.
|
138165101 | for (unsigned int localScvfIdx = 0; localScvfIdx < fluxVarsCache_.size(); ++localScvfIdx) |
| 240 | { | ||
| 241 |
3/3✓ Branch 1 taken 58128992 times.
✓ Branch 2 taken 43181882 times.
✓ Branch 0 taken 9450880 times.
|
122154100 | const auto& scvf = fvGeometry.scvf(globalScvfIndices_[localScvfIdx]); |
| 242 | |||
| 243 | 122154100 | const auto scvfInsideScvIdx = scvf.insideScvIdx(); | |
| 244 |
2/2✓ Branch 0 taken 58290272 times.
✓ Branch 1 taken 52471482 times.
|
158289912 | const auto& insideElement = scvfInsideScvIdx == globalI ? |
| 245 | element : | ||
| 246 | 58067896 | fvGeometry.gridGeometry().element(scvfInsideScvIdx); | |
| 247 | |||
| 248 |
1/2✓ Branch 1 taken 8466430 times.
✗ Branch 2 not taken.
|
122154100 | filler.fill(*this, fluxVarsCache_[localScvfIdx], insideElement, fvGeometry, elemVolVars, scvf); |
| 249 | } | ||
| 250 | } | ||
| 251 | 16011001 | } | |
| 252 | |||
| 253 | //! access operators in the case of no caching | ||
| 254 | template<class SubControlVolumeFace> | ||
| 255 | 509349449 | const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const | |
| 256 |
25/25✓ Branch 1 taken 70325884 times.
✓ Branch 2 taken 30702130 times.
✓ Branch 4 taken 12143483 times.
✓ Branch 5 taken 6732715 times.
✓ Branch 10 taken 3021 times.
✓ Branch 11 taken 49895 times.
✓ Branch 7 taken 43173336 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 6 taken 43016789 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.
✓ Branch 3 taken 9009203 times.
|
509349449 | { 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 | 30359860 | const GridFluxVariablesCache& gridFluxVarsCache() const | |
| 265 | 29517078 | { 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 | 25671291 | void bind_(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element, | |
| 304 | const FVElementGeometry& fvGeometry, | ||
| 305 | const ElementVolumeVariables& elemVolVars) | ||
| 306 | { | ||
| 307 | 25671291 | const auto& problem = gridFluxVarsCache().problem(); | |
| 308 | 25671291 | const auto& gridGeometry = fvGeometry.gridGeometry(); | |
| 309 | 25671291 | const auto globalI = gridGeometry.elementMapper().index(element); | |
| 310 | 25671291 | const auto& connectivityMapI = gridGeometry.connectivityMap()[globalI]; | |
| 311 | 25671291 | const auto numNeighbors = connectivityMapI.size(); | |
| 312 | |||
| 313 | // instantiate helper class to fill the caches | ||
| 314 | 25671291 | FluxVariablesCacheFiller filler(problem); | |
| 315 | |||
| 316 | // find the number of scv faces that need to be prepared | ||
| 317 | 25671291 | auto numScvf = fvGeometry.numScvf(); | |
| 318 |
2/2✓ Branch 0 taken 71517156 times.
✓ Branch 1 taken 23579522 times.
|
104178503 | for (unsigned int localIdxJ = 0; localIdxJ < numNeighbors; ++localIdxJ) |
| 319 | 78507212 | numScvf += connectivityMapI[localIdxJ].scvfsJ.size(); | |
| 320 | |||
| 321 | // fill the containers with the data on the scv faces inside the actual element | ||
| 322 | 25671291 | fluxVarsCache_.resize(numScvf); | |
| 323 | 25671291 | globalScvfIndices_.resize(numScvf); | |
| 324 | 25671291 | unsigned int localScvfIdx = 0; | |
| 325 |
2/2✓ Branch 0 taken 76288023 times.
✓ Branch 1 taken 23579522 times.
|
109088740 | for (auto&& scvf : scvfs(fvGeometry)) |
| 326 | { | ||
| 327 | 83417449 | filler.fill(*this, fluxVarsCache_[localScvfIdx], element, fvGeometry, elemVolVars, scvf, true); | |
| 328 | 83417449 | globalScvfIndices_[localScvfIdx] = scvf.index(); | |
| 329 | 83417449 | localScvfIdx++; | |
| 330 | } | ||
| 331 | |||
| 332 | // add required data on the scv faces in the neighboring elements | ||
| 333 |
2/2✓ Branch 0 taken 71517156 times.
✓ Branch 1 taken 23579522 times.
|
104178503 | for (unsigned int localIdxJ = 0; localIdxJ < numNeighbors; ++localIdxJ) |
| 334 | { | ||
| 335 | 78507212 | const auto elementJ = gridGeometry.element(connectivityMapI[localIdxJ].globalJ); | |
| 336 |
3/3✓ Branch 0 taken 66872356 times.
✓ Branch 1 taken 71517156 times.
✓ Branch 2 taken 4644800 times.
|
157014424 | for (auto scvfIdx : connectivityMapI[localIdxJ].scvfsJ) |
| 337 | { | ||
| 338 | 78507212 | auto&& scvfJ = fvGeometry.scvf(scvfIdx); | |
| 339 |
1/2✓ Branch 1 taken 1323200 times.
✗ Branch 2 not taken.
|
78507212 | filler.fill(*this, fluxVarsCache_[localScvfIdx], elementJ, fvGeometry, elemVolVars, scvfJ, true); |
| 340 | 78507212 | globalScvfIndices_[localScvfIdx] = scvfJ.index(); | |
| 341 | 78507212 | localScvfIdx++; | |
| 342 | } | ||
| 343 | } | ||
| 344 | 25671291 | } | |
| 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 | 509349449 | int getLocalScvfIdx_(const int scvfIdx) const | |
| 371 | { | ||
| 372 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 479682704 times.
|
509349449 | auto it = std::find(globalScvfIndices_.begin(), globalScvfIndices_.end(), scvfIdx); |
| 373 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 479682704 times.
|
509349449 | assert(it != globalScvfIndices_.end() && "Could not find the flux vars cache for scvfIdx"); |
| 374 | 509349449 | 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 |