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 NIModel | ||
10 | * \brief Adds I/O fields specific to non-isothermal models. | ||
11 | */ | ||
12 | #ifndef DUMUX_ENERGY_IO_FIELDS_HH | ||
13 | #define DUMUX_ENERGY_IO_FIELDS_HH | ||
14 | |||
15 | #include <string> | ||
16 | #include <dumux/io/name.hh> | ||
17 | |||
18 | namespace Dumux { | ||
19 | |||
20 | /*! | ||
21 | * \ingroup NIModel | ||
22 | * \brief Adds I/O fields specific to non-isothermal models | ||
23 | * \tparam IsothermalIOFields the isothermal io fields to adapt to non-isothermal io fields | ||
24 | */ | ||
25 | template<class IsothermalIOFields = void> | ||
26 | class EnergyIOFields | ||
27 | { | ||
28 | public: | ||
29 | template <class OutputModule> | ||
30 | 98 | static void initOutputModule(OutputModule& out) | |
31 | { | ||
32 | 98 | IsothermalIOFields::initOutputModule(out); | |
33 |
2/3✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 1 taken 78 times.
|
17892 | out.addVolumeVariable( [](const auto& v){ return v.temperature(); }, IOName::temperature()); |
34 | 98 | } | |
35 | |||
36 | template <class ModelTraits, class FluidSystem = void, class SolidSystem = void> | ||
37 | 4 | static std::string primaryVariableName(int pvIdx, int state = 0) | |
38 | { | ||
39 | using IsothermalTraits = typename ModelTraits::IsothermalTraits; | ||
40 | |||
41 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
|
4 | if (pvIdx < ModelTraits::numEq() - 1) |
42 | 2 | return IsothermalIOFields::template primaryVariableName<IsothermalTraits, FluidSystem, SolidSystem>(pvIdx, state); | |
43 | else | ||
44 | return IOName::temperature(); | ||
45 | } | ||
46 | }; | ||
47 | |||
48 | /*! | ||
49 | * \ingroup NIModel | ||
50 | * \brief Adds I/O fields specific to non-isothermal models. | ||
51 | * \note Specialization if this is class used on its own (not as an adapter) | ||
52 | */ | ||
53 | template<> | ||
54 | class EnergyIOFields<void> | ||
55 | { | ||
56 | public: | ||
57 | template <class OutputModule> | ||
58 | 1 | static void initOutputModule(OutputModule& out) | |
59 | { | ||
60 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | out.addVolumeVariable( [](const auto& v){ return v.temperature(); }, IOName::temperature()); |
61 | 1 | } | |
62 | |||
63 | template <class ModelTraits, class FluidSystem = void, class SolidSystem = void> | ||
64 | static std::string primaryVariableName(int pvIdx, int state = 0) | ||
65 | { | ||
66 | return IOName::temperature(); | ||
67 | } | ||
68 | }; | ||
69 | |||
70 | } // end namespace Dumux | ||
71 | |||
72 | #endif | ||
73 |