GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/common/entitymap.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 13 13 100.0%
Functions: 50 52 96.2%
Branches: 186 239 77.8%

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 Core
10 * \brief A map from indices to entities using grid entity seeds
11 */
12 #ifndef DUMUX_ENTITY_INDEX_MAP_HH
13 #define DUMUX_ENTITY_INDEX_MAP_HH
14
15 #include <vector>
16 #include <utility>
17 #include <dune/geometry/dimension.hh>
18
19 namespace Dumux {
20
21 /*!
22 * \ingroup Core
23 * \brief A map from indices to entities using grid entity seeds
24 */
25 template <class GridView, int codim = 0>
26
6/18
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 551 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 147 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 126 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 18 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 18 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 26 times.
✗ Branch 17 not taken.
886 class EntityMap
27 {
28 public:
29 using Grid = typename GridView::Traits::Grid;
30 using Entity = typename Grid::template Codim<codim>::Entity;
31 using EntitySeed = typename Grid::template Codim<codim>::EntitySeed;
32
33 //! constructor moving a ready seed list in here
34 EntityMap(const Grid& grid, std::vector<EntitySeed>&& seeds)
35 : grid_(grid)
36 , seeds_(std::move(seeds))
37 {}
38
39 //! constructor with all entities of codim
40 template<class Mapper>
41 1221 EntityMap(const Grid& grid, const Mapper& mapper)
42
1/4
✓ Branch 1 taken 886 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1221 : grid_(grid)
43 {
44
1/2
✓ Branch 1 taken 886 times.
✗ Branch 2 not taken.
1221 update(mapper);
45 1221 }
46
47 //! update the map after the grid changed
48 void update(std::vector<EntitySeed>&& seeds)
49 { seeds_.swap(std::move(seeds)); }
50
51 //! update the map after the grid changed
52 template<class Mapper>
53 1221 void update(const Mapper& mapper)
54 {
55
1/4
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1230 const auto& gv = grid_.leafGridView();
56
2/4
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
1230 seeds_.resize(gv.size(codim));
57
10/12
✓ Branch 1 taken 2919463 times.
✓ Branch 2 taken 376 times.
✓ Branch 3 taken 412166 times.
✓ Branch 4 taken 253 times.
✓ Branch 5 taken 132 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 359008 times.
✓ Branch 8 taken 132 times.
✓ Branch 9 taken 359008 times.
✓ Branch 10 taken 132 times.
✓ Branch 12 taken 359008 times.
✗ Branch 13 not taken.
10354808 for (const auto& entity : entities(gv, Dune::Codim<codim>()))
58
7/12
✓ Branch 0 taken 1566 times.
✓ Branch 1 taken 357442 times.
✓ Branch 3 taken 359008 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 359008 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 359008 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 359008 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 359008 times.
✗ Branch 16 not taken.
10369626 seeds_[mapper.index(entity)] = entity.seed();
59 1221 }
60
61 //! get an element from an index i
62 Entity operator[](std::size_t i) const
63
155/177
✓ Branch 1 taken 6919566 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 29989251 times.
✓ Branch 4 taken 6919694 times.
✓ Branch 5 taken 15345338 times.
✓ Branch 6 taken 30047356 times.
✓ Branch 7 taken 40084936 times.
✓ Branch 8 taken 15364872 times.
✓ Branch 9 taken 19615354 times.
✓ Branch 10 taken 40140500 times.
✓ Branch 11 taken 5344540 times.
✓ Branch 12 taken 19601559 times.
✓ Branch 13 taken 2743922 times.
✓ Branch 14 taken 5609442 times.
✓ Branch 15 taken 2308121 times.
✓ Branch 16 taken 2659322 times.
✓ Branch 17 taken 7973951 times.
✓ Branch 18 taken 2275120 times.
✓ Branch 19 taken 1140118 times.
✓ Branch 20 taken 7969415 times.
✓ Branch 21 taken 21970 times.
✓ Branch 22 taken 1123990 times.
✓ Branch 23 taken 332003 times.
✓ Branch 24 taken 16278 times.
✓ Branch 25 taken 12084900 times.
✓ Branch 26 taken 344805 times.
✓ Branch 27 taken 12362 times.
✓ Branch 28 taken 11833284 times.
✓ Branch 29 taken 960224 times.
✓ Branch 30 taken 12970 times.
✓ Branch 31 taken 2040 times.
✓ Branch 32 taken 740568 times.
✓ Branch 33 taken 35540 times.
✓ Branch 34 taken 2753 times.
✓ Branch 35 taken 1166581 times.
✓ Branch 36 taken 32304 times.
✓ Branch 37 taken 2731 times.
✓ Branch 38 taken 1135369 times.
✓ Branch 39 taken 318696 times.
✓ Branch 40 taken 693 times.
✓ Branch 41 taken 1117672 times.
✓ Branch 42 taken 318696 times.
✓ Branch 43 taken 576068 times.
✓ Branch 44 taken 1809548 times.
✓ Branch 45 taken 915356 times.
✓ Branch 46 taken 731108 times.
✓ Branch 47 taken 1203551 times.
✓ Branch 48 taken 914596 times.
✓ Branch 49 taken 160140 times.
✓ Branch 50 taken 1296447 times.
✓ Branch 51 taken 731036 times.
✓ Branch 52 taken 5676 times.
✓ Branch 53 taken 860952 times.
✓ Branch 54 taken 730972 times.
✓ Branch 55 taken 33460 times.
✓ Branch 56 taken 1294728 times.
✓ Branch 57 taken 426402 times.
✓ Branch 58 taken 441384 times.
✓ Branch 59 taken 1298026 times.
✓ Branch 60 taken 428766 times.
✓ Branch 61 taken 521536 times.
✓ Branch 62 taken 683222 times.
✓ Branch 63 taken 110034 times.
✓ Branch 64 taken 695030 times.
✓ Branch 65 taken 796664 times.
✓ Branch 66 taken 181746 times.
✓ Branch 67 taken 893644 times.
✓ Branch 68 taken 675706 times.
✓ Branch 69 taken 190184 times.
✓ Branch 70 taken 308696 times.
✓ Branch 71 taken 823663 times.
✓ Branch 72 taken 7908 times.
✓ Branch 73 taken 62084 times.
✓ Branch 74 taken 156769 times.
✓ Branch 75 taken 69404 times.
✓ Branch 76 taken 25394 times.
✓ Branch 77 taken 732 times.
✓ Branch 78 taken 3078432 times.
✓ Branch 79 taken 25212 times.
✓ Branch 80 taken 1720 times.
✓ Branch 81 taken 21351304 times.
✓ Branch 82 taken 1328 times.
✓ Branch 83 taken 9916 times.
✓ Branch 84 taken 18336264 times.
✓ Branch 85 taken 9110 times.
✓ Branch 86 taken 100356 times.
✓ Branch 87 taken 18665739 times.
✓ Branch 88 taken 1539 times.
✓ Branch 89 taken 101420 times.
✓ Branch 90 taken 18665297 times.
✓ Branch 91 taken 1967 times.
✓ Branch 92 taken 101138 times.
✓ Branch 93 taken 18436876 times.
✓ Branch 94 taken 1995 times.
✓ Branch 95 taken 176 times.
✓ Branch 96 taken 18436572 times.
✓ Branch 97 taken 152274 times.
✓ Branch 98 taken 22812 times.
✓ Branch 99 taken 111668 times.
✓ Branch 100 taken 153138 times.
✓ Branch 101 taken 131456 times.
✓ Branch 102 taken 304128 times.
✓ Branch 103 taken 322846 times.
✗ Branch 104 not taken.
✓ Branch 105 taken 465584 times.
✓ Branch 106 taken 561394 times.
✓ Branch 107 taken 1030 times.
✓ Branch 108 taken 162320 times.
✓ Branch 109 taken 353602 times.
✓ Branch 110 taken 1030 times.
✓ Branch 111 taken 162320 times.
✓ Branch 112 taken 214216 times.
✓ Branch 113 taken 4138 times.
✓ Branch 114 taken 12498032 times.
✓ Branch 115 taken 214216 times.
✓ Branch 116 taken 150470 times.
✓ Branch 117 taken 12498032 times.
✓ Branch 118 taken 5064 times.
✓ Branch 119 taken 150470 times.
✓ Branch 120 taken 304 times.
✓ Branch 121 taken 318108 times.
✓ Branch 122 taken 720676 times.
✓ Branch 123 taken 200 times.
✓ Branch 124 taken 322980 times.
✓ Branch 125 taken 720676 times.
✓ Branch 126 taken 336 times.
✓ Branch 127 taken 4888 times.
✓ Branch 128 taken 517000 times.
✓ Branch 129 taken 136 times.
✓ Branch 130 taken 4888 times.
✓ Branch 131 taken 70290 times.
✓ Branch 132 taken 28 times.
✓ Branch 133 taken 319248 times.
✓ Branch 134 taken 70290 times.
✓ Branch 135 taken 28 times.
✓ Branch 136 taken 319408 times.
✗ Branch 137 not taken.
✓ Branch 139 taken 176 times.
✗ Branch 140 not taken.
✓ Branch 141 taken 2464 times.
✗ Branch 142 not taken.
✓ Branch 143 taken 28 times.
✓ Branch 144 taken 2464 times.
✗ Branch 145 not taken.
✓ Branch 146 taken 28 times.
✓ Branch 147 taken 146664 times.
✗ Branch 148 not taken.
✓ Branch 150 taken 146664 times.
✗ Branch 151 not taken.
✓ Branch 153 taken 146664 times.
✗ Branch 154 not taken.
✓ Branch 156 taken 146664 times.
✗ Branch 157 not taken.
✓ Branch 159 taken 145768 times.
✗ Branch 160 not taken.
✓ Branch 162 taken 145768 times.
✗ Branch 163 not taken.
✗ Branch 169 not taken.
✓ Branch 170 taken 864 times.
✗ Branch 171 not taken.
✓ Branch 172 taken 864 times.
✗ Branch 173 not taken.
✓ Branch 174 taken 864 times.
✓ Branch 176 taken 97376 times.
✗ Branch 177 not taken.
✓ Branch 179 taken 97376 times.
✗ Branch 180 not taken.
✓ Branch 184 taken 200 times.
✗ Branch 185 not taken.
✓ Branch 187 taken 200 times.
✗ Branch 188 not taken.
✓ Branch 192 taken 1354 times.
✗ Branch 193 not taken.
✓ Branch 195 taken 1354 times.
✗ Branch 196 not taken.
✓ Branch 198 taken 1354 times.
✗ Branch 199 not taken.
1757798525 { return grid_.entity(seeds_[i]); }
64
65 //! get the size of the map
66 std::size_t size() const
67
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 2431624 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 201257 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 153860 times.
2786741 { return seeds_.size(); }
68
69 private:
70 const Grid& grid_;
71 std::vector<EntitySeed> seeds_;
72 };
73
74 template<class GridView>
75 using ElementMap = EntityMap<GridView, 0>;
76
77 } // end namespace Dumux
78
79 #endif
80