GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/discretization/facecentered/diamond/subcontrolvolume.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 24 24 100.0%
Functions: 0 0 -%
Branches: 48 68 70.6%

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 DiamondDiscretization
10 * \copydoc Dumux::FaceCenteredDiamondSubControlVolume
11 */
12 #ifndef DUMUX_DISCRETIZATION_FACECENTERED_DIAMOND_SUBCONTROLVOLUME_HH
13 #define DUMUX_DISCRETIZATION_FACECENTERED_DIAMOND_SUBCONTROLVOLUME_HH
14
15 #include <array>
16 #include <utility>
17 #include <typeinfo>
18
19 #include <dune/geometry/multilineargeometry.hh>
20
21 #include <dumux/common/indextraits.hh>
22 #include "geometryhelper.hh"
23
24 namespace Dumux {
25
26 /*!
27 * \ingroup DiamondDiscretization
28 * \brief Default traits class to be used for the sub-control volumes
29 * \tparam GV the type of the grid view
30 */
31 template<class GridView>
32 struct FaceCenteredDiamondScvGeometryTraits
33 {
34 using Grid = typename GridView::Grid;
35
36 static const int dim = Grid::dimension;
37 static const int dimWorld = Grid::dimensionworld;
38
39 using GridIndexType = typename IndexTraits<GridView>::GridIndex;
40 using LocalIndexType = typename IndexTraits<GridView>::SmallLocalIndex;
41 using Scalar = typename Grid::ctype;
42 using Geometry = Dune::MultiLinearGeometry<Scalar, dim, dimWorld, FCDiamondMLGeometryTraits<Scalar>>;
43
44 using CornerStorage = typename FCDiamondMLGeometryTraits<Scalar>::template CornerStorage<dim, dimWorld>::Type;
45 using GlobalPosition = typename CornerStorage::value_type;
46
47
1/2
✓ Branch 0 taken 338794 times.
✗ Branch 1 not taken.
463132 static constexpr Dune::GeometryType geometryType(Dune::GeometryType elementType)
48 {
49
2/3
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 1 taken 403370 times.
463138 if (elementType == Dune::GeometryTypes::hexahedron)
50 return Dune::GeometryTypes::pyramid;
51 else
52 302344 return Dune::GeometryTypes::simplex(dim);
53 }
54 };
55
56 /*!
57 * \ingroup DiamondDiscretization
58 * \brief Face centered diamond subcontrolvolume face
59 */
60 template<class GridView, class T = FaceCenteredDiamondScvGeometryTraits<GridView>>
61 class FaceCenteredDiamondSubControlVolume
62 {
63 using Scalar = typename T::Scalar;
64 using GridIndexType = typename T::GridIndexType;
65 using LocalIndexType = typename T::LocalIndexType;
66
67 public:
68 using GlobalPosition = typename T::GlobalPosition;
69 //! state the traits public and thus export all types
70 using Traits = T;
71
72 FaceCenteredDiamondSubControlVolume() = default;
73
74 463132 FaceCenteredDiamondSubControlVolume(const Scalar& volume,
75 const GlobalPosition& dofPosition,
76 const GlobalPosition& center,
77 const LocalIndexType indexInElement,
78 const GridIndexType eIdx,
79 const GridIndexType dofIdx)
80 463132 : center_(center)
81 463132 , dofPosition_(dofPosition)
82 463132 , volume_(volume)
83 463132 , indexInElement_(indexInElement)
84 463132 , eIdx_(eIdx)
85 463132 , dofIdx_(dofIdx)
86 {}
87
88 //! The center of the sub control volume
89 2268934 const GlobalPosition& center() const
90
2/5
✓ Branch 1 taken 5606 times.
✓ Branch 2 taken 6968304 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 0 not taken.
24503642 { return center_; }
91
92 //! The position of the degree of freedom
93 96274 const GlobalPosition& dofPosition() const
94
5/6
✓ Branch 0 taken 7366 times.
✓ Branch 1 taken 1860 times.
✓ Branch 2 taken 12178 times.
✓ Branch 3 taken 232554 times.
✓ Branch 4 taken 8208 times.
✗ Branch 5 not taken.
2305980 { return dofPosition_; }
95
96 15754746 Scalar volume() const
97
1/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
8780842 { return volume_; }
98
99 67116958 GridIndexType dofIndex() const
100
23/26
✓ Branch 3 taken 40968 times.
✓ Branch 4 taken 309804 times.
✓ Branch 8 taken 4115398 times.
✓ Branch 9 taken 756084 times.
✓ Branch 10 taken 54098 times.
✓ Branch 11 taken 7621946 times.
✓ Branch 13 taken 2607622 times.
✓ Branch 14 taken 232554 times.
✓ Branch 17 taken 54098 times.
✓ Branch 18 taken 555012 times.
✓ Branch 20 taken 289292 times.
✓ Branch 21 taken 2224 times.
✓ Branch 5 taken 232000 times.
✓ Branch 6 taken 13610 times.
✓ Branch 12 taken 1327296 times.
✓ Branch 7 taken 1046292 times.
✓ Branch 15 taken 179346 times.
✓ Branch 16 taken 553040 times.
✓ Branch 19 taken 442432 times.
✓ Branch 22 taken 90278 times.
✓ Branch 0 taken 663648 times.
✓ Branch 1 taken 1991184 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 2 taken 2160 times.
67076350 { return dofIdx_; }
101
102 80867722 LocalIndexType indexInElement() const
103
6/8
✓ Branch 0 taken 5600 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 22400 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 2800 times.
✓ Branch 4 taken 6968304 times.
✓ Branch 7 taken 2800 times.
79355722 { return indexInElement_; }
104
105 5794852 GridIndexType elementIndex() const
106
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 356454 times.
5438398 { return eIdx_; }
107
108 29385850 LocalIndexType localDofIndex() const
109
7/12
✓ Branch 2 taken 240 times.
✓ Branch 3 taken 543646 times.
✓ Branch 6 taken 9776192 times.
✗ Branch 7 not taken.
✓ Branch 1 taken 52942 times.
✗ Branch 0 not taken.
✓ Branch 4 taken 3566608 times.
✓ Branch 5 taken 655440 times.
✓ Branch 8 taken 1327296 times.
✗ Branch 9 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
100704992 { return indexInElement_; }
110
111 private:
112 GlobalPosition center_;
113 GlobalPosition dofPosition_;
114 Scalar volume_;
115 LocalIndexType indexInElement_;
116 GridIndexType eIdx_;
117 GridIndexType dofIdx_;
118 };
119
120 } // end namespace Dumux
121
122 #endif
123