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
476 void moveParamToGroup(const std::string & name, const std::string & group_name);
477
483 void renameParameterGroup(const std::string & old_name, const std::string & new_name);
484
489 std::string getGroupName(const std::string & param_name) const;
490
497 template <typename T>
498 void suppressParameter(const std::string & name);
499
504 template <typename T>
505 void makeParamRequired(const std::string & name);
506
511 template <typename T>
512 void makeParamNotRequired(const std::string & name);
513
519 void addCoupledVar(const std::string & name, const std::string & doc_string);
520
528 void addDeprecatedCoupledVar(const std::string & old_name,
529 const std::string & new_name,
530 const std::string & removal_date = "");
531
540 void addCoupledVar(const std::string & name, const Real value, const std::string & doc_string);
541
550 void addCoupledVar(const std::string & name,
551 const std::vector<Real> & value,
552 const std::string & doc_string);
553
555
572 void addCoupledVarWithAutoBuild(const std::string & name,
573 const std::string & base_name,
574 const std::string & num_name,
575 const std::string & doc_string);
576 void addRequiredCoupledVarWithAutoBuild(const std::string & name,
577 const std::string & base_name,
578 const std::string & num_name,
579 const std::string & doc_string);
581
587 std::string getMooseType(const std::string & name) const;
588 std::vector<std::string> getVecMooseType(const std::string & name) const;
589
597 bool isMooseBaseObject() const;
598
602 const std::string * queryObjectType() const;
603
609 const std::string & getObjectType() const;
613 const std::string & getObjectName() const;
614
624 void addRequiredCoupledVar(const std::string & name, const std::string & doc_string);
625
629 std::string getDocString(const std::string & name) const;
630
638 void setDocString(const std::string & name, const std::string & doc);
639
643 std::string getDocUnit(const std::string & name) const;
644
651 void setDocUnit(const std::string & name, const std::string & doc_unit);
652
656 bool isParamRequired(const std::string & name) const;
657
661 void makeParamNotRequired(const std::string & name);
662
668 bool isParamValid(const std::string & name) const;
669
675 bool isParamSetByAddParam(const std::string & name) const;
676
680 bool isParamDeprecated(const std::string & name) const;
681
682#ifdef MOOSE_KOKKOS_ENABLED
687 bool isKokkosObject() const;
688#endif
689
694 bool areAllRequiredParamsValid() const;
695
699 std::string type(const std::string & name) const;
700
704 bool isPrivate(const std::string & name) const;
705
709 void declareControllable(const std::string & name, std::set<ExecFlagType> execute_flags = {});
710
714 void markControlled(const std::string & name);
715
719 bool isControllable(const std::string & name) const;
720
724 const std::set<ExecFlagType> & getControllableExecuteOnTypes(const std::string & name) const;
725
731 void registerBase(const std::string & value);
732
738 bool hasBase() const;
739
745 const std::string & getBase() const;
746
758 void registerSystemAttributeName(const std::string & value);
759
764 const std::string & getSystemAttributeName() const;
765
773 void registerBuildableTypes(const std::string & names);
774
790 const std::string & name,
792 Moose::RelationshipManagerInputParameterCallback input_parameter_callback = nullptr);
793
798
802 const std::vector<std::string> & getBuildableTypes() const;
803
807 const std::vector<std::tuple<std::string,
811
813
817 void collapseSyntaxNesting(bool collapse);
818 bool collapseSyntaxNesting() const;
820
822
826 void mooseObjectSyntaxVisibility(bool visibility);
827 bool mooseObjectSyntaxVisibility() const;
829
831
834 using Parameters::operator=;
835 using Parameters::operator+=;
839
846 void checkParams(const std::string & parsing_syntax);
847
855 std::vector<std::string>
856 missingRequiredParamErrors(const std::string & parsing_syntax,
857 const std::set<std::string> & skip_required_params = {},
858 bool skip_private = false) const;
859
869 std::optional<std::pair<bool, std::string>> parameterRangeCheck(const Parameters::Value & value,
870 const std::string & long_name,
871 const std::string & short_name,
872 const bool include_param_path);
873
881 void finalize(const std::string & parsing_syntax);
882
896 std::filesystem::path
897 getFileBase(const std::optional<std::string> & param_name = std::optional<std::string>()) const;
898
903 inline std::set<std::string>::const_iterator coupledVarsBegin() const
904 {
905 return _coupled_vars.begin();
906 }
907 inline std::set<std::string>::const_iterator coupledVarsEnd() const
908 {
909 return _coupled_vars.end();
910 }
911
915 const std::set<std::string> & getCoupledVariableParamNames() const { return _coupled_vars; }
916
920 const std::unordered_map<std::string, std::string> & getNewToDeprecatedVarMap() const
921 {
923 }
924
926 bool isRangeChecked(const std::string & param_name) const;
927
929 std::string rangeCheckedFunction(const std::string & name) const;
930
932 bool hasDefault(const std::string & param_name) const;
933
939 bool hasCoupledVar(const std::string & coupling_name) const;
940
946 bool hasCoupledValue(const std::string & coupling_name) const
947 {
948 mooseDeprecated("InputParameters::hasCoupledValue() is deprecated. Use "
949 "InputParameters::hasCoupledVar() instead.");
950 return hasCoupledVar(coupling_name);
951 }
952
959 void setCoupledVar(const std::string & coupling_name, const std::string & value);
960
967 void setCoupledVar(const std::string & coupling_name, const std::vector<VariableName> & values);
968
974 const std::vector<VariableName> & getCoupledVar(const std::string & coupling_name) const;
975
981 bool hasDefaultCoupledValue(const std::string & coupling_name) const;
982
989 Real defaultCoupledValue(const std::string & coupling_name, unsigned int i = 0) const;
990
996 unsigned int numberDefaultCoupledValues(const std::string & coupling_name) const;
997
1005 void defaultCoupledValue(const std::string & coupling_name, Real value, unsigned int i = 0);
1006
1010 std::map<std::string, std::pair<std::string, std::string>> getAutoBuildVectors() const;
1011
1012 // BEGIN APPLY PARAMETER METHODS
1030 void applyParameters(const InputParameters & common,
1031 const std::vector<std::string> & exclude = {},
1032 const bool allow_private = false);
1033
1040 const std::vector<std::string> & exclude = {},
1041 const bool allow_private = false);
1042
1060 void applySpecificParameters(const InputParameters & common,
1061 const std::vector<std::string> & include,
1062 bool allow_private = false);
1063
1075 void applyParameter(const InputParameters & common,
1076 const std::string & common_name,
1077 bool allow_private = false);
1078 // END APPLY PARAMETER METHODS
1079
1090 void applyCoupledVar(const InputParameters & common, const std::string & var_name);
1091
1095 bool paramSetByUser(const std::string & name) const;
1096
1101 bool isParamSetByUser(const std::string & name) const;
1102
1108 bool isParamDefined(const std::string & name) const;
1109
1119 template <typename T>
1120 const T * queryParam(const std::string & name) const;
1121
1123 /*
1124 * These methods are here to retrieve parameters for scalar and vector types respectively. We will
1125 * throw errors
1126 * when returning most scalar and vector types.
1127 */
1128 template <typename T>
1129 static const T & getParamHelper(const std::string & name, const InputParameters & pars);
1131
1132 using Parameters::get;
1133
1135 template <typename R1,
1136 typename R2,
1137 typename V1 = typename std::conditional<std::is_same<R1, MooseEnumItem>::value,
1139 std::vector<R1>>::type,
1140 typename V2 = typename std::conditional<std::is_same<R2, MooseEnumItem>::value,
1142 std::vector<R2>>::type>
1143 std::vector<std::pair<R1, R2>> get(const std::string & param1, const std::string & param2) const;
1144
1148 std::set<std::string> getParametersList() const;
1149
1153 std::set<std::string> getControllableParameters() const;
1154
1158 std::set<std::string> getGroupParameters(const std::string & group) const;
1159
1164 void setReservedValues(const std::string & name, const std::set<std::string> & reserved);
1165
1170 std::set<std::string> reservedValues(const std::string & name) const;
1171
1176 std::string blockLocation() const;
1177
1182 std::string blockFullpath() const;
1183
1187 const hit::Node * getHitNode(const std::string & param) const;
1193 void setHitNode(const std::string & param, const hit::Node & node, const SetParamHitNodeKey);
1194
1199 std::string inputLocation(const std::string & param) const;
1200
1205 std::string paramFullpath(const std::string & param) const;
1206
1210 std::string paramLocationPrefix(const std::string & param) const;
1211
1219 template <typename... Args>
1220 std::string paramMessage(const std::string & param, Args... args) const;
1221
1225 template <typename... Args>
1226 [[noreturn]] void mooseError(Args &&... args) const;
1227
1232 template <typename... Args>
1233 [[noreturn]] void paramError(const std::string & param, Args... args) const;
1234
1239 std::string rawParamVal(const std::string & param) const;
1240
1245 template <typename T>
1246 void ignoreParameter(const std::string & name);
1247
1252 bool shouldIgnore(const std::string & name);
1253
1257 template <typename T>
1258 bool isType(const std::string & name) const;
1259
1266 std::string varName(const std::string & var_param_name,
1267 const std::string & moose_object_with_var_param_name) const;
1268
1276 void renameParam(const std::string & old_name,
1277 const std::string & new_name,
1278 const std::string & new_docstring);
1279
1286 void renameCoupledVar(const std::string & old_name,
1287 const std::string & new_name,
1288 const std::string & new_docstring);
1289
1290 void deprecateParam(const std::string & old_name,
1291 const std::string & new_name,
1292 const std::string & removal_date);
1293
1294 void deprecateCoupledVar(const std::string & old_name,
1295 const std::string & new_name,
1296 const std::string & removal_date);
1297
1304 const std::string & checkForRename(const std::string & name) const;
1305
1312 template <typename T>
1313 const T & get(std::string_view name) const;
1314
1323 template <typename T>
1324 bool have_parameter(std::string_view name) const;
1325
1333 template <typename T>
1334 void transferParam(const InputParameters & source_param,
1335 const std::string & name,
1336 const std::string & new_name = "",
1337 const std::string & new_description = "");
1338
1351 std::vector<std::string> paramAliases(const std::string & param_name) const;
1352
1357 const hit::Node * getHitNode() const { return _hit_node; }
1365 void setHitNode(const hit::Node & node, const SetHitNodeKey) { _hit_node = &node; }
1366
1370 bool isFinalized() const { return _finalized; }
1371
1375 std::optional<Moose::DataFileUtils::Path> queryDataFileNamePath(const std::string & name) const;
1376
1385 std::optional<std::string> setupVariableNames(std::vector<VariableName> & names,
1386 const hit::Node & node,
1388
1389private:
1390 // Private constructor so that InputParameters can only be created in certain places.
1392
1397
1398 template <typename T>
1399 static constexpr bool isFunctorNameType();
1400
1404 template <typename T>
1405 std::string appendFunctorDescription(const std::string & doc_string) const;
1406
1410 void setDeprecatedVarDocString(const std::string & new_name, const std::string & doc_string);
1411
1412 void renameParamInternal(const std::string & old_name,
1413 const std::string & new_name,
1414 const std::string & docstring,
1415 const std::string & removal_date);
1416
1417 void renameCoupledVarInternal(const std::string & old_name,
1418 const std::string & new_name,
1419 const std::string & docstring,
1420 const std::string & removal_date);
1421
1428 std::pair<std::string, const hit::Node *> paramMessageContext(const std::string & param) const;
1434 std::string paramMessagePrefix(const std::string & param) const;
1435
1437 {
1438 std::string _doc_string;
1440 std::string _doc_unit;
1442 std::string _custom_type;
1444 std::optional<CommandLineMetadata> _cl_data;
1446 std::optional<Moose::DataFileUtils::Path> _data_file_name_path;
1448 std::string _group;
1450 std::string _range_function;
1452 std::pair<std::string, std::string> _autobuild_vecs;
1454 bool _required = false;
1460 bool _valid = false;
1462 bool _is_private = false;
1465 std::vector<Real> _coupled_default = {0};
1467 bool _set_by_add_param = false;
1469 std::set<std::string> _reserved_values;
1473 const hit::Node * _hit_node;
1475 bool _controllable = false;
1477 std::set<ExecFlagType> _controllable_flags;
1479 bool _ignore = false;
1480 };
1481
1482 Metadata & at(const std::string & param_name)
1483 {
1484 const auto & param = checkForRename(param_name);
1485 if (_params.count(param) == 0)
1486 mooseError("param '", param, "' not present in InputParams");
1487 return _params[param];
1488 }
1489 const Metadata & at(const std::string & param_name) const
1490 {
1491 const auto & param = checkForRename(param_name);
1492 if (_params.count(param) == 0)
1493 mooseError("param '", param, "' not present in InputParams");
1494 return _params.at(param);
1495 }
1496
1506 void allowCopy(bool status) { _allow_copy = status; }
1507
1511 void checkParamName(const std::string & name) const;
1512
1517 template <typename T, typename S>
1518 void setParamHelper(const std::string & name, T & l_value, const S & r_value);
1519
1528 template <typename T>
1529 void addCommandLineParamHelper(const std::string & name,
1530 const std::string & syntax,
1531 const bool required,
1532 const bool value_required);
1533
1538 [[noreturn]] void callMooseError(std::string msg,
1539 const bool with_prefix = true,
1540 const hit::Node * node = nullptr,
1541 const bool show_trace = true) const;
1542
1545 std::map<std::string, Metadata> _params;
1546
1548 std::set<std::string> _coupled_vars;
1549
1553
1556 std::vector<std::string> _buildable_types;
1557
1562 std::vector<std::tuple<std::string,
1566
1570
1573
1577
1580
1582 std::unordered_map<std::string, std::string> _new_to_deprecated_coupled_vars;
1583
1588 std::map<std::string, std::pair<std::string, std::string>> _old_to_new_name_and_dep;
1589
1592 std::multimap<std::string, std::string> _new_to_old_names;
1593
1595 const hit::Node * _hit_node;
1596
1599
1600 // These are the only objects allowed to _create_ InputParameters
1603 friend class Parser;
1604 // for the printInputFile function in the action warehouse
1605 friend class ActionWarehouse;
1606};
1607
1608template <typename T>
1609void
1610InputParameters::setHelper(const std::string & /*name*/)
1611{
1612}
1613
1614// Template and inline function implementations
1615template <typename T>
1616T &
1617InputParameters::set(const std::string & name_in, bool quiet_mode)
1618{
1619 const auto & name = checkForRename(name_in);
1620
1621 checkParamName(name);
1622 checkConsistentType<T>(name);
1623
1624 T & result = this->Parameters::set<T>(name);
1625
1626 if (quiet_mode)
1627 _params[name]._set_by_add_param = true;
1628
1629 setHelper<T>(name);
1630
1631 return result;
1632}
1633
1634template <typename T, typename... Ts>
1635void
1636InputParameters::setParameters(const std::string & name,
1637 const T & value,
1638 Ts... extra_input_parameters)
1639{
1640 this->set<T>(name) = value;
1641 this->setParameters(extra_input_parameters...);
1642}
1643
1644template <typename T, typename UP_T>
1645std::optional<std::pair<bool, std::string>>
1646InputParameters::rangeCheck(const std::string & full_name,
1647 const std::string & short_name,
1648 const InputParameters::Parameter<std::vector<T>> & param,
1649 const bool include_param_path)
1650{
1651 if (!isParamValid(short_name))
1652 return {};
1653
1654 const auto & range_function = _params[short_name]._range_function;
1655 if (range_function.empty())
1656 return {};
1657
1670 std::vector<std::string> vars;
1671 if (fp.ParseAndDeduceVariables(range_function, vars) != -1) // -1 for success
1672 return {{false,
1673 "Error parsing expression '" + range_function + "' for parameter " + short_name + ""}};
1674
1675 // Fparser parameter buffer
1676 std::vector<UP_T> parbuf(vars.size());
1677
1678 // parameter vector
1679 const std::vector<T> & value = param.get();
1680
1681 // iterate over all vector values (maybe ;)
1682 bool need_to_iterate = false;
1683 unsigned int i = 0;
1684 do
1685 {
1686 // set parameters
1687 for (unsigned int j = 0; j < vars.size(); j++)
1688 {
1689 if (vars[j] == short_name)
1690 {
1691 if (value.size() == 0)
1692 {
1693 std::ostringstream oss;
1694 oss << "Range checking empty vector";
1695 if (include_param_path)
1696 oss << " parameter " << full_name;
1697 oss << "; expression = '" << range_function << "'";
1698 return {{true, oss.str()}};
1699 }
1700
1701 parbuf[j] = value[i];
1702 need_to_iterate = true;
1703 }
1704 else if (vars[j] == short_name + "_size")
1705 parbuf[j] = value.size();
1706 else
1707 {
1708 if (vars[j].substr(0, short_name.size() + 1) != short_name + "_")
1709 return {{false, "Error parsing expression '" + range_function + "'"}};
1710 std::istringstream iss(vars[j]);
1711 iss.seekg(short_name.size() + 1);
1712
1713 size_t index;
1714 if (iss >> index && iss.eof())
1715 {
1716 if (index >= value.size())
1717 {
1718 std::ostringstream oss;
1719 oss << "Error parsing expression '" + range_function + "'";
1720 if (include_param_path)
1721 oss << " for parameter " << full_name;
1722 oss << "; out of range variable '" + vars[j] << "'";
1723 return {{true, oss.str()}};
1724 }
1725 parbuf[j] = value[index];
1726 }
1727 else
1728 return {{false,
1729 "Error parsing expression '" + range_function + "'; invalid variable '" +
1730 vars[j] + "'"}};
1731 }
1732 }
1733
1734 // ensure range-checked input file parameter comparison functions
1735 // do absolute floating point comparisons instead of using a default epsilon.
1736 auto tmp_eps = fp.epsilon();
1737 fp.setEpsilon(0);
1738 UP_T result = fp.Eval(&parbuf[0]);
1739 fp.setEpsilon(tmp_eps);
1740
1741 // test function using the parameters determined above
1742 if (fp.EvalError())
1743 return {{false, "Error evaluating expression '" + range_function + "'"}};
1744
1745 if (!result)
1746 {
1747 std::ostringstream oss;
1748 oss << "Range check failed";
1749 if (include_param_path)
1750 oss << " for parameter " << full_name;
1751 oss << "; expression = '" << range_function << "'";
1752 if (need_to_iterate)
1753 oss << ", component " << i;
1754 return {{true, oss.str()}};
1755 }
1756
1757 } while (need_to_iterate && ++i < value.size());
1758
1759 return {};
1760}
1761
1762template <typename T, typename UP_T>
1763std::optional<std::pair<bool, std::string>>
1764InputParameters::rangeCheck(const std::string & full_name,
1765 const std::string & short_name,
1766 const InputParameters::Parameter<T> & param,
1767 const bool include_param_path)
1768{
1769 if (!isParamValid(short_name))
1770 return {};
1771
1772 const auto & range_function = _params[short_name]._range_function;
1773 if (range_function.empty())
1774 return {};
1775
1776 // Parse the expression
1778 if (fp.Parse(range_function, short_name) != -1) // -1 for success
1779 return {{false,
1780 "Error parsing expression '" + range_function + "'" + " for parameter " + short_name}};
1781
1782 // ensure range-checked input file parameter comparison functions
1783 // do absolute floating point comparisons instead of using a default epsilon.
1784 auto tmp_eps = fp.epsilon();
1785 fp.setEpsilon(0);
1786 // We require a non-const value for the implicit upscaling of the parameter type
1787 std::vector<UP_T> value(1, param.get());
1788 UP_T result = fp.Eval(&value[0]);
1789 fp.setEpsilon(tmp_eps);
1790
1791 if (fp.EvalError())
1792 return {{true,
1793 "Error evaluating expression '" + range_function + "' for parameter " + short_name +
1794 "; perhaps you used the wrong variable name?"}};
1795
1796 if (!result)
1797 {
1798 std::ostringstream oss;
1799 oss << "Range check failed";
1800 if (include_param_path)
1801 oss << " for parameter " << full_name;
1802 oss << "; expression = '" << range_function << "', value = " << value[0];
1803 return {{true, oss.str()}};
1804 }
1805
1806 return {};
1807}
1808
1809template <typename T>
1810T
1812 const std::string & error_string) const
1813{
1814 const auto & name = checkForRename(name_in);
1815
1816 T param = this->get<T>(name);
1817
1818 // Note: You will receive a compile error on this line if you attempt to pass a non-pointer
1819 // template type to this method
1820 if (!param)
1821 mooseError("Parameter ", name, " is NULL.\n", error_string);
1822 return param;
1823}
1824
1825template <typename T>
1826void
1827InputParameters::addRequiredParam(const std::string & name, const std::string & doc_string)
1828{
1829 checkParamName(name);
1830 checkConsistentType<T>(name);
1831
1832 InputParameters::insert<T>(name);
1833 auto & metadata = _params[name];
1834 metadata._required = true;
1835 if constexpr (isFunctorNameType<T>())
1836 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1837 else
1838 metadata._doc_string = doc_string;
1839}
1840
1841template <typename T>
1842void
1843InputParameters::addRequiredParam(const std::string & /*name*/,
1844 const T & /*value*/,
1845 const std::string & /*doc_string*/)
1846{
1847 mooseError("You cannot call addRequiredParam and supply a default value for this type, please "
1848 "use addParam instead");
1849}
1850
1851template <typename T, typename S>
1852void
1853InputParameters::addParam(const std::string & name, const S & value, const std::string & doc_string)
1854{
1855 checkParamName(name);
1856 checkConsistentType<T>(name);
1857
1858 T & l_value = InputParameters::set<T>(name);
1859 auto & metadata = _params[name];
1860 if constexpr (isFunctorNameType<T>())
1861 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1862 else
1863 metadata._doc_string = doc_string;
1864
1865 // Set the parameter now
1866 setParamHelper(name, l_value, value);
1867
1868 /* Indicate the default value, as set via addParam, is being used. The parameter is removed from
1869 the list whenever
1870 it changes, see set_attributes */
1871 metadata._set_by_add_param = true;
1872}
1873
1874template <typename T>
1875void
1876InputParameters::addParam(const std::string & name, const std::string & doc_string)
1877{
1878 checkParamName(name);
1879 checkConsistentType<T>(name);
1880
1881 InputParameters::insert<T>(name);
1882 if constexpr (isFunctorNameType<T>())
1883 _params[name]._doc_string = appendFunctorDescription<T>(doc_string);
1884 else
1885 _params[name]._doc_string = doc_string;
1886}
1887
1888template <typename T, typename S>
1889void
1890InputParameters::setParamHelper(const std::string & /*name*/, T & l_value, const S & r_value)
1891{
1892 l_value = r_value;
1893}
1894
1895template <typename T>
1896void
1898 const std::string & syntax,
1899 const bool required,
1900 const bool value_required)
1901{
1903 "This type is not a supported command line parameter type. See "
1904 "CommandLine::populateCommandLineParams to add it as a supported type.");
1905
1906 auto & cl_data = at(name)._cl_data;
1907 cl_data = CommandLineMetadata();
1908
1909 // Split up the syntax by whitespace
1910 std::vector<std::string> syntax_split;
1911 MooseUtils::tokenize(syntax, syntax_split, 1, " \t\n\v\f\r");
1912
1913 // Set the single syntax string as the combined syntax with removed whitespace
1914 cl_data->syntax = MooseUtils::stringJoin(syntax_split);
1915 mooseAssert(cl_data->syntax.size(), "Empty token");
1916
1917 // Set the switches; only parse those that begin with "-" as we also
1918 // provide examples within the syntax
1919 for (const auto & val : syntax_split)
1920 if (val.rfind("-", 0) == 0)
1921 {
1922 if (!std::regex_search(val, std::regex("^\\-+[a-zA-Z]")))
1923 mooseError("The switch '",
1924 val,
1925 "' for the command line parameter '",
1926 name,
1927 "' is invalid. It must begin with an alphabetical character.");
1928
1929 cl_data->switches.push_back(val);
1931 }
1932
1933 cl_data->required = required;
1934 cl_data->global = false;
1935
1936 // No arguments needed for a boolean parameter
1937 if constexpr (std::is_same_v<T, bool>)
1938 {
1939 (void)value_required; // purposely unused; doesn't take a value
1940 cl_data->argument_type = CommandLineMetadata::ArgumentType::NONE;
1941 }
1942 // MooseEnums require a value
1943 else if constexpr (std::is_same_v<T, MooseEnum>)
1944 {
1945 (void)value_required; // purposely unused; always required
1946 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1947 }
1948 // The user didn't specify a default, so a value is required
1949 else if (value_required)
1950 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1951 // Otherwise, it's optional (user specified a default)
1952 else
1953 cl_data->argument_type = CommandLineMetadata::ArgumentType::OPTIONAL;
1954}
1955
1956template <typename T>
1957void
1959 const std::string & parsed_function,
1960 const std::string & doc_string)
1961{
1962 addRequiredParam<T>(name, doc_string);
1963 _params[name]._range_function = parsed_function;
1964}
1965
1966template <typename T>
1967void
1969 const T & value,
1970 const std::string & parsed_function,
1971 const std::string & doc_string)
1972{
1973 addParam<T>(name, value, doc_string);
1974 _params[name]._range_function = parsed_function;
1975}
1976
1977template <typename T>
1978void
1980 const std::string & parsed_function,
1981 const std::string & doc_string)
1982{
1983 addParam<T>(name, doc_string);
1984 _params[name]._range_function = parsed_function;
1985}
1986
1987template <typename T>
1988void
1990 const std::string & custom_type,
1991 const std::string & doc_string)
1992{
1993 addRequiredParam<T>(name, doc_string);
1994 _params[name]._custom_type = custom_type;
1995}
1996
1997template <typename T>
1998void
2000 const T & value,
2001 const std::string & custom_type,
2002 const std::string & doc_string)
2003{
2004 addParam<T>(name, value, doc_string);
2005 _params[name]._custom_type = custom_type;
2006}
2007
2008template <typename T>
2009void
2011 const std::string & custom_type,
2012 const std::string & doc_string)
2013{
2014 addParam<T>(name, doc_string);
2015 _params[name]._custom_type = custom_type;
2016}
2017
2018template <typename T>
2019void
2021 const std::string & custom_type,
2022 const std::string & doc_string,
2023 const std::string & deprecation_message)
2024{
2026 addParam<T>(name, doc_string);
2027 auto & metadata = _params[name];
2028 metadata._custom_type = custom_type;
2029
2030 metadata._deprecation_message = deprecation_message;
2032}
2033
2034template <typename T>
2035void
2036InputParameters::addPrivateParam(const std::string & name)
2037{
2038 checkParamName(name);
2039 checkConsistentType<T>(name);
2040
2041 InputParameters::insert<T>(name);
2042 _params[name]._is_private = true;
2043}
2044
2045template <typename T>
2046void
2047InputParameters::addPrivateParam(const std::string & name, const T & value)
2048{
2049 checkParamName(name);
2050 checkConsistentType<T>(name);
2051
2052 InputParameters::set<T>(name) = value;
2053 auto & metadata = _params[name];
2054 metadata._is_private = true;
2055 metadata._set_by_add_param = true;
2056}
2057
2058template <typename T>
2059void
2061 const std::string & syntax,
2062 const std::string & doc_string)
2063{
2064 static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool");
2065
2066 addRequiredParam<T>(name, doc_string);
2067 addCommandLineParamHelper<T>(name, syntax, /* required = */ true, /* value_required = */ true);
2068}
2069
2070template <typename T>
2071void
2073 const std::string & syntax,
2074 const std::string & doc_string)
2075{
2076 static_assert(!std::is_same_v<T, MooseEnum>,
2077 "addCommandLineParam() without a value cannot be used with a MooseEnum because a "
2078 "MooseEnum requires initialization");
2079
2080 auto constexpr is_bool = std::is_same_v<T, bool>;
2081 if constexpr (is_bool)
2082 addParam<T>(name, false, doc_string);
2083 else
2084 addParam<T>(name, doc_string);
2085
2086 addCommandLineParamHelper<T>(
2087 name, syntax, /* required = */ false, /* value_required = */ !is_bool);
2088}
2089
2090template <typename T>
2091void
2093 const std::string & syntax,
2094 const T & value,
2095 const std::string & doc_string)
2096{
2097 if constexpr (std::is_same_v<T, bool>)
2098 mooseAssert(!value, "Default for bool must be false");
2099
2100 addParam<T>(name, value, doc_string);
2101 addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ true);
2102}
2103
2104template <typename T>
2105void
2107 const std::string & syntax,
2108 const T & value,
2109 const std::string & doc_string)
2110{
2111 mooseAssert(name == "citations" || name == "csg_only" || name == "mesh_only" ||
2112 name == "recover" || name == "run",
2113 "Not supported for new parameters");
2114 static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool (does not take a value)");
2115 addParam<T>(name, value, doc_string);
2116 addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ false);
2117}
2118
2119template <typename T>
2120void
2121InputParameters::checkConsistentType(const std::string & name_in) const
2122{
2123 const auto & name = checkForRename(name_in);
2124
2125 // If we don't currently have the Parameter, can't be any inconsistency
2127 if (it == _values.end())
2128 return;
2129
2130 // Now, if we already have the Parameter, but it doesn't have the
2131 // right type, throw an error.
2132 if (!this->Parameters::have_parameter<T>(name))
2133 mooseError("Attempting to set parameter \"",
2134 name,
2135 "\" with type (",
2136 libMesh::demangle(typeid(T).name()),
2137 ")\nbut the parameter already exists as type (",
2138 it->second->type(),
2139 ")");
2140}
2141
2142template <typename T>
2143void
2144InputParameters::suppressParameter(const std::string & name_in)
2145{
2146 const auto & name = checkForRename(name_in);
2147 if (!this->have_parameter<T>(name))
2148 mooseError("Unable to suppress nonexistent parameter: ", name);
2149
2150 auto & metadata = _params[name];
2151 metadata._required = false;
2152 metadata._is_private = true;
2153 metadata._controllable = false;
2154}
2155
2156template <typename T>
2157void
2158InputParameters::ignoreParameter(const std::string & name_in)
2159{
2160 const auto & name = checkForRename(name_in);
2161 suppressParameter<T>(name);
2162 _params[name]._ignore = true;
2163}
2164
2165template <typename T>
2166void
2167InputParameters::makeParamRequired(const std::string & name_in)
2168{
2169 const auto & name = checkForRename(name_in);
2170
2171 if (!this->have_parameter<T>(name))
2172 mooseError("Unable to require nonexistent parameter: ", name);
2173
2174 _params[name]._required = true;
2175}
2176
2177template <typename T>
2178void
2179InputParameters::makeParamNotRequired(const std::string & name_in)
2180{
2181 const auto & name = checkForRename(name_in);
2182
2183 if (!this->have_parameter<T>(name))
2184 mooseError("Unable to un-require nonexistent parameter: ", name);
2185
2186 _params[name]._required = false;
2187}
2188
2189template <typename T>
2190void
2192 const T & value,
2193 const std::string & doc_string,
2194 const std::string & deprecation_message)
2195{
2197 mooseAssert(!_old_to_new_name_and_dep.count(name),
2198 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2199 << name << "', already deprecated via deprecateParam or renamed via renameParam");
2200 addParam<T>(name, value, doc_string);
2201
2202 _params[name]._deprecation_message = deprecation_message;
2204}
2205
2206template <typename T>
2207void
2209 const std::string & doc_string,
2210 const std::string & deprecation_message)
2211{
2213 mooseAssert(!_old_to_new_name_and_dep.count(name),
2214 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2215 << name << "', already deprecated via deprecateParam or renamed via renameParam");
2216 addParam<T>(name, doc_string);
2217
2218 _params[name]._deprecation_message = deprecation_message;
2220}
2221
2222// Forward declare MooseEnum specializations for add*Param
2223template <>
2224void InputParameters::addRequiredParam<MooseEnum>(const std::string & name,
2225 const MooseEnum & moose_enum,
2226 const std::string & doc_string);
2227
2228template <>
2229void InputParameters::addRequiredParam<MultiMooseEnum>(const std::string & name,
2230 const MultiMooseEnum & moose_enum,
2231 const std::string & doc_string);
2232
2233template <>
2234void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2235 const std::string & name,
2236 const std::vector<MooseEnum> & moose_enums,
2237 const std::string & doc_string);
2238
2239template <>
2240void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2241 const std::string & name,
2242 const std::vector<MultiMooseEnum> & moose_enums,
2243 const std::string & doc_string);
2244
2245template <>
2246void InputParameters::addParam<MooseEnum>(const std::string & /*name*/,
2247 const std::string & /*doc_string*/);
2248
2249template <>
2250void InputParameters::addParam<MultiMooseEnum>(const std::string & /*name*/,
2251 const std::string & /*doc_string*/);
2252
2253template <>
2254void InputParameters::addParam<std::vector<MooseEnum>>(const std::string & /*name*/,
2255 const std::string & /*doc_string*/);
2256
2257template <>
2258void InputParameters::addParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2259 const std::string & /*doc_string*/);
2260
2261template <>
2262void
2263InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2264 const std::string & /*doc_string*/);
2265
2266template <>
2267void InputParameters::addPrivateParam<MooseEnum>(const std::string & /*name*/);
2268
2269template <>
2270void InputParameters::addPrivateParam<MultiMooseEnum>(const std::string & /*name*/);
2271
2272template <>
2273void InputParameters::addDeprecatedParam<MooseEnum>(const std::string & /*name*/,
2274 const std::string & /*doc_string*/,
2275 const std::string & /*deprecation_message*/);
2276
2277template <>
2278void
2279InputParameters::addDeprecatedParam<MultiMooseEnum>(const std::string & /*name*/,
2280 const std::string & /*doc_string*/,
2281 const std::string & /*deprecation_message*/);
2282
2283template <>
2284void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2285 const std::string & /*name*/,
2286 const std::string & /*doc_string*/,
2287 const std::string & /*deprecation_message*/);
2288
2289// Forward declare specializations for setParamHelper
2290template <>
2291void InputParameters::setParamHelper<PostprocessorName, Real>(const std::string & name,
2292 PostprocessorName & l_value,
2293 const Real & r_value);
2294
2295template <>
2296void InputParameters::setParamHelper<PostprocessorName, int>(const std::string & name,
2297 PostprocessorName & l_value,
2298 const int & r_value);
2299
2300template <>
2301void InputParameters::setParamHelper<FunctionName, Real>(const std::string & /*name*/,
2302 FunctionName & l_value,
2303 const Real & r_value);
2304
2305template <>
2306void InputParameters::setParamHelper<FunctionName, int>(const std::string & /*name*/,
2307 FunctionName & l_value,
2308 const int & r_value);
2309
2310template <>
2311void InputParameters::setParamHelper<MaterialPropertyName, Real>(const std::string & /*name*/,
2312 MaterialPropertyName & l_value,
2313 const Real & r_value);
2314
2315template <>
2316void InputParameters::setParamHelper<MaterialPropertyName, int>(const std::string & /*name*/,
2317 MaterialPropertyName & l_value,
2318 const int & r_value);
2319
2320template <>
2321void InputParameters::setParamHelper<MooseFunctorName, Real>(const std::string & /*name*/,
2322 MooseFunctorName & l_value,
2323 const Real & r_value);
2324
2325template <>
2326void InputParameters::setParamHelper<MooseFunctorName, int>(const std::string & /*name*/,
2327 MooseFunctorName & l_value,
2328 const int & r_value);
2329
2330template <typename T>
2331const T *
2332InputParameters::queryParam(const std::string & name) const
2333{
2334 return have_parameter<T>(name) && isParamValid(name) ? &getParamHelper<T>(name, *this) : nullptr;
2335}
2336
2337template <typename T>
2338const T &
2339InputParameters::getParamHelper(const std::string & name_in, const InputParameters & pars)
2340{
2341 const auto & name = pars.checkForRename(name_in);
2342
2343 if (!pars.isParamValid(name))
2344 pars.mooseError("The parameter \"", name, "\" is being retrieved before being set.");
2345
2346 return pars.get<T>(name);
2347}
2348
2349// Declare specializations so we don't fall back on the generic
2350// implementation, but the definition will be in InputParameters.C so
2351// we won't need to bring in *MooseEnum header files here.
2352template <>
2353const MooseEnum & InputParameters::getParamHelper<MooseEnum>(const std::string & name,
2354 const InputParameters & pars);
2355
2356template <>
2358InputParameters::getParamHelper<MultiMooseEnum>(const std::string & name,
2359 const InputParameters & pars);
2360
2361template <typename R1, typename R2, typename V1, typename V2>
2362std::vector<std::pair<R1, R2>>
2363InputParameters::get(const std::string & param1_in, const std::string & param2_in) const
2364{
2365 const auto & param1 = checkForRename(param1_in);
2366 const auto & param2 = checkForRename(param2_in);
2367
2368 const auto & v1 = get<V1>(param1);
2369 const auto & v2 = get<V2>(param2);
2370
2371 auto controllable = getControllableParameters();
2372 if (controllable.count(param1) || controllable.count(param2))
2373 mooseError("Parameters ",
2374 param1,
2375 " and/or ",
2376 param2 + " are controllable parameters and cannot be retireved using "
2377 "the MooseObject::getParam/InputParameters::get methods for pairs");
2378
2379 if (v1.size() != v2.size())
2380 paramError(param1,
2381 "Vector parameters ",
2382 param1,
2383 "(size: ",
2384 v1.size(),
2385 ") and " + param2,
2386 "(size: ",
2387 v2.size(),
2388 ") are of different lengths \n");
2389
2390 std::vector<std::pair<R1, R2>> parameter_pairs;
2391 auto i1 = v1.begin();
2392 auto i2 = v2.begin();
2393 for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
2394 parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
2395 return parameter_pairs;
2396}
2397
2399
2400template <typename T>
2401bool
2402InputParameters::isType(const std::string & name_in) const
2403{
2404 const auto & name = checkForRename(name_in);
2405
2406 if (!_params.count(name))
2407 mooseError("Parameter \"", name, "\" is not valid.");
2408 return have_parameter<T>(name);
2409}
2410
2411template <typename T>
2412const T &
2413InputParameters::get(std::string_view name_in) const
2414{
2415 const std::string name_str(name_in);
2416 const auto & name = checkForRename(name_str);
2417
2418 return Parameters::get<T>(name);
2419}
2420
2421template <typename T>
2422bool
2423InputParameters::have_parameter(std::string_view name_in) const
2424{
2425 const std::string name_str(name_in);
2426 const auto & name = checkForRename(name_str);
2427
2428 return Parameters::have_parameter<T>(name);
2429}
2430
2431template <typename T>
2432void
2434 const std::string & name_in,
2435 const std::string & new_name,
2436 const std::string & new_description)
2437{
2438 const auto & name = source_params.checkForRename(name_in);
2439 const auto p_name = new_name.empty() ? name_in : new_name;
2440 if (!source_params.have_parameter<T>(name) && !source_params.hasCoupledVar(name))
2441 mooseError("The '",
2442 name_in,
2443 "' parameter could not be transferred because it does not exist with type '",
2444 MooseUtils::prettyCppType<T>(),
2445 "' in the source parameters");
2446 if (name != name_in)
2447 mooseWarning("The transferred parameter " + name_in + " is deprecated in favor of " + name +
2448 " in the source parameters. The new name should likely be used for the parameter "
2449 "transfer instead.");
2450 const std::string description =
2451 new_description.empty() ? source_params.getDescription(name) : new_description;
2452
2453 if (source_params.isParamRequired(name))
2454 {
2455 // Check for a variable parameter
2456 if (source_params.hasCoupledVar(name))
2457 addRequiredCoupledVar(p_name, description);
2458 // Enums parameters have a default list of options
2459 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2460 addRequiredParam<T>(p_name, source_params.get<T>(name), description);
2461 else if (source_params.isRangeChecked(name))
2462 addRequiredRangeCheckedParam<T>(
2463 p_name, source_params.rangeCheckedFunction(name), description);
2464 else
2465 addRequiredParam<T>(p_name, description);
2466 }
2467 else
2468 {
2469 // Check for a variable parameter
2470 if (source_params.hasCoupledVar(name))
2471 {
2472 if (!source_params.hasDefaultCoupledValue(name))
2473 addCoupledVar(p_name, description);
2474 else if (source_params.numberDefaultCoupledValues(name) == 1)
2475 addCoupledVar(p_name, source_params.defaultCoupledValue(name), description);
2476 else
2477 {
2478 std::vector<Real> coupled_values;
2479 for (const auto i : libMesh::make_range(source_params.numberDefaultCoupledValues(name)))
2480 coupled_values.push_back(source_params.defaultCoupledValue(name, i));
2481 addCoupledVar(p_name, coupled_values, description);
2482 }
2483 }
2484 else if (source_params.isRangeChecked(name))
2485 {
2486 if (source_params.hasDefault(name))
2487 addRangeCheckedParam<T>(p_name,
2488 source_params.get<T>(name),
2489 source_params.rangeCheckedFunction(name),
2490 description);
2491 else
2492 addRangeCheckedParam<T>(p_name, source_params.rangeCheckedFunction(name), description);
2493 }
2494 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2495 addParam<T>(p_name, source_params.get<T>(name), description);
2496 else
2497 {
2498 if (source_params.hasDefault(name))
2499 addParam<T>(p_name, source_params.get<T>(name), description);
2500 else
2501 addParam<T>(p_name, description);
2502 }
2503 }
2504
2505 // Copy other attributes
2506 if (source_params.isPrivate(name))
2507 _params[p_name]._is_private = true;
2508 if (source_params.isControllable(name))
2509 _params[p_name]._controllable = true;
2510}
2511
2512template <typename... Args>
2513[[noreturn]] void
2514InputParameters::mooseError(Args &&... args) const
2515{
2516 std::ostringstream oss;
2517 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2518 callMooseError(oss.str());
2519}
2520
2521template <typename... Args>
2522std::string
2523InputParameters::paramMessage(const std::string & param, Args... args) const
2524{
2525 std::ostringstream oss;
2526 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2527 return paramMessagePrefix(param) + oss.str();
2528}
2529
2530template <typename... Args>
2531[[noreturn]] void
2532InputParameters::paramError(const std::string & param, Args... args) const
2533{
2534 std::ostringstream oss;
2535 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2536 const auto [prefix, node] = paramMessageContext(param);
2537 callMooseError(prefix + oss.str(), false, node, /* show_trace = */ false);
2538}
2539
2540namespace Moose
2541{
2542namespace internal
2543{
2544template <typename T>
2545constexpr T *
2547{
2548 return nullptr;
2549}
2550
2551#ifdef MOOSE_MFEM_ENABLED
2552
2553template <typename T>
2554constexpr bool
2556{
2557 return std::is_same_v<T, MFEMScalarCoefficientName> ||
2558 std::is_same_v<T, MFEMVectorCoefficientName>;
2559}
2560
2561template <typename T, typename A>
2562constexpr bool
2564{
2565 return isMFEMFunctorNameTypeHelper(getNullptrExample<T>());
2566}
2567
2568#endif
2569
2570template <typename T>
2571constexpr bool
2573{
2574 return std::is_same_v<T, MooseFunctorName>
2575#ifdef MOOSE_MFEM_ENABLED
2576 || std::is_same_v<T, MFEMScalarCoefficientName>
2577#endif
2578 ;
2579}
2580
2581template <typename T, typename A>
2582constexpr bool
2584{
2585 return isScalarFunctorNameTypeHelper(getNullptrExample<T>());
2586}
2587
2588template <typename T>
2589constexpr bool
2591{
2592#ifdef MOOSE_MFEM_ENABLED
2593 return std::is_same_v<T, MFEMVectorCoefficientName>;
2594#else
2595 return false;
2596#endif
2597}
2598
2599template <typename T, typename A>
2600constexpr bool
2602{
2603 return isVectorFunctorNameTypeHelper(getNullptrExample<T>());
2604}
2605
2606template <typename T>
2607constexpr bool
2612}
2613}
2614
2615template <typename T>
2616constexpr bool
2618{
2619 return Moose::internal::isFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>());
2620}
2621
2622template <typename T>
2623std::string
2624InputParameters::appendFunctorDescription(const std::string & doc_string) const
2625{
2626 auto numeric_value_type = []()
2627 {
2629 Moose::internal::getNullptrExample<T>()))
2630 return "number";
2632 Moose::internal::getNullptrExample<T>()))
2633 return "numeric vector value (enclosed in curly braces)";
2634 else
2635 {
2636 mooseAssert(false, "We control instantiations of this method");
2637 return "";
2638 }
2639 };
2640
2641 return MooseUtils::trim(doc_string, ". ") + ". A functor is any of the following: a variable, " +
2642 (
2643#ifdef MOOSE_MFEM_ENABLED
2644 Moose::internal::isMFEMFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>())
2645 ? "an MFEM"
2646 :
2647#endif
2648 "a functor") +
2649 " material property, a function, a postprocessor or a " + numeric_value_type() + ".";
2650}
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
void moveParamToGroup(const std::string &name, const std::string &group_name)
This method moves a single parameter to a different group than the one it is already assigned to (for...
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
std::vector< std::string > missingRequiredParamErrors(const std::string &parsing_syntax, const std::set< std::string > &skip_required_params={}, bool skip_private=false) const
Return errors for missing required parameters.
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:109
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:135
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.