Line | Branch | Exec | Source |
---|---|---|---|
1 | // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- | ||
2 | // vi: set et ts=4 sw=4 sts=4: | ||
3 | // | ||
4 | // SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
6 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup StaggeredDiscretization | ||
10 | * \copydoc Dumux::StaggeredFVGridGeometry | ||
11 | */ | ||
12 | #ifndef DUMUX_DISCRETIZATION_STAGGERED_FV_GRID_GEOMETRY | ||
13 | #define DUMUX_DISCRETIZATION_STAGGERED_FV_GRID_GEOMETRY | ||
14 | |||
15 | #include <utility> | ||
16 | |||
17 | #include <dumux/common/indextraits.hh> | ||
18 | #include <dumux/discretization/basegridgeometry.hh> | ||
19 | #include <dumux/discretization/checkoverlapsize.hh> | ||
20 | #include <dumux/discretization/method.hh> | ||
21 | #include <dumux/discretization/extrusion.hh> | ||
22 | |||
23 | namespace Dumux { | ||
24 | |||
25 | /*! | ||
26 | * \ingroup StaggeredDiscretization | ||
27 | * \brief Base class for cell center of face specific auxiliary FvGridGeometry classes. | ||
28 | * Provides a common interface and a pointer to the actual gridGeometry. | ||
29 | */ | ||
30 | template<class ActualGridGeometry> | ||
31 | class GridGeometryView | ||
32 | { | ||
33 | public: | ||
34 | |||
35 | 102 | explicit GridGeometryView(const ActualGridGeometry* actualGridGeometry) | |
36 | 102 | : gridGeometry_(actualGridGeometry) {} | |
37 | |||
38 | //! export the GridView type and the discretization method | ||
39 | using GridView = typename ActualGridGeometry::GridView; | ||
40 | |||
41 | //! export the discretization method this geometry belongs to | ||
42 | using DiscretizationMethod = DiscretizationMethods::Staggered; | ||
43 | static constexpr DiscretizationMethod discMethod{}; | ||
44 | |||
45 | using LocalView = typename ActualGridGeometry::LocalView; | ||
46 | |||
47 | /*! | ||
48 | * \brief Returns true if this view if related to cell centered dofs | ||
49 | */ | ||
50 | static constexpr bool isCellCenter() { return false; } | ||
51 | |||
52 | /*! | ||
53 | * \brief Returns true if this view if related to face dofs | ||
54 | */ | ||
55 | static constexpr bool isFace() {return false; } | ||
56 | |||
57 | /*! | ||
58 | * \brief Return an integral constant index for cell centered dofs | ||
59 | */ | ||
60 | static constexpr auto cellCenterIdx() | ||
61 | { return typename ActualGridGeometry::DofTypeIndices::CellCenterIdx{}; } | ||
62 | |||
63 | /*! | ||
64 | * \brief Return an integral constant index for face dofs | ||
65 | */ | ||
66 | static constexpr auto faceIdx() | ||
67 | { return typename ActualGridGeometry::DofTypeIndices::FaceIdx{}; } | ||
68 | |||
69 | /*! | ||
70 | * \brief Return the gridView this grid geometry object lives on | ||
71 | */ | ||
72 | 18238 | const auto& gridView() const | |
73 |
19/46✓ Branch 1 taken 51 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 51 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 17 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 17 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 17 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 17 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 20 times.
✓ Branch 23 taken 3807 times.
✓ Branch 24 taken 20 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 3807 times.
✓ Branch 28 taken 20 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 3827 times.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✓ Branch 34 taken 3807 times.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✓ Branch 39 taken 31 times.
✗ Branch 40 not taken.
✓ Branch 42 taken 31 times.
✓ Branch 43 taken 673 times.
✗ Branch 11 not taken.
✗ Branch 14 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 30 not taken.
✓ Branch 35 taken 676 times.
✓ Branch 38 taken 676 times.
✗ Branch 27 not taken.
✗ Branch 41 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✓ Branch 46 taken 673 times.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
|
18238 | { return gridGeometry_->gridView(); } |
74 | |||
75 | /*! | ||
76 | * \brief Returns the connectivity map of which dofs have derivatives with respect | ||
77 | * to a given dof. | ||
78 | */ | ||
79 | 102 | const auto& connectivityMap() const // TODO return correct map | |
80 | 102 | { return gridGeometry_->connectivityMap(); } | |
81 | |||
82 | /*! | ||
83 | * \brief Returns the mapper for vertices to indices for possibly adaptive grids. | ||
84 | */ | ||
85 | const auto& vertexMapper() const | ||
86 | { return gridGeometry_->vertexMapper(); } | ||
87 | |||
88 | /*! | ||
89 | * \brief Returns the mapper for elements to indices for constant grids. | ||
90 | */ | ||
91 | 250240 | const auto& elementMapper() const | |
92 |
2/4✓ Branch 1 taken 7000 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7000 times.
✗ Branch 5 not taken.
|
250240 | { return gridGeometry_->elementMapper(); } |
93 | |||
94 | /*! | ||
95 | * \brief Returns the actual gridGeometry we are a restriction of | ||
96 | */ | ||
97 |
2/4✓ Branch 1 taken 51 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 51 times.
✗ Branch 5 not taken.
|
102 | const ActualGridGeometry& actualGridGeometry() const |
98 |
4/8✓ Branch 1 taken 947549 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 947549 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 413074 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 413040 times.
✗ Branch 11 not taken.
|
2721212 | { return *gridGeometry_; } |
99 | |||
100 | protected: | ||
101 | const ActualGridGeometry* gridGeometry_; | ||
102 | |||
103 | }; | ||
104 | |||
105 | /*! | ||
106 | * \ingroup StaggeredDiscretization | ||
107 | * \brief Cell center specific auxiliary FvGridGeometry classes. | ||
108 | * Required for the Dumux multi-domain framework. | ||
109 | */ | ||
110 | template <class ActualGridGeometry> | ||
111 | class CellCenterFVGridGeometry : public GridGeometryView<ActualGridGeometry> | ||
112 | { | ||
113 | using ParentType = GridGeometryView<ActualGridGeometry>; | ||
114 | public: | ||
115 | |||
116 |
1/2✓ Branch 1 taken 51 times.
✗ Branch 2 not taken.
|
51 | using ParentType::ParentType; |
117 | |||
118 | /*! | ||
119 | * \brief Returns true because this view is related to cell centered dofs | ||
120 | */ | ||
121 | static constexpr bool isCellCenter() { return true; } | ||
122 | |||
123 | /*! | ||
124 | * \brief The total number of cell centered dofs | ||
125 | */ | ||
126 | 238 | std::size_t numDofs() const | |
127 | 476 | { return this->gridGeometry_->numCellCenterDofs(); } | |
128 | }; | ||
129 | |||
130 | /*! | ||
131 | * \ingroup StaggeredDiscretization | ||
132 | * \brief Face specific auxiliary FvGridGeometry classes. | ||
133 | * Required for the Dumux multi-domain framework. | ||
134 | */ | ||
135 | template <class ActualGridGeometry> | ||
136 | class FaceFVGridGeometry : public GridGeometryView<ActualGridGeometry> | ||
137 | { | ||
138 | using ParentType = GridGeometryView<ActualGridGeometry>; | ||
139 | public: | ||
140 | |||
141 |
1/2✓ Branch 1 taken 34 times.
✗ Branch 2 not taken.
|
51 | using ParentType::ParentType; |
142 | |||
143 | /*! | ||
144 | * \brief Returns true because this view is related to face dofs | ||
145 | */ | ||
146 | static constexpr bool isFace() {return true; } | ||
147 | |||
148 | /*! | ||
149 | * \brief The total number of cell centered dofs | ||
150 | */ | ||
151 | 238 | std::size_t numDofs() const | |
152 | 476 | { return this->gridGeometry_->numFaceDofs(); } | |
153 | }; | ||
154 | |||
155 | /*! | ||
156 | * \ingroup StaggeredDiscretization | ||
157 | * \brief Base class for the finite volume geometry vector for staggered models | ||
158 | * This builds up the sub control volumes and sub control volume faces | ||
159 | * for each element. | ||
160 | */ | ||
161 | template<class GridView, | ||
162 | bool cachingEnabled, | ||
163 | class Traits> | ||
164 | class StaggeredFVGridGeometry; | ||
165 | |||
166 | /*! | ||
167 | * \ingroup StaggeredDiscretization | ||
168 | * \brief Base class for the finite volume geometry vector for staggered models | ||
169 | * This builds up the sub control volumes and sub control volume faces | ||
170 | * for each element. Specialization in case the FVElementGeometries are stored. | ||
171 | */ | ||
172 | template<class GV, class T> | ||
173 | class StaggeredFVGridGeometry<GV, true, T> | ||
174 | : public BaseGridGeometry<GV, T> | ||
175 | { | ||
176 | using ThisType = StaggeredFVGridGeometry<GV, true, T>; | ||
177 | using ParentType = BaseGridGeometry<GV, T>; | ||
178 | using GridIndexType = typename IndexTraits<GV>::GridIndex; | ||
179 | using LocalIndexType = typename IndexTraits<GV>::LocalIndex; | ||
180 | using Element = typename GV::template Codim<0>::Entity; | ||
181 | |||
182 | using IntersectionMapper = typename T::IntersectionMapper; | ||
183 | using GeometryHelper = typename T::GeometryHelper; | ||
184 | using ConnectivityMap = typename T::template ConnectivityMap<ThisType>; | ||
185 | |||
186 | public: | ||
187 | //! export the traits | ||
188 | using Traits = typename T::PublicTraits; | ||
189 | |||
190 | //! export the discretization method this geometry belongs to | ||
191 | using DiscretizationMethod = DiscretizationMethods::Staggered; | ||
192 | static constexpr DiscretizationMethod discMethod{}; | ||
193 | |||
194 | static constexpr int upwindSchemeOrder = T::upwindSchemeOrder; | ||
195 | static constexpr bool useHigherOrder = upwindSchemeOrder > 1; | ||
196 | static constexpr bool cachingEnabled = true; | ||
197 | |||
198 | //! export the type of the fv element geometry (the local view type) | ||
199 | using LocalView = typename T::template LocalView<ThisType, true>; | ||
200 | //! export the type of sub control volume | ||
201 | using SubControlVolume = typename T::SubControlVolume; | ||
202 | //! export the type of sub control volume | ||
203 | using SubControlVolumeFace = typename T::SubControlVolumeFace; | ||
204 | //! export the type of extrusion | ||
205 | using Extrusion = Extrusion_t<T>; | ||
206 | //! export the grid view type | ||
207 | using GridView = GV; | ||
208 | //! export the dof type indices | ||
209 | using DofTypeIndices = typename T::DofTypeIndices; | ||
210 | |||
211 | //! return a integral constant for cell center dofs | ||
212 | static constexpr auto cellCenterIdx() | ||
213 | { return typename DofTypeIndices::CellCenterIdx{}; } | ||
214 | |||
215 | //! return a integral constant for face dofs | ||
216 | static constexpr auto faceIdx() | ||
217 | { return typename DofTypeIndices::FaceIdx{}; } | ||
218 | |||
219 | //! The order of the stencil built | ||
220 | static constexpr int upwindStencilOrder() | ||
221 | { return upwindSchemeOrder; } | ||
222 | |||
223 | using CellCenterFVGridGeometryType = CellCenterFVGridGeometry<ThisType>; | ||
224 | using FaceFVGridGeometryType = FaceFVGridGeometry<ThisType>; | ||
225 | |||
226 | using FVGridGeometryTuple = std::tuple< CellCenterFVGridGeometry<ThisType>, FaceFVGridGeometry<ThisType> >; | ||
227 | |||
228 | //! Constructor | ||
229 | 53 | StaggeredFVGridGeometry(const GridView& gridView, const std::string& paramGroup = "") | |
230 | : ParentType(gridView) | ||
231 |
2/4✗ Branch 1 not taken.
✓ Branch 2 taken 53 times.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
53 | , intersectionMapper_(gridView) |
232 | { | ||
233 | // Check if the overlap size is what we expect | ||
234 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
|
53 | if (!CheckOverlapSize<DiscretizationMethod>::isValid(gridView)) |
235 |
0/22✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
|
3 | DUNE_THROW(Dune::InvalidStateException, "The staggered discretization method needs at least an overlap of 1 for parallel computations. " |
236 | << " Set the parameter \"Grid.Overlap\" in the input file."); | ||
237 | |||
238 |
1/2✓ Branch 1 taken 53 times.
✗ Branch 2 not taken.
|
53 | update_(); |
239 | 53 | } | |
240 | |||
241 | //! The total number of sub control volumes | ||
242 | 2728290 | std::size_t numScv() const | |
243 | { | ||
244 |
7/14✓ Branch 1 taken 1331 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1360572 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1360572 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 51 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 5604 times.
✓ Branch 16 taken 80 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 80 times.
✗ Branch 20 not taken.
|
2728290 | return scvs_.size(); |
245 | } | ||
246 | |||
247 | //! The total number of sub control volume faces | ||
248 | 5706 | std::size_t numScvf() const | |
249 | { | ||
250 | 5706 | return scvfs_.size(); | |
251 | } | ||
252 | |||
253 | //! The total number of boundary sub control volume faces | ||
254 | 112 | std::size_t numBoundaryScvf() const | |
255 | { | ||
256 |
2/6✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 30 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
82 | return numBoundaryScvf_; |
257 | } | ||
258 | |||
259 | |||
260 | //! The total number of intersections | ||
261 | std::size_t numIntersections() const | ||
262 | { | ||
263 | return intersectionMapper_.numIntersections(); | ||
264 | } | ||
265 | |||
266 | //! the total number of dofs | ||
267 | std::size_t numDofs() const | ||
268 | { return numCellCenterDofs() + numFaceDofs(); } | ||
269 | |||
270 | 353 | std::size_t numCellCenterDofs() const | |
271 |
11/18✓ Branch 11 taken 31 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 31 times.
✓ Branch 15 taken 2 times.
✓ Branch 18 taken 5 times.
✓ Branch 19 taken 6 times.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
✓ Branch 17 taken 9 times.
✓ Branch 20 taken 9 times.
✗ Branch 21 not taken.
✗ Branch 16 not taken.
✓ Branch 22 taken 6 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 6 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 6 times.
✗ Branch 29 not taken.
|
344 | { return this->gridView().size(0); } |
272 | |||
273 | 630 | std::size_t numFaceDofs() const | |
274 |
11/20✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 13 times.
✓ Branch 24 taken 16 times.
✓ Branch 25 taken 2 times.
✓ Branch 19 taken 3 times.
✓ Branch 22 taken 3 times.
✗ Branch 23 not taken.
✓ Branch 15 taken 30 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 30 times.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
✗ Branch 26 not taken.
✓ Branch 28 taken 2 times.
✗ Branch 29 not taken.
✓ Branch 27 taken 6 times.
✓ Branch 30 taken 6 times.
✗ Branch 31 not taken.
|
630 | { return this->gridView().size(1); } |
275 | |||
276 | //! update all fvElementGeometries (call this after grid adaption) | ||
277 | void update(const GridView& gridView) | ||
278 | { | ||
279 | ParentType::update(gridView); | ||
280 | updateIntersectionMapper_(); | ||
281 | update_(); | ||
282 | } | ||
283 | |||
284 | //! update all fvElementGeometries (call this after grid adaption) | ||
285 | void update(GridView&& gridView) | ||
286 | { | ||
287 | ParentType::update(std::move(gridView)); | ||
288 | updateIntersectionMapper_(); | ||
289 | update_(); | ||
290 | } | ||
291 | |||
292 | //! Get a sub control volume with a global scv index | ||
293 | 838028984 | const SubControlVolume& scv(GridIndexType scvIdx) const | |
294 | { | ||
295 |
19/24✓ Branch 6 taken 1016784 times.
✓ Branch 7 taken 4744692 times.
✓ Branch 10 taken 5483920 times.
✓ Branch 11 taken 940830 times.
✓ Branch 13 taken 1183938 times.
✓ Branch 14 taken 11056 times.
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 8 taken 2293864 times.
✓ Branch 9 taken 1702820 times.
✓ Branch 12 taken 569240 times.
✓ Branch 15 taken 55132 times.
✓ Branch 16 taken 43200 times.
✓ Branch 18 taken 850 times.
✓ Branch 19 taken 204414 times.
✓ Branch 17 taken 8560 times.
✗ Branch 20 not taken.
✓ Branch 4 taken 19464 times.
✓ Branch 5 taken 21688 times.
✗ Branch 3 not taken.
✓ Branch 24 taken 20640 times.
✗ Branch 25 not taken.
✓ Branch 22 taken 302400 times.
✗ Branch 23 not taken.
|
983653828 | return scvs_[scvIdx]; |
296 | } | ||
297 | |||
298 | //! Get a sub control volume face with a global scvf index | ||
299 | 1868325789 | const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const | |
300 | { | ||
301 |
27/31✓ Branch 1 taken 6005698 times.
✓ Branch 2 taken 215515346 times.
✓ Branch 4 taken 2364592 times.
✓ Branch 5 taken 42480 times.
✓ Branch 6 taken 3091856 times.
✗ Branch 7 not taken.
✓ Branch 11 taken 37280 times.
✓ Branch 12 taken 284224 times.
✓ Branch 13 taken 47822 times.
✓ Branch 14 taken 6682 times.
✓ Branch 15 taken 1024542 times.
✓ Branch 16 taken 380462 times.
✓ Branch 17 taken 591984 times.
✓ Branch 18 taken 845472 times.
✓ Branch 19 taken 19284 times.
✓ Branch 20 taken 249936 times.
✓ Branch 21 taken 388332 times.
✓ Branch 22 taken 443388 times.
✓ Branch 23 taken 58403 times.
✓ Branch 24 taken 318251 times.
✓ Branch 3 taken 1439696 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1652160 times.
✓ Branch 25 taken 18328 times.
✓ Branch 26 taken 303316 times.
✓ Branch 27 taken 143260 times.
✓ Branch 28 taken 27650 times.
✓ Branch 29 taken 70 times.
✓ Branch 0 taken 22680 times.
✗ Branch 10 not taken.
✗ Branch 30 not taken.
|
430957672 | return scvfs_[scvfIdx]; |
302 | } | ||
303 | |||
304 | //! Get the sub control volume face indices of an scv by global index | ||
305 | 110587835 | const std::vector<GridIndexType>& scvfIndicesOfScv(GridIndexType scvIdx) const | |
306 | { | ||
307 |
2/4✓ Branch 1 taken 1360572 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 7000 times.
✗ Branch 7 not taken.
|
107240508 | return scvfIndicesOfScv_[scvIdx]; |
308 | } | ||
309 | |||
310 | 1437368117 | GridIndexType localToGlobalScvfIndex(GridIndexType eIdx, LocalIndexType localScvfIdx) const | |
311 | { | ||
312 | 1437368117 | return localToGlobalScvfIndices_[eIdx][localScvfIdx]; | |
313 | } | ||
314 | |||
315 |
2/2✓ Branch 0 taken 707484 times.
✓ Branch 1 taken 12252 times.
|
719736 | const SubControlVolumeFace& scvf(GridIndexType eIdx, LocalIndexType localScvfIdx) const |
316 | { | ||
317 |
14/17✓ Branch 0 taken 2400 times.
✓ Branch 1 taken 600 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 9 taken 346772 times.
✓ Branch 10 taken 280656308 times.
✓ Branch 12 taken 3895241 times.
✓ Branch 13 taken 285919951 times.
✓ Branch 15 taken 14778138 times.
✓ Branch 16 taken 207415580 times.
✓ Branch 17 taken 69686676 times.
✓ Branch 18 taken 3851288 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 2 times.
✓ Branch 19 taken 138804 times.
✓ Branch 20 taken 1375652 times.
✓ Branch 21 taken 482220 times.
|
1437314239 | return scvf(localToGlobalScvfIndex(eIdx, localScvfIdx)); |
318 | } | ||
319 | |||
320 | /*! | ||
321 | * \brief Returns the connectivity map of which dofs have derivatives with respect | ||
322 | * to a given dof. | ||
323 | */ | ||
324 | 12551456 | const ConnectivityMap &connectivityMap() const | |
325 |
3/6✓ Branch 3 taken 51 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 51 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 12551456 times.
✗ Branch 10 not taken.
|
20804582 | { return connectivityMap_; } |
326 | |||
327 | //! Returns a pointer the cell center specific auxiliary class. Required for the multi-domain FVAssembler's ctor. | ||
328 |
1/2✓ Branch 1 taken 51 times.
✗ Branch 2 not taken.
|
51 | std::unique_ptr<CellCenterFVGridGeometry<ThisType>> cellCenterFVGridGeometryPtr() const |
329 | { | ||
330 | return std::make_unique<CellCenterFVGridGeometry<ThisType>>(this); | ||
331 | } | ||
332 | |||
333 | //! Returns a pointer the face specific auxiliary class. Required for the multi-domain FVAssembler's ctor. | ||
334 |
1/2✓ Branch 1 taken 51 times.
✗ Branch 2 not taken.
|
51 | std::unique_ptr<FaceFVGridGeometry<ThisType>> faceFVGridGeometryPtr() const |
335 | { | ||
336 | return std::make_unique<FaceFVGridGeometry<ThisType>>(this); | ||
337 | } | ||
338 | |||
339 | //! Return a copy of the cell center specific auxiliary class. | ||
340 | CellCenterFVGridGeometry<ThisType> cellCenterFVGridGeometry() const | ||
341 | { | ||
342 | return CellCenterFVGridGeometry<ThisType>(this); | ||
343 | } | ||
344 | |||
345 | //! Return a copy of the face specific auxiliary class. | ||
346 | FaceFVGridGeometry<ThisType> faceFVGridGeometry() const | ||
347 | { | ||
348 | return FaceFVGridGeometry<ThisType>(this); | ||
349 | } | ||
350 | |||
351 | //! Returns whether one of the geometry's scvfs lies on a boundary | ||
352 | 3825940 | bool hasBoundaryScvf(GridIndexType eIdx) const | |
353 |
4/5✓ Branch 0 taken 169137 times.
✓ Branch 1 taken 1519235 times.
✓ Branch 3 taken 1602253 times.
✗ Branch 4 not taken.
✓ Branch 2 taken 535315 times.
|
3825940 | { return hasBoundaryScvf_[eIdx]; } |
354 | |||
355 | private: | ||
356 | |||
357 | void updateIntersectionMapper_() | ||
358 | { | ||
359 | intersectionMapper_.update(this->gridView()); | ||
360 | } | ||
361 | |||
362 | 53 | void update_() | |
363 | { | ||
364 | // clear containers (necessary after grid refinement) | ||
365 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 53 times.
|
53 | scvs_.clear(); |
366 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 53 times.
|
53 | scvfs_.clear(); |
367 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 53 times.
|
53 | scvfIndicesOfScv_.clear(); |
368 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 53 times.
|
53 | localToGlobalScvfIndices_.clear(); |
369 | |||
370 | // determine size of containers | ||
371 | 53 | std::size_t numScvs = this->gridView().size(0); | |
372 | 53 | std::size_t numScvf = 0; | |
373 |
1/2✓ Branch 1 taken 89778 times.
✗ Branch 2 not taken.
|
179503 | for (const auto& element : elements(this->gridView())) |
374 | 89725 | numScvf += element.subEntities(1); | |
375 | |||
376 | // reserve memory | ||
377 | 53 | scvs_.resize(numScvs); | |
378 | 53 | scvfs_.reserve(numScvf); | |
379 | 53 | scvfIndicesOfScv_.resize(numScvs); | |
380 | 53 | localToGlobalScvfIndices_.resize(numScvs); | |
381 | 53 | hasBoundaryScvf_.assign(numScvs, false); | |
382 | |||
383 | // Build the scvs and scv faces | ||
384 | 53 | GridIndexType scvfIdx = 0; | |
385 | 53 | numBoundaryScvf_ = 0; | |
386 |
1/2✓ Branch 3 taken 89778 times.
✗ Branch 4 not taken.
|
269228 | for (const auto& element : elements(this->gridView())) |
387 | { | ||
388 | 89725 | auto eIdx = this->elementMapper().index(element); | |
389 | |||
390 | // reserve memory for the localToGlobalScvfIdx map | ||
391 | 89725 | auto numLocalFaces = intersectionMapper_.numFaces(element); | |
392 | 89725 | localToGlobalScvfIndices_[eIdx].resize(numLocalFaces); | |
393 | |||
394 |
1/2✓ Branch 2 taken 89725 times.
✗ Branch 3 not taken.
|
89725 | scvs_[eIdx] = SubControlVolume(element.geometry(), eIdx); |
395 | |||
396 | // the element-wise index sets for finite volume geometry | ||
397 | 89725 | std::vector<GridIndexType> scvfsIndexSet; | |
398 |
1/2✓ Branch 1 taken 89725 times.
✗ Branch 2 not taken.
|
89725 | scvfsIndexSet.reserve(numLocalFaces); |
399 | |||
400 | 89725 | GeometryHelper geometryHelper(element, this->gridView()); | |
401 | |||
402 |
7/10✓ Branch 1 taken 89725 times.
✓ Branch 2 taken 331150 times.
✓ Branch 4 taken 7000 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 7000 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 28000 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 28000 times.
✓ Branch 13 taken 7000 times.
|
504875 | for (const auto& intersection : intersections(this->gridView(), element)) |
403 | { | ||
404 |
3/5✓ Branch 0 taken 328456 times.
✓ Branch 1 taken 30694 times.
✓ Branch 3 taken 750 times.
✗ Branch 4 not taken.
✗ Branch 2 not taken.
|
690268 | geometryHelper.updateLocalFace(intersectionMapper_, intersection); |
405 |
2/2✓ Branch 0 taken 356456 times.
✓ Branch 1 taken 2694 times.
|
359150 | const int localFaceIndex = geometryHelper.localFaceIndex(); |
406 | |||
407 | // inner sub control volume faces | ||
408 |
1/2✓ Branch 0 taken 5388 times.
✗ Branch 1 not taken.
|
5988 | if (intersection.neighbor()) |
409 | { | ||
410 |
2/4✓ Branch 1 taken 27400 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 27400 times.
✗ Branch 5 not taken.
|
353162 | auto nIdx = this->elementMapper().index(intersection.outside()); |
411 |
1/2✓ Branch 1 taken 353162 times.
✗ Branch 2 not taken.
|
353162 | scvfs_.emplace_back(intersection, |
412 |
1/2✓ Branch 1 taken 353162 times.
✗ Branch 2 not taken.
|
353162 | intersection.geometry(), |
413 | scvfIdx, | ||
414 |
2/4✓ Branch 1 taken 353162 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 353162 times.
✗ Branch 6 not taken.
|
706324 | std::vector<GridIndexType>({eIdx, nIdx}), |
415 | geometryHelper); | ||
416 |
1/2✓ Branch 1 taken 353162 times.
✗ Branch 2 not taken.
|
353162 | localToGlobalScvfIndices_[eIdx][localFaceIndex] = scvfIdx; |
417 |
1/2✓ Branch 1 taken 353162 times.
✗ Branch 2 not taken.
|
353162 | scvfsIndexSet.push_back(scvfIdx++); |
418 | } | ||
419 | // boundary sub control volume faces | ||
420 |
1/2✓ Branch 0 taken 5388 times.
✗ Branch 1 not taken.
|
5988 | else if (intersection.boundary()) |
421 | { | ||
422 |
1/2✓ Branch 1 taken 5388 times.
✗ Branch 2 not taken.
|
5988 | scvfs_.emplace_back(intersection, |
423 |
1/2✓ Branch 1 taken 5988 times.
✗ Branch 2 not taken.
|
5988 | intersection.geometry(), |
424 | scvfIdx, | ||
425 |
5/9✓ Branch 1 taken 5388 times.
✓ Branch 2 taken 600 times.
✓ Branch 4 taken 5388 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 5388 times.
✗ Branch 9 not taken.
✗ Branch 3 not taken.
✓ Branch 6 taken 600 times.
✗ Branch 7 not taken.
|
11976 | std::vector<GridIndexType>({eIdx, this->gridView().size(0) + numBoundaryScvf_++}), |
426 | geometryHelper); | ||
427 |
1/2✓ Branch 1 taken 5988 times.
✗ Branch 2 not taken.
|
5988 | localToGlobalScvfIndices_[eIdx][localFaceIndex] = scvfIdx; |
428 |
1/2✓ Branch 1 taken 5988 times.
✗ Branch 2 not taken.
|
5988 | scvfsIndexSet.push_back(scvfIdx++); |
429 | |||
430 | 5988 | hasBoundaryScvf_[eIdx] = true; | |
431 | } | ||
432 | } | ||
433 | |||
434 | // Save the scvf indices belonging to this scv to build up fv element geometries fast | ||
435 |
1/2✓ Branch 1 taken 89725 times.
✗ Branch 2 not taken.
|
89725 | scvfIndicesOfScv_[eIdx] = scvfsIndexSet; |
436 | } | ||
437 | |||
438 | // build the connectivity map for an efficient assembly | ||
439 | 53 | connectivityMap_.update(*this); | |
440 | 53 | } | |
441 | |||
442 | // mappers | ||
443 | ConnectivityMap connectivityMap_; | ||
444 | IntersectionMapper intersectionMapper_; | ||
445 | |||
446 | std::vector<SubControlVolume> scvs_; | ||
447 | std::vector<SubControlVolumeFace> scvfs_; | ||
448 | std::vector<std::vector<GridIndexType>> scvfIndicesOfScv_; | ||
449 | std::vector<std::vector<GridIndexType>> localToGlobalScvfIndices_; | ||
450 | GridIndexType numBoundaryScvf_; | ||
451 | std::vector<bool> hasBoundaryScvf_; | ||
452 | }; | ||
453 | |||
454 | /*! | ||
455 | * \ingroup StaggeredDiscretization | ||
456 | * \brief Base class for the finite volume geometry vector for staggered models | ||
457 | * This builds up the sub control volumes and sub control volume faces | ||
458 | * for each element. Specialization in case the FVElementGeometries are stored. | ||
459 | */ | ||
460 | template<class GV, class T> | ||
461 | class StaggeredFVGridGeometry<GV, false, T> | ||
462 | : public BaseGridGeometry<GV, T> | ||
463 | { | ||
464 | using ThisType = StaggeredFVGridGeometry<GV, false, T>; | ||
465 | using ParentType = BaseGridGeometry<GV, T>; | ||
466 | using GridIndexType = typename IndexTraits<GV>::GridIndex; | ||
467 | using LocalIndexType = typename IndexTraits<GV>::LocalIndex; | ||
468 | using Element = typename GV::template Codim<0>::Entity; | ||
469 | |||
470 | using IntersectionMapper = typename T::IntersectionMapper; | ||
471 | using ConnectivityMap = typename T::template ConnectivityMap<ThisType>; | ||
472 | |||
473 | public: | ||
474 | //! export the traits | ||
475 | using Traits = typename T::PublicTraits; | ||
476 | |||
477 | //! export the discretization method this geometry belongs to | ||
478 | using DiscretizationMethod = DiscretizationMethods::Staggered; | ||
479 | static constexpr DiscretizationMethod discMethod{}; | ||
480 | |||
481 | static constexpr int upwindSchemeOrder = T::upwindSchemeOrder; | ||
482 | static constexpr bool useHigherOrder = upwindSchemeOrder > 1; | ||
483 | static constexpr bool cachingEnabled = false; | ||
484 | |||
485 | using GeometryHelper = typename T::GeometryHelper; | ||
486 | |||
487 | //! export the type of the fv element geometry (the local view type) | ||
488 | using LocalView = typename T::template LocalView<ThisType, false>; | ||
489 | //! export the type of sub control volume | ||
490 | using SubControlVolume = typename T::SubControlVolume; | ||
491 | //! export the type of sub control volume | ||
492 | using SubControlVolumeFace = typename T::SubControlVolumeFace; | ||
493 | //! export the type of extrusion | ||
494 | using Extrusion = Extrusion_t<T>; | ||
495 | //! export the grid view type | ||
496 | using GridView = GV; | ||
497 | //! export the dof type indices | ||
498 | using DofTypeIndices = typename T::DofTypeIndices; | ||
499 | |||
500 | //! return a integral constant for cell center dofs | ||
501 | static constexpr auto cellCenterIdx() | ||
502 | { return typename DofTypeIndices::CellCenterIdx{}; } | ||
503 | |||
504 | //! return a integral constant for face dofs | ||
505 | static constexpr auto faceIdx() | ||
506 | { return typename DofTypeIndices::FaceIdx{}; } | ||
507 | |||
508 | //! The order of the stencil built | ||
509 | static constexpr int upwindStencilOrder() | ||
510 | { return upwindSchemeOrder; } | ||
511 | |||
512 | using CellCenterFVGridGeometryType = CellCenterFVGridGeometry<ThisType>; | ||
513 | using FaceFVGridGeometryType = FaceFVGridGeometry<ThisType>; | ||
514 | |||
515 | using FVGridGeometryTuple = std::tuple< CellCenterFVGridGeometry<ThisType>, FaceFVGridGeometry<ThisType> >; | ||
516 | |||
517 | //! Constructor | ||
518 | 1 | StaggeredFVGridGeometry(const GridView& gridView, const std::string& paramGroup = "") | |
519 | : ParentType(gridView) | ||
520 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
|
1 | , intersectionMapper_(gridView) |
521 | { | ||
522 | // Check if the overlap size is what we expect | ||
523 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
|
1 | if (!CheckOverlapSize<DiscretizationMethod>::isValid(gridView)) |
524 | ✗ | DUNE_THROW(Dune::InvalidStateException, "The staggered discretization method needs at least an overlap of 1 for parallel computations. " | |
525 | << " Set the parameter \"Grid.Overlap\" in the input file."); | ||
526 | |||
527 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | update_(); |
528 | 1 | } | |
529 | |||
530 | |||
531 | //! update all fvElementGeometries (call this after grid adaption) | ||
532 | void update(const GridView& gridView) | ||
533 | { | ||
534 | ParentType::update(gridView); | ||
535 | updateIntersectionMapper_(); | ||
536 | update_(); | ||
537 | } | ||
538 | |||
539 | //! update all fvElementGeometries (call this after grid adaption) | ||
540 | void update(GridView&& gridView) | ||
541 | { | ||
542 | ParentType::update(std::move(gridView)); | ||
543 | updateIntersectionMapper_(); | ||
544 | update_(); | ||
545 | } | ||
546 | |||
547 | //! The total number of sub control volumes | ||
548 | 24 | std::size_t numScv() const | |
549 | { | ||
550 |
24/48✗ 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.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 1 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 1 times.
✗ Branch 36 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 39 taken 1 times.
✗ Branch 40 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 46 not taken.
✓ Branch 47 taken 1 times.
|
24 | return numScvs_; |
551 | } | ||
552 | |||
553 | //! The total number of sub control volume faces | ||
554 | 48 | std::size_t numScvf() const | |
555 | { | ||
556 | 48 | return numScvf_; | |
557 | } | ||
558 | |||
559 | //! The total number of boundary sub control volume faces | ||
560 | 41 | std::size_t numBoundaryScvf() const | |
561 | { | ||
562 |
40/120✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 1 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 1 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 1 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 1 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 1 times.
✗ Branch 39 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✓ Branch 44 taken 1 times.
✗ Branch 45 not taken.
✓ Branch 47 taken 1 times.
✗ Branch 48 not taken.
✓ Branch 50 taken 1 times.
✗ Branch 51 not taken.
✓ Branch 53 taken 1 times.
✗ Branch 54 not taken.
✓ Branch 56 taken 1 times.
✗ Branch 57 not taken.
✓ Branch 59 taken 1 times.
✗ Branch 60 not taken.
✓ Branch 62 taken 1 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 1 times.
✗ Branch 78 not taken.
✓ Branch 80 taken 1 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✓ Branch 86 taken 1 times.
✗ Branch 87 not taken.
✓ Branch 89 taken 1 times.
✗ Branch 90 not taken.
✓ Branch 92 taken 1 times.
✗ Branch 93 not taken.
✓ Branch 95 taken 1 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 1 times.
✗ Branch 99 not taken.
✓ Branch 101 taken 1 times.
✗ Branch 102 not taken.
✓ Branch 104 taken 1 times.
✗ Branch 105 not taken.
✓ Branch 107 taken 1 times.
✗ Branch 108 not taken.
✓ Branch 110 taken 1 times.
✗ Branch 111 not taken.
✓ Branch 113 taken 1 times.
✗ Branch 114 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
✓ Branch 119 taken 1 times.
✗ Branch 120 not taken.
✗ Branch 122 not taken.
✗ Branch 123 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✗ Branch 131 not taken.
✗ Branch 132 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 137 not taken.
✗ Branch 138 not taken.
✗ Branch 140 not taken.
✗ Branch 141 not taken.
✗ Branch 143 not taken.
✗ Branch 144 not taken.
✗ Branch 146 not taken.
✗ Branch 147 not taken.
✗ Branch 149 not taken.
✗ Branch 150 not taken.
✗ Branch 152 not taken.
✗ Branch 153 not taken.
✗ Branch 155 not taken.
✗ Branch 156 not taken.
✗ Branch 158 not taken.
✗ Branch 159 not taken.
✗ Branch 161 not taken.
✗ Branch 162 not taken.
✗ Branch 164 not taken.
✗ Branch 165 not taken.
✗ Branch 167 not taken.
✗ Branch 168 not taken.
✗ Branch 170 not taken.
✗ Branch 171 not taken.
✗ Branch 173 not taken.
✗ Branch 174 not taken.
✗ Branch 176 not taken.
✗ Branch 177 not taken.
✗ Branch 179 not taken.
✗ Branch 180 not taken.
|
21 | return numBoundaryScvf_; |
563 | } | ||
564 | |||
565 | //! The total number of intersections | ||
566 | std::size_t numIntersections() const | ||
567 | { | ||
568 | return intersectionMapper_.numIntersections(); | ||
569 | } | ||
570 | |||
571 | //! the total number of dofs | ||
572 | std::size_t numDofs() const | ||
573 | { return numCellCenterDofs() + numFaceDofs(); } | ||
574 | |||
575 | 25 | std::size_t numCellCenterDofs() const | |
576 |
48/96✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 1 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 1 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 1 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 1 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 1 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 1 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 1 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 1 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 1 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 1 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 1 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 1 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 1 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 1 times.
✗ Branch 113 not taken.
✓ Branch 115 taken 1 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 1 times.
✗ Branch 119 not taken.
✓ Branch 121 taken 1 times.
✗ Branch 122 not taken.
✓ Branch 124 taken 1 times.
✗ Branch 125 not taken.
✓ Branch 127 taken 1 times.
✗ Branch 128 not taken.
✓ Branch 130 taken 1 times.
✗ Branch 131 not taken.
✓ Branch 133 taken 1 times.
✗ Branch 134 not taken.
✓ Branch 136 taken 1 times.
✗ Branch 137 not taken.
✓ Branch 139 taken 1 times.
✗ Branch 140 not taken.
✓ Branch 142 taken 1 times.
✗ Branch 143 not taken.
|
24 | { return this->gridView().size(0); } |
577 | |||
578 | 72 | std::size_t numFaceDofs() const | |
579 |
48/96✓ Branch 97 taken 1 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 1 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 1 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 1 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 1 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 1 times.
✗ Branch 113 not taken.
✓ Branch 115 taken 1 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 1 times.
✗ Branch 119 not taken.
✓ Branch 121 taken 1 times.
✗ Branch 122 not taken.
✓ Branch 124 taken 1 times.
✗ Branch 125 not taken.
✓ Branch 127 taken 1 times.
✗ Branch 128 not taken.
✓ Branch 130 taken 1 times.
✗ Branch 131 not taken.
✓ Branch 133 taken 1 times.
✗ Branch 134 not taken.
✓ Branch 136 taken 1 times.
✗ Branch 137 not taken.
✓ Branch 139 taken 1 times.
✗ Branch 140 not taken.
✓ Branch 142 taken 1 times.
✗ Branch 143 not taken.
✓ Branch 145 taken 1 times.
✗ Branch 146 not taken.
✓ Branch 148 taken 1 times.
✗ Branch 149 not taken.
✓ Branch 151 taken 1 times.
✗ Branch 152 not taken.
✓ Branch 154 taken 1 times.
✗ Branch 155 not taken.
✓ Branch 157 taken 1 times.
✗ Branch 158 not taken.
✓ Branch 160 taken 1 times.
✗ Branch 161 not taken.
✓ Branch 163 taken 1 times.
✗ Branch 164 not taken.
✓ Branch 166 taken 1 times.
✗ Branch 167 not taken.
✓ Branch 169 taken 1 times.
✗ Branch 170 not taken.
✓ Branch 172 taken 1 times.
✗ Branch 173 not taken.
✓ Branch 175 taken 1 times.
✗ Branch 176 not taken.
✓ Branch 178 taken 1 times.
✗ Branch 179 not taken.
✓ Branch 181 taken 1 times.
✗ Branch 182 not taken.
✓ Branch 184 taken 1 times.
✗ Branch 185 not taken.
✓ Branch 187 taken 1 times.
✗ Branch 188 not taken.
✓ Branch 190 taken 1 times.
✗ Branch 191 not taken.
✓ Branch 193 taken 1 times.
✗ Branch 194 not taken.
✓ Branch 196 taken 1 times.
✗ Branch 197 not taken.
✓ Branch 199 taken 1 times.
✗ Branch 200 not taken.
✓ Branch 202 taken 1 times.
✗ Branch 203 not taken.
✓ Branch 205 taken 1 times.
✗ Branch 206 not taken.
✓ Branch 208 taken 1 times.
✗ Branch 209 not taken.
✓ Branch 211 taken 1 times.
✗ Branch 212 not taken.
✓ Branch 214 taken 1 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.
|
72 | { return this->gridView().size(1); } |
580 | |||
581 | 8785 | const std::vector<GridIndexType>& scvfIndicesOfScv(GridIndexType scvIdx) const | |
582 | 8785 | { return scvfIndicesOfScv_[scvIdx]; } | |
583 | |||
584 | 4200 | GridIndexType localToGlobalScvfIndex(GridIndexType eIdx, LocalIndexType localScvfIdx) const | |
585 | { | ||
586 | 4200 | return localToGlobalScvfIndices_[eIdx][localScvfIdx]; | |
587 | } | ||
588 | |||
589 | /*! | ||
590 | * \brief Returns the connectivity map of which dofs have derivatives with respect | ||
591 | * to a given dof. | ||
592 | */ | ||
593 | 4800 | const ConnectivityMap &connectivityMap() const | |
594 |
25/50✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 25 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 25 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 25 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 25 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 25 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 25 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 25 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 25 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 25 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 25 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 25 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 25 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 25 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 25 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 25 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 25 times.
✗ Branch 35 not taken.
✓ Branch 36 taken 25 times.
✗ Branch 37 not taken.
✓ Branch 38 taken 25 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 25 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 25 times.
✗ Branch 43 not taken.
✓ Branch 44 taken 25 times.
✗ Branch 45 not taken.
✓ Branch 46 taken 25 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 4800 times.
✗ Branch 50 not taken.
|
5400 | { return connectivityMap_; } |
595 | |||
596 | //! Returns a pointer the cell center specific auxiliary class. Required for the multi-domain FVAssembler's ctor. | ||
597 | std::unique_ptr<CellCenterFVGridGeometry<ThisType>> cellCenterFVGridGeometryPtr() const | ||
598 | { | ||
599 | return std::make_unique<CellCenterFVGridGeometry<ThisType>>(this); | ||
600 | } | ||
601 | |||
602 | //! Returns a pointer the face specific auxiliary class. Required for the multi-domain FVAssembler's ctor. | ||
603 | std::unique_ptr<FaceFVGridGeometry<ThisType>> faceFVGridGeometryPtr() const | ||
604 | { | ||
605 | return std::make_unique<FaceFVGridGeometry<ThisType>>(this); | ||
606 | } | ||
607 | |||
608 | //! Return a copy of the cell center specific auxiliary class. | ||
609 | CellCenterFVGridGeometry<ThisType> cellCenterFVGridGeometry() const | ||
610 | { | ||
611 | return CellCenterFVGridGeometry<ThisType>(this); | ||
612 | } | ||
613 | |||
614 | //! Return a copy of the face specific auxiliary class. | ||
615 | FaceFVGridGeometry<ThisType> faceFVGridGeometry() const | ||
616 | { | ||
617 | return FaceFVGridGeometry<ThisType>(this); | ||
618 | } | ||
619 | |||
620 | //! Return a reference to the intersection mapper | ||
621 | const IntersectionMapper& intersectionMapper() const | ||
622 | { | ||
623 | 35140 | return intersectionMapper_; | |
624 | } | ||
625 | |||
626 | //! Return the neighbor volVar indices for all scvfs in the scv with index scvIdx | ||
627 | 8785 | const std::vector<GridIndexType>& neighborVolVarIndices(GridIndexType scvIdx) const | |
628 | 8785 | { return neighborVolVarIndices_[scvIdx]; } | |
629 | |||
630 | private: | ||
631 | |||
632 | void updateIntersectionMapper_() | ||
633 | { | ||
634 | intersectionMapper_.update(this->gridView()); | ||
635 | } | ||
636 | |||
637 | 1 | void update_() | |
638 | { | ||
639 | // clear containers (necessary after grid refinement) | ||
640 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | scvfIndicesOfScv_.clear(); |
641 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | neighborVolVarIndices_.clear(); |
642 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | localToGlobalScvfIndices_.clear(); |
643 | |||
644 | 1 | numScvs_ = numCellCenterDofs(); | |
645 | 1 | numScvf_ = 0; | |
646 | 1 | numBoundaryScvf_ = 0; | |
647 | 1 | scvfIndicesOfScv_.resize(numScvs_); | |
648 | 1 | localToGlobalScvfIndices_.resize(numScvs_); | |
649 | 1 | neighborVolVarIndices_.resize(numScvs_); | |
650 | |||
651 | // Build the scvs and scv faces | ||
652 |
1/2✓ Branch 4 taken 26 times.
✗ Branch 5 not taken.
|
76 | for (const auto& element : elements(this->gridView())) |
653 | { | ||
654 | 25 | auto eIdx = this->elementMapper().index(element); | |
655 | |||
656 | // the element-wise index sets for finite volume geometry | ||
657 |
1/2✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
|
25 | auto numLocalFaces = intersectionMapper_.numFaces(element); |
658 | 25 | std::vector<GridIndexType> scvfsIndexSet; | |
659 |
1/2✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
|
25 | scvfsIndexSet.reserve(numLocalFaces); |
660 |
1/2✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
|
25 | localToGlobalScvfIndices_[eIdx].resize(numLocalFaces); |
661 | |||
662 | 25 | std::vector<GridIndexType> neighborVolVarIndexSet; | |
663 |
1/2✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
|
25 | neighborVolVarIndexSet.reserve(numLocalFaces); |
664 | |||
665 |
3/4✓ Branch 1 taken 25 times.
✓ Branch 2 taken 100 times.
✓ Branch 5 taken 100 times.
✗ Branch 6 not taken.
|
125 | for (const auto& intersection : intersections(this->gridView(), element)) |
666 | { | ||
667 | 100 | const auto localFaceIndex = intersection.indexInInside(); | |
668 |
1/2✓ Branch 1 taken 100 times.
✗ Branch 2 not taken.
|
100 | localToGlobalScvfIndices_[eIdx][localFaceIndex] = numScvf_; |
669 |
3/4✓ Branch 0 taken 90 times.
✓ Branch 1 taken 10 times.
✓ Branch 3 taken 100 times.
✗ Branch 4 not taken.
|
100 | scvfsIndexSet.push_back(numScvf_++); |
670 | |||
671 | 100 | if (intersection.neighbor()) | |
672 | { | ||
673 | 80 | const auto nIdx = this->elementMapper().index(intersection.outside()); | |
674 |
1/2✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
|
80 | neighborVolVarIndexSet.emplace_back(nIdx); |
675 | } | ||
676 | else | ||
677 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | neighborVolVarIndexSet.emplace_back(numScvs_ + numBoundaryScvf_++); |
678 | } | ||
679 | |||
680 | // Save the scvf indices belonging to this scv to build up fv element geometries fast | ||
681 |
1/2✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
|
25 | scvfIndicesOfScv_[eIdx] = scvfsIndexSet; |
682 |
1/2✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
|
25 | neighborVolVarIndices_[eIdx] = neighborVolVarIndexSet; |
683 | } | ||
684 | |||
685 | // build the connectivity map for an efficient assembly | ||
686 | 1 | connectivityMap_.update(*this); | |
687 | 1 | } | |
688 | |||
689 | //! Information on the global number of geometries | ||
690 | std::size_t numScvs_; | ||
691 | std::size_t numScvf_; | ||
692 | std::size_t numBoundaryScvf_; | ||
693 | std::vector<std::vector<GridIndexType>> localToGlobalScvfIndices_; | ||
694 | std::vector<std::vector<GridIndexType>> neighborVolVarIndices_; | ||
695 | |||
696 | // mappers | ||
697 | ConnectivityMap connectivityMap_; | ||
698 | IntersectionMapper intersectionMapper_; | ||
699 | |||
700 | //! vectors that store the global data | ||
701 | std::vector<std::vector<GridIndexType>> scvfIndicesOfScv_; | ||
702 | }; | ||
703 | |||
704 | } // end namespace | ||
705 | |||
706 | #endif | ||
707 |