GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/common/fvproblemwithspatialparams.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 10 10 100.0%
Functions: 373 377 98.9%
Branches: 50 67 74.6%

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 Core
10 * \brief Base class for all finite volume problems that are parameterized.
11 */
12 #ifndef DUMUX_COMMON_FV_PROBLEM_WITH_SPATIAL_PARAMS_HH
13 #define DUMUX_COMMON_FV_PROBLEM_WITH_SPATIAL_PARAMS_HH
14
15 #include <memory>
16
17 #include <dumux/common/properties.hh>
18 #include <dumux/common/fvproblem.hh>
19
20 namespace Dumux {
21
22 /*!
23 * \ingroup Core
24 * \brief Base class for all finite-volume problems using spatial parameters.
25 */
26 template<class TypeTag>
27 class FVProblemWithSpatialParams
28 : public FVProblem<TypeTag>
29 {
30 using ParentType = FVProblem<TypeTag>;
31 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
32
33 public:
34 using SpatialParams = GetPropType<TypeTag, Properties::SpatialParams>;
35
36 /*!
37 * \brief Constructor
38 * \param gridGeometry The finite volume grid geometry
39 * \param paramGroup The parameter group in which to look for runtime parameters first (default is "")
40 * \note This constructor assumes the spatial parameters to be constructible from a grid geometry
41 */
42 892 FVProblemWithSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry,
43 const std::string& paramGroup = "")
44 : ParentType(gridGeometry, paramGroup)
45
2/4
✓ Branch 2 taken 634 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 634 times.
✗ Branch 6 not taken.
1784 , spatialParams_(std::make_shared<SpatialParams>(gridGeometry))
46 892 {}
47
48 /*!
49 * \brief Constructor
50 * \param gridGeometry The finite volume grid geometry
51 * \param spatialParams The spatially varying parameters
52 * \param paramGroup The parameter group in which to look for runtime parameters first (default is "")
53 */
54 322 FVProblemWithSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry,
55 std::shared_ptr<SpatialParams> spatialParams,
56 const std::string& paramGroup = "")
57 : ParentType(gridGeometry, paramGroup)
58
1/2
✓ Branch 2 taken 190 times.
✗ Branch 3 not taken.
644 , spatialParams_(spatialParams)
59 322 {}
60
61 //! Return a reference to the underlying spatial parameters
62
9/15
✓ Branch 6 taken 80 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 80 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 80 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 80 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 80 times.
✗ Branch 19 not taken.
✓ Branch 0 taken 9341892 times.
✓ Branch 1 taken 6490004 times.
✓ Branch 2 taken 3262 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 644 times.
3070696869 const SpatialParams& spatialParams() const
63
23/25
✓ Branch 0 taken 13093799 times.
✓ Branch 1 taken 91901361 times.
✓ Branch 2 taken 58809178 times.
✓ Branch 3 taken 44374677 times.
✓ Branch 4 taken 20181803 times.
✓ Branch 5 taken 81458659 times.
✓ Branch 6 taken 43070081 times.
✓ Branch 7 taken 29370917 times.
✓ Branch 8 taken 11884201 times.
✓ Branch 11 taken 30694245 times.
✓ Branch 12 taken 5823 times.
✓ Branch 10 taken 3200611 times.
✓ Branch 9 taken 156524 times.
✓ Branch 13 taken 292367 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 4065 times.
✓ Branch 17 taken 1174502 times.
✓ Branch 18 taken 140 times.
✓ Branch 20 taken 54505 times.
✓ Branch 21 taken 1102 times.
✓ Branch 19 taken 5308 times.
✓ Branch 24 taken 302400 times.
✗ Branch 25 not taken.
✓ Branch 16 taken 14720 times.
✓ Branch 22 taken 1178 times.
4670558186 { return *spatialParams_; }
64
65 //! Return a reference to the underlying spatial parameters
66 99432 SpatialParams& spatialParams()
67
15/21
✓ Branch 1 taken 7959 times.
✓ Branch 2 taken 2 times.
✓ Branch 4 taken 40413 times.
✓ Branch 5 taken 3472 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 2 times.
✓ Branch 10 taken 50 times.
✓ Branch 11 taken 2 times.
✓ Branch 13 taken 51 times.
✓ Branch 14 taken 2 times.
✓ Branch 16 taken 51 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 3 taken 3470 times.
✓ Branch 6 taken 33200 times.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
137404 { return *spatialParams_; }
68
69 private:
70 //! Spatially varying parameters
71 std::shared_ptr<SpatialParams> spatialParams_;
72 };
73
74 } // end namespace Dumux
75
76 #endif
77