GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/dualnetwork/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 33 33 100.0%
Functions: 2 2 100.0%
Branches: 110 232 47.4%

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 * \brief The spatial parameters class for the Hhat problem with multiple solid spheres
10 */
11
12 #ifndef DUMUX_TEST_MULTIDOMAIN_DUALNETWORK_SPATIALPARAMS_HH
13 #define DUMUX_TEST_MULTIDOMAIN_DUALNETWORK_SPATIALPARAMS_HH
14
15 #include <dumux/porenetwork/solidenergy/spatialparams.hh>
16 #include <dumux/porenetwork/1p/spatialparams.hh>
17
18 namespace Dumux::PoreNetwork {
19
20 /*!
21 * \brief The spatial parameters class.
22 */
23 template<class GridGeometry, class Scalar>
24 class FluidSpatialParams
25 : public PoreNetwork::OnePDefaultSpatialParams<GridGeometry, Scalar>
26 {
27 using ParentType = PoreNetwork::OnePDefaultSpatialParams<GridGeometry, Scalar>;
28 using GlobalPosition = typename GridGeometry::GlobalCoordinate;
29 public:
30 // export permeability type
31 using PermeabilityType = Scalar;
32
33 template<class GridData>
34 1 FluidSpatialParams(std::shared_ptr<const GridGeometry> fvGridGeometry, const GridData& gridData)
35
2/12
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
3 : ParentType(fvGridGeometry)
36 {
37
1/2
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
3 throatCenter_.resize(fvGridGeometry->gridView().size(0));
38
1/2
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
3 poreExtendedRadius_.resize(fvGridGeometry->gridView().size(1));
39
40
8/12
✓ 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 9 taken 1007 times.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1007 times.
✓ Branch 12 taken 1 times.
✓ Branch 14 taken 1007 times.
✗ Branch 15 not taken.
2017 for (const auto& element : elements(fvGridGeometry->gridView()))
41 {
42
3/6
✓ Branch 1 taken 1007 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1007 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1007 times.
✗ Branch 8 not taken.
3021 const auto eIdx = fvGridGeometry->elementMapper().index(element);
43
1/2
✓ Branch 1 taken 1007 times.
✗ Branch 2 not taken.
1007 const auto& params = gridData.parameters(element);
44
6/14
✓ Branch 1 taken 1007 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1007 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1007 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1007 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1007 times.
✓ Branch 14 taken 1007 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
2014 const auto posX = params[gridData.parameterIndex("ThroatCenterX")];
45
6/14
✓ Branch 1 taken 1007 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1007 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1007 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1007 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1007 times.
✓ Branch 14 taken 1007 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
2014 const auto posY = params[gridData.parameterIndex("ThroatCenterY")];
46
5/12
✓ Branch 1 taken 1007 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1007 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1007 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1007 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1007 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
2014 const auto posZ = params[gridData.parameterIndex("ThroatCenterZ")];
47
2/4
✓ Branch 2 taken 1007 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1007 times.
✗ Branch 6 not taken.
1007 throatCenter_[eIdx] = GlobalPosition{posX, posY, posZ};
48 }
49
50
8/12
✓ 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 9 taken 556 times.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 556 times.
✓ Branch 12 taken 1 times.
✓ Branch 14 taken 556 times.
✗ Branch 15 not taken.
1115 for (const auto& vertex : vertices(fvGridGeometry->gridView()))
51 {
52
3/6
✓ Branch 1 taken 556 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 556 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 556 times.
✗ Branch 8 not taken.
1668 const auto vIdx = fvGridGeometry->vertexMapper().index(vertex);
53
7/16
✓ Branch 1 taken 556 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 556 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 556 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 556 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 556 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 556 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 556 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
2224 poreExtendedRadius_[vIdx] = gridData.getParameter(vertex, "PoreExtendedRadius");
54 }
55 1 }
56
57 const GlobalPosition& throatCenter(const std::size_t eIdx) const
58 63989992 { return throatCenter_[eIdx]; }
59
60 template<class Element, class SubControlVolume, class ElementSolutionVector>
61 Scalar poreExtendedRadius(const Element& element,
62 const SubControlVolume& scv,
63 const ElementSolutionVector& elemSol) const
64 { return poreExtendedRadius_[scv.dofIndex()]; }
65
66 Scalar poreExtendedRadius(std::size_t dofIdx) const
67 { return poreExtendedRadius_[dofIdx]; }
68
69 private:
70 std::vector<GlobalPosition> throatCenter_;
71 std::vector<Scalar> poreExtendedRadius_;
72 };
73
74 /*!
75 * \brief The spatial parameters class.
76 */
77 template<class GridGeometry, class Scalar>
78 class SolidSpatialParams
79 : public PoreNetwork::SolidEnergySpatialParams<GridGeometry, Scalar>
80 {
81 using ParentType = PoreNetwork::SolidEnergySpatialParams<GridGeometry, Scalar>;
82 using GlobalPosition = typename GridGeometry::GlobalCoordinate;
83 public:
84 // export permeability type
85 using PermeabilityType = Scalar;
86
87 template<class GridData>
88 1 SolidSpatialParams(std::shared_ptr<const GridGeometry> fvGridGeometry, const GridData& gridData)
89
2/12
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
3 : ParentType(fvGridGeometry)
90 {
91
1/2
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
3 throatCenter_.resize(fvGridGeometry->gridView().size(0));
92
1/2
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
3 poreExtendedRadius_.resize(fvGridGeometry->gridView().size(1));
93
94
8/12
✓ 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 9 taken 2184 times.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 2184 times.
✓ Branch 12 taken 1 times.
✓ Branch 14 taken 2184 times.
✗ Branch 15 not taken.
4371 for (const auto& element : elements(fvGridGeometry->gridView()))
95 {
96
3/6
✓ Branch 1 taken 2184 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2184 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2184 times.
✗ Branch 8 not taken.
6552 const auto eIdx = fvGridGeometry->elementMapper().index(element);
97
1/2
✓ Branch 1 taken 2184 times.
✗ Branch 2 not taken.
2184 const auto& params = gridData.parameters(element);
98
6/14
✓ Branch 1 taken 2184 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2184 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2184 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 2184 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2184 times.
✓ Branch 14 taken 2184 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
4368 const auto posX = params[gridData.parameterIndex("ThroatCenterX")];
99
6/14
✓ Branch 1 taken 2184 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2184 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2184 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 2184 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2184 times.
✓ Branch 14 taken 2184 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
4368 const auto posY = params[gridData.parameterIndex("ThroatCenterY")];
100
5/12
✓ Branch 1 taken 2184 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2184 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2184 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 2184 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2184 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
4368 const auto posZ = params[gridData.parameterIndex("ThroatCenterZ")];
101
2/4
✓ Branch 2 taken 2184 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2184 times.
✗ Branch 6 not taken.
2184 throatCenter_[eIdx] = GlobalPosition{posX, posY, posZ};
102 }
103
104
8/12
✓ 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 9 taken 560 times.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 560 times.
✓ Branch 12 taken 1 times.
✓ Branch 14 taken 560 times.
✗ Branch 15 not taken.
1123 for (const auto& vertex : vertices(fvGridGeometry->gridView()))
105 {
106
3/6
✓ Branch 1 taken 560 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 560 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 560 times.
✗ Branch 8 not taken.
1680 const auto vIdx = fvGridGeometry->vertexMapper().index(vertex);
107
7/16
✓ Branch 1 taken 560 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 560 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 560 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 560 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 560 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 560 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 560 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
2240 poreExtendedRadius_[vIdx] = gridData.getParameter(vertex, "PoreExtendedRadius");
108 }
109 1 }
110
111 const GlobalPosition& throatCenter(const std::size_t eIdx) const
112 131040 { return throatCenter_[eIdx]; }
113
114 template<class Element, class SubControlVolume, class ElementSolutionVector>
115 Scalar poreExtendedRadius(const Element& element,
116 const SubControlVolume& scv,
117 const ElementSolutionVector& elemSol) const
118 { return poreExtendedRadius_[scv.dofIndex()]; }
119
120 Scalar poreExtendedRadius(std::size_t dofIdx) const
121
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 82759 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 82759 times.
389204 { return poreExtendedRadius_[dofIdx]; }
122
123 private:
124 std::vector<GlobalPosition> throatCenter_;
125 std::vector<Scalar> poreExtendedRadius_;
126 };
127
128 } // end namespace Dumux
129
130 #endif
131