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 StaggeredDiscretization | ||
10 | * \brief The local element solution class for staggered methods | ||
11 | */ | ||
12 | #ifndef DUMUX_STAGGERED_ELEMENT_SOLUTION_HH | ||
13 | #define DUMUX_STAGGERED_ELEMENT_SOLUTION_HH | ||
14 | |||
15 | #include <type_traits> | ||
16 | #include <dune/istl/bvector.hh> | ||
17 | #include <dumux/discretization/method.hh> | ||
18 | |||
19 | namespace Dumux { | ||
20 | |||
21 | /*! | ||
22 | * \ingroup StaggeredDiscretization | ||
23 | * \brief Helper function to create a PrimaryVariables object from CellCenterPrimaryVariables | ||
24 | * \tparam PrimaryVariables The type of the desired primary variables object | ||
25 | * \tparam CellCenterPrimaryVariables The type of the cell center (input) primary variables object | ||
26 | * \param cellCenterPriVars The cell center (input) primary variables object | ||
27 | */ | ||
28 | template<class PrimaryVariables, class CellCenterPrimaryVariables> | ||
29 | 61184766 | PrimaryVariables makePriVarsFromCellCenterPriVars(const CellCenterPrimaryVariables& cellCenterPriVars) | |
30 | { | ||
31 | static_assert(int(PrimaryVariables::dimension) > int(CellCenterPrimaryVariables::dimension), | ||
32 | "PrimaryVariables' size must be greater than the one of CellCenterPrimaryVariables"); | ||
33 | |||
34 | 61184766 | PrimaryVariables priVars(0.0); | |
35 | 61184766 | constexpr auto offset = PrimaryVariables::dimension - CellCenterPrimaryVariables::dimension; | |
36 |
78/84✓ Branch 0 taken 121870638 times.
✓ Branch 1 taken 33785809 times.
✓ Branch 2 taken 59198235 times.
✓ Branch 3 taken 17711905 times.
✓ Branch 4 taken 7466854 times.
✓ Branch 5 taken 2662423 times.
✓ Branch 6 taken 1148981 times.
✓ Branch 7 taken 383363 times.
✓ Branch 8 taken 766067 times.
✓ Branch 9 taken 215961 times.
✓ Branch 10 taken 100 times.
✓ Branch 11 taken 25 times.
✓ Branch 12 taken 100 times.
✓ Branch 13 taken 25 times.
✓ Branch 14 taken 75 times.
✓ Branch 15 taken 25 times.
✓ Branch 16 taken 125 times.
✓ Branch 17 taken 25 times.
✓ Branch 18 taken 100 times.
✓ Branch 19 taken 25 times.
✓ Branch 20 taken 100 times.
✓ Branch 21 taken 25 times.
✓ Branch 22 taken 75 times.
✓ Branch 23 taken 25 times.
✓ Branch 24 taken 125 times.
✓ Branch 25 taken 25 times.
✓ Branch 26 taken 100 times.
✓ Branch 27 taken 25 times.
✓ Branch 28 taken 100 times.
✓ Branch 29 taken 25 times.
✓ Branch 30 taken 75 times.
✓ Branch 31 taken 25 times.
✓ Branch 32 taken 100 times.
✓ Branch 33 taken 25 times.
✓ Branch 34 taken 75 times.
✓ Branch 35 taken 25 times.
✓ Branch 36 taken 75 times.
✓ Branch 37 taken 25 times.
✓ Branch 38 taken 50 times.
✓ Branch 39 taken 25 times.
✓ Branch 40 taken 75 times.
✓ Branch 41 taken 25 times.
✓ Branch 42 taken 50 times.
✓ Branch 43 taken 25 times.
✓ Branch 44 taken 50 times.
✓ Branch 45 taken 25 times.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 125 times.
✓ Branch 53 taken 25 times.
✓ Branch 54 taken 100 times.
✓ Branch 55 taken 25 times.
✓ Branch 56 taken 100 times.
✓ Branch 57 taken 25 times.
✓ Branch 58 taken 75 times.
✓ Branch 59 taken 25 times.
✓ Branch 60 taken 125 times.
✓ Branch 61 taken 25 times.
✓ Branch 62 taken 100 times.
✓ Branch 63 taken 25 times.
✓ Branch 64 taken 100 times.
✓ Branch 65 taken 25 times.
✓ Branch 66 taken 75 times.
✓ Branch 67 taken 25 times.
✓ Branch 68 taken 125 times.
✓ Branch 69 taken 25 times.
✓ Branch 70 taken 100 times.
✓ Branch 71 taken 25 times.
✓ Branch 72 taken 100 times.
✓ Branch 73 taken 25 times.
✓ Branch 74 taken 75 times.
✓ Branch 75 taken 25 times.
✓ Branch 76 taken 100 times.
✓ Branch 77 taken 25 times.
✓ Branch 78 taken 75 times.
✓ Branch 79 taken 25 times.
✓ Branch 80 taken 75 times.
✓ Branch 81 taken 25 times.
✓ Branch 82 taken 50 times.
✓ Branch 83 taken 25 times.
|
251638356 | for (std::size_t i = 0; i < cellCenterPriVars.size(); ++i) |
37 |
6/11✓ Branch 0 taken 14 times.
✓ Branch 1 taken 4208563 times.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 1749274 times.
✓ Branch 5 taken 444604 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 9216 times.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 4 not taken.
|
196865510 | priVars[i + offset] = cellCenterPriVars[i]; |
38 | return priVars; | ||
39 | } | ||
40 | |||
41 | template<class PrimaryVariables> | ||
42 | using StaggeredElementSolution = Dune::BlockVector<PrimaryVariables>; | ||
43 | |||
44 | /*! | ||
45 | * \ingroup Discretization | ||
46 | * \brief Make an element solution for staggered schemes | ||
47 | * \note This is e.g. used to construct an element solution at Dirichlet boundaries | ||
48 | */ | ||
49 | template<class FVElementGeometry, class PrimaryVariables> | ||
50 | 109900856 | auto elementSolution(PrimaryVariables&& priVars) | |
51 | -> std::enable_if_t<FVElementGeometry::GridGeometry::discMethod == DiscretizationMethods::staggered, | ||
52 | StaggeredElementSolution<PrimaryVariables>> | ||
53 | { | ||
54 | 109900856 | return StaggeredElementSolution<PrimaryVariables>({std::move(priVars)}); | |
55 | } | ||
56 | |||
57 | /*! | ||
58 | * \ingroup Discretization | ||
59 | * \brief Helper function to create an elementSolution from cell center primary variables | ||
60 | * \tparam PrimaryVariables The type of the desired primary variables object | ||
61 | * \tparam CellCenterPrimaryVariables The type of the cell center (input) primary variables object | ||
62 | * \param cellCenterPriVars The cell center (input) primary variables object | ||
63 | */ | ||
64 | template<class PrimaryVariables, class CellCenterPrimaryVariables> | ||
65 | 59344 | StaggeredElementSolution<PrimaryVariables> makeElementSolutionFromCellCenterPrivars(const CellCenterPrimaryVariables& cellCenterPriVars) | |
66 | { | ||
67 | 59344 | return StaggeredElementSolution<PrimaryVariables>({makePriVarsFromCellCenterPriVars<PrimaryVariables>(cellCenterPriVars)}); | |
68 | } | ||
69 | |||
70 | } // end namespace Dumux | ||
71 | |||
72 | #endif | ||
73 |