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 <dumux/common/indextraits.hh> | ||
16 | |||
17 | namespace Dumux::CVFE { | ||
18 | |||
19 | /*! | ||
20 | * \ingroup CVFEDiscretization | ||
21 | * \brief A local degree of freedom from an element perspective | ||
22 | */ | ||
23 | template<class LocalIndex, class GridIndex> | ||
24 | class LocalDof | ||
25 | { | ||
26 | public: | ||
27 |
7/8✓ Branch 1 taken 12679379 times.
✓ Branch 2 taken 221673112 times.
✓ Branch 4 taken 2653817 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.
|
380262870 | LocalDof(LocalIndex index, GridIndex dofIndex, GridIndex eIdx) |
28 | : index_(index), dofIndex_(dofIndex), eIdx_(eIdx) {} | ||
29 |
4/6✓ Branch 3 taken 37712 times.
✗ Branch 4 not taken.
✓ Branch 8 taken 18528 times.
✗ Branch 9 not taken.
✓ Branch 0 taken 17348880 times.
✓ Branch 1 taken 46343640 times.
|
119201902 | LocalIndex index() const { return index_; } |
30 |
2/4✓ Branch 3 taken 121438 times.
✗ Branch 4 not taken.
✓ Branch 8 taken 18528 times.
✗ Branch 9 not taken.
|
132296166 | GridIndex dofIndex() const { return dofIndex_; } |
31 | GridIndex elementIndex() const { return eIdx_; } | ||
32 | private: | ||
33 | LocalIndex index_; | ||
34 | GridIndex dofIndex_; | ||
35 | GridIndex eIdx_; | ||
36 | }; | ||
37 | |||
38 | |||
39 | } // end namespace Dumux::CVFE | ||
40 | |||
41 | namespace Dumux { | ||
42 | |||
43 | //! range over local dofs | ||
44 | template<class FVElementGeometry> | ||
45 | 8783688 | inline auto localDofs(const FVElementGeometry& fvGeometry) | |
46 | { | ||
47 | using LocalIndexType = typename IndexTraits<typename FVElementGeometry::GridGeometry::GridView>::LocalIndex; | ||
48 | using GridIndexType = typename IndexTraits<typename FVElementGeometry::GridGeometry::GridView>::GridIndex; | ||
49 | |||
50 | return Dune::transformedRangeView( | ||
51 | 109460030 | Dune::range(fvGeometry.numScv()), | |
52 | 119139972 | [&](const auto i) { return CVFE::LocalDof | |
53 | { | ||
54 | static_cast<LocalIndexType>(i), | ||
55 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25477008 times.
|
409653040 | static_cast<GridIndexType>(fvGeometry.scv(i).dofIndex()), |
56 |
7/8✓ Branch 1 taken 12679379 times.
✓ Branch 2 taken 247013792 times.
✓ Branch 4 taken 2790145 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.
|
422876992 | static_cast<GridIndexType>(fvGeometry.scv(i).elementIndex()) |
57 |
7/8✓ Branch 1 taken 12679379 times.
✓ Branch 2 taken 247013792 times.
✓ Branch 4 taken 2790145 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.
|
422876992 | }; } |
58 | ); | ||
59 | } | ||
60 | |||
61 | //! range over control-volume local dofs | ||
62 | template<class FVElementGeometry> | ||
63 | inline auto cvLocalDofs(const FVElementGeometry& fvGeometry) | ||
64 | { | ||
65 | // As default all dofs are cv dofs | ||
66 | return localDofs(fvGeometry); | ||
67 | } | ||
68 | |||
69 | //! range over sub control volumes related to a local dof. | ||
70 | //! this is the default range where a one-to-one mapping between scvs and localDofs is assumed. | ||
71 | //! If multiple scvs are related to a localDof, this range needs to be overwritten | ||
72 | //! within the fvElementGeometry class | ||
73 | template<class FVElementGeometry, class LocalDof> | ||
74 | inline auto | ||
75 |
7/12✓ Branch 0 taken 2587238 times.
✓ Branch 1 taken 161222708 times.
✓ Branch 2 taken 2587238 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2022846 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 632832 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 632832 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 632832 times.
✗ Branch 11 not taken.
|
184453738 | scvs(const FVElementGeometry& fvGeometry, const LocalDof& localDof) |
76 | { | ||
77 |
7/12✓ Branch 0 taken 2587238 times.
✓ Branch 1 taken 161222708 times.
✓ Branch 3 taken 2587238 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 2022846 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 632832 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 632832 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 632832 times.
✗ Branch 16 not taken.
|
184453738 | assert(fvGeometry.numScv() > localDof.index()); |
78 | 175357920 | return Dune::transformedRangeView( | |
79 | 175357920 | Dune::range(1), | |
80 | 184453738 | [&](const auto i) { return fvGeometry.scv(localDof.index()); } | |
81 | 175357920 | ); | |
82 | } | ||
83 | |||
84 | } // end namespace Dumux | ||
85 | #endif | ||
86 |