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 CCTpfaDiscretization | ||
10 | * \brief The finite volume geometry (scvs and scvfs) for cell-centered TPFA models on a grid view | ||
11 | * This builds up the sub control volumes and sub control volume faces | ||
12 | * for each element of the grid partition. | ||
13 | */ | ||
14 | #ifndef DUMUX_DISCRETIZATION_CCTPFA_FV_GRID_GEOMETRY_HH | ||
15 | #define DUMUX_DISCRETIZATION_CCTPFA_FV_GRID_GEOMETRY_HH | ||
16 | |||
17 | #include <utility> | ||
18 | #include <algorithm> | ||
19 | |||
20 | #include <dumux/common/indextraits.hh> | ||
21 | #include <dumux/common/defaultmappertraits.hh> | ||
22 | |||
23 | #include <dumux/discretization/method.hh> | ||
24 | #include <dumux/discretization/basegridgeometry.hh> | ||
25 | #include <dumux/discretization/checkoverlapsize.hh> | ||
26 | #include <dumux/discretization/cellcentered/subcontrolvolume.hh> | ||
27 | #include <dumux/discretization/cellcentered/connectivitymap.hh> | ||
28 | #include <dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh> | ||
29 | #include <dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh> | ||
30 | #include <dumux/discretization/extrusion.hh> | ||
31 | |||
32 | namespace Dumux { | ||
33 | |||
34 | /*! | ||
35 | * \ingroup CCTpfaDiscretization | ||
36 | * \brief The default traits for the tpfa finite volume grid geometry | ||
37 | * Defines the scv and scvf types and the mapper types | ||
38 | * \tparam the grid view type | ||
39 | */ | ||
40 | template<class GridView, class MapperTraits = DefaultMapperTraits<GridView>> | ||
41 | struct CCTpfaDefaultGridGeometryTraits | ||
42 | : public MapperTraits | ||
43 | { | ||
44 | using SubControlVolume = CCSubControlVolume<GridView>; | ||
45 | using SubControlVolumeFace = CCTpfaSubControlVolumeFace<GridView>; | ||
46 | |||
47 | template<class GridGeometry> | ||
48 | using ConnectivityMap = CCSimpleConnectivityMap<GridGeometry>; | ||
49 | |||
50 | template<class GridGeometry, bool enableCache> | ||
51 | using LocalView = CCTpfaFVElementGeometry<GridGeometry, enableCache>; | ||
52 | |||
53 | //! State the maximum admissible number of neighbors per scvf | ||
54 | //! Per default, we allow for 8 branches on network/surface grids, where | ||
55 | //! conformity is assumed. For normal grids, we allow a maximum of one | ||
56 | //! hanging node per scvf. Use different traits if you need more. | ||
57 | static constexpr int maxNumScvfNeighbors = int(GridView::dimension)<int(GridView::dimensionworld) ? 8 : 1<<(GridView::dimension-1); | ||
58 | }; | ||
59 | |||
60 | /*! | ||
61 | * \ingroup CCTpfaDiscretization | ||
62 | * \brief The finite volume geometry (scvs and scvfs) for cell-centered TPFA models on a grid view | ||
63 | * This builds up the sub control volumes and sub control volume faces | ||
64 | * \note This class is specialized for versions with and without caching the fv geometries on the grid view | ||
65 | */ | ||
66 | template<class GridView, | ||
67 | bool enableGridGeometryCache = false, | ||
68 | class Traits = CCTpfaDefaultGridGeometryTraits<GridView> > | ||
69 | class CCTpfaFVGridGeometry; | ||
70 | |||
71 | /*! | ||
72 | * \ingroup CCTpfaDiscretization | ||
73 | * \brief The finite volume geometry (scvs and scvfs) for cell-centered TPFA models on a grid view | ||
74 | * This builds up the sub control volumes and sub control volume faces | ||
75 | * \note For caching enabled we store the fv geometries for the whole grid view which is memory intensive but faster | ||
76 | */ | ||
77 | template<class GV, class Traits> | ||
78 | class CCTpfaFVGridGeometry<GV, true, Traits> | ||
79 | : public BaseGridGeometry<GV, Traits> | ||
80 | { | ||
81 | using ThisType = CCTpfaFVGridGeometry<GV, true, Traits>; | ||
82 | using ParentType = BaseGridGeometry<GV, Traits>; | ||
83 | using ConnectivityMap = typename Traits::template ConnectivityMap<ThisType>; | ||
84 | using GridIndexType = typename IndexTraits<GV>::GridIndex; | ||
85 | using Element = typename GV::template Codim<0>::Entity; | ||
86 | |||
87 | static const int dim = GV::dimension; | ||
88 | static const int dimWorld = GV::dimensionworld; | ||
89 | |||
90 | public: | ||
91 | //! export basic grid geometry type for the alternative constructor | ||
92 | using BasicGridGeometry = BasicGridGeometry_t<GV, Traits>; | ||
93 | //! export the type of the fv element geometry (the local view type) | ||
94 | using LocalView = typename Traits::template LocalView<ThisType, true>; | ||
95 | //! export the type of sub control volume | ||
96 | using SubControlVolume = typename Traits::SubControlVolume; | ||
97 | //! export the type of sub control volume | ||
98 | using SubControlVolumeFace = typename Traits::SubControlVolumeFace; | ||
99 | //! export the type of extrusion | ||
100 | using Extrusion = Extrusion_t<Traits>; | ||
101 | //! export dof mapper type | ||
102 | using DofMapper = typename Traits::ElementMapper; | ||
103 | |||
104 | //! export the discretization method this geometry belongs to | ||
105 | using DiscretizationMethod = DiscretizationMethods::CCTpfa; | ||
106 | static constexpr DiscretizationMethod discMethod{}; | ||
107 | |||
108 | //! The maximum admissible stencil size (used for static memory allocation during assembly) | ||
109 | static constexpr int maxElementStencilSize = LocalView::maxNumElementScvfs*Traits::maxNumScvfNeighbors + 1; | ||
110 | |||
111 | //! export the grid view type | ||
112 | using GridView = GV; | ||
113 | |||
114 | //! Constructor with basic grid geometry used to share state with another grid geometry on the same grid view | ||
115 | 235 | CCTpfaFVGridGeometry(std::shared_ptr<BasicGridGeometry> gg) | |
116 |
9/26✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 60 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 60 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 60 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 60 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 60 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 60 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 60 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 60 times.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
|
2115 | : ParentType(std::move(gg)) |
117 | { | ||
118 | // Check if the overlap size is what we expect | ||
119 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 168 times.
|
470 | if (!CheckOverlapSize<DiscretizationMethod>::isValid(this->gridView())) |
120 | ✗ | DUNE_THROW(Dune::InvalidStateException, "The cctpfa discretization method needs at least an overlap of 1 for parallel computations. " | |
121 | << " Set the parameter \"Grid.Overlap\" in the input file."); | ||
122 | |||
123 |
1/2✓ Branch 1 taken 168 times.
✗ Branch 2 not taken.
|
235 | update_(); |
124 | 235 | } | |
125 | |||
126 | //! Constructor from gridView | ||
127 | 232 | CCTpfaFVGridGeometry(const GridView& gridView) | |
128 |
2/6✓ Branch 2 taken 165 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 165 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
232 | : CCTpfaFVGridGeometry(std::make_shared<BasicGridGeometry>(gridView)) |
129 | 232 | {} | |
130 | |||
131 | //! the element mapper is the dofMapper | ||
132 | //! this is convenience to have better chance to have the same main files for box/tpfa/mpfa... | ||
133 | const DofMapper& dofMapper() const | ||
134 |
6/10✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 28 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
|
75330 | { return this->elementMapper(); } |
135 | |||
136 | //! The total number of sub control volumes | ||
137 | std::size_t numScv() const | ||
138 | { | ||
139 |
25/33✗ Branch 0 not taken.
✓ Branch 1 taken 180486 times.
✓ Branch 2 taken 1233890 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9262946 times.
✓ Branch 5 taken 2786723 times.
✓ Branch 6 taken 3470 times.
✓ Branch 7 taken 9643743 times.
✓ Branch 8 taken 1572629 times.
✓ Branch 9 taken 3470 times.
✓ Branch 10 taken 5208754 times.
✓ Branch 11 taken 10558231 times.
✓ Branch 12 taken 173500 times.
✓ Branch 13 taken 706812 times.
✓ Branch 14 taken 10560631 times.
✓ Branch 15 taken 173500 times.
✓ Branch 16 taken 321824 times.
✓ Branch 17 taken 8047 times.
✓ Branch 18 taken 800000 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 5000 times.
✓ Branch 21 taken 1730106 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 1735 times.
✓ Branch 25 taken 15642 times.
✓ Branch 26 taken 9 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 1735 times.
✗ Branch 29 not taken.
✓ Branch 32 taken 8000 times.
✗ Branch 33 not taken.
✓ Branch 37 taken 101 times.
✗ Branch 38 not taken.
|
58227525 | return scvs_.size(); |
140 | } | ||
141 | |||
142 | //! The total number of sub control volume faces | ||
143 | std::size_t numScvf() const | ||
144 | { | ||
145 |
2/5✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
2638 | return scvfs_.size(); |
146 | } | ||
147 | |||
148 | //! The total number of boundary sub control volume faces | ||
149 | ✗ | std::size_t numBoundaryScvf() const | |
150 | { | ||
151 | ✗ | return numBoundaryScvf_; | |
152 | } | ||
153 | |||
154 | //! The total number of degrees of freedom | ||
155 | std::size_t numDofs() const | ||
156 |
69/81✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29 times.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 45 times.
✓ Branch 8 taken 12 times.
✓ Branch 9 taken 5 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 14 times.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 5 times.
✓ Branch 14 taken 14 times.
✓ Branch 15 taken 14 times.
✓ Branch 16 taken 737483 times.
✓ Branch 17 taken 11 times.
✓ Branch 18 taken 5841 times.
✓ Branch 19 taken 737478 times.
✓ Branch 20 taken 5 times.
✓ Branch 21 taken 4 times.
✓ Branch 22 taken 737478 times.
✓ Branch 23 taken 429 times.
✓ Branch 24 taken 540802 times.
✓ Branch 25 taken 140403 times.
✓ Branch 26 taken 22 times.
✓ Branch 27 taken 541207 times.
✓ Branch 28 taken 140002 times.
✓ Branch 29 taken 17 times.
✓ Branch 30 taken 542433 times.
✓ Branch 31 taken 140014 times.
✓ Branch 32 taken 24 times.
✓ Branch 33 taken 1632 times.
✓ Branch 34 taken 6 times.
✓ Branch 35 taken 8 times.
✓ Branch 36 taken 1635 times.
✓ Branch 37 taken 23 times.
✓ Branch 38 taken 17 times.
✓ Branch 39 taken 4 times.
✓ Branch 40 taken 10 times.
✓ Branch 41 taken 15 times.
✗ Branch 42 not taken.
✓ Branch 43 taken 20 times.
✓ Branch 44 taken 18 times.
✓ Branch 45 taken 16 times.
✓ Branch 46 taken 19 times.
✓ Branch 47 taken 6 times.
✗ Branch 48 not taken.
✓ Branch 49 taken 19 times.
✓ Branch 50 taken 4 times.
✗ Branch 51 not taken.
✓ Branch 52 taken 17 times.
✓ Branch 53 taken 20 times.
✓ Branch 54 taken 1 times.
✓ Branch 55 taken 15 times.
✓ Branch 56 taken 2 times.
✓ Branch 57 taken 1 times.
✓ Branch 58 taken 28 times.
✓ Branch 59 taken 5 times.
✓ Branch 60 taken 1 times.
✓ Branch 61 taken 12 times.
✓ Branch 62 taken 5 times.
✓ Branch 63 taken 3 times.
✓ Branch 64 taken 12 times.
✓ Branch 65 taken 7 times.
✓ Branch 66 taken 3 times.
✓ Branch 67 taken 12 times.
✓ Branch 68 taken 5 times.
✓ Branch 69 taken 3 times.
✓ Branch 70 taken 1 times.
✓ Branch 71 taken 5 times.
✗ Branch 72 not taken.
✓ Branch 74 taken 8 times.
✗ Branch 75 not taken.
✓ Branch 77 taken 16 times.
✗ Branch 78 not taken.
✓ Branch 80 taken 16 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 16 times.
✗ Branch 84 not taken.
✓ Branch 88 taken 16 times.
✗ Branch 89 not taken.
|
2861835 | { return this->gridView().size(0); } |
157 | |||
158 | |||
159 | //! update all fvElementGeometries (call this after grid adaption) | ||
160 | void update(const GridView& gridView) | ||
161 | { | ||
162 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | ParentType::update(gridView); |
163 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | update_(); |
164 | } | ||
165 | |||
166 | //! update all fvElementGeometries (call this after grid adaption) | ||
167 | void update(GridView&& gridView) | ||
168 | { | ||
169 | ParentType::update(std::move(gridView)); | ||
170 | update_(); | ||
171 | } | ||
172 | |||
173 | //! Get a sub control volume with a global scv index | ||
174 | const SubControlVolume& scv(GridIndexType scvIdx) const | ||
175 | { | ||
176 |
74/80✗ Branch 0 not taken.
✓ Branch 1 taken 256 times.
✓ Branch 2 taken 2508832 times.
✓ Branch 3 taken 220420588 times.
✓ Branch 4 taken 2519136 times.
✓ Branch 5 taken 239369324 times.
✓ Branch 6 taken 10304 times.
✓ Branch 7 taken 18948992 times.
✓ Branch 8 taken 198498 times.
✓ Branch 9 taken 104673224 times.
✓ Branch 10 taken 198498 times.
✓ Branch 11 taken 240731753 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 191415969 times.
✓ Branch 14 taken 49932 times.
✓ Branch 15 taken 192235630 times.
✓ Branch 16 taken 49936 times.
✓ Branch 17 taken 137075834 times.
✓ Branch 18 taken 4 times.
✓ Branch 19 taken 15788972 times.
✓ Branch 20 taken 49687064 times.
✓ Branch 21 taken 142058296 times.
✓ Branch 22 taken 49695064 times.
✓ Branch 23 taken 126419936 times.
✓ Branch 24 taken 1162760 times.
✓ Branch 25 taken 1900608 times.
✓ Branch 26 taken 787440 times.
✓ Branch 27 taken 1603168 times.
✓ Branch 28 taken 5440 times.
✓ Branch 29 taken 1205428 times.
✓ Branch 30 taken 28288 times.
✓ Branch 31 taken 20506 times.
✓ Branch 32 taken 1205498 times.
✓ Branch 33 taken 37114 times.
✓ Branch 34 taken 20970 times.
✓ Branch 35 taken 1440814 times.
✓ Branch 36 taken 3115670 times.
✓ Branch 37 taken 1676108 times.
✓ Branch 38 taken 5221692 times.
✓ Branch 39 taken 1768742 times.
✓ Branch 40 taken 3998034 times.
✓ Branch 41 taken 3763038 times.
✓ Branch 42 taken 2800798 times.
✓ Branch 43 taken 4714302 times.
✓ Branch 44 taken 719258 times.
✓ Branch 45 taken 5434264 times.
✓ Branch 46 taken 2043014 times.
✓ Branch 47 taken 5094354 times.
✓ Branch 48 taken 125248 times.
✓ Branch 49 taken 160 times.
✓ Branch 50 taken 2049 times.
✓ Branch 51 taken 444243 times.
✓ Branch 52 taken 2049 times.
✓ Branch 53 taken 438651 times.
✓ Branch 54 taken 13632 times.
✓ Branch 55 taken 17652 times.
✗ Branch 56 not taken.
✓ Branch 57 taken 21448 times.
✗ Branch 58 not taken.
✓ Branch 59 taken 17146 times.
✓ Branch 60 taken 634 times.
✓ Branch 61 taken 21410 times.
✓ Branch 62 taken 38 times.
✓ Branch 63 taken 11498 times.
✓ Branch 64 taken 12166 times.
✓ Branch 65 taken 5324 times.
✓ Branch 66 taken 8000 times.
✓ Branch 67 taken 281196 times.
✓ Branch 68 taken 5324 times.
✓ Branch 69 taken 285 times.
✓ Branch 70 taken 281196 times.
✓ Branch 71 taken 8000 times.
✓ Branch 72 taken 285 times.
✓ Branch 73 taken 1766400 times.
✓ Branch 74 taken 8000 times.
✓ Branch 75 taken 901500 times.
✓ Branch 76 taken 1766400 times.
✗ Branch 77 not taken.
✓ Branch 78 taken 901500 times.
✗ Branch 79 not taken.
|
5244440030 | return scvs_[scvIdx]; |
177 | } | ||
178 | |||
179 | //! Get a sub control volume face with a global scvf index | ||
180 | const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const | ||
181 | { | ||
182 |
52/58✓ Branch 2 taken 13634 times.
✓ Branch 3 taken 649454 times.
✓ Branch 4 taken 2561052 times.
✓ Branch 5 taken 1523044 times.
✓ Branch 6 taken 2672786 times.
✓ Branch 7 taken 875210 times.
✓ Branch 8 taken 283704 times.
✓ Branch 9 taken 82166 times.
✓ Branch 10 taken 1297334 times.
✓ Branch 11 taken 484610 times.
✓ Branch 12 taken 1784826 times.
✓ Branch 13 taken 594032 times.
✓ Branch 14 taken 1547619 times.
✓ Branch 15 taken 531338 times.
✓ Branch 16 taken 941887 times.
✓ Branch 17 taken 371158 times.
✓ Branch 18 taken 2274070 times.
✓ Branch 19 taken 1369808 times.
✓ Branch 20 taken 16667617 times.
✓ Branch 21 taken 9587339 times.
✓ Branch 22 taken 23899115 times.
✓ Branch 23 taken 17553271 times.
✓ Branch 24 taken 9467275 times.
✓ Branch 25 taken 9793803 times.
✓ Branch 26 taken 17181 times.
✓ Branch 27 taken 5151881 times.
✓ Branch 28 taken 5520049 times.
✓ Branch 29 taken 36415 times.
✓ Branch 30 taken 10163239 times.
✓ Branch 31 taken 40809 times.
✓ Branch 32 taken 59006 times.
✓ Branch 33 taken 22526 times.
✓ Branch 34 taken 58838 times.
✓ Branch 35 taken 12726 times.
✓ Branch 36 taken 1071408 times.
✓ Branch 37 taken 242432 times.
✓ Branch 38 taken 1071408 times.
✓ Branch 39 taken 242400 times.
✓ Branch 40 taken 536 times.
✓ Branch 41 taken 504 times.
✓ Branch 42 taken 536 times.
✓ Branch 43 taken 504 times.
✓ Branch 44 taken 3470 times.
✗ Branch 45 not taken.
✓ Branch 46 taken 3470 times.
✗ Branch 47 not taken.
✓ Branch 48 taken 3470 times.
✗ Branch 49 not taken.
✓ Branch 50 taken 3470 times.
✗ Branch 51 not taken.
✓ Branch 52 taken 48000 times.
✗ Branch 53 not taken.
✓ Branch 54 taken 48000 times.
✗ Branch 55 not taken.
✓ Branch 56 taken 3344 times.
✓ Branch 57 taken 126 times.
✓ Branch 58 taken 3344 times.
✓ Branch 59 taken 126 times.
|
1403790700 | return scvfs_[scvfIdx]; |
183 | } | ||
184 | |||
185 | //! Get the scvf on the same face but from the other side | ||
186 | //! Note that e.g. the normals might be different in the case of surface grids | ||
187 | const SubControlVolumeFace& flipScvf(GridIndexType scvfIdx, unsigned int outsideScvfIdx = 0) const | ||
188 | { | ||
189 | 135648110 | return scvfs_[flipScvfIndices_[scvfIdx][outsideScvfIdx]]; | |
190 | } | ||
191 | |||
192 | //! Get the sub control volume face indices of an scv by global index | ||
193 | const std::vector<GridIndexType>& scvfIndicesOfScv(GridIndexType scvIdx) const | ||
194 | { | ||
195 |
3/12✗ Branch 0 not taken.
✓ Branch 1 taken 165000 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 165000 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 165000 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
327265511 | return scvfIndicesOfScv_[scvIdx]; |
196 | } | ||
197 | |||
198 | /*! | ||
199 | * \brief Returns the connectivity map of which dofs have derivatives with respect | ||
200 | * to a given dof. | ||
201 | */ | ||
202 | const ConnectivityMap &connectivityMap() const | ||
203 | 34633941 | { return connectivityMap_; } | |
204 | |||
205 | //! Returns whether one of the geometry's scvfs lies on a boundary | ||
206 | bool hasBoundaryScvf(GridIndexType eIdx) const | ||
207 |
24/24✓ Branch 0 taken 2630650 times.
✓ Branch 1 taken 29266965 times.
✓ Branch 2 taken 2630650 times.
✓ Branch 3 taken 29266965 times.
✓ Branch 4 taken 3184837 times.
✓ Branch 5 taken 9256966 times.
✓ Branch 6 taken 3184837 times.
✓ Branch 7 taken 9256966 times.
✓ Branch 8 taken 2308 times.
✓ Branch 9 taken 13214 times.
✓ Branch 10 taken 2308 times.
✓ Branch 11 taken 13214 times.
✓ Branch 12 taken 28 times.
✓ Branch 13 taken 36 times.
✓ Branch 14 taken 28 times.
✓ Branch 15 taken 36 times.
✓ Branch 16 taken 592 times.
✓ Branch 17 taken 432 times.
✓ Branch 18 taken 592 times.
✓ Branch 19 taken 432 times.
✓ Branch 20 taken 1804 times.
✓ Branch 21 taken 6778 times.
✓ Branch 22 taken 1804 times.
✓ Branch 23 taken 6778 times.
|
88729220 | { return hasBoundaryScvf_[eIdx]; } |
208 | |||
209 | private: | ||
210 | |||
211 | 237 | void update_() | |
212 | { | ||
213 | // clear containers (necessary after grid refinement) | ||
214 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 168 times.
|
237 | scvs_.clear(); |
215 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 126 times.
|
237 | scvfs_.clear(); |
216 | 237 | scvfIndicesOfScv_.clear(); | |
217 | 237 | flipScvfIndices_.clear(); | |
218 | |||
219 | // determine size of containers | ||
220 | 237 | std::size_t numScvs = numDofs(); | |
221 | 237 | std::size_t numScvf = 0; | |
222 |
10/12✓ Branch 2 taken 1557464 times.
✓ Branch 3 taken 68 times.
✓ Branch 4 taken 70321 times.
✓ Branch 5 taken 59 times.
✓ Branch 6 taken 11 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 19184 times.
✓ Branch 9 taken 11 times.
✓ Branch 10 taken 19184 times.
✓ Branch 11 taken 11 times.
✓ Branch 13 taken 19184 times.
✗ Branch 14 not taken.
|
2622552 | for (const auto& element : elements(this->gridView())) |
223 |
2/4✓ Branch 1 taken 19184 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19184 times.
✗ Branch 5 not taken.
|
4980929 | numScvf += element.subEntities(1); |
224 | |||
225 | // reserve memory | ||
226 | 237 | scvs_.resize(numScvs); | |
227 | 237 | scvfs_.reserve(numScvf); | |
228 | 237 | scvfIndicesOfScv_.resize(numScvs); | |
229 | 237 | hasBoundaryScvf_.assign(numScvs, false); | |
230 | |||
231 | // Build the scvs and scv faces | ||
232 | 237 | GridIndexType scvfIdx = 0; | |
233 | 237 | numBoundaryScvf_ = 0; | |
234 |
10/12✓ Branch 2 taken 1557464 times.
✓ Branch 3 taken 68 times.
✓ Branch 4 taken 70321 times.
✓ Branch 5 taken 59 times.
✓ Branch 6 taken 11 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 19184 times.
✓ Branch 9 taken 11 times.
✓ Branch 10 taken 19184 times.
✓ Branch 11 taken 11 times.
✓ Branch 13 taken 19184 times.
✗ Branch 14 not taken.
|
5068486 | for (const auto& element : elements(this->gridView())) |
235 | { | ||
236 |
2/4✓ Branch 1 taken 19184 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19184 times.
✗ Branch 5 not taken.
|
5068006 | const auto eIdx = this->elementMapper().index(element); |
237 |
5/6✓ Branch 1 taken 19184 times.
✓ Branch 2 taken 961290 times.
✓ Branch 3 taken 595964 times.
✓ Branch 4 taken 9352 times.
✓ Branch 5 taken 32 times.
✗ Branch 6 not taken.
|
5619452 | scvs_[eIdx] = SubControlVolume(element.geometry(), eIdx); |
238 | |||
239 | // the element-wise index sets for finite volume geometry | ||
240 |
2/6✓ Branch 1 taken 1576438 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19184 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
5068006 | std::vector<GridIndexType> scvfsIndexSet; |
241 |
3/5✓ Branch 1 taken 1576438 times.
✓ Branch 2 taken 109 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1576438 times.
✗ Branch 5 not taken.
|
4980929 | scvfsIndexSet.reserve(element.subEntities(1)); |
242 | |||
243 | // for network grids there might be multiple intersection with the same geometryInInside | ||
244 | // we identify those by the indexInInside for now (assumes conforming grids at branching facets) | ||
245 | using ScvfGridIndexStorage = typename SubControlVolumeFace::Traits::GridIndexStorage; | ||
246 |
4/6✓ Branch 1 taken 1576547 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1560277 times.
✓ Branch 4 taken 16270 times.
✓ Branch 5 taken 74118 times.
✗ Branch 6 not taken.
|
7578249 | std::vector<ScvfGridIndexStorage> outsideIndices; |
247 | if (dim < dimWorld) | ||
248 | { | ||
249 | //! first, push inside index in all neighbor sets | ||
250 |
2/4✓ Branch 1 taken 16270 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16270 times.
✗ Branch 5 not taken.
|
47520 | outsideIndices.resize(element.subEntities(1)); |
251 |
1/2✓ Branch 1 taken 40306 times.
✗ Branch 2 not taken.
|
127354 | std::for_each(outsideIndices.begin(), outsideIndices.end(), [eIdx] (auto& nIndices) { nIndices.push_back(eIdx); }); |
252 | |||
253 | // second, insert neighbors | ||
254 |
6/10✓ Branch 1 taken 16270 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16270 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 58625 times.
✗ Branch 9 not taken.
✓ Branch 13 taken 40898 times.
✓ Branch 14 taken 1457 times.
✓ Branch 16 taken 42355 times.
✗ Branch 17 not taken.
|
235350 | for (const auto& intersection : intersections(this->gridView(), element)) |
255 | { | ||
256 |
4/4✓ Branch 0 taken 40898 times.
✓ Branch 1 taken 1457 times.
✓ Branch 2 taken 40898 times.
✓ Branch 3 taken 1457 times.
|
118764 | if (intersection.neighbor()) |
257 | { | ||
258 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 3674 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3674 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3674 times.
|
171504 | const auto nIdx = this->elementMapper().index( intersection.outside() ); |
259 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 40898 times.
✓ Branch 3 taken 40898 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 40898 times.
✗ Branch 7 not taken.
|
57168 | outsideIndices[intersection.indexInInside()].push_back(nIdx); |
260 | } | ||
261 | } | ||
262 | } | ||
263 | |||
264 |
17/21✓ Branch 1 taken 90388 times.
✓ Branch 2 taken 1486159 times.
✓ Branch 3 taken 7832692 times.
✓ Branch 4 taken 90887 times.
✓ Branch 5 taken 110 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 55370 times.
✓ Branch 8 taken 153915 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 54934 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 267054 times.
✓ Branch 13 taken 41890 times.
✓ Branch 14 taken 83395 times.
✓ Branch 15 taken 992 times.
✓ Branch 16 taken 48187 times.
✓ Branch 17 taken 198738 times.
✓ Branch 18 taken 8542 times.
✓ Branch 19 taken 5832 times.
✓ Branch 20 taken 207280 times.
✗ Branch 21 not taken.
|
19499349 | for (const auto& intersection : intersections(this->gridView(), element)) |
265 | { | ||
266 | // inner sub control volume faces (includes periodic boundaries) | ||
267 |
4/4✓ Branch 0 taken 8005389 times.
✓ Branch 1 taken 155610 times.
✓ Branch 2 taken 242902 times.
✓ Branch 3 taken 9999 times.
|
14157830 | if (intersection.neighbor()) |
268 | { | ||
269 | // update the grid geometry if we have periodic boundaries | ||
270 |
4/4✓ Branch 0 taken 7720193 times.
✓ Branch 1 taken 211735 times.
✓ Branch 2 taken 73244 times.
✓ Branch 3 taken 40898 times.
|
13634968 | if (intersection.boundary()) |
271 | 32 | this->setPeriodic(); | |
272 | |||
273 | if (dim == dimWorld) | ||
274 | { | ||
275 |
3/6✓ Branch 1 taken 276272 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 276272 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 276272 times.
✗ Branch 8 not taken.
|
40223978 | const auto nIdx = this->elementMapper().index(intersection.outside()); |
276 |
4/9✓ Branch 1 taken 271598 times.
✓ Branch 2 taken 7692676 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 271598 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 198738 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
13520632 | scvfs_.emplace_back(intersection, |
277 | intersection.geometry(), | ||
278 | scvfIdx, | ||
279 | ScvfGridIndexStorage({eIdx, nIdx}), | ||
280 | 13520632 | false); | |
281 |
1/2✓ Branch 1 taken 7964274 times.
✗ Branch 2 not taken.
|
13520632 | scvfsIndexSet.push_back(scvfIdx++); |
282 | } | ||
283 | // this is for network grids | ||
284 | // (will be optimized away of dim == dimWorld) | ||
285 | else | ||
286 | { | ||
287 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40898 times.
|
57168 | auto indexInInside = intersection.indexInInside(); |
288 | // check if we already handled this facet | ||
289 |
6/6✓ Branch 0 taken 38849 times.
✓ Branch 1 taken 2049 times.
✓ Branch 2 taken 38849 times.
✓ Branch 3 taken 2049 times.
✓ Branch 4 taken 38849 times.
✓ Branch 5 taken 2049 times.
|
171504 | if (outsideIndices[indexInInside].empty()) |
290 | continue; | ||
291 | else | ||
292 | { | ||
293 |
1/2✓ Branch 1 taken 38849 times.
✗ Branch 2 not taken.
|
53860 | scvfs_.emplace_back(intersection, |
294 | intersection.geometry(), | ||
295 | scvfIdx, | ||
296 | 53860 | outsideIndices[indexInInside], | |
297 |
1/2✓ Branch 1 taken 38849 times.
✗ Branch 2 not taken.
|
53860 | false); |
298 |
1/2✓ Branch 1 taken 38849 times.
✗ Branch 2 not taken.
|
53860 | scvfsIndexSet.push_back(scvfIdx++); |
299 |
2/4✓ Branch 0 taken 38849 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38849 times.
✗ Branch 3 not taken.
|
107720 | outsideIndices[indexInInside].clear(); |
300 | } | ||
301 | } | ||
302 | } | ||
303 | // boundary sub control volume faces | ||
304 |
3/4✓ Branch 0 taken 154651 times.
✓ Branch 1 taken 3284 times.
✓ Branch 2 taken 1457 times.
✗ Branch 3 not taken.
|
287158 | else if (intersection.boundary()) |
305 | { | ||
306 |
5/12✓ Branch 1 taken 13225 times.
✓ Branch 2 taken 145550 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13225 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 9979 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1457 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
|
286712 | scvfs_.emplace_back(intersection, |
307 | intersection.geometry(), | ||
308 | scvfIdx, | ||
309 |
2/4✓ Branch 1 taken 147618 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1457 times.
✗ Branch 4 not taken.
|
286732 | ScvfGridIndexStorage({eIdx, static_cast<GridIndexType>(this->gridView().size(0) + numBoundaryScvf_++)}), |
310 |
1/2✓ Branch 1 taken 147618 times.
✗ Branch 2 not taken.
|
284498 | true); |
311 |
1/4✓ Branch 1 taken 158775 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
284498 | scvfsIndexSet.push_back(scvfIdx++); |
312 | |||
313 | 853494 | hasBoundaryScvf_[eIdx] = true; | |
314 | } | ||
315 | } | ||
316 | |||
317 | // Save the scvf indices belonging to this scv to build up fv element geometries fast | ||
318 |
2/4✓ Branch 1 taken 1576547 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1576547 times.
✗ Branch 5 not taken.
|
5068006 | scvfIndicesOfScv_[eIdx] = scvfsIndexSet; |
319 | } | ||
320 | |||
321 | // Make the flip index set for network, surface, and periodic grids | ||
322 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 125 times.
|
159 | if (dim < dimWorld || this->isPeriodic()) |
323 | { | ||
324 | 160 | flipScvfIndices_.resize(scvfs_.size()); | |
325 |
4/4✓ Branch 0 taken 40742 times.
✓ Branch 1 taken 44 times.
✓ Branch 2 taken 40742 times.
✓ Branch 3 taken 44 times.
|
56750 | for (auto&& scvf : scvfs_) |
326 | { | ||
327 |
2/2✓ Branch 0 taken 39265 times.
✓ Branch 1 taken 1477 times.
|
56510 | if (scvf.boundary()) |
328 | continue; | ||
329 | |||
330 | 162828 | flipScvfIndices_[scvf.index()].resize(scvf.numOutsideScvs()); | |
331 | 54276 | const auto insideScvIdx = scvf.insideScvIdx(); | |
332 | // check which outside scvf has the insideScvIdx index in its outsideScvIndices | ||
333 |
4/4✓ Branch 0 taken 41314 times.
✓ Branch 1 taken 39265 times.
✓ Branch 2 taken 41314 times.
✓ Branch 3 taken 39265 times.
|
169444 | for (unsigned int i = 0; i < scvf.numOutsideScvs(); ++i) |
334 | 115168 | flipScvfIndices_[scvf.index()][i] = findFlippedScvfIndex_(insideScvIdx, scvf.outsideScvIdx(i)); | |
335 | } | ||
336 | } | ||
337 | |||
338 | // build the connectivity map for an efficient assembly | ||
339 | 237 | connectivityMap_.update(*this); | |
340 | 237 | } | |
341 | |||
342 | // find the scvf that has insideScvIdx in its outsideScvIdx list and outsideScvIdx as its insideScvIdx | ||
343 | 41314 | GridIndexType findFlippedScvfIndex_(GridIndexType insideScvIdx, GridIndexType outsideScvIdx) | |
344 | { | ||
345 | // go over all potential scvfs of the outside scv | ||
346 |
2/4✓ Branch 0 taken 48553 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48553 times.
✗ Branch 3 not taken.
|
197938 | for (auto outsideScvfIndex : scvfIndicesOfScv_[outsideScvIdx]) |
347 | { | ||
348 | 73996 | const auto& outsideScvf = this->scvf(outsideScvfIndex); | |
349 |
4/4✓ Branch 0 taken 50753 times.
✓ Branch 1 taken 23509 times.
✓ Branch 2 taken 50753 times.
✓ Branch 3 taken 23509 times.
|
111662 | for (unsigned int j = 0; j < outsideScvf.numOutsideScvs(); ++j) |
350 |
4/4✓ Branch 0 taken 25044 times.
✓ Branch 1 taken 25709 times.
✓ Branch 2 taken 25044 times.
✓ Branch 3 taken 25709 times.
|
157960 | if (outsideScvf.outsideScvIdx(j) == insideScvIdx) |
351 | 41314 | return outsideScvf.index(); | |
352 | } | ||
353 | |||
354 | ✗ | DUNE_THROW(Dune::InvalidStateException, "No flipped version of this scvf found!"); | |
355 | } | ||
356 | |||
357 | //! connectivity map for efficient assembly | ||
358 | ConnectivityMap connectivityMap_; | ||
359 | |||
360 | //! containers storing the global data | ||
361 | std::vector<SubControlVolume> scvs_; | ||
362 | std::vector<SubControlVolumeFace> scvfs_; | ||
363 | std::vector<std::vector<GridIndexType>> scvfIndicesOfScv_; | ||
364 | std::size_t numBoundaryScvf_; | ||
365 | std::vector<bool> hasBoundaryScvf_; | ||
366 | |||
367 | //! needed for embedded surface and network grids (dim < dimWorld) | ||
368 | std::vector<std::vector<GridIndexType>> flipScvfIndices_; | ||
369 | }; | ||
370 | |||
371 | /*! | ||
372 | * \ingroup CCTpfaDiscretization | ||
373 | * \brief The finite volume geometry (scvs and scvfs) for cell-centered TPFA models on a grid view | ||
374 | * This builds up the sub control volumes and sub control volume faces | ||
375 | * \note For caching disabled we store only some essential index maps to build up local systems on-demand in | ||
376 | * the corresponding FVElementGeometry | ||
377 | */ | ||
378 | template<class GV, class Traits> | ||
379 | class CCTpfaFVGridGeometry<GV, false, Traits> | ||
380 | : public BaseGridGeometry<GV, Traits> | ||
381 | { | ||
382 | using ThisType = CCTpfaFVGridGeometry<GV, false, Traits>; | ||
383 | using ParentType = BaseGridGeometry<GV, Traits>; | ||
384 | using ConnectivityMap = typename Traits::template ConnectivityMap<ThisType>; | ||
385 | |||
386 | using GridIndexType = typename IndexTraits<GV>::GridIndex; | ||
387 | using Element = typename GV::template Codim<0>::Entity; | ||
388 | |||
389 | static const int dim = GV::dimension; | ||
390 | static const int dimWorld = GV::dimensionworld; | ||
391 | |||
392 | using ScvfGridIndexStorage = typename Traits::SubControlVolumeFace::Traits::GridIndexStorage; | ||
393 | using NeighborVolVarIndices = typename std::conditional_t< (dim<dimWorld), | ||
394 | ScvfGridIndexStorage, | ||
395 | Dune::ReservedVector<GridIndexType, 1> >; | ||
396 | |||
397 | public: | ||
398 | //! export basic grid geometry type for the alternative constructor | ||
399 | using BasicGridGeometry = BasicGridGeometry_t<GV, Traits>; | ||
400 | //! export the type of the fv element geometry (the local view type) | ||
401 | using LocalView = typename Traits::template LocalView<ThisType, false>; | ||
402 | //! export the type of sub control volume | ||
403 | using SubControlVolume = typename Traits::SubControlVolume; | ||
404 | //! export the type of sub control volume | ||
405 | using SubControlVolumeFace = typename Traits::SubControlVolumeFace; | ||
406 | //! export the type of extrusion | ||
407 | using Extrusion = Extrusion_t<Traits>; | ||
408 | //! export dof mapper type | ||
409 | using DofMapper = typename Traits::ElementMapper; | ||
410 | |||
411 | //! Export the discretization method this geometry belongs to | ||
412 | using DiscretizationMethod = DiscretizationMethods::CCTpfa; | ||
413 | static constexpr DiscretizationMethod discMethod{}; | ||
414 | |||
415 | //! The maximum admissible stencil size (used for static memory allocation during assembly) | ||
416 | static constexpr int maxElementStencilSize = LocalView::maxNumElementScvfs*Traits::maxNumScvfNeighbors + 1; | ||
417 | |||
418 | //! Export the type of the grid view | ||
419 | using GridView = GV; | ||
420 | |||
421 | //! Constructor with basic grid geometry used to share state with another grid geometry on the same grid view | ||
422 | 274 | CCTpfaFVGridGeometry(std::shared_ptr<BasicGridGeometry> gg) | |
423 |
6/14✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 54 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 54 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 54 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 54 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 54 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
|
1644 | : ParentType(std::move(gg)) |
424 | { | ||
425 | // Check if the overlap size is what we expect | ||
426 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 220 times.
|
548 | if (!CheckOverlapSize<DiscretizationMethod>::isValid(this->gridView())) |
427 | ✗ | DUNE_THROW(Dune::InvalidStateException, "The cctpfa discretization method needs at least an overlap of 1 for parallel computations. " | |
428 | << " Set the parameter \"Grid.Overlap\" in the input file."); | ||
429 | |||
430 |
1/2✓ Branch 1 taken 220 times.
✗ Branch 2 not taken.
|
274 | update_(); |
431 | 274 | } | |
432 | |||
433 | //! Constructor from gridView | ||
434 | 271 | CCTpfaFVGridGeometry(const GridView& gridView) | |
435 |
2/6✓ Branch 2 taken 217 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 217 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
271 | : CCTpfaFVGridGeometry(std::make_shared<BasicGridGeometry>(gridView)) |
436 | 271 | {} | |
437 | |||
438 | //! the element mapper is the dofMapper | ||
439 | //! this is convenience to have better chance to have the same main files for box/tpfa/mpfa... | ||
440 | const DofMapper& dofMapper() const | ||
441 |
4/8✓ Branch 1 taken 93 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 93 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
|
188 | { return this->elementMapper(); } |
442 | |||
443 | //! The total number of sub control volumes | ||
444 | ✗ | std::size_t numScv() const | |
445 | { | ||
446 | ✗ | return numScvs_; | |
447 | } | ||
448 | |||
449 | //! The total number of sub control volume faces | ||
450 | ✗ | std::size_t numScvf() const | |
451 | { | ||
452 | ✗ | return numScvf_; | |
453 | } | ||
454 | |||
455 | //! The total number of boundary sub control volume faces | ||
456 | std::size_t numBoundaryScvf() const | ||
457 | { | ||
458 | return numBoundaryScvf_; | ||
459 | } | ||
460 | |||
461 | //! The total number of degrees of freedom | ||
462 | std::size_t numDofs() const | ||
463 |
70/90✓ Branch 1 taken 234 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 522 times.
✓ Branch 5 taken 11 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 290 times.
✓ Branch 8 taken 11 times.
✓ Branch 9 taken 4 times.
✓ Branch 10 taken 3 times.
✓ Branch 11 taken 25 times.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 32 times.
✓ Branch 14 taken 3 times.
✓ Branch 15 taken 12 times.
✓ Branch 16 taken 21841 times.
✓ Branch 17 taken 4 times.
✓ Branch 18 taken 29 times.
✓ Branch 19 taken 21865 times.
✓ Branch 20 taken 8 times.
✓ Branch 21 taken 5 times.
✓ Branch 22 taken 21830 times.
✓ Branch 23 taken 8 times.
✓ Branch 24 taken 1262 times.
✓ Branch 25 taken 26 times.
✓ Branch 26 taken 6 times.
✓ Branch 27 taken 1190 times.
✓ Branch 28 taken 26 times.
✓ Branch 29 taken 1 times.
✓ Branch 30 taken 1180 times.
✓ Branch 31 taken 13 times.
✓ Branch 32 taken 24 times.
✓ Branch 33 taken 19 times.
✓ Branch 34 taken 2 times.
✓ Branch 35 taken 3 times.
✓ Branch 36 taken 16 times.
✓ Branch 37 taken 4 times.
✓ Branch 38 taken 3 times.
✓ Branch 39 taken 7 times.
✓ Branch 40 taken 19 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 8 times.
✓ Branch 43 taken 17 times.
✓ Branch 44 taken 1 times.
✓ Branch 45 taken 9 times.
✓ Branch 46 taken 17 times.
✓ Branch 47 taken 2 times.
✓ Branch 48 taken 10 times.
✓ Branch 49 taken 17 times.
✗ Branch 50 not taken.
✓ Branch 51 taken 28 times.
✓ Branch 52 taken 18 times.
✓ Branch 53 taken 1 times.
✓ Branch 54 taken 28 times.
✓ Branch 55 taken 3 times.
✓ Branch 56 taken 12 times.
✓ Branch 57 taken 29 times.
✗ Branch 58 not taken.
✓ Branch 59 taken 12 times.
✓ Branch 60 taken 8 times.
✗ Branch 61 not taken.
✓ Branch 62 taken 33 times.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✓ Branch 65 taken 12 times.
✗ Branch 66 not taken.
✓ Branch 68 taken 14 times.
✗ Branch 69 not taken.
✓ Branch 71 taken 12 times.
✗ Branch 72 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✓ Branch 99 taken 1 times.
✗ Branch 100 not taken.
✓ Branch 102 taken 1 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 1 times.
✗ Branch 106 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 124 taken 1 times.
✗ Branch 125 not taken.
|
49867 | { return this->gridView().size(0); } |
464 | |||
465 | //! update all fvElementGeometries (call this after grid adaption) | ||
466 | void update(const GridView& gridView) | ||
467 | { | ||
468 | 4 | ParentType::update(gridView); | |
469 | 4 | update_(); | |
470 | } | ||
471 | |||
472 | //! update all fvElementGeometries (call this after grid adaption) | ||
473 | void update(GridView&& gridView) | ||
474 | { | ||
475 | 11 | ParentType::update(std::move(gridView)); | |
476 | 11 | update_(); | |
477 | } | ||
478 | |||
479 | const std::vector<GridIndexType>& scvfIndicesOfScv(GridIndexType scvIdx) const | ||
480 |
14/26✓ Branch 1 taken 7422876 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7422876 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6351355 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1384 times.
✓ Branch 10 taken 6351355 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1384 times.
✓ Branch 13 taken 1174192 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1174192 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 3443131 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 3443131 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1396 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1396 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 12002 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 12002 times.
✗ Branch 35 not taken.
|
132531804 | { return scvfIndicesOfScv_[scvIdx]; } |
481 | |||
482 | //! Return the neighbor volVar indices for all scvfs in the scv with index scvIdx | ||
483 | const std::vector<NeighborVolVarIndices>& neighborVolVarIndices(GridIndexType scvIdx) const | ||
484 |
14/26✓ Branch 1 taken 7422876 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7422876 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6351355 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1384 times.
✓ Branch 10 taken 6351355 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1384 times.
✓ Branch 13 taken 1174192 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1174192 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 3443131 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 3443131 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1396 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1396 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 12002 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 12002 times.
✗ Branch 35 not taken.
|
132522316 | { return neighborVolVarIndices_[scvIdx]; } |
485 | |||
486 | /*! | ||
487 | * \brief Returns the connectivity map of which dofs have derivatives with respect | ||
488 | * to a given dof. | ||
489 | */ | ||
490 | const ConnectivityMap &connectivityMap() const | ||
491 | 38972089 | { return connectivityMap_; } | |
492 | |||
493 | private: | ||
494 | |||
495 | 291 | void update_() | |
496 | { | ||
497 | // clear local data | ||
498 | 291 | scvfIndicesOfScv_.clear(); | |
499 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
|
291 | neighborVolVarIndices_.clear(); |
500 | |||
501 | // reserve memory or resize the containers | ||
502 | 291 | numScvs_ = numDofs(); | |
503 | 291 | numScvf_ = 0; | |
504 | 291 | numBoundaryScvf_ = 0; | |
505 | 291 | scvfIndicesOfScv_.resize(numScvs_); | |
506 | 291 | neighborVolVarIndices_.resize(numScvs_); | |
507 | |||
508 | // Build the SCV and SCV face | ||
509 |
11/12✓ Branch 2 taken 326769 times.
✓ Branch 3 taken 98 times.
✓ Branch 4 taken 39504 times.
✓ Branch 5 taken 54 times.
✓ Branch 6 taken 48 times.
✓ Branch 7 taken 2016 times.
✓ Branch 8 taken 160970 times.
✓ Branch 9 taken 48 times.
✓ Branch 10 taken 160970 times.
✓ Branch 11 taken 48 times.
✓ Branch 13 taken 160970 times.
✗ Branch 14 not taken.
|
1115428 | for (const auto& element : elements(this->gridView())) |
510 | { | ||
511 |
2/4✓ Branch 1 taken 162986 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 162986 times.
✗ Branch 5 not taken.
|
1114834 | const auto eIdx = this->elementMapper().index(element); |
512 | |||
513 | // the element-wise index sets for finite volume geometry | ||
514 |
1/2✓ Branch 1 taken 451516 times.
✗ Branch 2 not taken.
|
557417 | auto numLocalFaces = element.subEntities(1); |
515 |
2/6✓ Branch 1 taken 487602 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 160970 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
1114834 | std::vector<GridIndexType> scvfsIndexSet; |
516 |
3/6✓ Branch 1 taken 487602 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 475574 times.
✓ Branch 4 taken 12028 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
1114834 | std::vector<NeighborVolVarIndices> neighborVolVarIndexSet; |
517 |
1/2✓ Branch 1 taken 487602 times.
✗ Branch 2 not taken.
|
557417 | scvfsIndexSet.reserve(numLocalFaces); |
518 |
1/2✓ Branch 1 taken 487602 times.
✗ Branch 2 not taken.
|
557417 | neighborVolVarIndexSet.reserve(numLocalFaces); |
519 | |||
520 | // for network grids there might be multiple intersection with the same geometryInInside | ||
521 | // we identify those by the indexInInside for now (assumes conforming grids at branching facets) | ||
522 |
3/6✓ Branch 1 taken 487602 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 475574 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 160222 times.
✗ Branch 6 not taken.
|
1650591 | std::vector<NeighborVolVarIndices> outsideIndices; |
523 | if (dim < dimWorld) | ||
524 | { | ||
525 |
1/2✓ Branch 1 taken 12028 times.
✗ Branch 2 not taken.
|
21660 | outsideIndices.resize(numLocalFaces); |
526 |
6/13✓ Branch 1 taken 12028 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12028 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 53562 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 13 taken 6950 times.
✓ Branch 14 taken 34584 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 7094 times.
✗ Branch 17 not taken.
|
229956 | for (const auto& intersection : intersections(this->gridView(), element)) |
527 | { | ||
528 |
4/4✓ Branch 0 taken 6950 times.
✓ Branch 1 taken 33820 times.
✓ Branch 2 taken 7714 times.
✓ Branch 3 taken 144 times.
|
87444 | if (intersection.neighbor()) |
529 | { | ||
530 |
5/8✗ Branch 0 not taken.
✓ Branch 1 taken 37768 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4092 times.
✓ Branch 4 taken 33676 times.
✓ Branch 5 taken 4092 times.
✓ Branch 7 taken 33676 times.
✗ Branch 8 not taken.
|
161866 | const auto nIdx = this->elementMapper().index(intersection.outside()); |
531 |
5/9✗ Branch 0 not taken.
✓ Branch 1 taken 40626 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6950 times.
✓ Branch 4 taken 33676 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6950 times.
✓ Branch 7 taken 33676 times.
✗ Branch 8 not taken.
|
76406 | outsideIndices[intersection.indexInInside()].push_back(nIdx); |
532 | } | ||
533 | } | ||
534 | } | ||
535 | |||
536 |
17/21✓ Branch 1 taken 172250 times.
✓ Branch 2 taken 315352 times.
✓ Branch 3 taken 1249144 times.
✓ Branch 4 taken 306348 times.
✓ Branch 5 taken 30422 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 129462 times.
✓ Branch 8 taken 813835 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 7862 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 41974 times.
✓ Branch 13 taken 9126 times.
✓ Branch 14 taken 651201 times.
✓ Branch 15 taken 2176 times.
✓ Branch 16 taken 15798 times.
✓ Branch 17 taken 25268 times.
✓ Branch 18 taken 2316 times.
✓ Branch 19 taken 8704 times.
✓ Branch 20 taken 27584 times.
✗ Branch 21 not taken.
|
4736401 | for (const auto& intersection : intersections(this->gridView(), element)) |
537 | { | ||
538 | // inner sub control volume faces (includes periodic boundaries) | ||
539 |
4/4✓ Branch 0 taken 1159289 times.
✓ Branch 1 taken 764525 times.
✓ Branch 2 taken 43283 times.
✓ Branch 3 taken 2460 times.
|
2246193 | if (intersection.neighbor()) |
540 | { | ||
541 | // update the grid geometry if we have periodic boundaries | ||
542 |
4/4✓ Branch 0 taken 1123518 times.
✓ Branch 1 taken 26826 times.
✓ Branch 2 taken 752088 times.
✓ Branch 3 taken 6950 times.
|
2180302 | if (intersection.boundary()) |
543 | 800 | this->setPeriodic(); | |
544 | |||
545 | if (dim == dimWorld) | ||
546 | { | ||
547 |
1/2✓ Branch 1 taken 1861806 times.
✗ Branch 2 not taken.
|
2094842 | scvfsIndexSet.push_back(numScvf_++); |
548 |
3/6✓ Branch 1 taken 632024 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 632024 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 632024 times.
✗ Branch 8 not taken.
|
5302310 | const auto nIdx = this->elementMapper().index(intersection.outside()); |
549 |
1/2✓ Branch 2 taken 1861806 times.
✗ Branch 3 not taken.
|
2094842 | neighborVolVarIndexSet.emplace_back(NeighborVolVarIndices({nIdx})); |
550 | } | ||
551 | // this is for network grids | ||
552 | // (will be optimized away of dim == dimWorld) | ||
553 | else | ||
554 | { | ||
555 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 40626 times.
✗ Branch 2 not taken.
|
76406 | auto indexInInside = intersection.indexInInside(); |
556 | // check if we already handled this facet | ||
557 |
6/6✓ Branch 0 taken 40456 times.
✓ Branch 1 taken 170 times.
✓ Branch 2 taken 40456 times.
✓ Branch 3 taken 170 times.
✓ Branch 4 taken 40456 times.
✓ Branch 5 taken 170 times.
|
229218 | if (outsideIndices[indexInInside].empty()) |
558 | continue; | ||
559 | else | ||
560 | { | ||
561 |
1/2✓ Branch 1 taken 40456 times.
✗ Branch 2 not taken.
|
76180 | scvfsIndexSet.push_back(numScvf_++); |
562 |
2/4✓ Branch 1 taken 40456 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 40456 times.
✗ Branch 5 not taken.
|
152360 | neighborVolVarIndexSet.emplace_back(std::move(outsideIndices[indexInInside])); |
563 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 40456 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 40456 times.
|
152360 | outsideIndices[indexInInside].clear(); |
564 | } | ||
565 | } | ||
566 | } | ||
567 | // boundary sub control volume faces | ||
568 |
3/4✓ Branch 0 taken 20786 times.
✓ Branch 1 taken 11261 times.
✓ Branch 2 taken 544 times.
✗ Branch 3 not taken.
|
38307 | else if (intersection.boundary()) |
569 | { | ||
570 |
1/2✓ Branch 1 taken 31983 times.
✗ Branch 2 not taken.
|
37615 | scvfsIndexSet.push_back(numScvf_++); |
571 |
5/11✓ Branch 1 taken 908 times.
✓ Branch 2 taken 31075 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 908 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 908 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 908 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
|
39371 | neighborVolVarIndexSet.emplace_back(NeighborVolVarIndices({static_cast<GridIndexType>(numScvs_ + numBoundaryScvf_++)})); |
572 | } | ||
573 | } | ||
574 | |||
575 | // store the sets of indices in the data container | ||
576 |
2/4✓ Branch 1 taken 487602 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 487602 times.
✗ Branch 5 not taken.
|
1114834 | scvfIndicesOfScv_[eIdx] = scvfsIndexSet; |
577 |
2/4✓ Branch 1 taken 487602 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 487602 times.
✗ Branch 5 not taken.
|
1114834 | neighborVolVarIndices_[eIdx] = neighborVolVarIndexSet; |
578 | } | ||
579 | |||
580 | // build the connectivity map for an efficient assembly | ||
581 | 291 | connectivityMap_.update(*this); | |
582 | 291 | } | |
583 | |||
584 | //! Information on the global number of geometries | ||
585 | std::size_t numScvs_; | ||
586 | std::size_t numScvf_; | ||
587 | std::size_t numBoundaryScvf_; | ||
588 | |||
589 | //! connectivity map for efficient assembly | ||
590 | ConnectivityMap connectivityMap_; | ||
591 | |||
592 | //! vectors that store the global data | ||
593 | std::vector<std::vector<GridIndexType>> scvfIndicesOfScv_; | ||
594 | std::vector<std::vector<NeighborVolVarIndices>> neighborVolVarIndices_; | ||
595 | }; | ||
596 | |||
597 | } // end namespace Dumux | ||
598 | |||
599 | #endif | ||
600 |