https://mooseframework.inl.gov
Loading...
Searching...
No Matches
InputParameters.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12// MOOSE includes
13#include "MooseUtils.h"
14#include "MooseError.h"
15#include "MooseTypes.h"
16#include "MooseEnum.h"
17#include "MultiMooseEnum.h"
18#include "ExecFlagEnum.h"
19#include "Conversion.h"
20#include "DataFileUtils.h"
21#include "MoosePassKey.h"
22
23#include "libmesh/parameters.h"
24
25#ifdef LIBMESH_HAVE_FPARSER
26#include "libmesh/fparser.hh"
27#else
28template <typename T>
30{
31}
32#endif
33
34#include <tuple>
35#include <unordered_map>
36#include <mutex>
37#include <optional>
38#include <filesystem>
39#include <regex>
40
41#include <gtest/gtest.h>
42
43// Forward declarations
44class Action;
45class ActionFactory;
46class Factory;
47class FEProblemBase;
48class InputParameters;
49class MooseEnum;
50class MooseObject;
51class MultiMooseEnum;
52class Problem;
53namespace hit
54{
55class Node;
56}
57namespace Moose
58{
59class Builder;
60}
61class CommandLine;
62
68{
69public:
71 InputParameters(const Parameters & rhs);
72
73 virtual ~InputParameters() = default;
74
75 virtual void clear() override;
76
81 {
88
90 std::string syntax;
92 std::vector<std::string> switches;
98 bool set_by_command_line = false;
100 bool global = false;
101 };
102
108 {
109 friend class Action;
110 friend class ActionFactory;
111 friend class Moose::Builder;
112 friend class Factory;
113 friend class FEProblemBase;
114 friend class InputParameters;
115 FRIEND_TEST(InputParametersTest, fileNames);
118 };
119
125 {
126 friend class Moose::Builder;
127 FRIEND_TEST(InputParametersTest, fileNames);
130 };
131
139 template <typename T>
141 {
142 static constexpr bool value =
143 std::is_same_v<T, std::string> || std::is_same_v<T, std::vector<std::string>> ||
144 std::is_same_v<T, Real> || std::is_same_v<T, unsigned int> || std::is_same_v<T, int> ||
145 std::is_same_v<T, bool> || std::is_same_v<T, MooseEnum>;
146 };
147
152 void addClassDescription(const std::string & doc_string);
153
157 std::string getClassDescription() const;
158
162 virtual void set_attributes(const std::string & name, bool inserted_only) override;
163
167 std::optional<std::string> queryDeprecatedParamMessage(const std::string & name) const;
168
170 template <typename T>
171 void setHelper(const std::string & name);
172
188 template <typename T>
189 T & set(const std::string & name, bool quiet_mode = false);
190
202 template <typename T, typename... Ts>
203 void setParameters(const std::string & name, const T & value, Ts... extra_input_parameters);
204
213 template <typename T, typename UP_T>
214 std::optional<std::pair<bool, std::string>>
215 rangeCheck(const std::string & full_name,
216 const std::string & short_name,
217 const InputParameters::Parameter<T> & param,
218 const bool include_param_path = true);
219 template <typename T, typename UP_T>
220 std::optional<std::pair<bool, std::string>>
221 rangeCheck(const std::string & full_name,
222 const std::string & short_name,
223 const InputParameters::Parameter<std::vector<T>> & param,
224 const bool include_param_path = true);
226
230 template <typename T>
231 T getCheckedPointerParam(const std::string & name, const std::string & error_string = "") const;
232
238 template <typename T>
239 void addRequiredParam(const std::string & name, const std::string & doc_string);
240
245 template <typename T>
246 void
247 addRequiredParam(const std::string & name, const T & moose_enum, const std::string & doc_string);
248
250
256 template <typename T, typename S>
257 void addParam(const std::string & name, const S & value, const std::string & doc_string);
258 template <typename T>
259 void addParam(const std::string & name, const std::string & doc_string);
261
265 template <typename T>
266 void addParam(const std::string & name,
267 const std::initializer_list<typename T::value_type> & value,
268 const std::string & doc_string)
269 {
270 addParam<T>(name, T{value}, doc_string);
271 }
272
274 // BEGIN RANGE CHECKED PARAMETER METHODS
279 template <typename T>
280 void addRequiredRangeCheckedParam(const std::string & name,
281 const std::string & parsed_function,
282 const std::string & doc_string);
283 template <typename T>
284 void addRangeCheckedParam(const std::string & name,
285 const T & value,
286 const std::string & parsed_function,
287 const std::string & doc_string);
288 template <typename T>
289 void addRangeCheckedParam(const std::string & name,
290 const std::string & parsed_function,
291 const std::string & doc_string);
292 // END RANGE CHECKED PARAMETER METHODS
294
299 template <typename T>
300 void addRequiredCustomTypeParam(const std::string & name,
301 const std::string & custom_type,
302 const std::string & doc_string);
303 template <typename T>
304 void addCustomTypeParam(const std::string & name,
305 const T & value,
306 const std::string & custom_type,
307 const std::string & doc_string);
308 template <typename T>
309 void addCustomTypeParam(const std::string & name,
310 const std::string & custom_type,
311 const std::string & doc_string);
312 template <typename T>
313 void addDeprecatedCustomTypeParam(const std::string & name,
314 const std::string & custom_type,
315 const std::string & doc_string,
316 const std::string & deprecation_msg);
317
324 template <typename T>
325 void addPrivateParam(const std::string & name, const T & value);
326 template <typename T>
327 void addPrivateParam(const std::string & name);
328
338 template <typename T>
339 void addRequiredCommandLineParam(const std::string & name,
340 const std::string & syntax,
341 const std::string & doc_string);
342 template <typename T>
343 void addCommandLineParam(const std::string & name,
344 const std::string & syntax,
345 const std::string & doc_string);
346 template <typename T>
347 void addCommandLineParam(const std::string & name,
348 const std::string & syntax,
349 const T & value,
350 const std::string & doc_string);
351 template <typename T>
352 void addCommandLineParam(const std::string & name,
353 const std::string & syntax,
354 const std::initializer_list<typename T::value_type> & value,
355 const std::string & doc_string)
356 {
357 addCommandLineParam<T>(name, syntax, T{value}, doc_string);
358 }
359
377 template <typename T>
378 void addOptionalValuedCommandLineParam(const std::string & name,
379 const std::string & syntax,
380 const T & value,
381 const std::string & doc_string);
382
388 void setGlobalCommandLineParam(const std::string & name);
389
397 template <typename T>
398 void addDeprecatedParam(const std::string & name,
399 const T & value,
400 const std::string & doc_string,
401 const std::string & deprecation_message);
402
403 template <typename T>
404 void addDeprecatedParam(const std::string & name,
405 const std::string & doc_string,
406 const std::string & deprecation_message);
407
417 template <typename T>
418 void checkConsistentType(const std::string & name) const;
419
423 bool isCommandLineParameter(const std::string & name) const;
424
430 std::optional<InputParameters::CommandLineMetadata>
431 queryCommandLineMetadata(const std::string & name) const;
432
437 getCommandLineMetadata(const std::string & name) const;
438
444 {
445 friend class CommandLine;
446 FRIEND_TEST(InputParametersTest, commandLineParamSetNotCLParam);
449 };
455 void commandLineParamSet(const std::string & name, const CommandLineParamSetKey);
456
460 const std::string & getDescription(const std::string & name) const;
461
467 void addParamNamesToGroup(const std::string & space_delim_names, const std::string group_name);
468
474 void renameParameterGroup(const std::string & old_name, const std::string & new_name);
475
480 std::string getGroupName(const std::string & param_name) const;
481
488 template <typename T>
489 void suppressParameter(const std::string & name);
490
495 template <typename T>
496 void makeParamRequired(const std::string & name);
497
502 template <typename T>
503 void makeParamNotRequired(const std::string & name);
504
510 void addCoupledVar(const std::string & name, const std::string & doc_string);
511
519 void addDeprecatedCoupledVar(const std::string & old_name,
520 const std::string & new_name,
521 const std::string & removal_date = "");
522
531 void addCoupledVar(const std::string & name, const Real value, const std::string & doc_string);
532
541 void addCoupledVar(const std::string & name,
542 const std::vector<Real> & value,
543 const std::string & doc_string);
544
546
563 void addCoupledVarWithAutoBuild(const std::string & name,
564 const std::string & base_name,
565 const std::string & num_name,
566 const std::string & doc_string);
567 void addRequiredCoupledVarWithAutoBuild(const std::string & name,
568 const std::string & base_name,
569 const std::string & num_name,
570 const std::string & doc_string);
572
578 std::string getMooseType(const std::string & name) const;
579 std::vector<std::string> getVecMooseType(const std::string & name) const;
580
588 bool isMooseBaseObject() const;
589
593 const std::string * queryObjectType() const;
594
600 const std::string & getObjectType() const;
604 const std::string & getObjectName() const;
605
615 void addRequiredCoupledVar(const std::string & name, const std::string & doc_string);
616
620 std::string getDocString(const std::string & name) const;
621
629 void setDocString(const std::string & name, const std::string & doc);
630
634 std::string getDocUnit(const std::string & name) const;
635
642 void setDocUnit(const std::string & name, const std::string & doc_unit);
643
647 bool isParamRequired(const std::string & name) const;
648
652 void makeParamNotRequired(const std::string & name);
653
659 bool isParamValid(const std::string & name) const;
660
666 bool isParamSetByAddParam(const std::string & name) const;
667
671 bool isParamDeprecated(const std::string & name) const;
672
673#ifdef MOOSE_KOKKOS_ENABLED
678 bool isKokkosObject() const;
679#endif
680
685 bool areAllRequiredParamsValid() const;
686
690 std::string type(const std::string & name) const;
691
695 bool isPrivate(const std::string & name) const;
696
700 void declareControllable(const std::string & name, std::set<ExecFlagType> execute_flags = {});
701
705 void markControlled(const std::string & name);
706
710 bool isControllable(const std::string & name) const;
711
715 const std::set<ExecFlagType> & getControllableExecuteOnTypes(const std::string & name) const;
716
722 void registerBase(const std::string & value);
723
729 bool hasBase() const;
730
736 const std::string & getBase() const;
737
749 void registerSystemAttributeName(const std::string & value);
750
755 const std::string & getSystemAttributeName() const;
756
764 void registerBuildableTypes(const std::string & names);
765
781 const std::string & name,
783 Moose::RelationshipManagerInputParameterCallback input_parameter_callback = nullptr);
784
789
793 const std::vector<std::string> & getBuildableTypes() const;
794
798 const std::vector<std::tuple<std::string,
802
804
808 void collapseSyntaxNesting(bool collapse);
809 bool collapseSyntaxNesting() const;
811
813
817 void mooseObjectSyntaxVisibility(bool visibility);
818 bool mooseObjectSyntaxVisibility() const;
820
822
825 using Parameters::operator=;
826 using Parameters::operator+=;
830
837 void checkParams(const std::string & parsing_syntax);
838
848 std::optional<std::pair<bool, std::string>> parameterRangeCheck(const Parameters::Value & value,
849 const std::string & long_name,
850 const std::string & short_name,
851 const bool include_param_path);
852
860 void finalize(const std::string & parsing_syntax);
861
875 std::filesystem::path
876 getFileBase(const std::optional<std::string> & param_name = std::optional<std::string>()) const;
877
882 inline std::set<std::string>::const_iterator coupledVarsBegin() const
883 {
884 return _coupled_vars.begin();
885 }
886 inline std::set<std::string>::const_iterator coupledVarsEnd() const
887 {
888 return _coupled_vars.end();
889 }
890
894 const std::set<std::string> & getCoupledVariableParamNames() const { return _coupled_vars; }
895
899 const std::unordered_map<std::string, std::string> & getNewToDeprecatedVarMap() const
900 {
902 }
903
905 bool isRangeChecked(const std::string & param_name) const;
906
908 std::string rangeCheckedFunction(const std::string & name) const;
909
911 bool hasDefault(const std::string & param_name) const;
912
918 bool hasCoupledVar(const std::string & coupling_name) const;
919
925 bool hasCoupledValue(const std::string & coupling_name) const
926 {
927 mooseDeprecated("InputParameters::hasCoupledValue() is deprecated. Use "
928 "InputParameters::hasCoupledVar() instead.");
929 return hasCoupledVar(coupling_name);
930 }
931
938 void setCoupledVar(const std::string & coupling_name, const std::string & value);
939
946 void setCoupledVar(const std::string & coupling_name, const std::vector<VariableName> & values);
947
953 const std::vector<VariableName> & getCoupledVar(const std::string & coupling_name) const;
954
960 bool hasDefaultCoupledValue(const std::string & coupling_name) const;
961
968 Real defaultCoupledValue(const std::string & coupling_name, unsigned int i = 0) const;
969
975 unsigned int numberDefaultCoupledValues(const std::string & coupling_name) const;
976
984 void defaultCoupledValue(const std::string & coupling_name, Real value, unsigned int i = 0);
985
989 std::map<std::string, std::pair<std::string, std::string>> getAutoBuildVectors() const;
990
991 // BEGIN APPLY PARAMETER METHODS
1009 void applyParameters(const InputParameters & common,
1010 const std::vector<std::string> & exclude = {},
1011 const bool allow_private = false);
1012
1019 const std::vector<std::string> & exclude = {},
1020 const bool allow_private = false);
1021
1039 void applySpecificParameters(const InputParameters & common,
1040 const std::vector<std::string> & include,
1041 bool allow_private = false);
1042
1054 void applyParameter(const InputParameters & common,
1055 const std::string & common_name,
1056 bool allow_private = false);
1057 // END APPLY PARAMETER METHODS
1058
1069 void applyCoupledVar(const InputParameters & common, const std::string & var_name);
1070
1074 bool paramSetByUser(const std::string & name) const;
1075
1080 bool isParamSetByUser(const std::string & name) const;
1081
1087 bool isParamDefined(const std::string & name) const;
1088
1098 template <typename T>
1099 const T * queryParam(const std::string & name) const;
1100
1102 /*
1103 * These methods are here to retrieve parameters for scalar and vector types respectively. We will
1104 * throw errors
1105 * when returning most scalar and vector types.
1106 */
1107 template <typename T>
1108 static const T & getParamHelper(const std::string & name, const InputParameters & pars);
1110
1111 using Parameters::get;
1112
1114 template <typename R1,
1115 typename R2,
1116 typename V1 = typename std::conditional<std::is_same<R1, MooseEnumItem>::value,
1118 std::vector<R1>>::type,
1119 typename V2 = typename std::conditional<std::is_same<R2, MooseEnumItem>::value,
1121 std::vector<R2>>::type>
1122 std::vector<std::pair<R1, R2>> get(const std::string & param1, const std::string & param2) const;
1123
1127 std::set<std::string> getParametersList() const;
1128
1132 std::set<std::string> getControllableParameters() const;
1133
1137 std::set<std::string> getGroupParameters(const std::string & group) const;
1138
1143 void setReservedValues(const std::string & name, const std::set<std::string> & reserved);
1144
1149 std::set<std::string> reservedValues(const std::string & name) const;
1150
1155 std::string blockLocation() const;
1156
1161 std::string blockFullpath() const;
1162
1166 const hit::Node * getHitNode(const std::string & param) const;
1172 void setHitNode(const std::string & param, const hit::Node & node, const SetParamHitNodeKey);
1173
1178 std::string inputLocation(const std::string & param) const;
1179
1184 std::string paramFullpath(const std::string & param) const;
1185
1189 std::string paramLocationPrefix(const std::string & param) const;
1190
1198 template <typename... Args>
1199 std::string paramMessage(const std::string & param, Args... args) const;
1200
1204 template <typename... Args>
1205 [[noreturn]] void mooseError(Args &&... args) const;
1206
1211 template <typename... Args>
1212 [[noreturn]] void paramError(const std::string & param, Args... args) const;
1213
1218 std::string rawParamVal(const std::string & param) const;
1219
1224 template <typename T>
1225 void ignoreParameter(const std::string & name);
1226
1231 bool shouldIgnore(const std::string & name);
1232
1236 template <typename T>
1237 bool isType(const std::string & name) const;
1238
1245 std::string varName(const std::string & var_param_name,
1246 const std::string & moose_object_with_var_param_name) const;
1247
1255 void renameParam(const std::string & old_name,
1256 const std::string & new_name,
1257 const std::string & new_docstring);
1258
1265 void renameCoupledVar(const std::string & old_name,
1266 const std::string & new_name,
1267 const std::string & new_docstring);
1268
1269 void deprecateParam(const std::string & old_name,
1270 const std::string & new_name,
1271 const std::string & removal_date);
1272
1273 void deprecateCoupledVar(const std::string & old_name,
1274 const std::string & new_name,
1275 const std::string & removal_date);
1276
1283 const std::string & checkForRename(const std::string & name) const;
1284
1291 template <typename T>
1292 const T & get(std::string_view name) const;
1293
1302 template <typename T>
1303 bool have_parameter(std::string_view name) const;
1304
1312 template <typename T>
1313 void transferParam(const InputParameters & source_param,
1314 const std::string & name,
1315 const std::string & new_name = "",
1316 const std::string & new_description = "");
1317
1330 std::vector<std::string> paramAliases(const std::string & param_name) const;
1331
1336 const hit::Node * getHitNode() const { return _hit_node; }
1344 void setHitNode(const hit::Node & node, const SetHitNodeKey) { _hit_node = &node; }
1345
1349 bool isFinalized() const { return _finalized; }
1350
1354 std::optional<Moose::DataFileUtils::Path> queryDataFileNamePath(const std::string & name) const;
1355
1364 std::optional<std::string> setupVariableNames(std::vector<VariableName> & names,
1365 const hit::Node & node,
1367
1368private:
1369 // Private constructor so that InputParameters can only be created in certain places.
1371
1376
1377 template <typename T>
1378 static constexpr bool isFunctorNameType();
1379
1383 template <typename T>
1384 std::string appendFunctorDescription(const std::string & doc_string) const;
1385
1389 void setDeprecatedVarDocString(const std::string & new_name, const std::string & doc_string);
1390
1391 void renameParamInternal(const std::string & old_name,
1392 const std::string & new_name,
1393 const std::string & docstring,
1394 const std::string & removal_date);
1395
1396 void renameCoupledVarInternal(const std::string & old_name,
1397 const std::string & new_name,
1398 const std::string & docstring,
1399 const std::string & removal_date);
1400
1407 std::pair<std::string, const hit::Node *> paramMessageContext(const std::string & param) const;
1413 std::string paramMessagePrefix(const std::string & param) const;
1414
1416 {
1417 std::string _doc_string;
1419 std::string _doc_unit;
1421 std::string _custom_type;
1423 std::optional<CommandLineMetadata> _cl_data;
1425 std::optional<Moose::DataFileUtils::Path> _data_file_name_path;
1427 std::string _group;
1429 std::string _range_function;
1431 std::pair<std::string, std::string> _autobuild_vecs;
1433 bool _required = false;
1439 bool _valid = false;
1441 bool _is_private = false;
1444 std::vector<Real> _coupled_default = {0};
1446 bool _set_by_add_param = false;
1448 std::set<std::string> _reserved_values;
1452 const hit::Node * _hit_node;
1454 bool _controllable = false;
1456 std::set<ExecFlagType> _controllable_flags;
1458 bool _ignore = false;
1459 };
1460
1461 Metadata & at(const std::string & param_name)
1462 {
1463 const auto & param = checkForRename(param_name);
1464 if (_params.count(param) == 0)
1465 mooseError("param '", param, "' not present in InputParams");
1466 return _params[param];
1467 }
1468 const Metadata & at(const std::string & param_name) const
1469 {
1470 const auto & param = checkForRename(param_name);
1471 if (_params.count(param) == 0)
1472 mooseError("param '", param, "' not present in InputParams");
1473 return _params.at(param);
1474 }
1475
1485 void allowCopy(bool status) { _allow_copy = status; }
1486
1490 void checkParamName(const std::string & name) const;
1491
1496 template <typename T, typename S>
1497 void setParamHelper(const std::string & name, T & l_value, const S & r_value);
1498
1507 template <typename T>
1508 void addCommandLineParamHelper(const std::string & name,
1509 const std::string & syntax,
1510 const bool required,
1511 const bool value_required);
1512
1517 [[noreturn]] void callMooseError(std::string msg,
1518 const bool with_prefix = true,
1519 const hit::Node * node = nullptr,
1520 const bool show_trace = true) const;
1521
1524 std::map<std::string, Metadata> _params;
1525
1527 std::set<std::string> _coupled_vars;
1528
1532
1535 std::vector<std::string> _buildable_types;
1536
1541 std::vector<std::tuple<std::string,
1545
1549
1552
1556
1559
1561 std::unordered_map<std::string, std::string> _new_to_deprecated_coupled_vars;
1562
1567 std::map<std::string, std::pair<std::string, std::string>> _old_to_new_name_and_dep;
1568
1571 std::multimap<std::string, std::string> _new_to_old_names;
1572
1574 const hit::Node * _hit_node;
1575
1578
1579 // These are the only objects allowed to _create_ InputParameters
1582 friend class Parser;
1583 // for the printInputFile function in the action warehouse
1584 friend class ActionWarehouse;
1585};
1586
1587template <typename T>
1588void
1589InputParameters::setHelper(const std::string & /*name*/)
1590{
1591}
1592
1593// Template and inline function implementations
1594template <typename T>
1595T &
1596InputParameters::set(const std::string & name_in, bool quiet_mode)
1597{
1598 const auto & name = checkForRename(name_in);
1599
1600 checkParamName(name);
1601 checkConsistentType<T>(name);
1602
1603 T & result = this->Parameters::set<T>(name);
1604
1605 if (quiet_mode)
1606 _params[name]._set_by_add_param = true;
1607
1608 setHelper<T>(name);
1609
1610 return result;
1611}
1612
1613template <typename T, typename... Ts>
1614void
1615InputParameters::setParameters(const std::string & name,
1616 const T & value,
1617 Ts... extra_input_parameters)
1618{
1619 this->set<T>(name) = value;
1620 this->setParameters(extra_input_parameters...);
1621}
1622
1623template <typename T, typename UP_T>
1624std::optional<std::pair<bool, std::string>>
1625InputParameters::rangeCheck(const std::string & full_name,
1626 const std::string & short_name,
1627 const InputParameters::Parameter<std::vector<T>> & param,
1628 const bool include_param_path)
1629{
1630 if (!isParamValid(short_name))
1631 return {};
1632
1633 const auto & range_function = _params[short_name]._range_function;
1634 if (range_function.empty())
1635 return {};
1636
1649 std::vector<std::string> vars;
1650 if (fp.ParseAndDeduceVariables(range_function, vars) != -1) // -1 for success
1651 return {{false,
1652 "Error parsing expression '" + range_function + "' for parameter " + short_name + ""}};
1653
1654 // Fparser parameter buffer
1655 std::vector<UP_T> parbuf(vars.size());
1656
1657 // parameter vector
1658 const std::vector<T> & value = param.get();
1659
1660 // iterate over all vector values (maybe ;)
1661 bool need_to_iterate = false;
1662 unsigned int i = 0;
1663 do
1664 {
1665 // set parameters
1666 for (unsigned int j = 0; j < vars.size(); j++)
1667 {
1668 if (vars[j] == short_name)
1669 {
1670 if (value.size() == 0)
1671 {
1672 std::ostringstream oss;
1673 oss << "Range checking empty vector";
1674 if (include_param_path)
1675 oss << " parameter " << full_name;
1676 oss << "; expression = '" << range_function << "'";
1677 return {{true, oss.str()}};
1678 }
1679
1680 parbuf[j] = value[i];
1681 need_to_iterate = true;
1682 }
1683 else if (vars[j] == short_name + "_size")
1684 parbuf[j] = value.size();
1685 else
1686 {
1687 if (vars[j].substr(0, short_name.size() + 1) != short_name + "_")
1688 return {{false, "Error parsing expression '" + range_function + "'"}};
1689 std::istringstream iss(vars[j]);
1690 iss.seekg(short_name.size() + 1);
1691
1692 size_t index;
1693 if (iss >> index && iss.eof())
1694 {
1695 if (index >= value.size())
1696 {
1697 std::ostringstream oss;
1698 oss << "Error parsing expression '" + range_function + "'";
1699 if (include_param_path)
1700 oss << " for parameter " << full_name;
1701 oss << "; out of range variable '" + vars[j] << "'";
1702 return {{true, oss.str()}};
1703 }
1704 parbuf[j] = value[index];
1705 }
1706 else
1707 return {{false,
1708 "Error parsing expression '" + range_function + "'; invalid variable '" +
1709 vars[j] + "'"}};
1710 }
1711 }
1712
1713 // ensure range-checked input file parameter comparison functions
1714 // do absolute floating point comparisons instead of using a default epsilon.
1715 auto tmp_eps = fp.epsilon();
1716 fp.setEpsilon(0);
1717 UP_T result = fp.Eval(&parbuf[0]);
1718 fp.setEpsilon(tmp_eps);
1719
1720 // test function using the parameters determined above
1721 if (fp.EvalError())
1722 return {{false, "Error evaluating expression '" + range_function + "'"}};
1723
1724 if (!result)
1725 {
1726 std::ostringstream oss;
1727 oss << "Range check failed";
1728 if (include_param_path)
1729 oss << " for parameter " << full_name;
1730 oss << "; expression = '" << range_function << "'";
1731 if (need_to_iterate)
1732 oss << ", component " << i;
1733 return {{true, oss.str()}};
1734 }
1735
1736 } while (need_to_iterate && ++i < value.size());
1737
1738 return {};
1739}
1740
1741template <typename T, typename UP_T>
1742std::optional<std::pair<bool, std::string>>
1743InputParameters::rangeCheck(const std::string & full_name,
1744 const std::string & short_name,
1745 const InputParameters::Parameter<T> & param,
1746 const bool include_param_path)
1747{
1748 if (!isParamValid(short_name))
1749 return {};
1750
1751 const auto & range_function = _params[short_name]._range_function;
1752 if (range_function.empty())
1753 return {};
1754
1755 // Parse the expression
1757 if (fp.Parse(range_function, short_name) != -1) // -1 for success
1758 return {{false,
1759 "Error parsing expression '" + range_function + "'" + " for parameter " + short_name}};
1760
1761 // ensure range-checked input file parameter comparison functions
1762 // do absolute floating point comparisons instead of using a default epsilon.
1763 auto tmp_eps = fp.epsilon();
1764 fp.setEpsilon(0);
1765 // We require a non-const value for the implicit upscaling of the parameter type
1766 std::vector<UP_T> value(1, param.get());
1767 UP_T result = fp.Eval(&value[0]);
1768 fp.setEpsilon(tmp_eps);
1769
1770 if (fp.EvalError())
1771 return {{true,
1772 "Error evaluating expression '" + range_function + "' for parameter " + short_name +
1773 "; perhaps you used the wrong variable name?"}};
1774
1775 if (!result)
1776 {
1777 std::ostringstream oss;
1778 oss << "Range check failed";
1779 if (include_param_path)
1780 oss << " for parameter " << full_name;
1781 oss << "; expression = '" << range_function << "', value = " << value[0];
1782 return {{true, oss.str()}};
1783 }
1784
1785 return {};
1786}
1787
1788template <typename T>
1789T
1791 const std::string & error_string) const
1792{
1793 const auto & name = checkForRename(name_in);
1794
1795 T param = this->get<T>(name);
1796
1797 // Note: You will receive a compile error on this line if you attempt to pass a non-pointer
1798 // template type to this method
1799 if (!param)
1800 mooseError("Parameter ", name, " is NULL.\n", error_string);
1801 return this->get<T>(name);
1802}
1803
1804template <typename T>
1805void
1806InputParameters::addRequiredParam(const std::string & name, const std::string & doc_string)
1807{
1808 checkParamName(name);
1809 checkConsistentType<T>(name);
1810
1811 InputParameters::insert<T>(name);
1812 auto & metadata = _params[name];
1813 metadata._required = true;
1814 if constexpr (isFunctorNameType<T>())
1815 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1816 else
1817 metadata._doc_string = doc_string;
1818}
1819
1820template <typename T>
1821void
1822InputParameters::addRequiredParam(const std::string & /*name*/,
1823 const T & /*value*/,
1824 const std::string & /*doc_string*/)
1825{
1826 mooseError("You cannot call addRequiredParam and supply a default value for this type, please "
1827 "use addParam instead");
1828}
1829
1830template <typename T, typename S>
1831void
1832InputParameters::addParam(const std::string & name, const S & value, const std::string & doc_string)
1833{
1834 checkParamName(name);
1835 checkConsistentType<T>(name);
1836
1837 T & l_value = InputParameters::set<T>(name);
1838 auto & metadata = _params[name];
1839 if constexpr (isFunctorNameType<T>())
1840 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1841 else
1842 metadata._doc_string = doc_string;
1843
1844 // Set the parameter now
1845 setParamHelper(name, l_value, value);
1846
1847 /* Indicate the default value, as set via addParam, is being used. The parameter is removed from
1848 the list whenever
1849 it changes, see set_attributes */
1850 metadata._set_by_add_param = true;
1851}
1852
1853template <typename T>
1854void
1855InputParameters::addParam(const std::string & name, const std::string & doc_string)
1856{
1857 checkParamName(name);
1858 checkConsistentType<T>(name);
1859
1860 InputParameters::insert<T>(name);
1861 if constexpr (isFunctorNameType<T>())
1862 _params[name]._doc_string = appendFunctorDescription<T>(doc_string);
1863 else
1864 _params[name]._doc_string = doc_string;
1865}
1866
1867template <typename T, typename S>
1868void
1869InputParameters::setParamHelper(const std::string & /*name*/, T & l_value, const S & r_value)
1870{
1871 l_value = r_value;
1872}
1873
1874template <typename T>
1875void
1877 const std::string & syntax,
1878 const bool required,
1879 const bool value_required)
1880{
1882 "This type is not a supported command line parameter type. See "
1883 "CommandLine::populateCommandLineParams to add it as a supported type.");
1884
1885 auto & cl_data = at(name)._cl_data;
1886 cl_data = CommandLineMetadata();
1887
1888 // Split up the syntax by whitespace
1889 std::vector<std::string> syntax_split;
1890 MooseUtils::tokenize(syntax, syntax_split, 1, " \t\n\v\f\r");
1891
1892 // Set the single syntax string as the combined syntax with removed whitespace
1893 cl_data->syntax = MooseUtils::stringJoin(syntax_split);
1894 mooseAssert(cl_data->syntax.size(), "Empty token");
1895
1896 // Set the switches; only parse those that begin with "-" as we also
1897 // provide examples within the syntax
1898 for (const auto & val : syntax_split)
1899 if (val.rfind("-", 0) == 0)
1900 {
1901 if (!std::regex_search(val, std::regex("^\\-+[a-zA-Z]")))
1902 mooseError("The switch '",
1903 val,
1904 "' for the command line parameter '",
1905 name,
1906 "' is invalid. It must begin with an alphabetical character.");
1907
1908 cl_data->switches.push_back(val);
1910 }
1911
1912 cl_data->required = required;
1913 cl_data->global = false;
1914
1915 // No arguments needed for a boolean parameter
1916 if constexpr (std::is_same_v<T, bool>)
1917 {
1918 (void)value_required; // purposely unused; doesn't take a value
1919 cl_data->argument_type = CommandLineMetadata::ArgumentType::NONE;
1920 }
1921 // MooseEnums require a value
1922 else if constexpr (std::is_same_v<T, MooseEnum>)
1923 {
1924 (void)value_required; // purposely unused; always required
1925 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1926 }
1927 // The user didn't specify a default, so a value is required
1928 else if (value_required)
1929 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1930 // Otherwise, it's optional (user specified a default)
1931 else
1932 cl_data->argument_type = CommandLineMetadata::ArgumentType::OPTIONAL;
1933}
1934
1935template <typename T>
1936void
1938 const std::string & parsed_function,
1939 const std::string & doc_string)
1940{
1941 addRequiredParam<T>(name, doc_string);
1942 _params[name]._range_function = parsed_function;
1943}
1944
1945template <typename T>
1946void
1948 const T & value,
1949 const std::string & parsed_function,
1950 const std::string & doc_string)
1951{
1952 addParam<T>(name, value, doc_string);
1953 _params[name]._range_function = parsed_function;
1954}
1955
1956template <typename T>
1957void
1959 const std::string & parsed_function,
1960 const std::string & doc_string)
1961{
1962 addParam<T>(name, doc_string);
1963 _params[name]._range_function = parsed_function;
1964}
1965
1966template <typename T>
1967void
1969 const std::string & custom_type,
1970 const std::string & doc_string)
1971{
1972 addRequiredParam<T>(name, doc_string);
1973 _params[name]._custom_type = custom_type;
1974}
1975
1976template <typename T>
1977void
1979 const T & value,
1980 const std::string & custom_type,
1981 const std::string & doc_string)
1982{
1983 addParam<T>(name, value, doc_string);
1984 _params[name]._custom_type = custom_type;
1985}
1986
1987template <typename T>
1988void
1990 const std::string & custom_type,
1991 const std::string & doc_string)
1992{
1993 addParam<T>(name, doc_string);
1994 _params[name]._custom_type = custom_type;
1995}
1996
1997template <typename T>
1998void
2000 const std::string & custom_type,
2001 const std::string & doc_string,
2002 const std::string & deprecation_message)
2003{
2005 addParam<T>(name, doc_string);
2006 auto & metadata = _params[name];
2007 metadata._custom_type = custom_type;
2008
2009 metadata._deprecation_message = deprecation_message;
2011}
2012
2013template <typename T>
2014void
2015InputParameters::addPrivateParam(const std::string & name)
2016{
2017 checkParamName(name);
2018 checkConsistentType<T>(name);
2019
2020 InputParameters::insert<T>(name);
2021 _params[name]._is_private = true;
2022}
2023
2024template <typename T>
2025void
2026InputParameters::addPrivateParam(const std::string & name, const T & value)
2027{
2028 checkParamName(name);
2029 checkConsistentType<T>(name);
2030
2031 InputParameters::set<T>(name) = value;
2032 auto & metadata = _params[name];
2033 metadata._is_private = true;
2034 metadata._set_by_add_param = true;
2035}
2036
2037template <typename T>
2038void
2040 const std::string & syntax,
2041 const std::string & doc_string)
2042{
2043 static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool");
2044
2045 addRequiredParam<T>(name, doc_string);
2046 addCommandLineParamHelper<T>(name, syntax, /* required = */ true, /* value_required = */ true);
2047}
2048
2049template <typename T>
2050void
2052 const std::string & syntax,
2053 const std::string & doc_string)
2054{
2055 static_assert(!std::is_same_v<T, MooseEnum>,
2056 "addCommandLineParam() without a value cannot be used with a MooseEnum because a "
2057 "MooseEnum requires initialization");
2058
2059 auto constexpr is_bool = std::is_same_v<T, bool>;
2060 if constexpr (is_bool)
2061 addParam<T>(name, false, doc_string);
2062 else
2063 addParam<T>(name, doc_string);
2064
2065 addCommandLineParamHelper<T>(
2066 name, syntax, /* required = */ false, /* value_required = */ !is_bool);
2067}
2068
2069template <typename T>
2070void
2072 const std::string & syntax,
2073 const T & value,
2074 const std::string & doc_string)
2075{
2076 if constexpr (std::is_same_v<T, bool>)
2077 mooseAssert(!value, "Default for bool must be false");
2078
2079 addParam<T>(name, value, doc_string);
2080 addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ true);
2081}
2082
2083template <typename T>
2084void
2086 const std::string & syntax,
2087 const T & value,
2088 const std::string & doc_string)
2089{
2090 mooseAssert(name == "citations" || name == "csg_only" || name == "mesh_only" ||
2091 name == "recover" || name == "run",
2092 "Not supported for new parameters");
2093 static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool (does not take a value)");
2094 addParam<T>(name, value, doc_string);
2095 addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ false);
2096}
2097
2098template <typename T>
2099void
2100InputParameters::checkConsistentType(const std::string & name_in) const
2101{
2102 const auto & name = checkForRename(name_in);
2103
2104 // If we don't currently have the Parameter, can't be any inconsistency
2106 if (it == _values.end())
2107 return;
2108
2109 // Now, if we already have the Parameter, but it doesn't have the
2110 // right type, throw an error.
2111 if (!this->Parameters::have_parameter<T>(name))
2112 mooseError("Attempting to set parameter \"",
2113 name,
2114 "\" with type (",
2115 libMesh::demangle(typeid(T).name()),
2116 ")\nbut the parameter already exists as type (",
2117 it->second->type(),
2118 ")");
2119}
2120
2121template <typename T>
2122void
2123InputParameters::suppressParameter(const std::string & name_in)
2124{
2125 const auto & name = checkForRename(name_in);
2126 if (!this->have_parameter<T>(name))
2127 mooseError("Unable to suppress nonexistent parameter: ", name);
2128
2129 auto & metadata = _params[name];
2130 metadata._required = false;
2131 metadata._is_private = true;
2132 metadata._controllable = false;
2133}
2134
2135template <typename T>
2136void
2137InputParameters::ignoreParameter(const std::string & name_in)
2138{
2139 const auto & name = checkForRename(name_in);
2140 suppressParameter<T>(name);
2141 _params[name]._ignore = true;
2142}
2143
2144template <typename T>
2145void
2146InputParameters::makeParamRequired(const std::string & name_in)
2147{
2148 const auto & name = checkForRename(name_in);
2149
2150 if (!this->have_parameter<T>(name))
2151 mooseError("Unable to require nonexistent parameter: ", name);
2152
2153 _params[name]._required = true;
2154}
2155
2156template <typename T>
2157void
2158InputParameters::makeParamNotRequired(const std::string & name_in)
2159{
2160 const auto & name = checkForRename(name_in);
2161
2162 if (!this->have_parameter<T>(name))
2163 mooseError("Unable to un-require nonexistent parameter: ", name);
2164
2165 _params[name]._required = false;
2166}
2167
2168template <typename T>
2169void
2171 const T & value,
2172 const std::string & doc_string,
2173 const std::string & deprecation_message)
2174{
2176 mooseAssert(!_old_to_new_name_and_dep.count(name),
2177 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2178 << name << "', already deprecated via deprecateParam or renamed via renameParam");
2179 addParam<T>(name, value, doc_string);
2180
2181 _params[name]._deprecation_message = deprecation_message;
2183}
2184
2185template <typename T>
2186void
2188 const std::string & doc_string,
2189 const std::string & deprecation_message)
2190{
2192 mooseAssert(!_old_to_new_name_and_dep.count(name),
2193 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2194 << name << "', already deprecated via deprecateParam or renamed via renameParam");
2195 addParam<T>(name, doc_string);
2196
2197 _params[name]._deprecation_message = deprecation_message;
2199}
2200
2201// Forward declare MooseEnum specializations for add*Param
2202template <>
2203void InputParameters::addRequiredParam<MooseEnum>(const std::string & name,
2204 const MooseEnum & moose_enum,
2205 const std::string & doc_string);
2206
2207template <>
2208void InputParameters::addRequiredParam<MultiMooseEnum>(const std::string & name,
2209 const MultiMooseEnum & moose_enum,
2210 const std::string & doc_string);
2211
2212template <>
2213void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2214 const std::string & name,
2215 const std::vector<MooseEnum> & moose_enums,
2216 const std::string & doc_string);
2217
2218template <>
2219void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2220 const std::string & name,
2221 const std::vector<MultiMooseEnum> & moose_enums,
2222 const std::string & doc_string);
2223
2224template <>
2225void InputParameters::addParam<MooseEnum>(const std::string & /*name*/,
2226 const std::string & /*doc_string*/);
2227
2228template <>
2229void InputParameters::addParam<MultiMooseEnum>(const std::string & /*name*/,
2230 const std::string & /*doc_string*/);
2231
2232template <>
2233void InputParameters::addParam<std::vector<MooseEnum>>(const std::string & /*name*/,
2234 const std::string & /*doc_string*/);
2235
2236template <>
2237void InputParameters::addParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2238 const std::string & /*doc_string*/);
2239
2240template <>
2241void
2242InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2243 const std::string & /*doc_string*/);
2244
2245template <>
2246void InputParameters::addPrivateParam<MooseEnum>(const std::string & /*name*/);
2247
2248template <>
2249void InputParameters::addPrivateParam<MultiMooseEnum>(const std::string & /*name*/);
2250
2251template <>
2252void InputParameters::addDeprecatedParam<MooseEnum>(const std::string & /*name*/,
2253 const std::string & /*doc_string*/,
2254 const std::string & /*deprecation_message*/);
2255
2256template <>
2257void
2258InputParameters::addDeprecatedParam<MultiMooseEnum>(const std::string & /*name*/,
2259 const std::string & /*doc_string*/,
2260 const std::string & /*deprecation_message*/);
2261
2262template <>
2263void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2264 const std::string & /*name*/,
2265 const std::string & /*doc_string*/,
2266 const std::string & /*deprecation_message*/);
2267
2268// Forward declare specializations for setParamHelper
2269template <>
2270void InputParameters::setParamHelper<PostprocessorName, Real>(const std::string & name,
2271 PostprocessorName & l_value,
2272 const Real & r_value);
2273
2274template <>
2275void InputParameters::setParamHelper<PostprocessorName, int>(const std::string & name,
2276 PostprocessorName & l_value,
2277 const int & r_value);
2278
2279template <>
2280void InputParameters::setParamHelper<FunctionName, Real>(const std::string & /*name*/,
2281 FunctionName & l_value,
2282 const Real & r_value);
2283
2284template <>
2285void InputParameters::setParamHelper<FunctionName, int>(const std::string & /*name*/,
2286 FunctionName & l_value,
2287 const int & r_value);
2288
2289template <>
2290void InputParameters::setParamHelper<MaterialPropertyName, Real>(const std::string & /*name*/,
2291 MaterialPropertyName & l_value,
2292 const Real & r_value);
2293
2294template <>
2295void InputParameters::setParamHelper<MaterialPropertyName, int>(const std::string & /*name*/,
2296 MaterialPropertyName & l_value,
2297 const int & r_value);
2298
2299template <>
2300void InputParameters::setParamHelper<MooseFunctorName, Real>(const std::string & /*name*/,
2301 MooseFunctorName & l_value,
2302 const Real & r_value);
2303
2304template <>
2305void InputParameters::setParamHelper<MooseFunctorName, int>(const std::string & /*name*/,
2306 MooseFunctorName & l_value,
2307 const int & r_value);
2308
2309template <typename T>
2310const T *
2311InputParameters::queryParam(const std::string & name) const
2312{
2313 return have_parameter<T>(name) && isParamValid(name) ? &getParamHelper<T>(name, *this) : nullptr;
2314}
2315
2316template <typename T>
2317const T &
2318InputParameters::getParamHelper(const std::string & name_in, const InputParameters & pars)
2319{
2320 const auto & name = pars.checkForRename(name_in);
2321
2322 if (!pars.isParamValid(name))
2323 pars.mooseError("The parameter \"", name, "\" is being retrieved before being set.");
2324
2325 return pars.get<T>(name);
2326}
2327
2328// Declare specializations so we don't fall back on the generic
2329// implementation, but the definition will be in InputParameters.C so
2330// we won't need to bring in *MooseEnum header files here.
2331template <>
2332const MooseEnum & InputParameters::getParamHelper<MooseEnum>(const std::string & name,
2333 const InputParameters & pars);
2334
2335template <>
2337InputParameters::getParamHelper<MultiMooseEnum>(const std::string & name,
2338 const InputParameters & pars);
2339
2340template <typename R1, typename R2, typename V1, typename V2>
2341std::vector<std::pair<R1, R2>>
2342InputParameters::get(const std::string & param1_in, const std::string & param2_in) const
2343{
2344 const auto & param1 = checkForRename(param1_in);
2345 const auto & param2 = checkForRename(param2_in);
2346
2347 const auto & v1 = get<V1>(param1);
2348 const auto & v2 = get<V2>(param2);
2349
2350 auto controllable = getControllableParameters();
2351 if (controllable.count(param1) || controllable.count(param2))
2352 mooseError("Parameters ",
2353 param1,
2354 " and/or ",
2355 param2 + " are controllable parameters and cannot be retireved using "
2356 "the MooseObject::getParam/InputParameters::get methods for pairs");
2357
2358 if (v1.size() != v2.size())
2359 paramError(param1,
2360 "Vector parameters ",
2361 param1,
2362 "(size: ",
2363 v1.size(),
2364 ") and " + param2,
2365 "(size: ",
2366 v2.size(),
2367 ") are of different lengths \n");
2368
2369 std::vector<std::pair<R1, R2>> parameter_pairs;
2370 auto i1 = v1.begin();
2371 auto i2 = v2.begin();
2372 for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
2373 parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
2374 return parameter_pairs;
2375}
2376
2378
2379template <typename T>
2380bool
2381InputParameters::isType(const std::string & name_in) const
2382{
2383 const auto & name = checkForRename(name_in);
2384
2385 if (!_params.count(name))
2386 mooseError("Parameter \"", name, "\" is not valid.");
2387 return have_parameter<T>(name);
2388}
2389
2390template <typename T>
2391const T &
2392InputParameters::get(std::string_view name_in) const
2393{
2394 const std::string name_str(name_in);
2395 const auto & name = checkForRename(name_str);
2396
2397 return Parameters::get<T>(name);
2398}
2399
2400template <typename T>
2401bool
2402InputParameters::have_parameter(std::string_view name_in) const
2403{
2404 const std::string name_str(name_in);
2405 const auto & name = checkForRename(name_str);
2406
2407 return Parameters::have_parameter<T>(name);
2408}
2409
2410template <typename T>
2411void
2413 const std::string & name_in,
2414 const std::string & new_name,
2415 const std::string & new_description)
2416{
2417 const auto & name = source_params.checkForRename(name_in);
2418 const auto p_name = new_name.empty() ? name_in : new_name;
2419 if (!source_params.have_parameter<T>(name) && !source_params.hasCoupledVar(name))
2420 mooseError("The '",
2421 name_in,
2422 "' parameter could not be transferred because it does not exist with type '",
2423 MooseUtils::prettyCppType<T>(),
2424 "' in the source parameters");
2425 if (name != name_in)
2426 mooseWarning("The transferred parameter " + name_in + " is deprecated in favor of " + name +
2427 " in the source parameters. The new name should likely be used for the parameter "
2428 "transfer instead.");
2429 const std::string description =
2430 new_description.empty() ? source_params.getDescription(name) : new_description;
2431
2432 if (source_params.isParamRequired(name))
2433 {
2434 // Check for a variable parameter
2435 if (source_params.hasCoupledVar(name))
2436 addRequiredCoupledVar(p_name, description);
2437 // Enums parameters have a default list of options
2438 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2439 addRequiredParam<T>(p_name, source_params.get<T>(name), description);
2440 else if (source_params.isRangeChecked(name))
2441 addRequiredRangeCheckedParam<T>(
2442 p_name, source_params.rangeCheckedFunction(name), description);
2443 else
2444 addRequiredParam<T>(p_name, description);
2445 }
2446 else
2447 {
2448 // Check for a variable parameter
2449 if (source_params.hasCoupledVar(name))
2450 {
2451 if (!source_params.hasDefaultCoupledValue(name))
2452 addCoupledVar(p_name, description);
2453 else if (source_params.numberDefaultCoupledValues(name) == 1)
2454 addCoupledVar(p_name, source_params.defaultCoupledValue(name), description);
2455 else
2456 {
2457 std::vector<Real> coupled_values;
2458 for (const auto i : libMesh::make_range(source_params.numberDefaultCoupledValues(name)))
2459 coupled_values.push_back(source_params.defaultCoupledValue(name, i));
2460 addCoupledVar(p_name, coupled_values, description);
2461 }
2462 }
2463 else if (source_params.isRangeChecked(name))
2464 {
2465 if (source_params.hasDefault(name))
2466 addRangeCheckedParam<T>(p_name,
2467 source_params.get<T>(name),
2468 source_params.rangeCheckedFunction(name),
2469 description);
2470 else
2471 addRangeCheckedParam<T>(p_name, source_params.rangeCheckedFunction(name), description);
2472 }
2473 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2474 addParam<T>(p_name, source_params.get<T>(name), description);
2475 else
2476 {
2477 if (source_params.hasDefault(name))
2478 addParam<T>(p_name, source_params.get<T>(name), description);
2479 else
2480 addParam<T>(p_name, description);
2481 }
2482 }
2483
2484 // Copy other attributes
2485 if (source_params.isPrivate(name))
2486 _params[p_name]._is_private = true;
2487 if (source_params.isControllable(name))
2488 _params[p_name]._controllable = true;
2489}
2490
2491template <typename... Args>
2492[[noreturn]] void
2493InputParameters::mooseError(Args &&... args) const
2494{
2495 std::ostringstream oss;
2496 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2497 callMooseError(oss.str());
2498}
2499
2500template <typename... Args>
2501std::string
2502InputParameters::paramMessage(const std::string & param, Args... args) const
2503{
2504 std::ostringstream oss;
2505 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2506 return paramMessagePrefix(param) + oss.str();
2507}
2508
2509template <typename... Args>
2510[[noreturn]] void
2511InputParameters::paramError(const std::string & param, Args... args) const
2512{
2513 std::ostringstream oss;
2514 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2515 const auto [prefix, node] = paramMessageContext(param);
2516 callMooseError(prefix + oss.str(), false, node, /* show_trace = */ false);
2517}
2518
2519namespace Moose
2520{
2521namespace internal
2522{
2523template <typename T>
2524constexpr T *
2526{
2527 return nullptr;
2528}
2529
2530#ifdef MOOSE_MFEM_ENABLED
2531
2532template <typename T>
2533constexpr bool
2535{
2536 return std::is_same_v<T, MFEMScalarCoefficientName> ||
2537 std::is_same_v<T, MFEMVectorCoefficientName>;
2538}
2539
2540template <typename T, typename A>
2541constexpr bool
2543{
2544 return isMFEMFunctorNameTypeHelper(getNullptrExample<T>());
2545}
2546
2547#endif
2548
2549template <typename T>
2550constexpr bool
2552{
2553 return std::is_same_v<T, MooseFunctorName>
2554#ifdef MOOSE_MFEM_ENABLED
2555 || std::is_same_v<T, MFEMScalarCoefficientName>
2556#endif
2557 ;
2558}
2559
2560template <typename T, typename A>
2561constexpr bool
2563{
2564 return isScalarFunctorNameTypeHelper(getNullptrExample<T>());
2565}
2566
2567template <typename T>
2568constexpr bool
2570{
2571#ifdef MOOSE_MFEM_ENABLED
2572 return std::is_same_v<T, MFEMVectorCoefficientName>;
2573#else
2574 return false;
2575#endif
2576}
2577
2578template <typename T, typename A>
2579constexpr bool
2581{
2582 return isVectorFunctorNameTypeHelper(getNullptrExample<T>());
2583}
2584
2585template <typename T>
2586constexpr bool
2591}
2592}
2593
2594template <typename T>
2595constexpr bool
2597{
2598 return Moose::internal::isFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>());
2599}
2600
2601template <typename T>
2602std::string
2603InputParameters::appendFunctorDescription(const std::string & doc_string) const
2604{
2605 auto numeric_value_type = []()
2606 {
2608 Moose::internal::getNullptrExample<T>()))
2609 return "number";
2611 Moose::internal::getNullptrExample<T>()))
2612 return "numeric vector value (enclosed in curly braces)";
2613 else
2614 {
2615 mooseAssert(false, "We control instantiations of this method");
2616 return "";
2617 }
2618 };
2619
2620 return MooseUtils::trim(doc_string, ". ") + ". A functor is any of the following: a variable, " +
2621 (
2622#ifdef MOOSE_MFEM_ENABLED
2623 Moose::internal::isMFEMFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>())
2624 ? "an MFEM"
2625 :
2626#endif
2627 "a functor") +
2628 " material property, a function, a postprocessor or a " + numeric_value_type() + ".";
2629}
InputParameters emptyInputParameters()
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition MooseError.h:345
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition MooseError.h:363
std::array< Real, 2 > values
Definition MortarUtils.C:52
char ** vars
Specialized factory for generic Action System objects.
Storage for action instances.
Base class for actions.
Definition Action.h:38
This class wraps provides and tracks access to command line parameters.
Definition CommandLine.h:30
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Generic factory class for build all sorts of objects.
Definition Factory.h:29
Storage container for all InputParamter objects.
Class that is used as a parameter to commandLineParamSet() that allows only the CommandLine to set th...
CommandLineParamSetKey(const CommandLineParamSetKey &)
FRIEND_TEST(InputParametersTest, commandLineParamSetNotCLParam)
Class that is used as a parameter to setHitNode() that allows only relevant classes to set the hit no...
FRIEND_TEST(InputParametersTest, fileNames)
SetHitNodeKey(const SetHitNodeKey &)
Class that is used as a parameter to setHitNode(param) that allows only relevant classes to set the h...
FRIEND_TEST(InputParametersTest, fileNames)
SetParamHitNodeKey(const SetParamHitNodeKey &)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void setHelper(const std::string &name)
This functions is called in set as a 'callback' to avoid code duplication.
void mooseError(Args &&... args) const
Emits an error prefixed with the object information, if available.
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn't required or valid in the derived class...
std::string getMooseType(const std::string &name) const
Utility functions for retrieving one of the MooseTypes variables into the common "string" base class.
bool collapseSyntaxNesting() const
virtual void clear() override
std::vector< std::string > getVecMooseType(const std::string &name) const
std::vector< std::string > _buildable_types
The parameter is used to restrict types that can be built.
std::set< std::string > getGroupParameters(const std::string &group) const
Return names of parameters within a group.
bool _finalized
Whether or not we've called finalize() on these parameters yet.
bool isKokkosObject() const
Returns whether this InputParameters belongs to a Kokkos object Checks whether MooseBase::kokkos_obje...
bool isParamDefined(const std::string &name) const
Method returns true if the parameter is defined for any type.
const std::vector< std::tuple< std::string, Moose::RelationshipManagerType, Moose::RelationshipManagerInputParameterCallback > > & getBuildableRelationshipManagerTypes() const
Returns the list of buildable (or required) RelationshipManager object types for this object.
Metadata & at(const std::string &param_name)
void applySpecificParameters(const InputParameters &common, const std::vector< std::string > &include, bool allow_private=false)
Method for applying common parameters.
std::filesystem::path getFileBase(const std::optional< std::string > &param_name=std::optional< std::string >()) const
bool _show_deprecated_message
Flag for disabling deprecated parameters message, this is used by applyParameters to avoid dumping me...
bool mooseObjectSyntaxVisibility() const
const hit::Node * getHitNode() const
void addCustomTypeParam(const std::string &name, const T &value, const std::string &custom_type, const std::string &doc_string)
unsigned int numberDefaultCoupledValues(const std::string &coupling_name) const
Get the number of defaulted coupled value entries.
void registerSystemAttributeName(const std::string &value)
This method is used to define the MOOSE system name that is used by the TheWarehouse object for stori...
bool paramSetByUser(const std::string &name) const
Deprecated method.
const std::set< std::string > & getCoupledVariableParamNames() const
Return the coupled variable parameter names.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Declare the given parameters as controllable.
std::optional< std::string > setupVariableNames(std::vector< VariableName > &names, const hit::Node &node, const Moose::PassKey< Moose::Builder >)
Entrypoint for the Builder to setup a std::vector<VariableName> parameter, which will setup the defau...
void setCoupledVar(const std::string &coupling_name, const std::string &value)
Set a coupled variable parameter to a single variable name.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...
bool hasCoupledVar(const std::string &coupling_name) const
Return whether or not the coupled variable exists.
std::optional< std::string > queryDeprecatedParamMessage(const std::string &name) const
bool isPrivate(const std::string &name) const
Returns a Boolean indicating whether the specified parameter is private or not.
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
These methods add an range checked parameters.
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was set by the user.
bool _collapse_nesting
This parameter collapses one level of nesting in the syntax blocks.
std::string varName(const std::string &var_param_name, const std::string &moose_object_with_var_param_name) const
Determine the actual variable name from the given variable \emph parameter name.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
bool isParamSetByAddParam(const std::string &name) const
Returns whether or not the parameter was set due to addParam.
void checkParamName(const std::string &name) const
Make sure the parameter name doesn't have any invalid characters.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void markControlled(const std::string &name)
Marker a parameter that has been changed by the Control system (this is for output purposes)
void renameParam(const std::string &old_name, const std::string &new_name, const std::string &new_docstring)
Rename a parameter and provide a new documentation string.
bool isMooseBaseObject() const
void commandLineParamSet(const std::string &name, const CommandLineParamSetKey)
Marks the command line parameter name as set by the CommandLine.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
std::optional< std::pair< bool, std::string > > parameterRangeCheck(const Parameters::Value &value, const std::string &long_name, const std::string &short_name, const bool include_param_path)
Performs a range check on the parameter (which must have a range check)
std::string blockFullpath() const
std::optional< InputParameters::CommandLineMetadata > queryCommandLineMetadata(const std::string &name) const
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
void setDocString(const std::string &name, const std::string &doc)
Set the doc string of a parameter.
void transferParam(const InputParameters &source_param, const std::string &name, const std::string &new_name="", const std::string &new_description="")
A routine to transfer a parameter from one class' validParams to another.
void addOptionalValuedCommandLineParam(const std::string &name, const std::string &syntax, const T &value, const std::string &doc_string)
Add a command line parameter with an optional value.
void deprecateCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
void addPrivateParam(const std::string &name, const T &value)
These method add a parameter to the InputParameters object which can be retrieved like any other para...
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
Enable support for initializer lists as default arguments for container type.
std::string appendFunctorDescription(const std::string &doc_string) const
Appends description of what a functor is to a doc string.
std::string rangeCheckedFunction(const std::string &name) const
Return the range check function for any parameter (empty string if it is not range checked)
void setHitNode(const std::string &param, const hit::Node &node, const SetParamHitNodeKey)
Sets the hit node associated with the parameter param to node.
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System.
std::string getDocString(const std::string &name) const
Returns the documentation string for the specified parameter name.
const std::string & getSystemAttributeName() const
Get the system attribute name if it was registered.
void allowCopy(bool status)
Toggle the availability of the copy constructor.
bool _moose_object_syntax_visibility
This parameter hides derived MOOSE object types from appearing in syntax dumps.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
std::vector< std::string > paramAliases(const std::string &param_name) const
Return all the aliased names associated with param_name.
void addRelationshipManager(const std::string &name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback input_parameter_callback=nullptr)
Tells MOOSE about a RelationshipManager that this object needs.
bool areAllRequiredParamsValid() const
This method returns true if all of the parameters in this object are valid (i.e.
void addCoupledVarWithAutoBuild(const std::string &name, const std::string &base_name, const std::string &num_name, const std::string &doc_string)
These methods add a coupled variable name pair.
void finalize(const std::string &parsing_syntax)
Finalizes the parameters, which must be done before constructing any objects with these parameters (t...
void addRequiredCustomTypeParam(const std::string &name, const std::string &custom_type, const std::string &doc_string)
These methods add an option parameter and with a customer type to the InputParameters object.
virtual void set_attributes(const std::string &name, bool inserted_only) override
Override from libMesh to set user-defined attributes on our parameter.
std::map< std::string, std::pair< std::string, std::string > > getAutoBuildVectors() const
Returns the auto build vectors for all parameters.
std::set< std::string >::const_iterator coupledVarsEnd() const
void renameCoupledVarInternal(const std::string &old_name, const std::string &new_name, const std::string &docstring, const std::string &removal_date)
void setReservedValues(const std::string &name, const std::set< std::string > &reserved)
Provide a set of reserved values for a parameter.
std::set< std::string > getControllableParameters() const
Return list of controllable parameters.
std::string type(const std::string &name) const
Prints the type of the requested parameter by name.
std::string paramMessage(const std::string &param, Args... args) const
void ignoreParameter(const std::string &name)
Informs this object that values for this parameter set from the input file or from the command line s...
std::multimap< std::string, std::string > _new_to_old_names
A map from derived-class/blessed parameter names to associated base-class/deprecated parameter names.
bool have_parameter(std::string_view name) const
A wrapper around the Parameters base class method.
std::optional< Moose::DataFileUtils::Path > queryDataFileNamePath(const std::string &name) const
static constexpr bool isFunctorNameType()
void renameParameterGroup(const std::string &old_name, const std::string &new_name)
This method renames a parameter group.
void setDocUnit(const std::string &name, const std::string &doc_unit)
Set the unit string of a parameter.
std::set< std::string >::const_iterator coupledVarsBegin() const
Methods returning iterators to the coupled variables names stored in this InputParameters object.
void renameParamInternal(const std::string &old_name, const std::string &new_name, const std::string &docstring, const std::string &removal_date)
std::string getDocUnit(const std::string &name) const
Returns the documentation unit string for the specified parameter name.
void renameCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &new_docstring)
Rename a coupled variable and provide a new documentation string.
bool isParamRequired(const std::string &name) const
Returns a boolean indicating whether the specified parameter is required or not.
void clearRelationshipManagers()
Clears all currently registered RelationshipManagers.
const std::string & getObjectType() const
bool isFinalized() const
void setParameters()
Method to terminate the recursive setParameters definition.
std::string _class_description
The class description for the owning object.
const std::string & getObjectName() const
void addCommandLineParam(const std::string &name, const std::string &syntax, const std::string &doc_string)
bool hasCoupledValue(const std::string &coupling_name) const
Return whether or not the coupled variable exists.
friend InputParameters emptyInputParameters()
void paramError(const std::string &param, Args... args) const
Emits a parameter error prefixed with the parameter location and object information if available.
InputParameters & operator=(const InputParameters &rhs)
std::optional< std::pair< bool, std::string > > rangeCheck(const std::string &full_name, const std::string &short_name, const InputParameters::Parameter< T > &param, const bool include_param_path=true)
Runs a range on the supplied parameter if it exists and throws an error if that check fails.
bool isCommandLineParameter(const std::string &name) const
const std::vector< std::string > & getBuildableTypes() const
Returns the list of buildable types as a std::vector<std::string>
const hit::Node * _hit_node
The hit node representing the syntax that created these parameters, if any.
const std::set< ExecFlagType > & getControllableExecuteOnTypes(const std::string &name) const
Return the allowed execute flags for a controllable parameter.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
bool shouldIgnore(const std::string &name)
Whether to ignore the value of an input parameter set in the input file or from the command line.
void setHitNode(const hit::Node &node, const SetHitNodeKey)
Sets the hit node that represents the syntax responsible for creating these parameters.
void addCommandLineParamHelper(const std::string &name, const std::string &syntax, const bool required, const bool value_required)
Helper for all of the addCommandLineParam() calls, which sets up _cl_data in the metadata.
bool hasDefault(const std::string &param_name) const
Return whether a parameter has a default.
std::string inputLocation(const std::string &param) const
void addDeprecatedCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &removal_date="")
This method adds a deprecated coupled variable name pair.
std::string rawParamVal(const std::string &param) const
void deprecateParam(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
void makeParamNotRequired(const std::string &name)
Changes the parameter to not be required.
std::string paramMessagePrefix(const std::string &param) const
Get a prefix for messages associated with a parameter.
void setDeprecatedVarDocString(const std::string &new_name, const std::string &doc_string)
Private method for setting deprecated coupled variable documentation strings.
std::string paramFullpath(const std::string &param) const
const std::vector< VariableName > & getCoupledVar(const std::string &coupling_name) const
Get a coupled variable parameter.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
std::set< std::string > getParametersList() const
std::string blockLocation() const
std::set< std::string > reservedValues(const std::string &name) const
Get a set of reserved parameter values.
void checkParams(const std::string &parsing_syntax)
This function checks parameters stored in the object to make sure they are in the correct state as th...
std::string paramLocationPrefix(const std::string &param) const
Returns a prefix containing the parameter name and location (if available)
void checkConsistentType(const std::string &name) const
This method checks to make sure that we aren't adding a parameter with the same name but a different ...
void addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void addCommandLineParam(const std::string &name, const std::string &syntax, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
virtual ~InputParameters()=default
std::pair< std::string, const hit::Node * > paramMessageContext(const std::string &param) const
Get the context associated with a parameter for a message.
std::vector< std::tuple< std::string, Moose::RelationshipManagerType, Moose::RelationshipManagerInputParameterCallback > > _buildable_rm_types
The RelationshipManagers that this object may either build or require.
bool hasDefaultCoupledValue(const std::string &coupling_name) const
Return whether or not the requested parameter has a default coupled value.
const std::string * queryObjectType() const
std::unordered_map< std::string, std::string > _new_to_deprecated_coupled_vars
A map from deprecated coupled variable names to the new blessed name.
std::string getGroupName(const std::string &param_name) const
This method retrieves the group name for the passed parameter name if one exists.
InputParameters & operator+=(const InputParameters &rhs)
std::map< std::string, Metadata > _params
The actual parameter data.
void applyParameter(const InputParameters &common, const std::string &common_name, bool allow_private=false)
Apply values from a single parameter in common, to a single parameter stored in this object.
void addRequiredCoupledVarWithAutoBuild(const std::string &name, const std::string &base_name, const std::string &num_name, const std::string &doc_string)
std::string getClassDescription() const
Returns the class description.
void registerBuildableTypes(const std::string &names)
This method is here to indicate which Moose types a particular Action may build.
void addRequiredCommandLineParam(const std::string &name, const std::string &syntax, const std::string &doc_string)
Add parameters for retrieval from the command line.
Real defaultCoupledValue(const std::string &coupling_name, unsigned int i=0) const
Get the default value for an optionally coupled variable.
const std::unordered_map< std::string, std::string > & getNewToDeprecatedVarMap() const
Return the new to deprecated variable name map.
void applyCoupledVar(const InputParameters &common, const std::string &var_name)
Apply properties of a single coupled variable in common, to a single coupled variable stored in this ...
bool isParamDeprecated(const std::string &name) const
Returns True if the parameters is deprecated.
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
bool isControllable(const std::string &name) const
Returns a Boolean indicating whether the specified parameter is controllable.
void setGlobalCommandLineParam(const std::string &name)
Sets the command line parameter with name as global.
const std::string & getBase() const
static const T & getParamHelper(const std::string &name, const InputParameters &pars)
void makeParamRequired(const std::string &name)
Changes the parameter to be required.
bool hasBase() const
std::set< std::string > _coupled_vars
The coupled variables set.
std::map< std::string, std::pair< std::string, std::string > > _old_to_new_name_and_dep
A map from base-class/deprecated parameter names to derived-class/blessed parameter names and the dep...
bool isType(const std::string &name) const
bool isRangeChecked(const std::string &param_name) const
Return whether a parameter has a range check.
void addDeprecatedCustomTypeParam(const std::string &name, const std::string &custom_type, const std::string &doc_string, const std::string &deprecation_msg)
bool _allow_copy
A flag for toggling the error message in the copy constructor.
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller.
const Metadata & at(const std::string &param_name) const
void setParamHelper(const std::string &name, T &l_value, const S &r_value)
This method is called when adding a Parameter with a default value, can be specialized for non-matchi...
const InputParameters::CommandLineMetadata & getCommandLineMetadata(const std::string &name) const
const std::string & checkForRename(const std::string &name) const
Checks whether the provided name is a renamed parameter name.
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another,...
const T * queryParam(const std::string &name) const
Query a parameter.
const std::string & getDescription(const std::string &name) const
Get the documentation string for a parameter.
void applyCommonUserSetParameters(const InputParameters &common, const std::vector< std::string > &exclude={}, const bool allow_private=false)
Variant of applyParameters that only applies parameters explicitly set by the user in common (i....
void applyParameters(const InputParameters &common, const std::vector< std::string > &exclude={}, const bool allow_private=false)
Method for applying common parameters.
void callMooseError(std::string msg, const bool with_prefix=true, const hit::Node *node=nullptr, const bool show_trace=true) const
Internal helper for calling back to mooseError(), ideally from the underlying MooseBase object if it ...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
Parses MOOSE input using HIT/WASP.
Definition Builder.h:57
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
Class for parsing input files.
Definition Parser.h:102
Class that hold the whole problem being solved.
Definition Problem.h:20
map_type::const_iterator const_iterator
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
std::string trim(const std::string &str, const std::string &white_space=" \t\n\v\f\r")
Standard scripting language trim function.
std::string stringJoin(const std::vector< std::string > &values, const std::string &separator=" ")
Concatenates value into a single string separated by separator.
constexpr bool isVectorFunctorNameTypeHelper(T *)
constexpr bool isMFEMFunctorNameTypeHelper(T *)
constexpr bool isScalarFunctorNameTypeHelper(T *)
constexpr bool isFunctorNameTypeHelper(T *ex)
constexpr T * getNullptrExample()
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
std::function< void(const InputParameters &, InputParameters &)> RelationshipManagerInputParameterCallback
The type for the callback to set RelationshipManager parameters.
RelationshipManagerType
Main types of Relationship Managers.
Definition Moose.h:48
std::string demangle(const char *name)
void add_command_line_name(const std::string &name)
IntRange< T > make_range(T beg, T end)
void mooseStreamAll(std::ostringstream &ss)
All of the following are not meant to be called directly - they are called by the normal macros (moos...
Definition MooseError.C:137
Structure for storing information about a command line parameter.
bool global
Whether or not the parameter is global (passed to MultiApps)
std::vector< std::string > switches
The switches for the parameter (i.e., [-t, –timing])
bool required
Whether or not the argument is required.
ArgumentType argument_type
The type of argument.
std::string syntax
The syntax for the parameter.
bool set_by_command_line
Whether or not the parameter was set by the CommandLine.
bool _is_private
The set of parameters that will NOT appear in the the dump of the parser tree.
bool _valid
Whether the parameter is either explicitly set or provided a default value when added Note: We do not...
std::optional< CommandLineMetadata > _cl_data
The data pertaining to a command line parameter (empty if not a command line param)
std::set< std::string > _reserved_values
The reserved option names for a parameter.
bool _controllable
True if the parameters is controllable.
std::string _doc_unit
The developer-designated unit of the parameter for use in documentation.
std::string _deprecation_message
If non-empty, this parameter is deprecated.
std::vector< Real > _coupled_default
The default value for optionally coupled variables.
bool _ignore
whether user setting of this parameter should be ignored
std::pair< std::string, std::string > _autobuild_vecs
directions for auto build vectors (base_, 5) -> "base_0 base_1 base_2 base_3 base_4")
std::set< ExecFlagType > _controllable_flags
Controllable execute flag restriction.
std::optional< Moose::DataFileUtils::Path > _data_file_name_path
The searched path information pertaining to a DataFileName parameter.
const hit::Node * _hit_node
Original location of parameter node; used for error messages.
bool _required
True for parameters that are required (i.e. will cause an abort if not supplied)
std::string _custom_type
The custom type that will be printed in the YAML dump for a parameter if supplied.
bool _set_by_add_param
True if a parameters value was set by addParam, and not set again.
std::string _range_function
The map of functions used for range checked parameters.
std::string _group
The names of the parameters organized into groups.
Determines whether or not the given type is a type that is supported for a command line parameter.