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 CCMpfaDiscretization | ||
10 | * \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered mpfa models | ||
11 | * This builds up the sub control volumes and sub control volume faces | ||
12 | * for each element in the local scope we are restricting to, e.g. stencil or element. | ||
13 | */ | ||
14 | #ifndef DUMUX_DISCRETIZATION_CCMPFA_FV_ELEMENT_GEOMETRY_HH | ||
15 | #define DUMUX_DISCRETIZATION_CCMPFA_FV_ELEMENT_GEOMETRY_HH | ||
16 | |||
17 | #include <optional> | ||
18 | #include <utility> | ||
19 | |||
20 | #include <dune/common/exceptions.hh> | ||
21 | #include <dune/common/iteratorrange.hh> | ||
22 | #include <dune/geometry/type.hh> | ||
23 | |||
24 | #include <dumux/common/parameters.hh> | ||
25 | #include <dumux/common/indextraits.hh> | ||
26 | #include <dumux/discretization/scvandscvfiterators.hh> | ||
27 | |||
28 | namespace Dumux { | ||
29 | |||
30 | #ifndef DOXYGEN | ||
31 | namespace Detail::Mpfa { | ||
32 | |||
33 | template<typename GridGeometry, typename SubControlVolumeFace> | ||
34 | 16 | typename SubControlVolumeFace::Traits::Geometry makeScvfGeometry(const GridGeometry& gridGeometry, | |
35 | const SubControlVolumeFace& scvf) | ||
36 | { | ||
37 | static constexpr int dim = GridGeometry::GridView::dimension; | ||
38 | |||
39 | 16 | const auto& facetInfo = scvf.facetInfo(); | |
40 | 16 | const auto element = gridGeometry.element(facetInfo.elementIndex); | |
41 | 16 | const auto elemGeo = element.geometry(); | |
42 | 16 | const auto refElement = referenceElement(elemGeo); | |
43 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
|
56 | for (const auto& is : intersections(gridGeometry.gridView(), element)) |
44 | { | ||
45 |
4/4✓ Branch 0 taken 16 times.
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 24 times.
|
80 | if (is.indexInInside() == facetInfo.facetIndex) |
46 | { | ||
47 | 16 | const auto numCorners = is.geometry().corners(); | |
48 | 16 | const auto isPositions = GridGeometry::MpfaHelper::computeScvfCornersOnIntersection( | |
49 | 16 | elemGeo, refElement, facetInfo.facetIndex, numCorners | |
50 | ); | ||
51 | return { | ||
52 | Dune::GeometryTypes::cube(dim-1), | ||
53 | 48 | GridGeometry::MpfaHelper::getScvfCorners( | |
54 | 16 | isPositions, numCorners, facetInfo.facetCornerIndex | |
55 | ) | ||
56 | 16 | }; | |
57 | } | ||
58 | } | ||
59 | ✗ | DUNE_THROW(Dune::InvalidStateException, "Could not construct scvf geometry"); | |
60 | } | ||
61 | |||
62 | template<typename GridGeometry, typename SubControlVolumeFace> | ||
63 | 400 | auto getVertexCorner(const GridGeometry& gridGeometry, const SubControlVolumeFace& scvf) | |
64 | { | ||
65 | static constexpr int dim = GridGeometry::GridView::dimension; | ||
66 | |||
67 | 400 | const auto& facetInfo = scvf.facetInfo(); | |
68 | 400 | const auto element = gridGeometry.element(facetInfo.elementIndex); | |
69 | 400 | const auto elemGeo = element.geometry(); | |
70 | 400 | const auto refElement = referenceElement(elemGeo); | |
71 | return elemGeo.global(refElement.position( | ||
72 | 400 | refElement.subEntity(facetInfo.facetIndex, 1, facetInfo.facetCornerIndex, dim), | |
73 | dim | ||
74 | 400 | )); | |
75 | } | ||
76 | |||
77 | template<typename GridGeometry, typename SubControlVolumeFace> | ||
78 | 894 | auto getFacetCorner(const GridGeometry& gridGeometry, const SubControlVolumeFace& scvf) | |
79 | { | ||
80 | 894 | const auto& facetInfo = scvf.facetInfo(); | |
81 | 894 | const auto element = gridGeometry.element(facetInfo.elementIndex); | |
82 |
1/2✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
|
988 | const auto elemGeo = element.geometry(); |
83 |
1/2✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
|
894 | const auto refElement = referenceElement(elemGeo); |
84 | 1882 | return elemGeo.global(refElement.position(facetInfo.facetIndex, 1)); | |
85 | } | ||
86 | |||
87 | } // namespace Detail::Mpfa | ||
88 | #endif // DOXYGEN | ||
89 | |||
90 | /*! | ||
91 | * \ingroup CCMpfaDiscretization | ||
92 | * \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered mpfa models | ||
93 | * This builds up the sub control volumes and sub control volume faces | ||
94 | * for each element in the local scope we are restricting to, e.g. stencil or element. | ||
95 | * \tparam GG the finite volume grid geometry type | ||
96 | * \tparam enableGridGeometryCache if the grid geometry is cached or not | ||
97 | * \note This class is specialized for versions with and without caching the fv geometries on the grid view | ||
98 | */ | ||
99 | template<class GG, bool enableGridGeometryCache> | ||
100 | class CCMpfaFVElementGeometry; | ||
101 | |||
102 | /*! | ||
103 | * \ingroup CCMpfaDiscretization | ||
104 | * \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered mpfa models | ||
105 | * Specialization for grid caching enabled | ||
106 | * \note The finite volume geometries are stored in the corresponding FVGridGeometry | ||
107 | */ | ||
108 | template<class GG> | ||
109 |
22/59✓ Branch 0 taken 122 times.
✓ Branch 1 taken 6350570 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 1158772 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 216692 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 216353 times.
✓ Branch 22 taken 339 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 339 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 158 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 216353 times.
✓ Branch 32 taken 583053 times.
✓ Branch 33 taken 216353 times.
✓ Branch 34 taken 583053 times.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✓ Branch 40 taken 158 times.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✓ Branch 44 taken 159 times.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✓ Branch 48 taken 583053 times.
✗ Branch 49 not taken.
✓ Branch 50 taken 583053 times.
✗ Branch 51 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✓ Branch 57 taken 1 times.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
13907094 | class CCMpfaFVElementGeometry<GG, true> |
110 | { | ||
111 | using ThisType = CCMpfaFVElementGeometry<GG, true>; | ||
112 | using GridView = typename GG::GridView; | ||
113 | using GridIndexType = typename IndexTraits<GridView>::GridIndex; | ||
114 | |||
115 | static constexpr int dim = GridView::dimension; | ||
116 | static constexpr int dimWorld = GridView::dimensionworld; | ||
117 | |||
118 | public: | ||
119 | //! export type of the element | ||
120 | using Element = typename GridView::template Codim<0>::Entity; | ||
121 | //! export type of subcontrol volume | ||
122 | using SubControlVolume = typename GG::SubControlVolume; | ||
123 | //! export type of subcontrol volume face | ||
124 | using SubControlVolumeFace = typename GG::SubControlVolumeFace; | ||
125 | //! export type of finite volume grid geometry | ||
126 | using GridGeometry = GG; | ||
127 | //! the maximum number of scvs per element | ||
128 | static constexpr std::size_t maxNumElementScvs = 1; | ||
129 | //! the maximum number of scvfs per element (use cubes for maximum) | ||
130 | static constexpr std::size_t maxNumElementScvfs = dim == 3 ? 24 : 8; | ||
131 | |||
132 | //! Constructor | ||
133 | CCMpfaFVElementGeometry(const GridGeometry& gridGeometry) | ||
134 |
28/48✓ Branch 1 taken 107 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 107 times.
✓ Branch 5 taken 1283454 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 13 times.
✓ Branch 8 taken 1283454 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 13 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 5054062 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 5054062 times.
✓ Branch 17 taken 26 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 1159959 times.
✓ Branch 20 taken 26 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 1159959 times.
✓ Branch 23 taken 13056 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 216692 times.
✓ Branch 26 taken 13056 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 216692 times.
✓ Branch 29 taken 27 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 216511 times.
✓ Branch 32 taken 27 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 216511 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 583211 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 583211 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 160 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 160 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 583053 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 583053 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
|
25966804 | : gridGeometryPtr_(&gridGeometry) {} |
135 | |||
136 | //! Get an element sub control volume with a global scv index | ||
137 | const SubControlVolume& scv(GridIndexType scvIdx) const | ||
138 | { | ||
139 |
32/45✗ Branch 0 not taken.
✓ Branch 1 taken 769 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 768 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 764 times.
✓ Branch 12 taken 4 times.
✓ Branch 13 taken 580150 times.
✓ Branch 14 taken 9984 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 589370 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 240960 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 240960 times.
✓ Branch 23 taken 30020 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 375284 times.
✓ Branch 26 taken 30020 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 375284 times.
✗ Branch 29 not taken.
✓ Branch 35 taken 60230 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 60230 times.
✓ Branch 39 taken 579386 times.
✓ Branch 40 taken 339 times.
✓ Branch 41 taken 216014 times.
✓ Branch 42 taken 579725 times.
✓ Branch 43 taken 216014 times.
✓ Branch 44 taken 579725 times.
✓ Branch 45 taken 216014 times.
✓ Branch 46 taken 579725 times.
✓ Branch 47 taken 216014 times.
✓ Branch 48 taken 579386 times.
✓ Branch 49 taken 3660 times.
✓ Branch 50 taken 579386 times.
✗ Branch 51 not taken.
✓ Branch 52 taken 3660 times.
✓ Branch 53 taken 1166106 times.
✗ Branch 54 not taken.
✓ Branch 56 taken 1166106 times.
✗ Branch 57 not taken.
|
1773661400 | return gridGeometry().scv(scvIdx); |
140 | } | ||
141 | |||
142 | //! Get an element sub control volume face with a global scvf index | ||
143 | const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const | ||
144 | { | ||
145 |
76/84✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7480 times.
✓ Branch 3 taken 215600 times.
✓ Branch 4 taken 7472 times.
✓ Branch 5 taken 215608 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 768 times.
✓ Branch 8 taken 512 times.
✓ Branch 9 taken 28832 times.
✓ Branch 10 taken 1272 times.
✓ Branch 11 taken 28832 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 768 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 768 times.
✓ Branch 16 taken 21502192 times.
✓ Branch 17 taken 2835712 times.
✓ Branch 18 taken 21835888 times.
✓ Branch 19 taken 3216672 times.
✓ Branch 20 taken 111541968 times.
✓ Branch 21 taken 6212976 times.
✓ Branch 22 taken 111208008 times.
✓ Branch 23 taken 19590280 times.
✓ Branch 24 taken 504 times.
✓ Branch 25 taken 28832 times.
✓ Branch 26 taken 13740808 times.
✓ Branch 27 taken 93840 times.
✓ Branch 28 taken 10608 times.
✓ Branch 29 taken 93840 times.
✓ Branch 30 taken 14731376 times.
✓ Branch 31 taken 10626902 times.
✓ Branch 32 taken 14731376 times.
✓ Branch 33 taken 10626902 times.
✓ Branch 34 taken 45396686 times.
✓ Branch 35 taken 5295610 times.
✓ Branch 36 taken 45535902 times.
✓ Branch 37 taken 5590666 times.
✓ Branch 38 taken 139216 times.
✓ Branch 39 taken 295056 times.
✓ Branch 40 taken 4524676 times.
✓ Branch 41 taken 10695088 times.
✓ Branch 42 taken 9159764 times.
✓ Branch 43 taken 15330176 times.
✓ Branch 44 taken 5551004 times.
✓ Branch 45 taken 6069048 times.
✓ Branch 46 taken 915916 times.
✓ Branch 47 taken 3897276 times.
✓ Branch 48 taken 2987404 times.
✓ Branch 49 taken 5547136 times.
✓ Branch 50 taken 71718122 times.
✓ Branch 51 taken 70762686 times.
✓ Branch 52 taken 88425078 times.
✓ Branch 53 taken 68525802 times.
✓ Branch 54 taken 19854214 times.
✓ Branch 55 taken 16771663 times.
✓ Branch 56 taken 159854 times.
✓ Branch 57 taken 2340795 times.
✓ Branch 58 taken 13730200 times.
✓ Branch 59 taken 146268 times.
✓ Branch 60 taken 6948696 times.
✓ Branch 61 taken 1107436 times.
✓ Branch 62 taken 6948696 times.
✓ Branch 63 taken 1205996 times.
✓ Branch 64 taken 18072 times.
✓ Branch 65 taken 117608 times.
✓ Branch 66 taken 4514592 times.
✓ Branch 67 taken 186952 times.
✓ Branch 68 taken 4664896 times.
✓ Branch 69 taken 186952 times.
✓ Branch 70 taken 168376 times.
✓ Branch 71 taken 19048 times.
✗ Branch 72 not taken.
✓ Branch 73 taken 1380 times.
✗ Branch 74 not taken.
✓ Branch 75 taken 1380 times.
✗ Branch 76 not taken.
✓ Branch 77 taken 15776 times.
✗ Branch 78 not taken.
✓ Branch 79 taken 15776 times.
✓ Branch 82 taken 74520 times.
✓ Branch 83 taken 8424 times.
✓ Branch 84 taken 74520 times.
✓ Branch 85 taken 8424 times.
|
3034435532 | return gridGeometry().scvf(scvfIdx); |
146 | } | ||
147 | |||
148 | //! Get the scvf on the same face but from the other side | ||
149 | //! Note that e.g. the normals might be different in the case of surface grids | ||
150 | const SubControlVolumeFace& flipScvf(GridIndexType scvfIdx, unsigned int outsideScvIdx = 0) const | ||
151 | { | ||
152 | 179304916 | return gridGeometry().flipScvf(scvfIdx, outsideScvIdx); | |
153 | } | ||
154 | |||
155 | //! iterator range for sub control volumes. Iterates over | ||
156 | //! all scvs of the bound element (not including neighbor scvs) | ||
157 | //! This is a free function found by means of ADL | ||
158 | //! To iterate over all sub control volumes of this FVElementGeometry use | ||
159 | //! for (auto&& scv : scvs(fvGeometry)) | ||
160 | friend inline Dune::IteratorRange< ScvIterator<SubControlVolume, std::array<GridIndexType, 1>, ThisType> > | ||
161 | scvs(const CCMpfaFVElementGeometry& fvGeometry) | ||
162 | { | ||
163 | using ScvIterator = Dumux::ScvIterator<SubControlVolume, std::array<GridIndexType, 1>, ThisType>; | ||
164 | 73080252 | return Dune::IteratorRange<ScvIterator>(ScvIterator(fvGeometry.scvIndices_.begin(), fvGeometry), | |
165 | 109620378 | ScvIterator(fvGeometry.scvIndices_.end(), fvGeometry)); | |
166 | } | ||
167 | |||
168 | //! iterator range for sub control volumes faces. Iterates over | ||
169 | //! all scvfs of the bound element (not including neighbor scvfs) | ||
170 | //! This is a free function found by means of ADL | ||
171 | //! To iterate over all sub control volume faces of this FVElementGeometry use | ||
172 | //! for (auto&& scvf : scvfs(fvGeometry)) | ||
173 | friend inline Dune::IteratorRange< ScvfIterator<SubControlVolumeFace, std::vector<GridIndexType>, ThisType> > | ||
174 | scvfs(const CCMpfaFVElementGeometry& fvGeometry) | ||
175 | { | ||
176 | 48214218 | const auto& g = fvGeometry.gridGeometry(); | |
177 | 48214218 | const auto scvIdx = fvGeometry.scvIndices_[0]; | |
178 | using ScvfIterator = Dumux::ScvfIterator<SubControlVolumeFace, std::vector<GridIndexType>, ThisType>; | ||
179 | 48214218 | return Dune::IteratorRange<ScvfIterator>(ScvfIterator(g.scvfIndicesOfScv(scvIdx).begin(), fvGeometry), | |
180 | 192856873 | ScvfIterator(g.scvfIndicesOfScv(scvIdx).end(), fvGeometry)); | |
181 | } | ||
182 | |||
183 | //! number of sub control volumes in this fv element geometry | ||
184 | ✗ | std::size_t numScv() const | |
185 | { | ||
186 |
2/4✓ Branch 0 taken 5033024 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10033024 times.
✗ Branch 3 not taken.
|
34912160 | return scvIndices_.size(); |
187 | } | ||
188 | |||
189 | //! number of sub control volumes in this fv element geometry | ||
190 | std::size_t numScvf() const | ||
191 | { | ||
192 |
6/14✗ Branch 0 not taken.
✓ Branch 1 taken 27500 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 27500 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 27500 times.
✓ Branch 7 taken 27500 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 27500 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 27500 times.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
1820658 | return gridGeometry().scvfIndicesOfScv(scvIndices_[0]).size(); |
193 | } | ||
194 | |||
195 | /*! | ||
196 | * \brief bind the local view (r-value overload) | ||
197 | * This overload is called when an instance of this class is a temporary in the usage context | ||
198 | * This allows a usage like this: `const auto view = localView(...).bind(element);` | ||
199 | */ | ||
200 | CCMpfaFVElementGeometry bind(const Element& element) && | ||
201 | { | ||
202 |
1/2✓ Branch 1 taken 339 times.
✗ Branch 2 not taken.
|
343 | this->bindElement(element); |
203 |
2/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
347 | return std::move(*this); |
204 | } | ||
205 | |||
206 | void bind(const Element& element) & | ||
207 | { | ||
208 |
3/5✓ Branch 1 taken 256 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 256 times.
✓ Branch 5 taken 651133 times.
✗ Branch 6 not taken.
|
11991788 | this->bindElement(element); |
209 | } | ||
210 | |||
211 | /*! | ||
212 | * \brief bind the local view (r-value overload) | ||
213 | * This overload is called when an instance of this class is a temporary in the usage context | ||
214 | * This allows a usage like this: `const auto view = localView(...).bindElement(element);` | ||
215 | */ | ||
216 | CCMpfaFVElementGeometry bindElement(const Element& element) && | ||
217 | { | ||
218 |
2/4✓ Branch 1 taken 432706 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1166106 times.
✗ Branch 5 not taken.
|
5470960 | this->bindElement(element); |
219 |
2/4✓ Branch 0 taken 3861780 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10368 times.
✗ Branch 3 not taken.
|
9343108 | return std::move(*this); |
220 | } | ||
221 | |||
222 | //! Bind only element-local | ||
223 | 18951432 | void bindElement(const Element& element) & | |
224 | { | ||
225 |
2/2✓ Branch 0 taken 3991376 times.
✓ Branch 1 taken 10224873 times.
|
18951432 | element_ = element; |
226 | 37902864 | scvIndices_[0] = gridGeometry().elementMapper().index(element); | |
227 | 18951432 | } | |
228 | |||
229 | //! Returns true if bind/bindElement has already been called | ||
230 | bool isBound() const | ||
231 |
2/4✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
2 | { return static_cast<bool>(element_); } |
232 | |||
233 | //! The bound element | ||
234 | const Element& element() const | ||
235 | 10066050 | { return *element_; } | |
236 | |||
237 | //! The global finite volume geometry we are a restriction of | ||
238 | ✗ | const GridGeometry& gridGeometry() const | |
239 | ✗ | { return *gridGeometryPtr_; } | |
240 | |||
241 | //! Returns whether one of the geometry's scvfs lies on a boundary | ||
242 | bool hasBoundaryScvf() const | ||
243 |
6/6✓ Branch 0 taken 1007159 times.
✓ Branch 1 taken 291072 times.
✓ Branch 2 taken 1007159 times.
✓ Branch 3 taken 291072 times.
✓ Branch 4 taken 1007159 times.
✓ Branch 5 taken 291072 times.
|
3894693 | { return gridGeometry().hasBoundaryScvf(scvIndices_[0]); } |
244 | |||
245 | //! Create the geometry of a given sub control volume | ||
246 | ✗ | typename Element::Geometry geometry(const SubControlVolume& scv) const | |
247 | ✗ | { return gridGeometryPtr_->element(scv.dofIndex()).geometry(); } | |
248 | |||
249 | //! Create the geometry of a given sub control volume face | ||
250 | typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const | ||
251 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | { return Detail::Mpfa::makeScvfGeometry(gridGeometry(), scvf); } |
252 | |||
253 | //! Return the position of the scvf corner that coincides with an element vertex | ||
254 | typename SubControlVolumeFace::Traits::GlobalPosition vertexCorner(const SubControlVolumeFace& scvf) const | ||
255 | { return Detail::Mpfa::getVertexCorner(gridGeometry(), scvf); } | ||
256 | |||
257 | //! Return the corner of the scvf that is inside the facet the scvf is embedded in | ||
258 | typename SubControlVolumeFace::Traits::GlobalPosition facetCorner(const SubControlVolumeFace& scvf) const | ||
259 | ✗ | { return Detail::Mpfa::getFacetCorner(gridGeometry(), scvf); } | |
260 | |||
261 | private: | ||
262 | |||
263 | std::optional<Element> element_; | ||
264 | std::array<GridIndexType, 1> scvIndices_; | ||
265 | const GridGeometry* gridGeometryPtr_; | ||
266 | }; | ||
267 | |||
268 | /*! | ||
269 | * \ingroup CCMpfaDiscretization | ||
270 | * \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered TPFA models | ||
271 | * Specialization for grid caching disabled | ||
272 | */ | ||
273 | template<class GG> | ||
274 | class CCMpfaFVElementGeometry<GG, false> | ||
275 | { | ||
276 | using ThisType = CCMpfaFVElementGeometry<GG, false>; | ||
277 | using GridView = typename GG::GridView; | ||
278 | using GridIndexType = typename IndexTraits<GridView>::GridIndex; | ||
279 | using MpfaHelper = typename GG::MpfaHelper; | ||
280 | |||
281 | static constexpr int dim = GridView::dimension; | ||
282 | static constexpr int dimWorld = GridView::dimensionworld; | ||
283 | using CoordScalar = typename GridView::ctype; | ||
284 | |||
285 | public: | ||
286 | //! export type of the element | ||
287 | using Element = typename GridView::template Codim<0>::Entity; | ||
288 | //! export type of subcontrol volume | ||
289 | using SubControlVolume = typename GG::SubControlVolume; | ||
290 | //! export type of subcontrol volume face | ||
291 | using SubControlVolumeFace = typename GG::SubControlVolumeFace; | ||
292 | //! export type of finite volume grid geometries | ||
293 | using GridGeometry = GG; | ||
294 | //! the maximum number of scvs per element | ||
295 | static constexpr std::size_t maxNumElementScvs = 1; | ||
296 | //! the maximum number of scvfs per element (use cubes for maximum) | ||
297 | static constexpr std::size_t maxNumElementScvfs = dim == 3 ? 24 : 8; | ||
298 | |||
299 | //! Constructor | ||
300 | CCMpfaFVElementGeometry(const GridGeometry& gridGeometry) | ||
301 |
87/168✗ Branch 0 not taken.
✓ Branch 1 taken 122 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 120 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 122 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
✓ Branch 10 taken 120 times.
✓ Branch 11 taken 2 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 122 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 2 times.
✓ Branch 16 taken 120 times.
✓ Branch 17 taken 2 times.
✓ Branch 19 taken 125 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 125 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 125 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 103 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 103 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 103 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 103 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 103 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 103 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 100 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 100 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 100 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 139643 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 139643 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 139643 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 139643 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 139643 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 139643 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 139644 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 139644 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 139644 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 225332 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 225332 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 225332 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 225332 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 225332 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 225332 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 290705 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 290705 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 290705 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 71253 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 71253 times.
✗ Branch 113 not taken.
✓ Branch 115 taken 71253 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 71253 times.
✗ Branch 119 not taken.
✓ Branch 121 taken 71253 times.
✗ Branch 122 not taken.
✓ Branch 124 taken 71253 times.
✗ Branch 125 not taken.
✓ Branch 127 taken 5879 times.
✗ Branch 128 not taken.
✓ Branch 130 taken 5879 times.
✗ Branch 131 not taken.
✓ Branch 133 taken 5879 times.
✗ Branch 134 not taken.
✓ Branch 136 taken 50002 times.
✗ Branch 137 not taken.
✓ Branch 139 taken 50002 times.
✗ Branch 140 not taken.
✓ Branch 142 taken 50002 times.
✗ Branch 143 not taken.
✓ Branch 145 taken 50002 times.
✗ Branch 146 not taken.
✓ Branch 148 taken 50002 times.
✗ Branch 149 not taken.
✓ Branch 151 taken 50002 times.
✗ Branch 152 not taken.
✓ Branch 154 taken 50000 times.
✗ Branch 155 not taken.
✓ Branch 157 taken 50000 times.
✗ Branch 158 not taken.
✓ Branch 160 taken 50000 times.
✗ Branch 161 not taken.
✓ Branch 163 taken 964000 times.
✗ Branch 164 not taken.
✓ Branch 166 taken 964000 times.
✗ Branch 167 not taken.
✓ Branch 169 taken 964000 times.
✗ Branch 170 not taken.
✓ Branch 172 taken 964000 times.
✗ Branch 173 not taken.
✓ Branch 175 taken 964000 times.
✗ Branch 176 not taken.
✓ Branch 178 taken 964000 times.
✗ Branch 179 not taken.
✓ Branch 181 taken 964000 times.
✗ Branch 182 not taken.
✓ Branch 184 taken 964000 times.
✗ Branch 185 not taken.
✓ Branch 187 taken 964000 times.
✗ Branch 188 not taken.
✓ Branch 190 taken 100 times.
✗ Branch 191 not taken.
✓ Branch 193 taken 100 times.
✗ Branch 194 not taken.
✓ Branch 196 taken 100 times.
✗ Branch 197 not taken.
✓ Branch 199 taken 100 times.
✗ Branch 200 not taken.
✓ Branch 202 taken 100 times.
✗ Branch 203 not taken.
✓ Branch 205 taken 100 times.
✗ Branch 206 not taken.
✓ Branch 208 taken 100 times.
✗ Branch 209 not taken.
✓ Branch 211 taken 100 times.
✗ Branch 212 not taken.
✓ Branch 214 taken 100 times.
✗ Branch 215 not taken.
✓ Branch 217 taken 1 times.
✗ Branch 218 not taken.
✓ Branch 220 taken 1 times.
✗ Branch 221 not taken.
✓ Branch 223 taken 1 times.
✗ Branch 224 not taken.
✓ Branch 226 taken 1 times.
✗ Branch 227 not taken.
✓ Branch 229 taken 1 times.
✗ Branch 230 not taken.
✓ Branch 232 taken 1 times.
✗ Branch 233 not taken.
✓ Branch 235 taken 1 times.
✗ Branch 236 not taken.
✓ Branch 238 taken 1 times.
✗ Branch 239 not taken.
✓ Branch 241 taken 1 times.
✗ Branch 242 not taken.
|
13058424 | : gridGeometryPtr_(&gridGeometry) {} |
302 | |||
303 | //! Get an element sub control volume with a global scv index | ||
304 | //! We separate element and neighbor scvs to speed up mapping | ||
305 | const SubControlVolume& scv(GridIndexType scvIdx) const | ||
306 | { | ||
307 |
102/108✓ Branch 0 taken 2029208 times.
✓ Branch 1 taken 5754144 times.
✓ Branch 2 taken 2029208 times.
✓ Branch 3 taken 5754144 times.
✓ Branch 4 taken 7594902 times.
✓ Branch 5 taken 18992899 times.
✓ Branch 6 taken 7594902 times.
✓ Branch 7 taken 18992899 times.
✓ Branch 8 taken 4607169 times.
✓ Branch 9 taken 13364640 times.
✓ Branch 10 taken 4607169 times.
✓ Branch 11 taken 13364640 times.
✓ Branch 12 taken 1222324 times.
✓ Branch 13 taken 3303654 times.
✓ Branch 14 taken 1222324 times.
✓ Branch 15 taken 3303654 times.
✓ Branch 16 taken 7370376 times.
✓ Branch 17 taken 19139838 times.
✓ Branch 18 taken 7370376 times.
✓ Branch 19 taken 19139838 times.
✓ Branch 20 taken 5490480 times.
✓ Branch 21 taken 16083722 times.
✓ Branch 22 taken 5490480 times.
✓ Branch 23 taken 16083722 times.
✓ Branch 24 taken 275116 times.
✓ Branch 25 taken 308848 times.
✓ Branch 26 taken 275116 times.
✓ Branch 27 taken 308848 times.
✓ Branch 28 taken 3813734 times.
✓ Branch 29 taken 10311972 times.
✓ Branch 30 taken 3813734 times.
✓ Branch 31 taken 10311972 times.
✓ Branch 32 taken 3219582 times.
✓ Branch 33 taken 9733603 times.
✓ Branch 34 taken 3219582 times.
✓ Branch 35 taken 9733603 times.
✓ Branch 36 taken 4328732 times.
✓ Branch 37 taken 16865028 times.
✓ Branch 38 taken 4328732 times.
✓ Branch 39 taken 16865028 times.
✓ Branch 40 taken 768912 times.
✓ Branch 41 taken 1327270 times.
✓ Branch 42 taken 768912 times.
✓ Branch 43 taken 1327270 times.
✓ Branch 44 taken 1077780 times.
✓ Branch 45 taken 814300 times.
✓ Branch 46 taken 1077780 times.
✓ Branch 47 taken 814300 times.
✓ Branch 48 taken 2285971 times.
✓ Branch 49 taken 2518383 times.
✓ Branch 50 taken 2285971 times.
✓ Branch 51 taken 2518383 times.
✓ Branch 52 taken 101887 times.
✓ Branch 53 taken 13289313 times.
✓ Branch 54 taken 101887 times.
✓ Branch 55 taken 13289313 times.
✓ Branch 56 taken 256034 times.
✓ Branch 57 taken 244704 times.
✓ Branch 58 taken 256034 times.
✓ Branch 59 taken 244704 times.
✓ Branch 60 taken 717444 times.
✓ Branch 61 taken 1693394 times.
✓ Branch 62 taken 717444 times.
✓ Branch 63 taken 1693394 times.
✓ Branch 64 taken 376770 times.
✓ Branch 65 taken 715850 times.
✓ Branch 66 taken 376770 times.
✓ Branch 67 taken 715850 times.
✓ Branch 68 taken 104628 times.
✓ Branch 69 taken 646260 times.
✓ Branch 70 taken 104628 times.
✓ Branch 71 taken 646260 times.
✓ Branch 72 taken 161928 times.
✓ Branch 73 taken 66300 times.
✓ Branch 74 taken 161928 times.
✓ Branch 75 taken 66300 times.
✓ Branch 76 taken 1457344 times.
✓ Branch 77 taken 426772 times.
✓ Branch 78 taken 1457344 times.
✓ Branch 79 taken 426772 times.
✓ Branch 80 taken 160112 times.
✓ Branch 81 taken 760448 times.
✓ Branch 82 taken 160112 times.
✓ Branch 83 taken 760448 times.
✓ Branch 84 taken 161112 times.
✓ Branch 85 taken 262192 times.
✓ Branch 86 taken 161112 times.
✓ Branch 87 taken 262192 times.
✓ Branch 88 taken 5304 times.
✓ Branch 89 taken 5448 times.
✓ Branch 90 taken 5304 times.
✓ Branch 91 taken 5448 times.
✓ Branch 92 taken 10696 times.
✗ Branch 93 not taken.
✓ Branch 94 taken 10696 times.
✗ Branch 95 not taken.
✓ Branch 96 taken 13056 times.
✓ Branch 97 taken 97376 times.
✓ Branch 98 taken 13056 times.
✓ Branch 99 taken 97376 times.
✗ Branch 100 not taken.
✓ Branch 101 taken 96424 times.
✗ Branch 102 not taken.
✓ Branch 103 taken 96424 times.
✓ Branch 104 taken 13440 times.
✗ Branch 105 not taken.
✓ Branch 106 taken 13440 times.
✗ Branch 107 not taken.
|
368893646 | if (scvIdx == scvIndices_[0]) |
308 | 95214390 | return scvs_[0]; | |
309 | else | ||
310 | 136798078 | return neighborScvs_[findLocalIndex(scvIdx, neighborScvIndices_)]; | |
311 | } | ||
312 | |||
313 | //! Get an element sub control volume face with a global scvf index | ||
314 | //! We separate element and neighbor scvfs to speed up mapping | ||
315 | 352073666 | const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const | |
316 | { | ||
317 | 1056220998 | auto it = std::find(scvfIndices_.begin(), scvfIndices_.end(), scvfIdx); | |
318 |
6/6✓ Branch 0 taken 76025836 times.
✓ Branch 1 taken 276047830 times.
✓ Branch 2 taken 76025836 times.
✓ Branch 3 taken 276047830 times.
✓ Branch 4 taken 76025836 times.
✓ Branch 5 taken 276047830 times.
|
1056220998 | if (it != scvfIndices_.end()) |
319 | 304103344 | return scvfs_[std::distance(scvfIndices_.begin(), it)]; | |
320 | else | ||
321 | 276047830 | return neighborScvfs_[findLocalIndex(scvfIdx, neighborScvfIndices_)]; | |
322 | } | ||
323 | |||
324 | //! Get the scvf on the same face but from the other side | ||
325 | //! Note that e.g. the normals might be different in the case of surface grids | ||
326 | const SubControlVolumeFace& flipScvf(GridIndexType scvfIdx, unsigned int outsideScvIdx = 0) const | ||
327 | { | ||
328 | 38249300 | return scvf( gridGeometry().flipScvfIdx(scvfIdx, outsideScvIdx) ); | |
329 | } | ||
330 | |||
331 | //! iterator range for sub control volumes. Iterates over | ||
332 | //! all scvs of the bound element (not including neighbor scvs) | ||
333 | //! This is a free function found by means of ADL | ||
334 | //! To iterate over all sub control volumes of this FVElementGeometry use | ||
335 | //! for (auto&& scv : scvs(fvGeometry)) | ||
336 | friend inline Dune::IteratorRange<typename std::array<SubControlVolume, 1>::const_iterator> | ||
337 | scvs(const ThisType& g) | ||
338 | { | ||
339 | using IteratorType = typename std::array<SubControlVolume, 1>::const_iterator; | ||
340 |
5/8✗ Branch 0 not taken.
✓ Branch 1 taken 92 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 91 times.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 91 times.
✗ Branch 8 not taken.
|
18783948 | return Dune::IteratorRange<IteratorType>(g.scvs_.begin(), g.scvs_.end()); |
341 | } | ||
342 | |||
343 | //! iterator range for sub control volumes faces. Iterates over | ||
344 | //! all scvfs of the bound element (not including neighbor scvfs) | ||
345 | //! This is a free function found by means of ADL | ||
346 | //! To iterate over all sub control volume faces of this FVElementGeometry use | ||
347 | //! for (auto&& scvf : scvfs(fvGeometry)) | ||
348 | friend inline Dune::IteratorRange<typename std::vector<SubControlVolumeFace>::const_iterator> | ||
349 | scvfs(const ThisType& g) | ||
350 | { | ||
351 | using IteratorType = typename std::vector<SubControlVolumeFace>::const_iterator; | ||
352 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
24633882 | return Dune::IteratorRange<IteratorType>(g.scvfs_.begin(), g.scvfs_.end()); |
353 | } | ||
354 | |||
355 | //! number of sub control volumes in this fv element geometry | ||
356 | ✗ | std::size_t numScv() const | |
357 |
2/4✓ Branch 0 taken 33024 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33024 times.
✗ Branch 3 not taken.
|
6264264 | { return scvs_.size(); } |
358 | |||
359 | //! number of sub control volumes in this fv element geometry | ||
360 | std::size_t numScvf() const | ||
361 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 300 times.
✓ Branch 2 taken 2592 times.
✓ Branch 3 taken 300 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1472785 | { return scvfs_.size(); } |
362 | |||
363 | /*! | ||
364 | * \brief bind the local view (r-value overload) | ||
365 | * This overload is called when an instance of this class is a temporary in the usage context | ||
366 | * This allows a usage like this: `const auto view = localView(...).bindElement(element);` | ||
367 | */ | ||
368 | CCMpfaFVElementGeometry bindElement(const Element& element) && | ||
369 | { | ||
370 |
1/2✓ Branch 1 taken 91 times.
✗ Branch 2 not taken.
|
91 | this->bindElement_(element); |
371 | 91 | return std::move(*this); | |
372 | } | ||
373 | |||
374 | void bindElement(const Element& element) & | ||
375 | { | ||
376 |
5/10✓ Branch 1 taken 82745 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 66482 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 37704 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 10896 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 17784 times.
✗ Branch 14 not taken.
|
215611 | this->bindElement_(element); |
377 | } | ||
378 | |||
379 | /*! | ||
380 | * \brief bind the local view (r-value overload) | ||
381 | * This overload is called when an instance of this class is a temporary in the usage context | ||
382 | * This allows a usage like this: `const auto view = localView(...).bind(element);` | ||
383 | */ | ||
384 | CCMpfaFVElementGeometry bind(const Element& element) && | ||
385 | { | ||
386 |
3/6✓ Branch 1 taken 3503 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 50000 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 100 times.
✗ Branch 8 not taken.
|
53603 | this->bind_(element); |
387 | 53603 | return std::move(*this); | |
388 | } | ||
389 | |||
390 | void bind(const Element& element) & | ||
391 | { | ||
392 |
6/10✓ Branch 1 taken 2729 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 100 times.
✓ Branch 5 taken 12812 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 164 times.
✓ Branch 9 taken 200 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1928 times.
✗ Branch 13 not taken.
|
1414439 | this->bind_(element); |
393 | } | ||
394 | |||
395 | //! Returns true if bind/bindElement has already been called | ||
396 | bool isBound() const | ||
397 |
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.
|
2 | { return static_cast<bool>(element_); } |
398 | |||
399 | //! The bound element | ||
400 | const Element& element() const | ||
401 | 66050 | { return *element_; } | |
402 | |||
403 | //! The global finite volume geometry we are a restriction of | ||
404 | ✗ | const GridGeometry& gridGeometry() const | |
405 | ✗ | { return *gridGeometryPtr_; } | |
406 | |||
407 | //! Returns whether one of the geometry's scvfs lies on a boundary | ||
408 | ✗ | bool hasBoundaryScvf() const | |
409 | ✗ | { return hasBoundaryScvf_; } | |
410 | |||
411 | //! Create the geometry of a given sub control volume | ||
412 | ✗ | typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const | |
413 | ✗ | { return gridGeometryPtr_->element(scv.dofIndex()).geometry(); } | |
414 | |||
415 | //! Create the geometry of a given sub control volume face | ||
416 | typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const | ||
417 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | { return Detail::Mpfa::makeScvfGeometry(gridGeometry(), scvf); } |
418 | |||
419 | //! Return the position of the scvf corner that coincides with an element vertex | ||
420 | typename SubControlVolumeFace::Traits::GlobalPosition vertexCorner(const SubControlVolumeFace& scvf) const | ||
421 | 400 | { return Detail::Mpfa::getVertexCorner(gridGeometry(), scvf); } | |
422 | |||
423 | //! Return the corner of the scvf that is inside the facet the scvf is embedded in | ||
424 | typename SubControlVolumeFace::Traits::GlobalPosition facetCorner(const SubControlVolumeFace& scvf) const | ||
425 |
1/2✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
|
494 | { return Detail::Mpfa::getFacetCorner(gridGeometry(), scvf); } |
426 | |||
427 | private: | ||
428 | |||
429 | //! Binding of an element preparing the geometries of the whole stencil | ||
430 | //! called by the local assembler to prepare element assembly | ||
431 | 1468042 | void bind_(const Element& element) | |
432 | { | ||
433 | // make inside geometries | ||
434 | 1468042 | bindElement_(element); | |
435 | |||
436 | // get some references for convenience | ||
437 | 2936084 | const auto globalI = gridGeometry().elementMapper().index(element); | |
438 | 1468042 | const auto& assemblyMapI = gridGeometry().connectivityMap()[globalI]; | |
439 | |||
440 | // reserve memory | ||
441 | 1468042 | const auto numNeighbors = assemblyMapI.size(); | |
442 | 2936084 | const auto numNeighborScvfs = numNeighborScvfs_(assemblyMapI); | |
443 | 1468042 | neighborScvs_.reserve(numNeighbors); | |
444 | 1468042 | neighborScvIndices_.reserve(numNeighbors); | |
445 | 1468042 | neighborScvfIndices_.reserve(numNeighborScvfs); | |
446 | 1468042 | neighborScvfs_.reserve(numNeighborScvfs); | |
447 | |||
448 | // make neighbor geometries | ||
449 | // use the assembly map to determine which faces are necessary | ||
450 |
4/4✓ Branch 0 taken 15403387 times.
✓ Branch 1 taken 1468042 times.
✓ Branch 2 taken 15403387 times.
✓ Branch 3 taken 1468042 times.
|
35210900 | for (const auto& dataJ : assemblyMapI) |
451 |
1/2✓ Branch 1 taken 14412835 times.
✗ Branch 2 not taken.
|
15403387 | makeNeighborGeometries(gridGeometry().element(dataJ.globalJ), |
452 | 15403387 | dataJ.globalJ, | |
453 | 15403387 | dataJ.scvfsJ, | |
454 | 15403387 | dataJ.additionalScvfs); | |
455 | |||
456 | // //! TODO Check if user added additional DOF dependencies, i.e. the residual of DOF globalI depends | ||
457 | // //! on additional DOFs not included in the discretization schemes' occupation pattern | ||
458 | // const auto& additionalDofDependencies = problem.getAdditionalDofDependencies(globalI); | ||
459 | // if (!additionalDofDependencies.empty()) | ||
460 | // { | ||
461 | // const auto newNumNeighbors = neighborScvs_.size() + additionalDofDependencies.size(); | ||
462 | // neighborScvs_.reserve(newNumNeighbors); | ||
463 | // neighborScvIndices_.reserve(newNumNeighbors); | ||
464 | // for (auto globalJ : additionalDofDependencies) | ||
465 | // { | ||
466 | // neighborScvs_.emplace_back(gridGeometry().element(globalJ).geometry(), globalJ); | ||
467 | // neighborScvIndices_.emplace_back(globalJ); | ||
468 | // } | ||
469 | // } | ||
470 | 1468042 | } | |
471 | |||
472 | //! Binding of an element preparing the geometries only inside the element | ||
473 | 1683744 | void bindElement_(const Element& element) | |
474 | { | ||
475 | 1683744 | clear(); | |
476 |
2/2✓ Branch 0 taken 64635 times.
✓ Branch 1 taken 166034 times.
|
1683744 | element_ = element; |
477 | 1683744 | makeElementGeometries(element); | |
478 | 1683744 | } | |
479 | |||
480 | //! Computes the number of neighboring scvfs that have to be prepared | ||
481 | template<class DataJContainer> | ||
482 | ✗ | std::size_t numNeighborScvfs_(const DataJContainer& dataJContainer) | |
483 | { | ||
484 | 1468042 | std::size_t numNeighborScvfs = 0; | |
485 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 15403387 times.
✓ Branch 5 taken 1468042 times.
✓ Branch 6 taken 15403387 times.
✓ Branch 7 taken 1468042 times.
|
35210900 | for (const auto& dataJ : dataJContainer) |
486 | 46210161 | numNeighborScvfs += dataJ.scvfsJ.size() + dataJ.additionalScvfs.size(); | |
487 | ✗ | return numNeighborScvfs; | |
488 | } | ||
489 | |||
490 | //! create scvs and scvfs of the bound element | ||
491 | 1683744 | void makeElementGeometries(const Element& element) | |
492 | { | ||
493 | // make the scv | ||
494 | 3367488 | const auto eIdx = gridGeometry().elementMapper().index(element); | |
495 |
2/2✓ Branch 2 taken 1453091 times.
✓ Branch 3 taken 230653 times.
|
2097327 | scvs_[0] = SubControlVolume(element.geometry(), eIdx); |
496 |
2/2✓ Branch 0 taken 29 times.
✓ Branch 1 taken 1683715 times.
|
1683744 | scvIndices_[0] = eIdx; |
497 | |||
498 | // get data on the scv faces | ||
499 |
2/2✓ Branch 0 taken 29 times.
✓ Branch 1 taken 1683715 times.
|
1683744 | const auto& scvFaceIndices = gridGeometry().scvfIndicesOfScv(eIdx); |
500 |
2/2✓ Branch 0 taken 29 times.
✓ Branch 1 taken 1683715 times.
|
1683744 | const auto& neighborVolVarIndices = gridGeometry().neighborVolVarIndices(eIdx); |
501 | |||
502 | // the quadrature point parameterizaion to be used on scvfs | ||
503 |
4/6✓ Branch 0 taken 29 times.
✓ Branch 1 taken 1683715 times.
✓ Branch 3 taken 29 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 29 times.
✗ Branch 7 not taken.
|
1683744 | static const auto q = getParam<CoordScalar>("MPFA.Q"); |
504 | |||
505 | // reserve memory for the scv faces | ||
506 | 1683744 | const auto numLocalScvf = scvFaceIndices.size(); | |
507 | 1683744 | scvfIndices_.reserve(numLocalScvf); | |
508 | 1683744 | scvfs_.reserve(numLocalScvf); | |
509 | |||
510 | // for network grids we only want to do one scvf per half facet | ||
511 | // this approach assumes conforming grids at branching facets | ||
512 |
1/2✓ Branch 1 taken 1500830 times.
✗ Branch 2 not taken.
|
1683744 | std::vector<bool> finishedFacets; |
513 | if (dim < dimWorld) | ||
514 |
2/4✓ Branch 1 taken 115597 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 115597 times.
✗ Branch 5 not taken.
|
115597 | finishedFacets.resize(element.subEntities(1), false); |
515 | |||
516 | 1683744 | int scvfCounter = 0; | |
517 |
13/19✓ Branch 1 taken 1500830 times.
✓ Branch 2 taken 182914 times.
✓ Branch 3 taken 731656 times.
✓ Branch 4 taken 1500830 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 47755 times.
✓ Branch 8 taken 6217447 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 47755 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 238775 times.
✓ Branch 13 taken 462388 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 462388 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 96967 times.
✓ Branch 19 taken 94053 times.
✓ Branch 21 taken 191020 times.
✗ Branch 22 not taken.
|
17194502 | for (const auto& is : intersections(gridGeometry().gridView(), element)) |
518 | { | ||
519 | // if we are dealing with a lower dimensional network | ||
520 | // only make a new scvf if we haven't handled it yet | ||
521 | if (dim < dimWorld) | ||
522 | { | ||
523 |
1/2✓ Branch 1 taken 462388 times.
✗ Branch 2 not taken.
|
462388 | const auto indexInInside = is.indexInInside(); |
524 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 462388 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 462388 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 462388 times.
|
1387164 | if (finishedFacets[indexInInside]) |
525 | ✗ | continue; | |
526 | else | ||
527 | 924776 | finishedFacets[indexInInside] = true; | |
528 | } | ||
529 | |||
530 | // if outside level > inside level, use the outside element in the following | ||
531 |
16/18✓ Branch 0 taken 794750 times.
✓ Branch 1 taken 4819519 times.
✓ Branch 2 taken 833680 times.
✓ Branch 3 taken 94053 times.
✓ Branch 4 taken 5355527 times.
✓ Branch 5 taken 96967 times.
✓ Branch 6 taken 663934 times.
✓ Branch 7 taken 4788560 times.
✓ Branch 8 taken 663934 times.
✓ Branch 9 taken 96967 times.
✓ Branch 10 taken 4691593 times.
✓ Branch 11 taken 96967 times.
✓ Branch 12 taken 4681209 times.
✓ Branch 13 taken 10384 times.
✓ Branch 14 taken 4681209 times.
✓ Branch 15 taken 72779 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
8533804 | bool useNeighbor = is.neighbor() && is.outside().level() > element.level(); |
532 |
4/7✓ Branch 0 taken 10384 times.
✓ Branch 1 taken 4753988 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10384 times.
✗ Branch 4 not taken.
✓ Branch 7 taken 4301984 times.
✗ Branch 8 not taken.
|
10451420 | const auto& e = useNeighbor ? is.outside() : element; |
533 |
5/7✓ Branch 0 taken 10384 times.
✓ Branch 1 taken 5676664 times.
✓ Branch 3 taken 10384 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 191020 times.
✓ Branch 6 taken 4753988 times.
✗ Branch 7 not taken.
|
5687048 | const auto indexInElement = useNeighbor ? is.indexInOutside() : is.indexInInside(); |
534 |
1/2✓ Branch 1 taken 4955392 times.
✗ Branch 2 not taken.
|
10451420 | const auto eg = e.geometry(); |
535 |
1/2✓ Branch 1 taken 5687048 times.
✗ Branch 2 not taken.
|
5687048 | const auto refElement = referenceElement(eg); |
536 | |||
537 | // Set up a container with all relevant positions for scvf corner computation | ||
538 |
3/6✓ Branch 1 taken 4955392 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 191020 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 191020 times.
✗ Branch 6 not taken.
|
5687048 | const auto numCorners = is.geometry().corners(); |
539 |
1/2✓ Branch 1 taken 191020 times.
✗ Branch 2 not taken.
|
5687048 | const auto isPositions = MpfaHelper::computeScvfCornersOnIntersection(eg, |
540 | refElement, | ||
541 | indexInElement, | ||
542 | numCorners); | ||
543 | |||
544 | // make the scv faces belonging to each corner of the intersection | ||
545 |
3/3✓ Branch 0 taken 382040 times.
✓ Branch 1 taken 11183076 times.
✓ Branch 2 taken 5496028 times.
|
17061144 | for (int c = 0; c < numCorners; ++c) |
546 | { | ||
547 | // get the global vertex index the scv face is connected to | ||
548 | 11374096 | auto vIdxLocal = refElement.subEntity(indexInElement, 1, c, dim); | |
549 |
2/4✓ Branch 1 taken 11374096 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 11374096 times.
✗ Branch 5 not taken.
|
22748192 | auto vIdxGlobal = gridGeometry().vertexMapper().subIndex(e, vIdxLocal, dim); |
550 | |||
551 | // do not build scvfs connected to a processor boundary | ||
552 |
4/4✓ Branch 0 taken 8832 times.
✓ Branch 1 taken 11365264 times.
✓ Branch 2 taken 8832 times.
✓ Branch 3 taken 11365264 times.
|
22748192 | if (gridGeometry().isGhostVertex(vIdxGlobal)) |
553 | 8832 | continue; | |
554 | |||
555 |
5/5✓ Branch 0 taken 10640160 times.
✓ Branch 1 taken 725104 times.
✓ Branch 2 taken 1355521 times.
✓ Branch 3 taken 73775 times.
✓ Branch 4 taken 9210864 times.
|
11365264 | hasBoundaryScvf_ = (hasBoundaryScvf_ || is.boundary()); |
556 | 34095792 | typename SubControlVolumeFace::FacetInfo facetInfo{ | |
557 |
2/4✓ Branch 1 taken 9910784 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 9910784 times.
✗ Branch 5 not taken.
|
22730528 | gridGeometry().elementMapper().index(e), |
558 |
5/7✓ Branch 0 taken 20768 times.
✓ Branch 1 taken 11344496 times.
✓ Branch 3 taken 20768 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 382040 times.
✓ Branch 6 taken 9507976 times.
✗ Branch 7 not taken.
|
11365264 | useNeighbor ? is.indexInOutside() : is.indexInInside(), |
559 | c | ||
560 | }; | ||
561 |
4/5✓ Branch 0 taken 1834504 times.
✓ Branch 1 taken 2016 times.
✓ Branch 2 taken 9528744 times.
✓ Branch 3 taken 1836520 times.
✗ Branch 4 not taken.
|
22730528 | scvfs_.emplace_back(MpfaHelper(), |
562 | ✗ | MpfaHelper::getScvfCorners(isPositions, numCorners, c), | |
563 | is, | ||
564 | 11365264 | std::move(facetInfo), | |
565 | vIdxGlobal, | ||
566 | vIdxLocal, | ||
567 | 11365264 | scvFaceIndices[scvfCounter], | |
568 | eIdx, | ||
569 | 22730528 | neighborVolVarIndices[scvfCounter], | |
570 | q, | ||
571 | is.boundary()); | ||
572 | |||
573 |
2/4✓ Branch 1 taken 11365264 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 11365264 times.
✗ Branch 5 not taken.
|
22730528 | scvfIndices_.emplace_back(scvFaceIndices[scvfCounter]); |
574 | 11365264 | scvfCounter++; | |
575 | } | ||
576 | } | ||
577 | 1683744 | } | |
578 | |||
579 | //! create the scv and necessary scvfs of a neighboring element | ||
580 | template<typename IndexVector> | ||
581 | 15403387 | void makeNeighborGeometries(const Element& element, | |
582 | GridIndexType eIdxGlobal, | ||
583 | const IndexVector& scvfIndices, | ||
584 | const IndexVector& additionalScvfs) | ||
585 | { | ||
586 | // create the neighbor scv if it doesn't exist yet | ||
587 |
1/2✓ Branch 2 taken 14412835 times.
✗ Branch 3 not taken.
|
15485979 | neighborScvs_.emplace_back(element.geometry(), eIdxGlobal); |
588 | 15403387 | neighborScvIndices_.push_back(eIdxGlobal); | |
589 | |||
590 | // get data on the scv faces | ||
591 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 15403357 times.
|
15403387 | const auto& scvFaceIndices = gridGeometry().scvfIndicesOfScv(eIdxGlobal); |
592 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 15403357 times.
|
15403387 | const auto& neighborVolVarIndices = gridGeometry().neighborVolVarIndices(eIdxGlobal); |
593 | |||
594 | // the quadrature point parameterizaion to be used on scvfs | ||
595 |
5/6✓ Branch 0 taken 30 times.
✓ Branch 1 taken 15403357 times.
✓ Branch 3 taken 28 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 28 times.
✗ Branch 7 not taken.
|
15403387 | static const auto q = getParam<CoordScalar>("MPFA.Q"); |
596 | |||
597 | // for network grids we only want to do one scvf per half facet | ||
598 | // this approach assumes conforming grids at branching facets | ||
599 |
1/2✓ Branch 1 taken 14495427 times.
✗ Branch 2 not taken.
|
15403387 | std::vector<bool> finishedFacets; |
600 | if (dim < dimWorld) | ||
601 |
2/4✓ Branch 1 taken 683472 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 683472 times.
✗ Branch 5 not taken.
|
683472 | finishedFacets.resize(element.subEntities(1), false); |
602 | |||
603 | 15403387 | int scvfCounter = 0; | |
604 |
13/19✓ Branch 1 taken 14495427 times.
✓ Branch 2 taken 907960 times.
✓ Branch 3 taken 3631840 times.
✓ Branch 4 taken 14495427 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 82592 times.
✓ Branch 8 taken 59794536 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 82592 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 412960 times.
✓ Branch 13 taken 2733888 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 2733888 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 176960 times.
✓ Branch 19 taken 153408 times.
✓ Branch 21 taken 330368 times.
✗ Branch 22 not taken.
|
155761566 | for (const auto& is : intersections(gridGeometry().gridView(), element)) |
605 | { | ||
606 | // if we are dealing with a lower dimensional network | ||
607 | // only make a new scvf if we haven't handled it yet | ||
608 | if (dim < dimWorld) | ||
609 | { | ||
610 |
1/2✓ Branch 1 taken 2733888 times.
✗ Branch 2 not taken.
|
2733888 | auto indexInInside = is.indexInInside(); |
611 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 2733888 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2733888 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2733888 times.
|
8201664 | if(finishedFacets[indexInInside]) |
612 | ✗ | continue; | |
613 | else | ||
614 | 5467776 | finishedFacets[indexInInside] = true; | |
615 | } | ||
616 | |||
617 | // if outside level > inside level, use the outside element in the following | ||
618 |
16/18✓ Branch 0 taken 3737786 times.
✓ Branch 1 taken 45215138 times.
✓ Branch 2 taken 4057757 times.
✓ Branch 3 taken 153408 times.
✓ Branch 4 taken 48480528 times.
✓ Branch 5 taken 176960 times.
✓ Branch 6 taken 3489812 times.
✓ Branch 7 taken 45167676 times.
✓ Branch 8 taken 3489812 times.
✓ Branch 9 taken 176960 times.
✓ Branch 10 taken 44990716 times.
✓ Branch 11 taken 176960 times.
✓ Branch 12 taken 44920792 times.
✓ Branch 13 taken 69924 times.
✓ Branch 14 taken 44920792 times.
✓ Branch 15 taken 390985 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
63633525 | bool useNeighbor = is.neighbor() && is.outside().level() > element.level(); |
619 |
4/7✓ Branch 0 taken 69924 times.
✓ Branch 1 taken 45311777 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 69924 times.
✗ Branch 4 not taken.
✓ Branch 7 taken 42647813 times.
✗ Branch 8 not taken.
|
94725610 | const auto& e = useNeighbor ? is.outside() : element; |
620 |
5/7✓ Branch 0 taken 69924 times.
✓ Branch 1 taken 49273985 times.
✓ Branch 3 taken 69924 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 330368 times.
✓ Branch 6 taken 45311777 times.
✗ Branch 7 not taken.
|
49343909 | const auto indexInElement = useNeighbor ? is.indexInOutside() : is.indexInInside(); |
621 |
1/2✓ Branch 1 taken 45712069 times.
✗ Branch 2 not taken.
|
94725610 | const auto eg = e.geometry(); |
622 |
1/2✓ Branch 1 taken 49343909 times.
✗ Branch 2 not taken.
|
49343909 | const auto refElement = referenceElement(eg); |
623 | |||
624 | // Set up a container with all relevant positions for scvf corner computation | ||
625 |
3/6✓ Branch 1 taken 45712069 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 330368 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 330368 times.
✗ Branch 6 not taken.
|
49343909 | const auto numCorners = is.geometry().corners(); |
626 |
1/2✓ Branch 1 taken 330368 times.
✗ Branch 2 not taken.
|
49343909 | const auto isPositions = MpfaHelper::computeScvfCornersOnIntersection(eg, |
627 | refElement, | ||
628 | indexInElement, | ||
629 | numCorners); | ||
630 | |||
631 | // make the scv faces belonging to each corner of the intersection | ||
632 |
3/3✓ Branch 0 taken 660736 times.
✓ Branch 1 taken 98357450 times.
✓ Branch 2 taken 49013541 times.
|
148031727 | for (int c = 0; c < numCorners; ++c) |
633 | { | ||
634 | // get the global vertex index the scv face is connected to | ||
635 | 98687818 | auto vIdxLocal = refElement.subEntity(indexInElement, 1, c, dim); | |
636 |
2/4✓ Branch 1 taken 98687818 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 98687818 times.
✗ Branch 5 not taken.
|
197375636 | auto vIdxGlobal = gridGeometry().vertexMapper().subIndex(e, vIdxLocal, dim); |
637 | |||
638 | // do not build scvfs connected to a processor boundary | ||
639 |
4/4✓ Branch 0 taken 98665322 times.
✓ Branch 1 taken 22496 times.
✓ Branch 2 taken 98665322 times.
✓ Branch 3 taken 22496 times.
|
197375636 | if (gridGeometry().isGhostVertex(vIdxGlobal)) |
640 | 58550798 | continue; | |
641 | |||
642 | // only build the scvf if it is in the list of necessary indices | ||
643 | 197330644 | if (!MpfaHelper::vectorContainsValue(scvfIndices, scvFaceIndices[scvfCounter]) | |
644 |
3/4✓ Branch 0 taken 58528302 times.
✓ Branch 1 taken 40137020 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 58528302 times.
|
98665322 | && !MpfaHelper::vectorContainsValue(additionalScvfs, scvFaceIndices[scvfCounter])) |
645 | { | ||
646 | // increment counter either way | ||
647 | 58528302 | scvfCounter++; | |
648 | 58528302 | continue; | |
649 | } | ||
650 | |||
651 | // build scvf | ||
652 | 120411060 | typename SubControlVolumeFace::FacetInfo facetInfo{ | |
653 |
2/4✓ Branch 1 taken 37373148 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 37373148 times.
✗ Branch 5 not taken.
|
80274040 | gridGeometry().elementMapper().index(e), |
654 |
5/7✓ Branch 0 taken 38294 times.
✓ Branch 1 taken 40098726 times.
✓ Branch 3 taken 38294 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 321024 times.
✓ Branch 6 taken 37013830 times.
✗ Branch 7 not taken.
|
40137020 | useNeighbor ? is.indexInOutside() : is.indexInInside(), |
655 | c | ||
656 | }; | ||
657 |
4/5✓ Branch 0 taken 3079712 times.
✓ Branch 1 taken 5184 times.
✓ Branch 2 taken 37052124 times.
✓ Branch 3 taken 3084896 times.
✗ Branch 4 not taken.
|
80274040 | neighborScvfs_.emplace_back(MpfaHelper(), |
658 | ✗ | MpfaHelper::getScvfCorners(isPositions, numCorners, c), | |
659 | is, | ||
660 | 40137020 | std::move(facetInfo), | |
661 | vIdxGlobal, | ||
662 | vIdxLocal, | ||
663 | 40137020 | scvFaceIndices[scvfCounter], | |
664 | eIdxGlobal, | ||
665 | 80274040 | neighborVolVarIndices[scvfCounter], | |
666 | q, | ||
667 | is.boundary()); | ||
668 | |||
669 |
2/4✓ Branch 1 taken 40137020 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 40137020 times.
✗ Branch 5 not taken.
|
80274040 | neighborScvfIndices_.emplace_back(scvFaceIndices[scvfCounter]); |
670 | |||
671 | // increment counter | ||
672 | 40137020 | scvfCounter++; | |
673 | } | ||
674 | } | ||
675 | 15403387 | } | |
676 | |||
677 | //! map a global index to the local storage index | ||
678 | ✗ | unsigned int findLocalIndex(const GridIndexType idx, | |
679 | const std::vector<GridIndexType>& indices) const | ||
680 | { | ||
681 | ✗ | auto it = std::find(indices.begin(), indices.end(), idx); | |
682 | ✗ | assert(it != indices.end() && "Could not find the scv/scvf! Make sure to properly bind this class!"); | |
683 | ✗ | return std::distance(indices.begin(), it); | |
684 | } | ||
685 | |||
686 | //! clear all containers | ||
687 | 1683744 | void clear() | |
688 | { | ||
689 |
2/2✓ Branch 0 taken 232810 times.
✓ Branch 1 taken 1450934 times.
|
1683744 | scvfIndices_.clear(); |
690 |
2/2✓ Branch 0 taken 206896 times.
✓ Branch 1 taken 1361251 times.
|
1683744 | scvfs_.clear(); |
691 | |||
692 |
2/2✓ Branch 0 taken 17516 times.
✓ Branch 1 taken 1666228 times.
|
1683744 | neighborScvIndices_.clear(); |
693 |
2/2✓ Branch 0 taken 17516 times.
✓ Branch 1 taken 1666228 times.
|
1683744 | neighborScvfIndices_.clear(); |
694 |
2/2✓ Branch 0 taken 17516 times.
✓ Branch 1 taken 1666228 times.
|
1683744 | neighborScvs_.clear(); |
695 |
2/2✓ Branch 0 taken 17420 times.
✓ Branch 1 taken 1550727 times.
|
1683744 | neighborScvfs_.clear(); |
696 | |||
697 | 1683744 | hasBoundaryScvf_ = false; | |
698 | 1683744 | } | |
699 | |||
700 | const GridGeometry* gridGeometryPtr_; | ||
701 | std::optional<Element> element_; | ||
702 | |||
703 | // local storage after binding an element | ||
704 | std::array<GridIndexType, 1> scvIndices_; | ||
705 | std::vector<GridIndexType> scvfIndices_; | ||
706 | std::array<SubControlVolume, 1> scvs_; | ||
707 | std::vector<SubControlVolumeFace> scvfs_; | ||
708 | |||
709 | std::vector<GridIndexType> neighborScvIndices_; | ||
710 | std::vector<GridIndexType> neighborScvfIndices_; | ||
711 | std::vector<SubControlVolume> neighborScvs_; | ||
712 | std::vector<SubControlVolumeFace> neighborScvfs_; | ||
713 | |||
714 | bool hasBoundaryScvf_ = false; | ||
715 | }; | ||
716 | |||
717 | } // end namespace | ||
718 | |||
719 | #endif | ||
720 |