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 CVFEDiscretization | ||
10 | * \brief Class representing dofs on elements for control-volume finite element schemes | ||
11 | */ | ||
12 | #ifndef DUMUX_CVFE_LOCAL_DOF_HH | ||
13 | #define DUMUX_CVFE_LOCAL_DOF_HH | ||
14 | |||
15 | #include <ranges> | ||
16 | |||
17 | #include <dumux/common/indextraits.hh> | ||
18 | |||
19 | namespace Dumux::CVFE { | ||
20 | |||
21 | /*! | ||
22 | * \ingroup CVFEDiscretization | ||
23 | * \brief A local degree of freedom from an element perspective | ||
24 | */ | ||
25 | template<class LocalIndex, class GridIndex> | ||
26 | class LocalDof | ||
27 | { | ||
28 | public: | ||
29 | using LocalIndexType = LocalIndex; | ||
30 | using GridIndexType = GridIndex; | ||
31 | |||
32 |
3/6✗ Branch 1 not taken.
✓ Branch 2 taken 24687936 times.
✓ Branch 4 taken 107880 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 57320 times.
✗ Branch 8 not taken.
|
424453548 | LocalDof(LocalIndex index, GridIndex dofIndex, GridIndex eIdx) |
33 | : index_(index), dofIndex_(dofIndex), eIdx_(eIdx) {} | ||
34 |
9/10✓ Branch 0 taken 22008380 times.
✓ Branch 1 taken 18206280 times.
✓ Branch 2 taken 9894052 times.
✓ Branch 3 taken 1725984 times.
✓ Branch 4 taken 9892752 times.
✓ Branch 5 taken 499080 times.
✓ Branch 6 taken 4946376 times.
✓ Branch 7 taken 249540 times.
✓ Branch 8 taken 18528 times.
✗ Branch 9 not taken.
|
122352302 | LocalIndex index() const { return index_; } |
35 |
3/6✓ Branch 3 taken 1310630 times.
✗ Branch 4 not taken.
✓ Branch 0 taken 252900 times.
✗ Branch 1 not taken.
✓ Branch 8 taken 18528 times.
✗ Branch 9 not taken.
|
132445806 | GridIndex dofIndex() const { return dofIndex_; } |
36 | 6198080 | GridIndex elementIndex() const { return eIdx_; } | |
37 | private: | ||
38 | LocalIndex index_; | ||
39 | GridIndex dofIndex_; | ||
40 | GridIndex eIdx_; | ||
41 | }; | ||
42 | |||
43 | |||
44 | } // end namespace Dumux::CVFE | ||
45 | |||
46 | namespace Dumux { | ||
47 | |||
48 | //! range over local dofs | ||
49 | template<class FVElementGeometry> | ||
50 | 2835372 | inline auto localDofs(const FVElementGeometry& fvGeometry) | |
51 | { | ||
52 | using LocalIndexType = typename IndexTraits<typename FVElementGeometry::GridGeometry::GridView>::LocalIndex; | ||
53 | using GridIndexType = typename IndexTraits<typename FVElementGeometry::GridGeometry::GridView>::GridIndex; | ||
54 | |||
55 | 105641372 | return std::views::iota(0u, fvGeometry.numScv()) | |
56 | 103311000 | | std::views::transform([&](const auto i) { return CVFE::LocalDof | |
57 | { | ||
58 | static_cast<LocalIndexType>(i), | ||
59 |
7/8✓ Branch 1 taken 12673679 times.
✓ Branch 2 taken 220569684 times.
✓ Branch 4 taken 2647417 times.
✓ Branch 5 taken 20498280 times.
✓ Branch 7 taken 153904 times.
✗ Branch 8 not taken.
✓ Branch 3 taken 1823392 times.
✓ Branch 6 taken 1449528 times.
|
387975444 | static_cast<GridIndexType>(fvGeometry.scv(i).dofIndex()), |
60 |
7/8✓ Branch 1 taken 12673679 times.
✓ Branch 2 taken 220569684 times.
✓ Branch 4 taken 2647417 times.
✓ Branch 5 taken 20498280 times.
✓ Branch 7 taken 153904 times.
✗ Branch 8 not taken.
✓ Branch 3 taken 1823392 times.
✓ Branch 6 taken 1449528 times.
|
387975444 | static_cast<GridIndexType>(fvGeometry.scv(i).elementIndex()) |
61 |
7/8✓ Branch 1 taken 12673679 times.
✓ Branch 2 taken 220569684 times.
✓ Branch 4 taken 2647417 times.
✓ Branch 5 taken 20498280 times.
✓ Branch 7 taken 153904 times.
✗ Branch 8 not taken.
✓ Branch 3 taken 1823392 times.
✓ Branch 6 taken 1449528 times.
|
387975444 | }; } |
62 | ); | ||
63 | } | ||
64 | |||
65 | //! range over control-volume local dofs | ||
66 | template<class FVElementGeometry> | ||
67 | inline auto cvLocalDofs(const FVElementGeometry& fvGeometry) | ||
68 | { | ||
69 | // As default all dofs are cv dofs | ||
70 | return localDofs(fvGeometry); | ||
71 | } | ||
72 | |||
73 | //! range over sub control volumes related to a local dof. | ||
74 | //! this is the default range where a one-to-one mapping between scvs and localDofs is assumed. | ||
75 | //! If multiple scvs are related to a localDof, this range needs to be overwritten | ||
76 | //! within the fvElementGeometry class | ||
77 | template<class FVElementGeometry, class LocalDof> | ||
78 | inline std::ranges::range auto | ||
79 |
10/18✓ Branch 0 taken 34328374 times.
✓ Branch 1 taken 86343314 times.
✓ Branch 2 taken 35674294 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 12993520 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2659456 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2659456 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1678112 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 30832 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 30832 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 30832 times.
✗ Branch 17 not taken.
|
176593758 | scvs(const FVElementGeometry& fvGeometry, const LocalDof& localDof) |
80 | { | ||
81 |
10/18✓ Branch 0 taken 34328374 times.
✓ Branch 1 taken 86343314 times.
✓ Branch 3 taken 35674294 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 12993520 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 2659456 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 2659456 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 1678112 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 30832 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 30832 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 30832 times.
✗ Branch 25 not taken.
|
176593758 | assert(fvGeometry.numScv() > localDof.index()); |
82 | 86508050 | return std::views::single(1) | std::views::transform( | |
83 | 176758494 | [&](const auto i) -> const typename FVElementGeometry::SubControlVolume& { return fvGeometry.scv(localDof.index()); } | |
84 | 86508050 | ); | |
85 | } | ||
86 | |||
87 | } // end namespace Dumux | ||
88 | #endif | ||
89 |