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