GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/discretization/facecentered/diamond/subcontrolvolume.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 5 18 27.8%
Functions: 0 38 0.0%
Branches: 5 18 27.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 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 static constexpr Dune::GeometryType geometryType(Dune::GeometryType elementType)
48 {
49
1/4
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 251950 times.
✗ Branch 3 not taken.
525772 if (elementType == Dune::GeometryTypes::hexahedron)
50 return Dune::GeometryTypes::pyramid;
51 else
52 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 370630 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 : center_(center)
81 , dofPosition_(dofPosition)
82 , volume_(volume)
83 , indexInElement_(indexInElement)
84 , eIdx_(eIdx)
85 370630 , dofIdx_(dofIdx)
86 {}
87
88 //! The center of the sub control volume
89 const GlobalPosition& center() const
90
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6973904 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
21174040 { return center_; }
91
92 //! The position of the degree of freedom
93 const GlobalPosition& dofPosition() const
94
3/8
✓ Branch 0 taken 180 times.
✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 8208 times.
✗ Branch 7 not taken.
2287778 { return dofPosition_; }
95
96 Scalar volume() const
97 { return volume_; }
98
99 GridIndexType dofIndex() const
100 { return dofIdx_; }
101
102 LocalIndexType indexInElement() const
103 { return indexInElement_; }
104
105 GridIndexType elementIndex() const
106 { return eIdx_; }
107
108 LocalIndexType localDofIndex() const
109 { 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