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-FileCopyrightInfo: 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 The infrastructure to retrieve run-time parameters from Dune::ParameterTrees. | ||
11 | */ | ||
12 | |||
13 | #include <config.h> | ||
14 | |||
15 | #include <iostream> | ||
16 | #include <list> | ||
17 | #include <sstream> | ||
18 | #include <unordered_map> | ||
19 | #include <fstream> | ||
20 | #include <functional> | ||
21 | |||
22 | #include <dune/common/parametertree.hh> | ||
23 | #include <dune/common/parametertreeparser.hh> | ||
24 | #include <dune/common/parallel/mpihelper.hh> | ||
25 | |||
26 | #include <dumux/common/exceptions.hh> | ||
27 | #include <dumux/common/parameters.hh> | ||
28 | #include <dumux/common/loggingparametertree.hh> | ||
29 | |||
30 | namespace Dumux { | ||
31 | |||
32 | // Initialize the parameter tree singletons | ||
33 | 15 | void Parameters::init(int argc, char **argv, const Usage& usage) | |
34 | { | ||
35 |
7/16✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 15 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 15 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 15 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 8 times.
✓ Branch 15 taken 7 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
53 | init(argc, argv, [] (Dune::ParameterTree&) {}, "", usage); |
36 | 15 | } | |
37 | |||
38 | // Initialize the parameter tree singletons | ||
39 | 33 | void Parameters::init(int argc, char **argv, | |
40 | std::string parameterFileName, | ||
41 | const Usage& usage) | ||
42 | { | ||
43 |
5/12✓ Branch 2 taken 33 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 33 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 33 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 31 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
66 | init(argc, argv, [] (Dune::ParameterTree&) {}, parameterFileName, usage); |
44 | 33 | } | |
45 | |||
46 | // Initialize the parameter tree singletons | ||
47 | ✗ | void Parameters::init(int argc, char **argv, | |
48 | const DefaultParams& defaultParams, | ||
49 | const Usage& usage) | ||
50 | { | ||
51 | ✗ | init(argc, argv, defaultParams, "", usage); | |
52 | ✗ | } | |
53 | |||
54 | // Initialize the parameter tree | ||
55 | 624 | void Parameters::init(int argc, char **argv, | |
56 | const DefaultParams& defaultParams, | ||
57 | std::string parameterFileName, | ||
58 | const Usage& usage) | ||
59 | { | ||
60 | 624 | const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); | |
61 | |||
62 | // check whether the user wanted to see the help message | ||
63 |
2/2✓ Branch 0 taken 2729 times.
✓ Branch 1 taken 624 times.
|
3353 | for (int i = 1; i < argc; ++i) |
64 | { | ||
65 |
10/24✓ Branch 1 taken 2729 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2729 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2729 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2729 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2729 times.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 2729 times.
✓ Branch 18 taken 2729 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 2729 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 2729 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 2729 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
8187 | if (std::string("--help") == argv[i] || std::string("-h") == argv[i]) |
66 | { | ||
67 | // return usage message and return; | ||
68 | ✗ | if (mpiHelper.rank() == 0) | |
69 | ✗ | usage(argv[0], defaultUsageMessage(argv[0])); | |
70 | |||
71 | ✗ | exit(0); | |
72 | } | ||
73 | } | ||
74 | |||
75 | // apply the default parameters | ||
76 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 624 times.
|
624 | defaultParams(defaultParamTree_()); |
77 | 624 | applyGlobalDefaults_(defaultParamTree_()); | |
78 | |||
79 | // parse parameters from the command line | ||
80 | 624 | const auto commandLineArgs = parseCommandLine(argc, argv); | |
81 |
2/4✓ Branch 1 taken 624 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624 times.
✗ Branch 5 not taken.
|
624 | mergeTree_(paramTree_(), commandLineArgs); |
82 | |||
83 | // overwrite parameter file if one was specified on the command line | ||
84 |
8/14✓ Branch 1 taken 624 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 624 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 31 times.
✓ Branch 11 taken 593 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 624 times.
✓ Branch 14 taken 75 times.
✓ Branch 15 taken 549 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
1279 | parameterFileName = commandLineArgs.get<std::string>("ParameterFile", parameterFileName); |
85 | |||
86 | // otherwise use the default name (executable name + .input) | ||
87 |
4/4✓ Branch 0 taken 75 times.
✓ Branch 1 taken 549 times.
✓ Branch 2 taken 75 times.
✓ Branch 3 taken 549 times.
|
1248 | if (parameterFileName.empty()) |
88 | { | ||
89 | 225 | parameterFileName = [&](){ | |
90 |
2/13✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 75 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 75 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
600 | std::string defaultName = std::string(argv[0]) + ".input"; |
91 |
4/6✓ Branch 1 taken 75 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 75 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 11 times.
✓ Branch 8 taken 64 times.
|
450 | std::ifstream pFile(defaultName.c_str()); |
92 |
4/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 71 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 71 times.
|
300 | if (pFile.is_open()) |
93 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
8 | return defaultName; |
94 | |||
95 |
1/2✓ Branch 1 taken 71 times.
✗ Branch 2 not taken.
|
142 | defaultName = "params.input"; |
96 |
3/6✓ Branch 1 taken 71 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 71 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 71 times.
✗ Branch 8 not taken.
|
284 | pFile = std::ifstream(defaultName.c_str()); |
97 |
4/4✓ Branch 0 taken 60 times.
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 60 times.
✓ Branch 3 taken 11 times.
|
284 | if (pFile.is_open()) |
98 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
|
120 | return defaultName; |
99 | else | ||
100 |
2/4✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 11 times.
✗ Branch 5 not taken.
|
44 | return std::string(""); |
101 |
2/4✓ Branch 1 taken 75 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 75 times.
|
75 | }(); |
102 | |||
103 | // if no parameter file was given and also no default names where found, continue without | ||
104 |
4/4✓ Branch 0 taken 11 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 11 times.
✓ Branch 3 taken 64 times.
|
150 | if (parameterFileName.empty()) |
105 | { | ||
106 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 9 times.
|
22 | if (mpiHelper.size() > 1) |
107 |
3/6✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
6 | std::cout << "Rank " << mpiHelper.rank() << ": "; |
108 |
1/2✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
|
11 | std::cout << "No parameter file found. Continuing without parameter file.\n"; |
109 | |||
110 | 11 | return; | |
111 | } | ||
112 | else | ||
113 | { | ||
114 |
4/4✓ Branch 0 taken 10 times.
✓ Branch 1 taken 54 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 54 times.
|
128 | if (mpiHelper.size() > 1) |
115 |
3/6✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 10 times.
✗ Branch 9 not taken.
|
30 | std::cout << "Rank " << mpiHelper.rank() << ": "; |
116 | 64 | std::cout << "No parameter file given. " | |
117 | << "Defaulting to '" | ||
118 | << parameterFileName | ||
119 |
2/4✓ Branch 3 taken 64 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 64 times.
✗ Branch 7 not taken.
|
192 | << "' for input file.\n"; |
120 | } | ||
121 | } | ||
122 | |||
123 |
4/4✓ Branch 0 taken 70 times.
✓ Branch 1 taken 543 times.
✓ Branch 2 taken 70 times.
✓ Branch 3 taken 543 times.
|
1226 | if (mpiHelper.size() > 1) |
124 |
3/6✓ Branch 2 taken 70 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 70 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 70 times.
✗ Branch 9 not taken.
|
210 | std::cout << "Rank " << mpiHelper.rank() << ": "; |
125 |
2/4✓ Branch 2 taken 613 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 613 times.
✗ Branch 6 not taken.
|
1226 | std::cout << "Reading parameters from file " << parameterFileName << ".\n"; |
126 | |||
127 | // read parameters from the file without overwriting the command line params | ||
128 | // because the command line arguments have precedence | ||
129 | // let Dune do the error checking if the file exists | ||
130 |
5/10✓ Branch 1 taken 613 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 613 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 613 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 120 times.
✓ Branch 10 taken 493 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
733 | Dune::ParameterTreeParser::readINITree(parameterFileName, |
131 | paramTree_(), | ||
132 | /*overwrite=*/false); | ||
133 | } | ||
134 | |||
135 | // Initialize the parameter tree | ||
136 | 27 | void Parameters::init(const DefaultParams& params, | |
137 | const DefaultParams& defaultParams) | ||
138 | { | ||
139 | // apply the parameters | ||
140 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
|
27 | params(paramTree_()); |
141 | // apply the default parameters | ||
142 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
|
27 | defaultParams(defaultParamTree_()); |
143 | 27 | applyGlobalDefaults_(defaultParamTree_()); | |
144 | 27 | } | |
145 | |||
146 | // Initialize the parameter tree | ||
147 | ✗ | void Parameters::init(const std::string& parameterFileName, | |
148 | const DefaultParams& params, | ||
149 | bool inputFileOverwritesParams, | ||
150 | const DefaultParams& defaultParams) | ||
151 | { | ||
152 | // apply the parameters | ||
153 | ✗ | params(paramTree_()); | |
154 | |||
155 | // read parameters from the input file | ||
156 | ✗ | Dune::ParameterTreeParser::readINITree(parameterFileName, paramTree_(), inputFileOverwritesParams); | |
157 | |||
158 | // apply the default parameters | ||
159 | ✗ | defaultParams(defaultParamTree_()); | |
160 | ✗ | applyGlobalDefaults_(defaultParamTree_()); | |
161 | ✗ | } | |
162 | |||
163 | // prints all used and unused parameters | ||
164 | 410 | void Parameters::print() | |
165 | { | ||
166 | 410 | getTree().reportAll(); | |
167 | 410 | } | |
168 | |||
169 | // Parse command line arguments into a parameter tree | ||
170 | 624 | Dune::ParameterTree Parameters::parseCommandLine(int argc, char **argv) | |
171 | { | ||
172 | 624 | Dune::ParameterTree commandLineArgs; | |
173 |
2/2✓ Branch 1 taken 1619 times.
✓ Branch 2 taken 624 times.
|
2243 | for (int i = 1; i < argc; ++i) |
174 | { | ||
175 |
3/4✓ Branch 0 taken 509 times.
✓ Branch 1 taken 1110 times.
✓ Branch 2 taken 509 times.
✗ Branch 3 not taken.
|
1619 | if (argv[i][0] != '-' && i == 1) |
176 | { | ||
177 | // try to pass first argument as parameter file | ||
178 |
5/12✓ Branch 1 taken 509 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 509 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 509 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 509 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 509 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1018 | commandLineArgs["ParameterFile"] = argv[1]; |
179 | 509 | continue; | |
180 | } | ||
181 | |||
182 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1110 times.
|
1110 | if (argv[i][0] != '-') |
183 | ✗ | DUNE_THROW(ParameterException, "-> Command line argument " << i << " (='" << argv[i] << "') is invalid. <-"); | |
184 | |||
185 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1110 times.
|
1110 | if (i+1 == argc) |
186 | ✗ | DUNE_THROW(ParameterException, "-> No argument given for parameter '" << argv[i] << "'! <-"); | |
187 | |||
188 | // check for the ParameterFile argument | ||
189 |
7/10✓ Branch 1 taken 1110 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1110 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1110 times.
✓ Branch 9 taken 7 times.
✓ Branch 10 taken 1103 times.
✓ Branch 11 taken 7 times.
✓ Branch 12 taken 1103 times.
|
2220 | if (argv[i]+1 == std::string("ParameterFile")) // +1 removes the '-' |
190 | { | ||
191 |
5/12✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 7 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 7 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 7 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
14 | commandLineArgs["ParameterFile"] = argv[i+1]; |
192 | 7 | ++i; | |
193 | } | ||
194 | |||
195 | // add all other options as key value pairs | ||
196 | else | ||
197 | { | ||
198 | // read a -MyOpt VALUE option | ||
199 |
2/4✓ Branch 1 taken 1103 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1103 times.
✗ Branch 5 not taken.
|
3309 | std::string paramName = argv[i]+1; // +1 removes the '-' |
200 |
4/10✓ Branch 1 taken 1103 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1103 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 357 times.
✓ Branch 7 taken 746 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
3309 | std::string paramValue = argv[i+1]; |
201 | 1103 | ++i; // In the case of '-MyOpt VALUE' each pair counts as two arguments | |
202 | |||
203 | // Put the key=value pair into the parameter tree | ||
204 |
4/6✓ Branch 1 taken 1103 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1103 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 588 times.
✓ Branch 7 taken 515 times.
|
1103 | commandLineArgs[paramName] = paramValue; |
205 | } | ||
206 | } | ||
207 | 624 | return commandLineArgs; | |
208 | } | ||
209 | |||
210 | // get the parameter tree singleton | ||
211 | 474316 | const LoggingParameterTree& Parameters::getTree() | |
212 | { | ||
213 |
6/10✓ Branch 0 taken 636 times.
✓ Branch 1 taken 473680 times.
✓ Branch 3 taken 636 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 636 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 636 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 636 times.
✗ Branch 13 not taken.
|
474316 | static LoggingParameterTree tree(paramTree_(), defaultParamTree_()); |
214 | 474316 | return tree; | |
215 | } | ||
216 | |||
217 | // the actual internal parameter tree storing all user-specfied runtime parameters | ||
218 | 1900 | Dune::ParameterTree& Parameters::paramTree_() | |
219 | { | ||
220 |
4/6✓ Branch 0 taken 638 times.
✓ Branch 1 taken 1262 times.
✓ Branch 3 taken 638 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 638 times.
✗ Branch 7 not taken.
|
1900 | static Dune::ParameterTree tree; |
221 | 1900 | return tree; | |
222 | } | ||
223 | |||
224 | // the parameter tree storing the Dumux global defaults for some parameters | ||
225 | 1938 | Dune::ParameterTree& Parameters::defaultParamTree_() | |
226 | { | ||
227 |
4/6✓ Branch 0 taken 638 times.
✓ Branch 1 taken 1300 times.
✓ Branch 3 taken 638 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 638 times.
✗ Branch 7 not taken.
|
1938 | static Dune::ParameterTree tree; |
228 | 1938 | return tree; | |
229 | } | ||
230 | |||
231 | 651 | void Parameters::applyGlobalDefaults_(Dune::ParameterTree& params) | |
232 | { | ||
233 | // global defaults | ||
234 | 1302 | Dune::ParameterTree defaultParams; | |
235 | |||
236 | // parameters in the implicit group | ||
237 |
6/14✓ Branch 1 taken 651 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 651 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 651 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 651 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 651 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 651 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1953 | defaultParams["Flux.UpwindWeight"] = "1.0"; |
238 |
6/14✓ Branch 1 taken 651 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 651 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 651 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 651 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 651 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 651 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1953 | defaultParams["Implicit.EnableJacobianRecycling"] = "false"; |
239 | |||
240 | // parameters in the assembly group | ||
241 |
6/14✓ Branch 1 taken 651 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 651 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 651 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 651 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 651 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 651 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1953 | defaultParams["Assembly.NumericDifferenceMethod"] = "1"; |
242 | |||
243 | // parameters in the problem group | ||
244 |
6/14✓ Branch 1 taken 651 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 651 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 651 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 651 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 651 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 651 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1953 | defaultParams["Problem.EnableGravity"] = "true"; |
245 |
6/14✓ Branch 1 taken 651 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 651 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 651 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 651 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 651 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 651 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1953 | defaultParams["Problem.EnableInertiaTerms"] = "true"; |
246 | |||
247 | // parameters in the time loop group | ||
248 |
6/14✓ Branch 1 taken 651 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 651 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 651 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 651 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 651 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 651 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1953 | defaultParams["TimeLoop.MaxTimeStepSize"] = "1e300"; |
249 |
6/14✓ Branch 1 taken 651 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 651 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 651 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 651 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 651 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 651 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1953 | defaultParams["TimeLoop.MaxTimeStepDivisions"] = "10"; |
250 | |||
251 | // parameters in the vtk group | ||
252 |
6/14✓ Branch 1 taken 651 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 651 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 651 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 651 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 651 times.
✓ Branch 15 taken 651 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1302 | defaultParams["Vtk.AddVelocity"] = "false"; |
253 |
6/14✓ Branch 1 taken 651 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 651 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 651 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 651 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 651 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 651 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1953 | defaultParams["Vtk.AddProcessRank"] = "true"; |
254 | |||
255 | // parameters in the mpfa group | ||
256 |
6/14✓ Branch 1 taken 651 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 651 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 651 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 651 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 651 times.
✓ Branch 15 taken 651 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1302 | defaultParams["MPFA.Q"] = "0.0"; |
257 | |||
258 | // merge the global default tree but do not overwrite if the parameter already exists | ||
259 |
1/2✓ Branch 1 taken 651 times.
✗ Branch 2 not taken.
|
651 | mergeTree_(params, defaultParams, false); |
260 | 651 | } | |
261 | |||
262 | // merge source into target tree | ||
263 | 1275 | void Parameters::mergeTree_(Dune::ParameterTree& target, const Dune::ParameterTree& source, bool overwrite) | |
264 |
4/10✓ Branch 1 taken 1275 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1275 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1275 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1275 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
|
2550 | { mergeTreeImpl_(target, source, overwrite, ""); } |
265 | |||
266 | // recursively merge all elements | ||
267 | 6822 | void Parameters::mergeTreeImpl_(Dune::ParameterTree& target, const Dune::ParameterTree& source, bool overwrite, const std::string& group) | |
268 | { | ||
269 |
9/12✓ Branch 0 taken 1275 times.
✓ Branch 1 taken 5547 times.
✓ Branch 2 taken 1275 times.
✓ Branch 3 taken 5547 times.
✓ Branch 5 taken 1275 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1275 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 5547 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 42 times.
✓ Branch 14 taken 6780 times.
|
20466 | const auto prefix = group.empty() ? "" : group + "."; |
270 |
5/6✓ Branch 1 taken 6822 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8111 times.
✓ Branch 4 taken 6822 times.
✓ Branch 5 taken 8111 times.
✓ Branch 6 taken 6822 times.
|
14933 | for (const auto& key : source.getValueKeys()) |
271 |
4/6✓ Branch 0 taken 6510 times.
✓ Branch 1 taken 1601 times.
✓ Branch 3 taken 6510 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6510 times.
✗ Branch 6 not taken.
|
8111 | if (overwrite || !target.hasKey(key)) |
272 |
6/12✓ Branch 1 taken 8111 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8111 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8111 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8111 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 5561 times.
✓ Branch 13 taken 2550 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
13672 | target[prefix + key] = source[key]; |
273 | |||
274 |
5/6✓ Branch 1 taken 6822 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5547 times.
✓ Branch 4 taken 6822 times.
✓ Branch 5 taken 5547 times.
✓ Branch 6 taken 6822 times.
|
17916 | for (const auto& subKey : source.getSubKeys()) |
275 |
5/12✓ Branch 1 taken 5547 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5547 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5547 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 42 times.
✓ Branch 10 taken 5505 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
5589 | mergeTreeImpl_(target, source.sub(subKey), overwrite, prefix + subKey); |
276 | 6822 | } | |
277 | |||
278 | } // end namespace Dumux | ||
279 |