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 BoxDiscretization | ||
10 | * \brief Base class for the local finite volume geometry for box models | ||
11 | * This builds up the sub control volumes and sub control volume faces | ||
12 | * for an element. | ||
13 | */ | ||
14 | #ifndef DUMUX_DISCRETIZATION_BOX_FV_ELEMENT_GEOMETRY_HH | ||
15 | #define DUMUX_DISCRETIZATION_BOX_FV_ELEMENT_GEOMETRY_HH | ||
16 | |||
17 | #include <optional> | ||
18 | #include <utility> | ||
19 | #include <unordered_map> | ||
20 | #include <array> | ||
21 | #include <vector> | ||
22 | |||
23 | #include <dune/geometry/type.hh> | ||
24 | #include <dune/localfunctions/lagrange/pqkfactory.hh> | ||
25 | |||
26 | #include <dumux/common/indextraits.hh> | ||
27 | #include <dumux/discretization/scvandscvfiterators.hh> | ||
28 | #include <dumux/discretization/box/boxgeometryhelper.hh> | ||
29 | |||
30 | namespace Dumux { | ||
31 | |||
32 | /*! | ||
33 | * \ingroup BoxDiscretization | ||
34 | * \brief Base class for the finite volume geometry vector for box models | ||
35 | * This builds up the sub control volumes and sub control volume faces | ||
36 | * for each element. | ||
37 | * \tparam GG the finite volume grid geometry type | ||
38 | * \tparam enableGridGeometryCache if the grid geometry is cached or not | ||
39 | */ | ||
40 | template<class GG, bool enableGridGeometryCache> | ||
41 | class BoxFVElementGeometry; | ||
42 | |||
43 | //! specialization in case the FVElementGeometries are stored | ||
44 | template<class GG> | ||
45 |
66/128✓ Branch 0 taken 2 times.
✓ Branch 1 taken 926114 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 926214 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 1046540 times.
✓ Branch 10 taken 2 times.
✓ Branch 11 taken 2 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 763 times.
✓ Branch 15 taken 1182326 times.
✓ Branch 16 taken 2 times.
✓ Branch 17 taken 762 times.
✓ Branch 18 taken 8225 times.
✓ Branch 19 taken 445150 times.
✓ Branch 20 taken 2 times.
✓ Branch 21 taken 452612 times.
✓ Branch 22 taken 1 times.
✓ Branch 23 taken 8224 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 389382 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 470 times.
✓ Branch 29 taken 403782 times.
✓ Branch 30 taken 666146 times.
✓ Branch 31 taken 389382 times.
✓ Branch 32 taken 210897 times.
✓ Branch 33 taken 666144 times.
✓ Branch 34 taken 196898 times.
✓ Branch 35 taken 680144 times.
✓ Branch 36 taken 196897 times.
✗ Branch 37 not taken.
✓ Branch 38 taken 21200 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✓ Branch 41 taken 7200 times.
✓ Branch 42 taken 2252 times.
✓ Branch 43 taken 7200 times.
✓ Branch 44 taken 3 times.
✗ Branch 45 not taken.
✓ Branch 46 taken 7 times.
✓ Branch 47 taken 6400 times.
✓ Branch 48 taken 1189858 times.
✓ Branch 49 taken 6400 times.
✓ Branch 50 taken 21601 times.
✓ Branch 51 taken 1189858 times.
✓ Branch 52 taken 21600 times.
✓ Branch 53 taken 1189858 times.
✓ Branch 54 taken 1 times.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✓ Branch 58 taken 2 times.
✓ Branch 59 taken 1 times.
✓ Branch 60 taken 3 times.
✓ Branch 61 taken 1 times.
✓ Branch 62 taken 2 times.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✓ Branch 66 taken 2 times.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 75 taken 1 times.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✓ Branch 82 taken 3200 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 3200 times.
✗ Branch 86 not taken.
✓ Branch 87 taken 3200 times.
✗ Branch 88 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✓ Branch 94 taken 9600 times.
✗ Branch 95 not taken.
✓ Branch 96 taken 9600 times.
✗ Branch 97 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✓ Branch 103 taken 3200 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 3200 times.
✗ Branch 107 not taken.
✓ Branch 108 taken 3200 times.
✗ Branch 109 not taken.
✗ Branch 111 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✓ Branch 115 taken 9600 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 9600 times.
✗ Branch 119 not taken.
✓ Branch 120 taken 9600 times.
✗ Branch 121 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✓ Branch 127 taken 1 times.
✗ Branch 128 not taken.
✓ Branch 129 taken 1 times.
✗ Branch 130 not taken.
✓ Branch 131 taken 1 times.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
|
24009670 | class BoxFVElementGeometry<GG, true> |
46 | { | ||
47 | using GridView = typename GG::GridView; | ||
48 | static constexpr int dim = GridView::dimension; | ||
49 | static constexpr int dimWorld = GridView::dimensionworld; | ||
50 | using GridIndexType = typename IndexTraits<GridView>::GridIndex; | ||
51 | using LocalIndexType = typename IndexTraits<GridView>::LocalIndex; | ||
52 | using CoordScalar = typename GridView::ctype; | ||
53 | using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType; | ||
54 | using GGCache = typename GG::Cache; | ||
55 | using GeometryHelper = typename GGCache::GeometryHelper; | ||
56 | public: | ||
57 | //! export the element type | ||
58 | using Element = typename GridView::template Codim<0>::Entity; | ||
59 | //! export type of subcontrol volume | ||
60 | using SubControlVolume = typename GG::SubControlVolume; | ||
61 | //! export type of subcontrol volume face | ||
62 | using SubControlVolumeFace = typename GG::SubControlVolumeFace; | ||
63 | //! export type of finite volume grid geometry | ||
64 | using GridGeometry = GG; | ||
65 | //! the maximum number of scvs per element (2^dim for cubes) | ||
66 | static constexpr std::size_t maxNumElementScvs = (1<<dim); | ||
67 | |||
68 | /*! | ||
69 | * \brief Constructor | ||
70 | * \note Never use this directly and always construct this class via `localView(gridGeometry)` | ||
71 | */ | ||
72 | BoxFVElementGeometry(const GGCache& ggCache) | ||
73 |
62/86✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 926074 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 706 times.
✓ Branch 8 taken 926074 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 706 times.
✓ Branch 11 taken 20 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 30 times.
✓ Branch 14 taken 20 times.
✓ Branch 15 taken 3 times.
✓ Branch 16 taken 30 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 3 times.
✓ Branch 19 taken 1182335 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 766 times.
✓ Branch 22 taken 1182335 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 766 times.
✓ Branch 25 taken 444392 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 397608 times.
✓ Branch 28 taken 444392 times.
✓ Branch 29 taken 2091 times.
✓ Branch 30 taken 397608 times.
✓ Branch 31 taken 471 times.
✓ Branch 32 taken 2091 times.
✓ Branch 33 taken 673344 times.
✓ Branch 34 taken 471 times.
✓ Branch 35 taken 78 times.
✓ Branch 36 taken 673344 times.
✓ Branch 37 taken 210896 times.
✓ Branch 38 taken 78 times.
✓ Branch 39 taken 23854 times.
✓ Branch 40 taken 210896 times.
✓ Branch 41 taken 21 times.
✓ Branch 42 taken 23854 times.
✓ Branch 43 taken 3 times.
✓ Branch 44 taken 21 times.
✓ Branch 45 taken 7 times.
✓ Branch 46 taken 3 times.
✓ Branch 47 taken 2 times.
✓ Branch 48 taken 7 times.
✓ Branch 49 taken 1189858 times.
✓ Branch 50 taken 2 times.
✗ Branch 51 not taken.
✓ Branch 52 taken 1189858 times.
✓ Branch 53 taken 2 times.
✗ Branch 54 not taken.
✓ Branch 55 taken 3 times.
✓ Branch 56 taken 2 times.
✓ Branch 57 taken 76 times.
✓ Branch 58 taken 3 times.
✓ Branch 59 taken 2 times.
✓ Branch 60 taken 76 times.
✗ Branch 61 not taken.
✓ Branch 62 taken 2 times.
✗ Branch 63 not taken.
✓ Branch 65 taken 1 times.
✗ Branch 66 not taken.
✓ Branch 68 taken 1 times.
✗ Branch 69 not taken.
✓ Branch 71 taken 1 times.
✗ Branch 72 not taken.
✓ Branch 74 taken 1 times.
✗ Branch 75 not taken.
✓ Branch 77 taken 3200 times.
✗ Branch 78 not taken.
✓ Branch 80 taken 3200 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 9600 times.
✗ Branch 84 not taken.
✓ Branch 86 taken 9600 times.
✗ Branch 87 not taken.
✓ Branch 89 taken 3200 times.
✗ Branch 90 not taken.
✓ Branch 92 taken 3200 times.
✗ Branch 93 not taken.
✓ Branch 95 taken 9600 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 9600 times.
✗ Branch 99 not taken.
|
19400050 | : ggCache_(&ggCache) {} |
74 | |||
75 | //! Get a sub control volume with a local scv index | ||
76 | ✗ | const SubControlVolume& scv(LocalIndexType scvIdx) const | |
77 | { | ||
78 |
13/24✗ Branch 0 not taken.
✓ Branch 1 taken 189774972 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 189774972 times.
✓ Branch 4 taken 20000 times.
✓ Branch 5 taken 189774972 times.
✓ Branch 6 taken 188958572 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 188958572 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 188938572 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 65234916 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 65234916 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 65234916 times.
✓ Branch 18 taken 65234916 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 65234916 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 65234916 times.
✗ Branch 23 not taken.
|
1746344448 | return ggCache_->scvs(eIdx_)[scvIdx]; |
79 | } | ||
80 | |||
81 | //! Get a sub control volume face with a local scvf index | ||
82 | const SubControlVolumeFace& scvf(LocalIndexType scvfIdx) const | ||
83 | { | ||
84 | return ggCache_->scvfs(eIdx_)[scvfIdx]; | ||
85 | } | ||
86 | |||
87 | //! iterator range for sub control volumes. Iterates over | ||
88 | //! all scvs of the bound element. | ||
89 | //! This is a free function found by means of ADL | ||
90 | //! To iterate over all sub control volumes of this FVElementGeometry use | ||
91 | //! for (auto&& scv : scvs(fvGeometry)) | ||
92 | friend inline Dune::IteratorRange<typename std::vector<SubControlVolume>::const_iterator> | ||
93 | ✗ | scvs(const BoxFVElementGeometry& fvGeometry) | |
94 | { | ||
95 | using Iter = typename std::vector<SubControlVolume>::const_iterator; | ||
96 | 719387323 | const auto& s = fvGeometry.ggCache_->scvs(fvGeometry.eIdx_); | |
97 | 2158161969 | return Dune::IteratorRange<Iter>(s.begin(), s.end()); | |
98 | } | ||
99 | |||
100 | //! iterator range for sub control volumes faces. Iterates over | ||
101 | //! all scvfs of the bound element. | ||
102 | //! This is a free function found by means of ADL | ||
103 | //! To iterate over all sub control volume faces of this FVElementGeometry use | ||
104 | //! for (auto&& scvf : scvfs(fvGeometry)) | ||
105 | friend inline Dune::IteratorRange<typename std::vector<SubControlVolumeFace>::const_iterator> | ||
106 | ✗ | scvfs(const BoxFVElementGeometry& fvGeometry) | |
107 | { | ||
108 | using Iter = typename std::vector<SubControlVolumeFace>::const_iterator; | ||
109 | 38074449 | const auto& s = fvGeometry.ggCache_->scvfs(fvGeometry.eIdx_); | |
110 | 114223347 | return Dune::IteratorRange<Iter>(s.begin(), s.end()); | |
111 | } | ||
112 | |||
113 | //! Get a local finite element basis | ||
114 | 180786 | const FeLocalBasis& feLocalBasis() const | |
115 | { | ||
116 |
16/47✓ Branch 1 taken 4946174 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5190674 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5440274 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 249600 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 1300680 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 1558600 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 257920 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 864000 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1113600 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 271720 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 32040 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 32040 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 9920 times.
✗ Branch 47 not taken.
✓ Branch 51 taken 9920 times.
✗ Branch 52 not taken.
✓ Branch 54 taken 9920 times.
✗ Branch 55 not taken.
✓ Branch 57 taken 9920 times.
✗ Branch 58 not taken.
|
26021364 | return gridGeometry().feCache().get(element_->type()).localBasis(); |
117 | } | ||
118 | |||
119 | //! The total number of sub control volumes | ||
120 | ✗ | std::size_t numScv() const | |
121 | { | ||
122 |
22/30✓ Branch 0 taken 7 times.
✓ Branch 1 taken 233835 times.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 295955 times.
✓ Branch 4 taken 96384 times.
✓ Branch 5 taken 2430 times.
✓ Branch 6 taken 158505 times.
✓ Branch 7 taken 4887616 times.
✓ Branch 8 taken 2431 times.
✓ Branch 9 taken 77840 times.
✓ Branch 10 taken 4983944 times.
✓ Branch 11 taken 399302 times.
✓ Branch 12 taken 174168 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 399302 times.
✓ Branch 15 taken 666144 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1199778 times.
✓ Branch 18 taken 666144 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 1199778 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 9600 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 9600 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 9600 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 9600 times.
✗ Branch 33 not taken.
|
182466282 | return ggCache_->scvs(eIdx_).size(); |
123 | } | ||
124 | |||
125 | //! The total number of sub control volume faces | ||
126 | ✗ | std::size_t numScvf() const | |
127 | { | ||
128 |
4/8✓ Branch 1 taken 19386 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19386 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3200 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3200 times.
✗ Branch 11 not taken.
|
2601176 | return ggCache_->scvfs(eIdx_).size(); |
129 | } | ||
130 | |||
131 | /*! | ||
132 | * \brief bind the local view (r-value overload) | ||
133 | * This overload is called when an instance of this class is a temporary in the usage context | ||
134 | * This allows a usage like this: `const auto view = localView(...).bind(element);` | ||
135 | */ | ||
136 | BoxFVElementGeometry bind(const Element& element) && | ||
137 | { | ||
138 |
2/4✓ Branch 1 taken 19386 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3200 times.
✗ Branch 5 not taken.
|
118262 | this->bindElement(element); |
139 |
2/4✓ Branch 0 taken 88817 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 6859 times.
✗ Branch 4 not taken.
|
213938 | return std::move(*this); |
140 | } | ||
141 | |||
142 | //! this function is for compatibility reasons with cc methods | ||
143 | //! The box stencil is always element-local so bind and bindElement | ||
144 | //! are identical. | ||
145 | void bind(const Element& element) & | ||
146 |
3/6✓ Branch 1 taken 759 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 80320 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
5751598 | { this->bindElement(element); } |
147 | |||
148 | /*! | ||
149 | * \brief bind the local view (r-value overload) | ||
150 | * This overload is called when an instance of this class is a temporary in the usage context | ||
151 | * This allows a usage like this: `const auto view = localView(...).bindElement(element);` | ||
152 | */ | ||
153 | BoxFVElementGeometry bindElement(const Element& element) && | ||
154 | { | ||
155 |
4/7✓ Branch 1 taken 1531114 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 220496 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1189858 times.
✗ Branch 8 not taken.
|
6393340 | this->bindElement(element); |
156 |
5/6✓ Branch 0 taken 8430 times.
✓ Branch 1 taken 105044 times.
✓ Branch 2 taken 15287 times.
✓ Branch 3 taken 105046 times.
✓ Branch 4 taken 6859 times.
✗ Branch 5 not taken.
|
9845212 | return std::move(*this); |
157 | } | ||
158 | |||
159 | //! Binding of an element, has to be called before using the fvgeometries | ||
160 | //! Prepares all the volume variables within the element | ||
161 | //! For compatibility reasons with the FVGeometry cache being disabled | ||
162 | 15059318 | void bindElement(const Element& element) & | |
163 | { | ||
164 |
2/2✓ Branch 0 taken 1402516 times.
✓ Branch 1 taken 6685431 times.
|
15059318 | element_ = element; |
165 | // cache element index | ||
166 | 15059318 | eIdx_ = gridGeometry().elementMapper().index(element); | |
167 | 15059318 | } | |
168 | |||
169 | //! Returns true if bind/bindElement has already been called | ||
170 | bool isBound() const | ||
171 |
2/4✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
202218 | { return static_cast<bool>(element_); } |
172 | |||
173 | //! The bound element | ||
174 | const Element& element() const | ||
175 |
2/4✓ Branch 3 taken 80320 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 80320 times.
✗ Branch 7 not taken.
|
59928846 | { return *element_; } |
176 | |||
177 | //! The bound element's index in the grid view | ||
178 | ✗ | GridIndexType elementIndex() const | |
179 | ✗ | { return eIdx_; } | |
180 | |||
181 | //! The grid geometry we are a restriction of | ||
182 | ✗ | const GridGeometry& gridGeometry() const | |
183 |
33/53✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 8218 times.
✓ Branch 9 taken 138187 times.
✓ Branch 10 taken 1179634 times.
✓ Branch 11 taken 9428945 times.
✓ Branch 12 taken 73920 times.
✓ Branch 13 taken 4887560 times.
✓ Branch 14 taken 78486 times.
✓ Branch 15 taken 61024 times.
✓ Branch 16 taken 186148 times.
✓ Branch 17 taken 4568386 times.
✓ Branch 18 taken 122220 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 102378 times.
✓ Branch 21 taken 1090492 times.
✓ Branch 22 taken 1795424 times.
✓ Branch 23 taken 1216596 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 1 times.
✓ Branch 26 taken 1202796 times.
✓ Branch 27 taken 871947 times.
✓ Branch 28 taken 11320 times.
✓ Branch 29 taken 72614 times.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✓ Branch 34 taken 1548 times.
✓ Branch 35 taken 50638 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 948 times.
✓ Branch 39 taken 18252 times.
✓ Branch 40 taken 2 times.
✓ Branch 41 taken 57568 times.
✓ Branch 42 taken 23068 times.
✓ Branch 43 taken 18254 times.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 47 not taken.
✓ Branch 48 taken 7200 times.
✗ Branch 49 not taken.
✓ Branch 53 taken 9920 times.
✗ Branch 54 not taken.
✓ Branch 57 taken 9920 times.
✗ Branch 58 not taken.
✓ Branch 64 taken 3200 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 3200 times.
✗ Branch 68 not taken.
|
62101243 | { return ggCache_->gridGeometry(); } |
184 | |||
185 | //! Returns whether one of the geometry's scvfs lies on a boundary | ||
186 | ✗ | bool hasBoundaryScvf() const | |
187 |
24/24✓ Branch 0 taken 214184 times.
✓ Branch 1 taken 1733951 times.
✓ Branch 2 taken 214184 times.
✓ Branch 3 taken 1733951 times.
✓ Branch 4 taken 205916 times.
✓ Branch 5 taken 119476 times.
✓ Branch 6 taken 205916 times.
✓ Branch 7 taken 119476 times.
✓ Branch 8 taken 1804 times.
✓ Branch 9 taken 6778 times.
✓ Branch 10 taken 1804 times.
✓ Branch 11 taken 6778 times.
✓ Branch 12 taken 28 times.
✓ Branch 13 taken 36 times.
✓ Branch 14 taken 28 times.
✓ Branch 15 taken 36 times.
✓ Branch 16 taken 592 times.
✓ Branch 17 taken 432 times.
✓ Branch 18 taken 592 times.
✓ Branch 19 taken 432 times.
✓ Branch 20 taken 1804 times.
✓ Branch 21 taken 6778 times.
✓ Branch 22 taken 1804 times.
✓ Branch 23 taken 6778 times.
|
4583558 | { return ggCache_->hasBoundaryScvf(eIdx_); } |
188 | |||
189 | //! Geometry of a sub control volume | ||
190 | 28424 | typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const | |
191 | { | ||
192 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 27584 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 27584 times.
|
56848 | assert(isBound()); |
193 | 56848 | const auto geo = element().geometry(); | |
194 |
2/4✓ Branch 1 taken 9008 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 9008 times.
✗ Branch 5 not taken.
|
28424 | return { Dune::GeometryTypes::cube(dim), GeometryHelper(geo).getScvCorners(scv.indexInElement()) }; |
195 | } | ||
196 | |||
197 | //! Geometry of a sub control volume face | ||
198 | 73568 | typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const | |
199 | { | ||
200 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 57492 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 57492 times.
|
147136 | assert(isBound()); |
201 | 157996 | const auto geo = element().geometry(); | |
202 |
2/2✓ Branch 0 taken 57480 times.
✓ Branch 1 taken 12 times.
|
73568 | const GeometryHelper geometryHelper(geo); |
203 |
2/2✓ Branch 0 taken 57480 times.
✓ Branch 1 taken 12 times.
|
73568 | if (scvf.boundary()) |
204 | { | ||
205 | 73556 | const auto localBoundaryIndex = scvf.index() - geometryHelper.numInteriorScvf(); | |
206 | 73556 | const auto& key = ggCache_->scvfBoundaryGeometryKeys(eIdx_)[localBoundaryIndex]; | |
207 | 220668 | return { Dune::GeometryTypes::cube(dim-1), geometryHelper.getBoundaryScvfCorners(key[0], key[1]) }; | |
208 | } | ||
209 | else | ||
210 | 12 | return { Dune::GeometryTypes::cube(dim-1), geometryHelper.getScvfCorners(scvf.index()) }; | |
211 | } | ||
212 | |||
213 | private: | ||
214 | const GGCache* ggCache_; | ||
215 | GridIndexType eIdx_; | ||
216 | |||
217 | std::optional<Element> element_; | ||
218 | }; | ||
219 | |||
220 | //! specialization in case the FVElementGeometries are not stored | ||
221 | template<class GG> | ||
222 | class BoxFVElementGeometry<GG, false> | ||
223 | { | ||
224 | using GridView = typename GG::GridView; | ||
225 | static constexpr int dim = GridView::dimension; | ||
226 | static constexpr int dimWorld = GridView::dimensionworld; | ||
227 | using GridIndexType = typename IndexTraits<GridView>::GridIndex; | ||
228 | using LocalIndexType = typename IndexTraits<GridView>::LocalIndex; | ||
229 | using CoordScalar = typename GridView::ctype; | ||
230 | using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType; | ||
231 | using GGCache = typename GG::Cache; | ||
232 | using GeometryHelper = typename GGCache::GeometryHelper; | ||
233 | public: | ||
234 | //! export the element type | ||
235 | using Element = typename GridView::template Codim<0>::Entity; | ||
236 | //! export type of subcontrol volume | ||
237 | using SubControlVolume = typename GG::SubControlVolume; | ||
238 | //! export type of subcontrol volume face | ||
239 | using SubControlVolumeFace = typename GG::SubControlVolumeFace; | ||
240 | //! export type of finite volume grid geometry | ||
241 | using GridGeometry = GG; | ||
242 | //! the maximum number of scvs per element (2^dim for cubes) | ||
243 | static constexpr std::size_t maxNumElementScvs = (1<<dim); | ||
244 | |||
245 | /*! | ||
246 | * \brief Constructor | ||
247 | * \note Never use this directly and always construct this class via `localView(gridGeometry)` | ||
248 | */ | ||
249 | BoxFVElementGeometry(const GGCache& ggCache) | ||
250 |
78/114✗ Branch 0 not taken.
✓ Branch 1 taken 23167 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 23165 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 23167 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
✓ Branch 10 taken 23165 times.
✓ Branch 11 taken 5541 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 23165 times.
✓ Branch 14 taken 5541 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 11269 times.
✓ Branch 17 taken 5541 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 11269 times.
✓ Branch 20 taken 5541 times.
✓ Branch 21 taken 4466 times.
✓ Branch 22 taken 11269 times.
✓ Branch 23 taken 5541 times.
✓ Branch 24 taken 4466 times.
✓ Branch 25 taken 11269 times.
✓ Branch 26 taken 16 times.
✓ Branch 27 taken 4466 times.
✓ Branch 28 taken 11269 times.
✓ Branch 29 taken 16 times.
✓ Branch 30 taken 4466 times.
✓ Branch 31 taken 2106802 times.
✓ Branch 32 taken 16 times.
✓ Branch 33 taken 4466 times.
✓ Branch 34 taken 2106802 times.
✓ Branch 35 taken 16 times.
✗ Branch 36 not taken.
✓ Branch 37 taken 2106802 times.
✓ Branch 38 taken 16 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 2106802 times.
✓ Branch 41 taken 2 times.
✗ Branch 42 not taken.
✓ Branch 43 taken 2106802 times.
✓ Branch 44 taken 2 times.
✗ Branch 45 not taken.
✓ Branch 46 taken 1867370 times.
✓ Branch 47 taken 2 times.
✗ Branch 48 not taken.
✓ Branch 49 taken 1867370 times.
✓ Branch 50 taken 2 times.
✗ Branch 51 not taken.
✓ Branch 52 taken 1867370 times.
✓ Branch 53 taken 2 times.
✗ Branch 54 not taken.
✓ Branch 55 taken 1867370 times.
✓ Branch 56 taken 30330 times.
✗ Branch 57 not taken.
✓ Branch 58 taken 1867370 times.
✓ Branch 59 taken 30330 times.
✗ Branch 60 not taken.
✓ Branch 61 taken 103138 times.
✓ Branch 62 taken 30330 times.
✗ Branch 63 not taken.
✓ Branch 64 taken 103138 times.
✓ Branch 65 taken 30330 times.
✗ Branch 66 not taken.
✓ Branch 67 taken 103138 times.
✓ Branch 68 taken 30330 times.
✗ Branch 69 not taken.
✓ Branch 70 taken 103138 times.
✓ Branch 71 taken 1 times.
✗ Branch 72 not taken.
✓ Branch 73 taken 103138 times.
✓ Branch 74 taken 1 times.
✗ Branch 75 not taken.
✓ Branch 76 taken 376562 times.
✓ Branch 77 taken 1 times.
✗ Branch 78 not taken.
✓ Branch 79 taken 376562 times.
✓ Branch 80 taken 1 times.
✗ Branch 81 not taken.
✓ Branch 82 taken 376562 times.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✓ Branch 85 taken 376562 times.
✓ Branch 86 taken 2 times.
✗ Branch 87 not taken.
✓ Branch 88 taken 376562 times.
✓ Branch 89 taken 2 times.
✗ Branch 90 not taken.
✓ Branch 91 taken 16705 times.
✓ Branch 92 taken 2 times.
✗ Branch 93 not taken.
✓ Branch 94 taken 16705 times.
✓ Branch 95 taken 2 times.
✗ Branch 96 not taken.
✓ Branch 97 taken 16705 times.
✓ Branch 98 taken 2 times.
✗ Branch 99 not taken.
✓ Branch 100 taken 16705 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 16705 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 604311 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 604311 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 604311 times.
✗ Branch 113 not taken.
✓ Branch 115 taken 604311 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 604311 times.
✗ Branch 119 not taken.
|
26565605 | : ggCache_(&ggCache) {} |
251 | |||
252 | //! Get a sub control volume with a local scv index | ||
253 | const SubControlVolume& scv(LocalIndexType scvIdx) const | ||
254 | { | ||
255 |
22/26✗ Branch 0 not taken.
✓ Branch 1 taken 174775718 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 175259774 times.
✓ Branch 4 taken 163571494 times.
✓ Branch 5 taken 2823256 times.
✓ Branch 6 taken 164055550 times.
✓ Branch 7 taken 2339200 times.
✓ Branch 8 taken 484056 times.
✓ Branch 9 taken 213324828 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 214951624 times.
✓ Branch 12 taken 211535340 times.
✓ Branch 13 taken 1626796 times.
✓ Branch 14 taken 213159736 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 1786296 times.
✓ Branch 17 taken 2919444 times.
✓ Branch 18 taken 161905 times.
✓ Branch 19 taken 3232515 times.
✓ Branch 20 taken 5 times.
✓ Branch 21 taken 313079 times.
✓ Branch 22 taken 13 times.
✓ Branch 23 taken 313071 times.
✓ Branch 24 taken 13 times.
✓ Branch 25 taken 313063 times.
|
1460470148 | return scvs_[scvIdx]; |
256 | } | ||
257 | |||
258 | //! Get a sub control volume face with a local scvf index | ||
259 | const SubControlVolumeFace& scvf(LocalIndexType scvfIdx) const | ||
260 | { | ||
261 | return scvfs_[scvfIdx]; | ||
262 | } | ||
263 | |||
264 | //! iterator range for sub control volumes. Iterates over | ||
265 | //! all scvs of the bound element. | ||
266 | //! This is a free function found by means of ADL | ||
267 | //! To iterate over all sub control volumes of this FVElementGeometry use | ||
268 | //! for (auto&& scv : scvs(fvGeometry)) | ||
269 | friend inline Dune::IteratorRange<typename std::vector<SubControlVolume>::const_iterator> | ||
270 | scvs(const BoxFVElementGeometry& fvGeometry) | ||
271 | { | ||
272 | using Iter = typename std::vector<SubControlVolume>::const_iterator; | ||
273 |
3/6✓ Branch 1 taken 204 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 204 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 204 times.
✗ Branch 8 not taken.
|
3447015348 | return Dune::IteratorRange<Iter>(fvGeometry.scvs_.begin(), fvGeometry.scvs_.end()); |
274 | } | ||
275 | |||
276 | //! iterator range for sub control volumes faces. Iterates over | ||
277 | //! all scvfs of the bound element. | ||
278 | //! This is a free function found by means of ADL | ||
279 | //! To iterate over all sub control volume faces of this FVElementGeometry use | ||
280 | //! for (auto&& scvf : scvfs(fvGeometry)) | ||
281 | friend inline Dune::IteratorRange<typename std::vector<SubControlVolumeFace>::const_iterator> | ||
282 | scvfs(const BoxFVElementGeometry& fvGeometry) | ||
283 | { | ||
284 | using Iter = typename std::vector<SubControlVolumeFace>::const_iterator; | ||
285 | 135947535 | return Dune::IteratorRange<Iter>(fvGeometry.scvfs_.begin(), fvGeometry.scvfs_.end()); | |
286 | } | ||
287 | |||
288 | //! Get a local finite element basis | ||
289 | 2810178 | const FeLocalBasis& feLocalBasis() const | |
290 | { | ||
291 |
3/6✓ Branch 1 taken 5362908 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5362908 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5362908 times.
✗ Branch 8 not taken.
|
46056285 | return gridGeometry().feCache().get(element_->type()).localBasis(); |
292 | } | ||
293 | |||
294 | //! The total number of sub control volumes | ||
295 | std::size_t numScv() const | ||
296 | { | ||
297 |
16/22✓ Branch 0 taken 1 times.
✓ Branch 1 taken 490726 times.
✓ Branch 2 taken 251381 times.
✓ Branch 3 taken 604315 times.
✓ Branch 4 taken 5570747 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1926 times.
✓ Branch 7 taken 704384 times.
✓ Branch 8 taken 391696 times.
✓ Branch 9 taken 6300 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 864 times.
✓ Branch 12 taken 2488 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 52000 times.
✗ Branch 15 not taken.
✓ Branch 19 taken 100000 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 25280 times.
✓ Branch 23 taken 12640 times.
✓ Branch 26 taken 304 times.
✗ Branch 27 not taken.
|
122116022 | return scvs_.size(); |
298 | } | ||
299 | |||
300 | //! The total number of sub control volume faces | ||
301 | std::size_t numScvf() const | ||
302 | { | ||
303 |
1/2✓ Branch 3 taken 100 times.
✗ Branch 4 not taken.
|
4259807 | return scvfs_.size(); |
304 | } | ||
305 | |||
306 | /*! | ||
307 | * \brief bind the local view (r-value overload) | ||
308 | * This overload is called when an instance of this class is a temporary in the usage context | ||
309 | * This allows a usage like this: `const auto view = localView(...).bind(element);` | ||
310 | */ | ||
311 | BoxFVElementGeometry bind(const Element& element) && | ||
312 | { | ||
313 | this->bindElement(element); | ||
314 | return std::move(*this); | ||
315 | } | ||
316 | |||
317 | //! this function is for compatibility reasons with cc methods | ||
318 | //! The box stencil is always element-local so bind and bindElement | ||
319 | //! are identical. | ||
320 | void bind(const Element& element) & | ||
321 |
5/11✓ Branch 1 taken 58120 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 136178 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 14240 times.
✓ Branch 8 taken 14102 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 15 taken 100 times.
✗ Branch 16 not taken.
|
4262203 | { this->bindElement(element); } |
322 | |||
323 | /*! | ||
324 | * \brief bind the local view (r-value overload) | ||
325 | * This overload is called when an instance of this class is a temporary in the usage context | ||
326 | * This allows a usage like this: `const auto view = localView(...).bindElement(element);` | ||
327 | */ | ||
328 | BoxFVElementGeometry bindElement(const Element& element) && | ||
329 | { | ||
330 |
3/6✓ Branch 1 taken 310033 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 144000 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 604300 times.
✗ Branch 8 not taken.
|
1058333 | this->bindElement(element); |
331 | 1058333 | return std::move(*this); | |
332 | } | ||
333 | |||
334 | //! Binding of an element, has to be called before using the fvgeometries | ||
335 | //! Prepares all the volume variables within the element | ||
336 | //! For compatibility reasons with the FVGeometry cache being disabled | ||
337 | 8680995 | void bindElement(const Element& element) & | |
338 | { | ||
339 |
2/2✓ Branch 0 taken 1837330 times.
✓ Branch 1 taken 3805316 times.
|
8680995 | element_ = element; |
340 | 8680995 | eIdx_ = gridGeometry().elementMapper().index(element); | |
341 | 8680995 | makeElementGeometries_(); | |
342 | 8680995 | } | |
343 | |||
344 | //! Returns true if bind/bindElement has already been called | ||
345 | bool isBound() const | ||
346 |
4/8✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
466 | { return static_cast<bool>(element_); } |
347 | |||
348 | //! The bound element | ||
349 | const Element& element() const | ||
350 | 80712578 | { return *element_; } | |
351 | |||
352 | //! The bound element's index in the grid view | ||
353 | GridIndexType elementIndex() const | ||
354 | { return eIdx_; } | ||
355 | |||
356 | //! The grid geometry we are a restriction of | ||
357 | ✗ | const GridGeometry& gridGeometry() const | |
358 |
11/11✓ Branch 0 taken 2480 times.
✓ Branch 1 taken 5954492 times.
✓ Branch 2 taken 3703579 times.
✓ Branch 3 taken 3867274 times.
✓ Branch 4 taken 5054302 times.
✓ Branch 5 taken 111503 times.
✓ Branch 6 taken 57806 times.
✓ Branch 7 taken 1211280 times.
✓ Branch 8 taken 144300 times.
✓ Branch 10 taken 12084 times.
✓ Branch 11 taken 6042 times.
|
55247198 | { return ggCache_->gridGeometry(); } |
359 | |||
360 | //! Returns whether one of the geometry's scvfs lies on a boundary | ||
361 | ✗ | bool hasBoundaryScvf() const | |
362 | ✗ | { return hasBoundaryScvf_; } | |
363 | |||
364 | //! Geometry of a sub control volume | ||
365 | 240 | typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const | |
366 | { | ||
367 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 240 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 240 times.
|
480 | assert(isBound()); |
368 | 480 | const auto geo = element().geometry(); | |
369 | 312 | return { Dune::GeometryTypes::cube(dim), GeometryHelper(geo).getScvCorners(scv.indexInElement()) }; | |
370 | } | ||
371 | |||
372 | //! Geometry of a sub control volume face | ||
373 | 36 | typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const | |
374 | { | ||
375 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 36 times.
|
72 | assert(isBound()); |
376 | 72 | const auto geo = element().geometry(); | |
377 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 12 times.
|
36 | const GeometryHelper geometryHelper(geo); |
378 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 12 times.
|
36 | if (scvf.boundary()) |
379 | { | ||
380 | 24 | const auto localBoundaryIndex = scvf.index() - geometryHelper.numInteriorScvf(); | |
381 | 24 | const auto& key = scvfBoundaryGeometryKeys_[localBoundaryIndex]; | |
382 | 72 | return { Dune::GeometryTypes::cube(dim-1), geometryHelper.getBoundaryScvfCorners(key[0], key[1]) }; | |
383 | } | ||
384 | else | ||
385 | 12 | return { Dune::GeometryTypes::cube(dim-1), geometryHelper.getScvfCorners(scvf.index()) }; | |
386 | } | ||
387 | |||
388 | private: | ||
389 | 8680995 | void makeElementGeometries_() | |
390 | { | ||
391 | 8680995 | hasBoundaryScvf_ = false; | |
392 | |||
393 | // get the element geometry | ||
394 | 8680995 | const auto& element = *element_; | |
395 | 8680995 | const auto elementGeometry = element.geometry(); | |
396 |
1/2✓ Branch 1 taken 3038349 times.
✗ Branch 2 not taken.
|
8680995 | const auto refElement = referenceElement(elementGeometry); |
397 | |||
398 | // get the sub control volume geometries of this element | ||
399 |
1/2✓ Branch 1 taken 3038349 times.
✗ Branch 2 not taken.
|
8680995 | GeometryHelper geometryHelper(elementGeometry); |
400 | |||
401 | // construct the sub control volumes | ||
402 |
2/4✓ Branch 1 taken 3038349 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3038349 times.
✗ Branch 5 not taken.
|
17361990 | scvs_.resize(elementGeometry.corners()); |
403 |
4/4✓ Branch 0 taken 29444354 times.
✓ Branch 1 taken 8680995 times.
✓ Branch 2 taken 29444354 times.
✓ Branch 3 taken 8680995 times.
|
76250698 | for (LocalIndexType scvLocalIdx = 0; scvLocalIdx < elementGeometry.corners(); ++scvLocalIdx) |
404 | { | ||
405 | // get associated dof index | ||
406 |
2/4✓ Branch 1 taken 12153396 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12153396 times.
✗ Branch 5 not taken.
|
58888708 | const auto dofIdxGlobal = gridGeometry().vertexMapper().subIndex(element, scvLocalIdx, dim); |
407 | |||
408 | // add scv to the local container | ||
409 |
1/2✓ Branch 1 taken 12153396 times.
✗ Branch 2 not taken.
|
30323426 | scvs_[scvLocalIdx] = SubControlVolume( |
410 | geometryHelper.getScvCorners(scvLocalIdx), | ||
411 | scvLocalIdx, | ||
412 | eIdx_, | ||
413 | dofIdxGlobal | ||
414 | ); | ||
415 | } | ||
416 | |||
417 | // construct the sub control volume faces | ||
418 |
1/2✓ Branch 1 taken 3038349 times.
✗ Branch 2 not taken.
|
8680995 | const auto numInnerScvf = geometryHelper.numInteriorScvf(); |
419 |
1/2✓ Branch 1 taken 3038349 times.
✗ Branch 2 not taken.
|
8680995 | scvfs_.resize(numInnerScvf); |
420 |
2/2✓ Branch 0 taken 421905 times.
✓ Branch 1 taken 8259090 times.
|
8680995 | scvfBoundaryGeometryKeys_.clear(); |
421 | |||
422 | 8680995 | LocalIndexType scvfLocalIdx = 0; | |
423 |
2/2✓ Branch 0 taken 26901616 times.
✓ Branch 1 taken 8680995 times.
|
35582611 | for (; scvfLocalIdx < numInnerScvf; ++scvfLocalIdx) |
424 | { | ||
425 | // find the local scv indices this scvf is connected to | ||
426 |
1/4✓ Branch 3 taken 26901616 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
107606464 | std::vector<LocalIndexType> localScvIndices({static_cast<LocalIndexType>(refElement.subEntity(scvfLocalIdx, dim-1, 0, dim)), |
427 |
1/2✓ Branch 2 taken 12154914 times.
✗ Branch 3 not taken.
|
26901616 | static_cast<LocalIndexType>(refElement.subEntity(scvfLocalIdx, dim-1, 1, dim))}); |
428 | |||
429 |
1/2✓ Branch 1 taken 26901616 times.
✗ Branch 2 not taken.
|
26901616 | const auto& corners = geometryHelper.getScvfCorners(scvfLocalIdx); |
430 |
4/5✗ Branch 2 not taken.
✓ Branch 3 taken 2420508 times.
✓ Branch 4 taken 24481108 times.
✓ Branch 5 taken 2420508 times.
✓ Branch 6 taken 24481108 times.
|
31742632 | scvfs_[scvfLocalIdx] = SubControlVolumeFace( |
431 | corners, | ||
432 | geometryHelper.normal(corners, localScvIndices), | ||
433 | element, | ||
434 | elementGeometry, | ||
435 | scvfLocalIdx, | ||
436 |
1/2✓ Branch 1 taken 2820014 times.
✗ Branch 2 not taken.
|
26901616 | std::move(localScvIndices), |
437 | false | ||
438 | ); | ||
439 | } | ||
440 | |||
441 | // construct the sub control volume faces on the domain boundary | ||
442 |
14/18✗ Branch 0 not taken.
✓ Branch 1 taken 3038349 times.
✓ Branch 2 taken 4725124 times.
✓ Branch 3 taken 14753296 times.
✓ Branch 4 taken 8802398 times.
✓ Branch 5 taken 40032 times.
✓ Branch 6 taken 681014 times.
✓ Branch 7 taken 160128 times.
✓ Branch 8 taken 18345121 times.
✓ Branch 9 taken 18655 times.
✓ Branch 10 taken 507742 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 526397 times.
✓ Branch 13 taken 671956 times.
✓ Branch 14 taken 13953802 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 2703806 times.
✗ Branch 17 not taken.
|
66946450 | for (const auto& intersection : intersections(gridGeometry().gridView(), element)) |
443 | { | ||
444 |
7/8✓ Branch 0 taken 14602765 times.
✓ Branch 1 taken 2749816 times.
✓ Branch 2 taken 12639005 times.
✓ Branch 3 taken 1020662 times.
✓ Branch 4 taken 464011 times.
✓ Branch 5 taken 800 times.
✓ Branch 6 taken 18655 times.
✗ Branch 7 not taken.
|
31248180 | if (intersection.boundary() && !intersection.neighbor()) |
445 | { | ||
446 |
2/4✓ Branch 1 taken 463211 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 235932 times.
✗ Branch 4 not taken.
|
2169981 | const auto isGeometry = intersection.geometry(); |
447 | 1489493 | hasBoundaryScvf_ = true; | |
448 | |||
449 |
4/4✓ Branch 0 taken 2941795 times.
✓ Branch 1 taken 1489493 times.
✓ Branch 2 taken 2941795 times.
✓ Branch 3 taken 1489493 times.
|
7373083 | for (unsigned int isScvfLocalIdx = 0; isScvfLocalIdx < isGeometry.corners(); ++isScvfLocalIdx) |
450 | { | ||
451 | // find the scv this scvf is connected to | ||
452 |
2/3✓ Branch 0 taken 445528 times.
✓ Branch 1 taken 446231 times.
✗ Branch 2 not taken.
|
5447279 | const LocalIndexType insideScvIdx = static_cast<LocalIndexType>(refElement.subEntity(intersection.indexInInside(), 1, isScvfLocalIdx, dim)); |
453 |
2/6✓ Branch 1 taken 918783 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 918783 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
8825385 | std::vector<LocalIndexType> localScvIndices = {insideScvIdx, insideScvIdx}; |
454 | |||
455 |
8/9✓ Branch 0 taken 469888 times.
✓ Branch 1 taken 2471907 times.
✓ Branch 2 taken 24360 times.
✓ Branch 3 taken 480805 times.
✓ Branch 4 taken 2436630 times.
✓ Branch 5 taken 48764 times.
✓ Branch 6 taken 455448 times.
✓ Branch 7 taken 2418928 times.
✗ Branch 8 not taken.
|
5496996 | scvfs_.emplace_back( |
456 | geometryHelper.getBoundaryScvfCorners(intersection.indexInInside(), isScvfLocalIdx), | ||
457 | intersection.centerUnitOuterNormal(), | ||
458 | intersection, | ||
459 | isGeometry, | ||
460 | isScvfLocalIdx, | ||
461 | scvfLocalIdx, | ||
462 | 2941795 | std::move(localScvIndices), | |
463 |
2/3✓ Branch 0 taken 24360 times.
✓ Branch 1 taken 943187 times.
✗ Branch 2 not taken.
|
2941795 | true |
464 | ); | ||
465 | |||
466 | ✗ | scvfBoundaryGeometryKeys_.emplace_back(std::array<LocalIndexType, 2>{{ | |
467 |
4/6✓ Branch 0 taken 445528 times.
✓ Branch 1 taken 2496267 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 474103 times.
✓ Branch 4 taken 2467692 times.
✗ Branch 5 not taken.
|
5447279 | static_cast<LocalIndexType>(intersection.indexInInside()), |
468 | static_cast<LocalIndexType>(isScvfLocalIdx) | ||
469 | }}); | ||
470 | |||
471 | // increment local counter | ||
472 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2941795 times.
|
2941795 | scvfLocalIdx++; |
473 | } | ||
474 | } | ||
475 | } | ||
476 | 8680995 | } | |
477 | |||
478 | //! The bound element | ||
479 | GridIndexType eIdx_; | ||
480 | std::optional<Element> element_; | ||
481 | |||
482 | //! The global geometry cache | ||
483 | const GGCache* ggCache_; | ||
484 | |||
485 | //! vectors to store the geometries locally after binding an element | ||
486 | std::vector<SubControlVolume> scvs_; | ||
487 | std::vector<SubControlVolumeFace> scvfs_; | ||
488 | std::vector<std::array<LocalIndexType, 2>> scvfBoundaryGeometryKeys_; | ||
489 | |||
490 | bool hasBoundaryScvf_ = false; | ||
491 | }; | ||
492 | |||
493 | } // end namespace Dumux | ||
494 | |||
495 | #endif | ||
496 |