GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/discretization/porenetwork/subcontrolvolumeface.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 13 13 100.0%
Functions: 0 0 -%
Branches: 80 109 73.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-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 PoreNetworkDiscretization
10 * \brief Base class for a sub control volume face
11 */
12 #ifndef DUMUX_DISCRETIZATION_PNM_SUBCONTROLVOLUMEFACE_HH
13 #define DUMUX_DISCRETIZATION_PNM_SUBCONTROLVOLUMEFACE_HH
14
15 #include <dune/geometry/axisalignedcubegeometry.hh>
16 #include <dumux/common/indextraits.hh>
17 #include <dumux/discretization/subcontrolvolumefacebase.hh>
18
19 namespace Dumux::PoreNetwork {
20
21 /*!
22 * \ingroup PoreNetworkDiscretization
23 * \brief Default traits class
24 * \tparam GV the type of the grid view
25 */
26 template<class GridView>
27 struct PNMDefaultScvfGeometryTraits
28 {
29 using Grid = typename GridView::Grid;
30 static constexpr int dim = Grid::dimension;
31 static constexpr int dimWorld = Grid::dimensionworld;
32
33 using GridIndexType = typename IndexTraits<GridView>::GridIndex;
34 using LocalIndexType = typename IndexTraits<GridView>::LocalIndex;
35
36 using Scalar = typename Grid::ctype;
37 using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
38 using CornerStorage = std::array<Dune::FieldVector<Scalar, dimWorld>, 1>;
39 using Geometry = Dune::AxisAlignedCubeGeometry<Scalar, dim-1, dimWorld>;
40
41 };
42
43 /*!
44 * \ingroup PoreNetworkDiscretization
45 * \brief Class for a sub control volume face for porenetworks
46 * \tparam GV the type of the grid view
47 * \tparam T the scvf geometry traits
48 */
49 template<class GV,
50 class T = PNMDefaultScvfGeometryTraits<GV> >
51 class PNMSubControlVolumeFace
52 : public Dumux::SubControlVolumeFaceBase<PNMSubControlVolumeFace<GV, T>, T>
53 {
54 using ThisType = PNMSubControlVolumeFace<GV, T>;
55 using ParentType = Dumux::SubControlVolumeFaceBase<ThisType, T>;
56 using GridIndexType = typename T::GridIndexType;
57 using LocalIndexType = typename T::LocalIndexType;
58 using Scalar = typename T::Scalar;
59
60 public:
61 //! export the type used for global coordinates
62 using GlobalPosition = typename T::GlobalPosition;
63 //! state the traits public and thus export all types
64 using Traits = T;
65
66 //! The default constructor
67
15/33
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 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 2 times.
✗ Branch 20 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✓ Branch 29 taken 338742 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 338742 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 182830 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 182830 times.
✗ Branch 39 not taken.
✓ Branch 43 taken 2 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 2 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 6 taken 952 times.
2807832 PNMSubControlVolumeFace() = default;
68
69 //! Constructor for inner scvfs
70 3955347 PNMSubControlVolumeFace(const GlobalPosition& center,
71 const GlobalPosition& unitOuterNormal,
72 const Scalar& area,
73 GridIndexType scvfIndex,
74 std::array<LocalIndexType, 2>&& scvIndices)
75 3955347 : center_(center),
76 3955347 unitOuterNormal_(unitOuterNormal),
77 area_(area),
78 scvfIndex_(scvfIndex),
79 scvIndices_(std::move(scvIndices))
80 {}
81
82 //! The center of the sub control volume face
83 const GlobalPosition& center() const
84 1872 { return center_; }
85
86 //! The integration point for flux evaluations in global coordinates
87 const GlobalPosition& ipGlobal() const
88 1242046 { return center_; }
89
90 //! The area of the sub control volume face
91 Scalar area() const
92 { return area_; }
93
94 //! We assume to always have a pore body and not a pore throat at the boundary
95 bool boundary() const
96 { return false; }
97
98 //! The unit outer normal of the sub control volume face
99 const GlobalPosition& unitOuterNormal() const
100 1872 { return unitOuterNormal_; }
101
102 //! Index of the inside sub control volume for spatial param evaluation
103 89464026 LocalIndexType insideScvIdx() const
104
26/28
✓ Branch 0 taken 31854 times.
✓ Branch 1 taken 22413 times.
✓ Branch 2 taken 1228437 times.
✓ Branch 3 taken 896284 times.
✓ Branch 4 taken 1776342 times.
✓ Branch 5 taken 2223717 times.
✓ Branch 6 taken 369536 times.
✓ Branch 7 taken 953223 times.
✓ Branch 8 taken 2532950 times.
✓ Branch 9 taken 823435 times.
✓ Branch 10 taken 7330 times.
✓ Branch 11 taken 1174600 times.
✓ Branch 12 taken 1092264 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 4385 times.
✓ Branch 15 taken 10999 times.
✓ Branch 16 taken 397 times.
✓ Branch 17 taken 2524593 times.
✓ Branch 18 taken 22032 times.
✓ Branch 19 taken 2539784 times.
✓ Branch 20 taken 6681 times.
✓ Branch 21 taken 1129442 times.
✓ Branch 22 taken 10470328 times.
✓ Branch 23 taken 21478346 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 32058562 times.
✓ Branch 26 taken 18206 times.
✓ Branch 27 taken 25653 times.
85813058 { return scvIndices_[0]; }
105
106 //! Index of the outside sub control volume for spatial param evaluation
107 // This results in undefined behaviour if boundary is true
108 89381325 LocalIndexType outsideScvIdx() const
109
22/24
✓ Branch 0 taken 31854 times.
✓ Branch 1 taken 22413 times.
✓ Branch 2 taken 1228437 times.
✓ Branch 3 taken 896284 times.
✓ Branch 4 taken 1776342 times.
✓ Branch 5 taken 2223717 times.
✓ Branch 6 taken 369536 times.
✓ Branch 7 taken 953223 times.
✓ Branch 8 taken 2532950 times.
✓ Branch 9 taken 825855 times.
✓ Branch 10 taken 4910 times.
✓ Branch 11 taken 1174600 times.
✓ Branch 12 taken 1092264 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 4385 times.
✓ Branch 15 taken 10999 times.
✓ Branch 16 taken 397 times.
✓ Branch 17 taken 2524593 times.
✓ Branch 18 taken 6681 times.
✓ Branch 19 taken 2560154 times.
✓ Branch 20 taken 10470328 times.
✓ Branch 21 taken 22570610 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 32058562 times.
85730357 { return scvIndices_[1]; }
110
111 //! The local index of this sub control volume face
112 140633325 GridIndexType index() const
113
17/24
✓ Branch 0 taken 20364 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24066409 times.
✓ Branch 4 taken 302005 times.
✓ Branch 5 taken 10231662 times.
✓ Branch 7 taken 132635 times.
✓ Branch 8 taken 2546134 times.
✓ Branch 10 taken 48084 times.
✓ Branch 11 taken 1174589 times.
✓ Branch 13 taken 61904 times.
✓ Branch 14 taken 32058562 times.
✓ Branch 17 taken 1 times.
✓ Branch 18 taken 31948673 times.
✓ Branch 19 taken 1 times.
✓ Branch 20 taken 31948673 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 8736 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 8056 times.
✗ Branch 12 not taken.
✓ Branch 15 taken 61536 times.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
108684652 { return scvfIndex_; }
114
115 private:
116 GlobalPosition center_;
117 GlobalPosition unitOuterNormal_;
118 Scalar area_;
119 GridIndexType scvfIndex_;
120 std::array<LocalIndexType, 2> scvIndices_;
121 };
122
123 } // end namespace Dumux::PoreNetwork
124
125 #endif
126