GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/discretization/facecentered/diamond/subcontrolvolumeface.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 11 20 55.0%
Functions: 0 32 0.0%
Branches: 24 30 80.0%

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::FaceCenteredDiamondSubControlVolumeFace
11 */
12 #ifndef DUMUX_DISCRETIZATION_FACECENTERED_DIAMOND_SUBCONTROLVOLUMEFACE_HH
13 #define DUMUX_DISCRETIZATION_FACECENTERED_DIAMOND_SUBCONTROLVOLUMEFACE_HH
14
15 #include <array>
16 #include <utility>
17 #include <dune/common/fvector.hh>
18 #include <dune/geometry/type.hh>
19 #include <dune/geometry/multilineargeometry.hh>
20
21 #include <dumux/common/boundaryflag.hh>
22 #include <dumux/common/indextraits.hh>
23 #include <dumux/common/typetraits/isvalid.hh>
24 #include <dumux/discretization/subcontrolvolumefacebase.hh>
25 #include <dumux/discretization/facecentered/diamond/geometryhelper.hh>
26
27
28 #include <typeinfo>
29
30 namespace Dumux {
31
32 /*!
33 * \ingroup DiamondDiscretization
34 * \brief Default traits class to be used for the sub-control volumes
35 * for the cell-centered finite volume scheme using TPFA
36 * \tparam GV the type of the grid view
37 */
38 template<class GridView>
39 struct FaceCenteredDiamondScvfGeometryTraits
40 {
41 using Grid = typename GridView::Grid;
42 static constexpr int dim = Grid::dimension;
43 static constexpr int dimWorld = Grid::dimensionworld;
44
45 using GridIndexType = typename IndexTraits<GridView>::GridIndex;
46 using LocalIndexType = typename IndexTraits<GridView>::SmallLocalIndex;
47 using Scalar = typename Grid::ctype;
48 using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, FCDiamondMLGeometryTraits<Scalar>>;
49 using CornerStorage = typename FCDiamondMLGeometryTraits<Scalar>::template CornerStorage<dim-1, dimWorld>::Type;
50 using GlobalPosition = typename CornerStorage::value_type;
51 using BoundaryFlag = Dumux::BoundaryFlag<Grid>;
52
53 static constexpr Dune::GeometryType interiorGeometryType(Dune::GeometryType)
54 { return Dune::GeometryTypes::simplex(dim-1); }
55 };
56
57 /*!
58 * \ingroup DiamondDiscretization
59 * \brief The SCVF implementation for diamond
60 */
61 template<class GridView, class T = FaceCenteredDiamondScvfGeometryTraits<GridView>>
62 class FaceCenteredDiamondSubControlVolumeFace
63 {
64 using Scalar = typename T::Scalar;
65 using GridIndexType = typename T::GridIndexType;
66 using LocalIndexType = typename T::LocalIndexType;
67 using Geometry = typename T::Geometry;
68 using BoundaryFlag = typename T::BoundaryFlag;
69
70 public:
71 //! state the traits public and thus export all types
72 using Traits = T;
73
74 using GlobalPosition = typename T::GlobalPosition;
75
76 FaceCenteredDiamondSubControlVolumeFace() = default;
77
78 // interior scvf
79 415910 FaceCenteredDiamondSubControlVolumeFace(const GlobalPosition& center,
80 const Scalar area,
81 const GlobalPosition& normal,
82 const std::array<LocalIndexType, 2>& scvIndices,
83 const LocalIndexType localScvfIdx)
84 : center_(center)
85 , unitOuterNormal_(normal)
86 , area_(area)
87 , localScvfIdx_(localScvfIdx)
88 , scvIndices_(scvIndices)
89 , boundary_(false)
90 831820 , boundaryFlag_{}
91 {}
92
93 // boundary scvf
94 9692 FaceCenteredDiamondSubControlVolumeFace(const GlobalPosition& center,
95 const Scalar area,
96 const GlobalPosition& normal,
97 const std::array<LocalIndexType, 2>& scvIndices,
98 const LocalIndexType localScvfIdx,
99 const BoundaryFlag& bFlag)
100 : center_(center)
101 , unitOuterNormal_(normal)
102 , area_(area)
103 , localScvfIdx_(localScvfIdx)
104 , scvIndices_(scvIndices)
105 , boundary_(true)
106 9692 , boundaryFlag_(bFlag)
107 {}
108
109 //! The center of the sub control volume face
110 const GlobalPosition& center() const
111 3043478 { return center_; }
112
113 //! The integration point of the sub control volume face
114 const GlobalPosition& ipGlobal() const
115
6/6
✓ Branch 0 taken 2076 times.
✓ Branch 1 taken 9065680 times.
✓ Branch 2 taken 12600 times.
✓ Branch 3 taken 36174 times.
✓ Branch 4 taken 160 times.
✓ Branch 5 taken 522 times.
11618952 { return center_; }
116
117 //! The unit outer normal
118 const GlobalPosition unitOuterNormal() const
119
2/4
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5376 times.
✗ Branch 4 not taken.
4070356 { return unitOuterNormal_; }
120
121 //! Index of the inside sub control volume
122 GridIndexType insideScvIdx() const
123
9/10
✓ Branch 0 taken 5022473 times.
✓ Branch 1 taken 6293631 times.
✓ Branch 2 taken 5022473 times.
✓ Branch 3 taken 6293631 times.
✓ Branch 4 taken 6973904 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7010512 times.
✓ Branch 7 taken 74416 times.
✓ Branch 8 taken 36608 times.
✓ Branch 9 taken 74416 times.
102083144 { return scvIndices_[0]; }
124
125 //! index of the outside sub control volume
126 GridIndexType outsideScvIdx() const
127
6/8
✓ Branch 0 taken 5022473 times.
✓ Branch 1 taken 6293631 times.
✓ Branch 2 taken 5022473 times.
✓ Branch 3 taken 6293631 times.
✓ Branch 4 taken 6973904 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6973904 times.
✗ Branch 7 not taken.
67289328 { return scvIndices_[1]; }
128
129 std::size_t numOutsideScvs() const
130
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
12 { return static_cast<std::size_t>(!boundary()); }
131
132 GridIndexType index() const
133 { return localScvfIdx_; }
134
135 bool boundary() const
136 { return boundary_; }
137
138 Scalar area() const
139 { return area_; }
140
141 //! Return the boundary flag
142 typename BoundaryFlag::value_type boundaryFlag() const
143 {
144 43541 return boundaryFlag_.get();
145 }
146
147 private:
148 GlobalPosition center_;
149 GlobalPosition unitOuterNormal_;
150 Scalar area_;
151 LocalIndexType localScvfIdx_;
152 std::array<LocalIndexType, 2> scvIndices_;
153 bool boundary_;
154 BoundaryFlag boundaryFlag_;
155 };
156
157
158 } // end namespace Dumux
159
160 #endif
161