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
857 std::optional<std::pair<bool, std::string>> parameterRangeCheck(const Parameters::Value & value,
858 const std::string & long_name,
859 const std::string & short_name,
860 const bool include_param_path);
861
869 void finalize(const std::string & parsing_syntax);
870
884 std::filesystem::path
885 getFileBase(const std::optional<std::string> & param_name = std::optional<std::string>()) const;
886
891 inline std::set<std::string>::const_iterator coupledVarsBegin() const
892 {
893 return _coupled_vars.begin();
894 }
895 inline std::set<std::string>::const_iterator coupledVarsEnd() const
896 {
897 return _coupled_vars.end();
898 }
899
903 const std::set<std::string> & getCoupledVariableParamNames() const { return _coupled_vars; }
904
908 const std::unordered_map<std::string, std::string> & getNewToDeprecatedVarMap() const
909 {
911 }
912
914 bool isRangeChecked(const std::string & param_name) const;
915
917 std::string rangeCheckedFunction(const std::string & name) const;
918
920 bool hasDefault(const std::string & param_name) const;
921
927 bool hasCoupledVar(const std::string & coupling_name) const;
928
934 bool hasCoupledValue(const std::string & coupling_name) const
935 {
936 mooseDeprecated("InputParameters::hasCoupledValue() is deprecated. Use "
937 "InputParameters::hasCoupledVar() instead.");
938 return hasCoupledVar(coupling_name);
939 }
940
947 void setCoupledVar(const std::string & coupling_name, const std::string & value);
948
955 void setCoupledVar(const std::string & coupling_name, const std::vector<VariableName> & values);
956
962 const std::vector<VariableName> & getCoupledVar(const std::string & coupling_name) const;
963
969 bool hasDefaultCoupledValue(const std::string & coupling_name) const;
970
977 Real defaultCoupledValue(const std::string & coupling_name, unsigned int i = 0) const;
978
984 unsigned int numberDefaultCoupledValues(const std::string & coupling_name) const;
985
993 void defaultCoupledValue(const std::string & coupling_name, Real value, unsigned int i = 0);
994
998 std::map<std::string, std::pair<std::string, std::string>> getAutoBuildVectors() const;
999
1000 // BEGIN APPLY PARAMETER METHODS
1018 void applyParameters(const InputParameters & common,
1019 const std::vector<std::string> & exclude = {},
1020 const bool allow_private = false);
1021
1028 const std::vector<std::string> & exclude = {},
1029 const bool allow_private = false);
1030
1048 void applySpecificParameters(const InputParameters & common,
1049 const std::vector<std::string> & include,
1050 bool allow_private = false);
1051
1063 void applyParameter(const InputParameters & common,
1064 const std::string & common_name,
1065 bool allow_private = false);
1066 // END APPLY PARAMETER METHODS
1067
1078 void applyCoupledVar(const InputParameters & common, const std::string & var_name);
1079
1083 bool paramSetByUser(const std::string & name) const;
1084
1089 bool isParamSetByUser(const std::string & name) const;
1090
1096 bool isParamDefined(const std::string & name) const;
1097
1107 template <typename T>
1108 const T * queryParam(const std::string & name) const;
1109
1111 /*
1112 * These methods are here to retrieve parameters for scalar and vector types respectively. We will
1113 * throw errors
1114 * when returning most scalar and vector types.
1115 */
1116 template <typename T>
1117 static const T & getParamHelper(const std::string & name, const InputParameters & pars);
1119
1120 using Parameters::get;
1121
1123 template <typename R1,
1124 typename R2,
1125 typename V1 = typename std::conditional<std::is_same<R1, MooseEnumItem>::value,
1127 std::vector<R1>>::type,
1128 typename V2 = typename std::conditional<std::is_same<R2, MooseEnumItem>::value,
1130 std::vector<R2>>::type>
1131 std::vector<std::pair<R1, R2>> get(const std::string & param1, const std::string & param2) const;
1132
1136 std::set<std::string> getParametersList() const;
1137
1141 std::set<std::string> getControllableParameters() const;
1142
1146 std::set<std::string> getGroupParameters(const std::string & group) const;
1147
1152 void setReservedValues(const std::string & name, const std::set<std::string> & reserved);
1153
1158 std::set<std::string> reservedValues(const std::string & name) const;
1159
1164 std::string blockLocation() const;
1165
1170 std::string blockFullpath() const;
1171
1175 const hit::Node * getHitNode(const std::string & param) const;
1181 void setHitNode(const std::string & param, const hit::Node & node, const SetParamHitNodeKey);
1182
1187 std::string inputLocation(const std::string & param) const;
1188
1193 std::string paramFullpath(const std::string & param) const;
1194
1198 std::string paramLocationPrefix(const std::string & param) const;
1199
1207 template <typename... Args>
1208 std::string paramMessage(const std::string & param, Args... args) const;
1209
1213 template <typename... Args>
1214 [[noreturn]] void mooseError(Args &&... args) const;
1215
1220 template <typename... Args>
1221 [[noreturn]] void paramError(const std::string & param, Args... args) const;
1222
1227 std::string rawParamVal(const std::string & param) const;
1228
1233 template <typename T>
1234 void ignoreParameter(const std::string & name);
1235
1240 bool shouldIgnore(const std::string & name);
1241
1245 template <typename T>
1246 bool isType(const std::string & name) const;
1247
1254 std::string varName(const std::string & var_param_name,
1255 const std::string & moose_object_with_var_param_name) const;
1256
1264 void renameParam(const std::string & old_name,
1265 const std::string & new_name,
1266 const std::string & new_docstring);
1267
1274 void renameCoupledVar(const std::string & old_name,
1275 const std::string & new_name,
1276 const std::string & new_docstring);
1277
1278 void deprecateParam(const std::string & old_name,
1279 const std::string & new_name,
1280 const std::string & removal_date);
1281
1282 void deprecateCoupledVar(const std::string & old_name,
1283 const std::string & new_name,
1284 const std::string & removal_date);
1285
1292 const std::string & checkForRename(const std::string & name) const;
1293
1300 template <typename T>
1301 const T & get(std::string_view name) const;
1302
1311 template <typename T>
1312 bool have_parameter(std::string_view name) const;
1313
1321 template <typename T>
1322 void transferParam(const InputParameters & source_param,
1323 const std::string & name,
1324 const std::string & new_name = "",
1325 const std::string & new_description = "");
1326
1339 std::vector<std::string> paramAliases(const std::string & param_name) const;
1340
1345 const hit::Node * getHitNode() const { return _hit_node; }
1353 void setHitNode(const hit::Node & node, const SetHitNodeKey) { _hit_node = &node; }
1354
1358 bool isFinalized() const { return _finalized; }
1359
1363 std::optional<Moose::DataFileUtils::Path> queryDataFileNamePath(const std::string & name) const;
1364
1373 std::optional<std::string> setupVariableNames(std::vector<VariableName> & names,
1374 const hit::Node & node,
1376
1377private:
1378 // Private constructor so that InputParameters can only be created in certain places.
1380
1385
1386 template <typename T>
1387 static constexpr bool isFunctorNameType();
1388
1392 template <typename T>
1393 std::string appendFunctorDescription(const std::string & doc_string) const;
1394
1398 void setDeprecatedVarDocString(const std::string & new_name, const std::string & doc_string);
1399
1400 void renameParamInternal(const std::string & old_name,
1401 const std::string & new_name,
1402 const std::string & docstring,
1403 const std::string & removal_date);
1404
1405 void renameCoupledVarInternal(const std::string & old_name,
1406 const std::string & new_name,
1407 const std::string & docstring,
1408 const std::string & removal_date);
1409
1416 std::pair<std::string, const hit::Node *> paramMessageContext(const std::string & param) const;
1422 std::string paramMessagePrefix(const std::string & param) const;
1423
1425 {
1426 std::string _doc_string;
1428 std::string _doc_unit;
1430 std::string _custom_type;
1432 std::optional<CommandLineMetadata> _cl_data;
1434 std::optional<Moose::DataFileUtils::Path> _data_file_name_path;
1436 std::string _group;
1438 std::string _range_function;
1440 std::pair<std::string, std::string> _autobuild_vecs;
1442 bool _required = false;
1448 bool _valid = false;
1450 bool _is_private = false;
1453 std::vector<Real> _coupled_default = {0};
1455 bool _set_by_add_param = false;
1457 std::set<std::string> _reserved_values;
1461 const hit::Node * _hit_node;
1463 bool _controllable = false;
1465 std::set<ExecFlagType> _controllable_flags;
1467 bool _ignore = false;
1468 };
1469
1470 Metadata & at(const std::string & param_name)
1471 {
1472 const auto & param = checkForRename(param_name);
1473 if (_params.count(param) == 0)
1474 mooseError("param '", param, "' not present in InputParams");
1475 return _params[param];
1476 }
1477 const Metadata & at(const std::string & param_name) const
1478 {
1479 const auto & param = checkForRename(param_name);
1480 if (_params.count(param) == 0)
1481 mooseError("param '", param, "' not present in InputParams");
1482 return _params.at(param);
1483 }
1484
1494 void allowCopy(bool status) { _allow_copy = status; }
1495
1499 void checkParamName(const std::string & name) const;
1500
1505 template <typename T, typename S>
1506 void setParamHelper(const std::string & name, T & l_value, const S & r_value);
1507
1516 template <typename T>
1517 void addCommandLineParamHelper(const std::string & name,
1518 const std::string & syntax,
1519 const bool required,
1520 const bool value_required);
1521
1526 [[noreturn]] void callMooseError(std::string msg,
1527 const bool with_prefix = true,
1528 const hit::Node * node = nullptr,
1529 const bool show_trace = true) const;
1530
1533 std::map<std::string, Metadata> _params;
1534
1536 std::set<std::string> _coupled_vars;
1537
1541
1544 std::vector<std::string> _buildable_types;
1545
1550 std::vector<std::tuple<std::string,
1554
1558
1561
1565
1568
1570 std::unordered_map<std::string, std::string> _new_to_deprecated_coupled_vars;
1571
1576 std::map<std::string, std::pair<std::string, std::string>> _old_to_new_name_and_dep;
1577
1580 std::multimap<std::string, std::string> _new_to_old_names;
1581
1583 const hit::Node * _hit_node;
1584
1587
1588 // These are the only objects allowed to _create_ InputParameters
1591 friend class Parser;
1592 // for the printInputFile function in the action warehouse
1593 friend class ActionWarehouse;
1594};
1595
1596template <typename T>
1597void
1598InputParameters::setHelper(const std::string & /*name*/)
1599{
1600}
1601
1602// Template and inline function implementations
1603template <typename T>
1604T &
1605InputParameters::set(const std::string & name_in, bool quiet_mode)
1606{
1607 const auto & name = checkForRename(name_in);
1608
1609 checkParamName(name);
1610 checkConsistentType<T>(name);
1611
1612 T & result = this->Parameters::set<T>(name);
1613
1614 if (quiet_mode)
1615 _params[name]._set_by_add_param = true;
1616
1617 setHelper<T>(name);
1618
1619 return result;
1620}
1621
1622template <typename T, typename... Ts>
1623void
1624InputParameters::setParameters(const std::string & name,
1625 const T & value,
1626 Ts... extra_input_parameters)
1627{
1628 this->set<T>(name) = value;
1629 this->setParameters(extra_input_parameters...);
1630}
1631
1632template <typename T, typename UP_T>
1633std::optional<std::pair<bool, std::string>>
1634InputParameters::rangeCheck(const std::string & full_name,
1635 const std::string & short_name,
1636 const InputParameters::Parameter<std::vector<T>> & param,
1637 const bool include_param_path)
1638{
1639 if (!isParamValid(short_name))
1640 return {};
1641
1642 const auto & range_function = _params[short_name]._range_function;
1643 if (range_function.empty())
1644 return {};
1645
1658 std::vector<std::string> vars;
1659 if (fp.ParseAndDeduceVariables(range_function, vars) != -1) // -1 for success
1660 return {{false,
1661 "Error parsing expression '" + range_function + "' for parameter " + short_name + ""}};
1662
1663 // Fparser parameter buffer
1664 std::vector<UP_T> parbuf(vars.size());
1665
1666 // parameter vector
1667 const std::vector<T> & value = param.get();
1668
1669 // iterate over all vector values (maybe ;)
1670 bool need_to_iterate = false;
1671 unsigned int i = 0;
1672 do
1673 {
1674 // set parameters
1675 for (unsigned int j = 0; j < vars.size(); j++)
1676 {
1677 if (vars[j] == short_name)
1678 {
1679 if (value.size() == 0)
1680 {
1681 std::ostringstream oss;
1682 oss << "Range checking empty vector";
1683 if (include_param_path)
1684 oss << " parameter " << full_name;
1685 oss << "; expression = '" << range_function << "'";
1686 return {{true, oss.str()}};
1687 }
1688
1689 parbuf[j] = value[i];
1690 need_to_iterate = true;
1691 }
1692 else if (vars[j] == short_name + "_size")
1693 parbuf[j] = value.size();
1694 else
1695 {
1696 if (vars[j].substr(0, short_name.size() + 1) != short_name + "_")
1697 return {{false, "Error parsing expression '" + range_function + "'"}};
1698 std::istringstream iss(vars[j]);
1699 iss.seekg(short_name.size() + 1);
1700
1701 size_t index;
1702 if (iss >> index && iss.eof())
1703 {
1704 if (index >= value.size())
1705 {
1706 std::ostringstream oss;
1707 oss << "Error parsing expression '" + range_function + "'";
1708 if (include_param_path)
1709 oss << " for parameter " << full_name;
1710 oss << "; out of range variable '" + vars[j] << "'";
1711 return {{true, oss.str()}};
1712 }
1713 parbuf[j] = value[index];
1714 }
1715 else
1716 return {{false,
1717 "Error parsing expression '" + range_function + "'; invalid variable '" +
1718 vars[j] + "'"}};
1719 }
1720 }
1721
1722 // ensure range-checked input file parameter comparison functions
1723 // do absolute floating point comparisons instead of using a default epsilon.
1724 auto tmp_eps = fp.epsilon();
1725 fp.setEpsilon(0);
1726 UP_T result = fp.Eval(&parbuf[0]);
1727 fp.setEpsilon(tmp_eps);
1728
1729 // test function using the parameters determined above
1730 if (fp.EvalError())
1731 return {{false, "Error evaluating expression '" + range_function + "'"}};
1732
1733 if (!result)
1734 {
1735 std::ostringstream oss;
1736 oss << "Range check failed";
1737 if (include_param_path)
1738 oss << " for parameter " << full_name;
1739 oss << "; expression = '" << range_function << "'";
1740 if (need_to_iterate)
1741 oss << ", component " << i;
1742 return {{true, oss.str()}};
1743 }
1744
1745 } while (need_to_iterate && ++i < value.size());
1746
1747 return {};
1748}
1749
1750template <typename T, typename UP_T>
1751std::optional<std::pair<bool, std::string>>
1752InputParameters::rangeCheck(const std::string & full_name,
1753 const std::string & short_name,
1754 const InputParameters::Parameter<T> & param,
1755 const bool include_param_path)
1756{
1757 if (!isParamValid(short_name))
1758 return {};
1759
1760 const auto & range_function = _params[short_name]._range_function;
1761 if (range_function.empty())
1762 return {};
1763
1764 // Parse the expression
1766 if (fp.Parse(range_function, short_name) != -1) // -1 for success
1767 return {{false,
1768 "Error parsing expression '" + range_function + "'" + " for parameter " + short_name}};
1769
1770 // ensure range-checked input file parameter comparison functions
1771 // do absolute floating point comparisons instead of using a default epsilon.
1772 auto tmp_eps = fp.epsilon();
1773 fp.setEpsilon(0);
1774 // We require a non-const value for the implicit upscaling of the parameter type
1775 std::vector<UP_T> value(1, param.get());
1776 UP_T result = fp.Eval(&value[0]);
1777 fp.setEpsilon(tmp_eps);
1778
1779 if (fp.EvalError())
1780 return {{true,
1781 "Error evaluating expression '" + range_function + "' for parameter " + short_name +
1782 "; perhaps you used the wrong variable name?"}};
1783
1784 if (!result)
1785 {
1786 std::ostringstream oss;
1787 oss << "Range check failed";
1788 if (include_param_path)
1789 oss << " for parameter " << full_name;
1790 oss << "; expression = '" << range_function << "', value = " << value[0];
1791 return {{true, oss.str()}};
1792 }
1793
1794 return {};
1795}
1796
1797template <typename T>
1798T
1800 const std::string & error_string) const
1801{
1802 const auto & name = checkForRename(name_in);
1803
1804 T param = this->get<T>(name);
1805
1806 // Note: You will receive a compile error on this line if you attempt to pass a non-pointer
1807 // template type to this method
1808 if (!param)
1809 mooseError("Parameter ", name, " is NULL.\n", error_string);
1810 return param;
1811}
1812
1813template <typename T>
1814void
1815InputParameters::addRequiredParam(const std::string & name, const std::string & doc_string)
1816{
1817 checkParamName(name);
1818 checkConsistentType<T>(name);
1819
1820 InputParameters::insert<T>(name);
1821 auto & metadata = _params[name];
1822 metadata._required = true;
1823 if constexpr (isFunctorNameType<T>())
1824 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1825 else
1826 metadata._doc_string = doc_string;
1827}
1828
1829template <typename T>
1830void
1831InputParameters::addRequiredParam(const std::string & /*name*/,
1832 const T & /*value*/,
1833 const std::string & /*doc_string*/)
1834{
1835 mooseError("You cannot call addRequiredParam and supply a default value for this type, please "
1836 "use addParam instead");
1837}
1838
1839template <typename T, typename S>
1840void
1841InputParameters::addParam(const std::string & name, const S & value, const std::string & doc_string)
1842{
1843 checkParamName(name);
1844 checkConsistentType<T>(name);
1845
1846 T & l_value = InputParameters::set<T>(name);
1847 auto & metadata = _params[name];
1848 if constexpr (isFunctorNameType<T>())
1849 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1850 else
1851 metadata._doc_string = doc_string;
1852
1853 // Set the parameter now
1854 setParamHelper(name, l_value, value);
1855
1856 /* Indicate the default value, as set via addParam, is being used. The parameter is removed from
1857 the list whenever
1858 it changes, see set_attributes */
1859 metadata._set_by_add_param = true;
1860}
1861
1862template <typename T>
1863void
1864InputParameters::addParam(const std::string & name, const std::string & doc_string)
1865{
1866 checkParamName(name);
1867 checkConsistentType<T>(name);
1868
1869 InputParameters::insert<T>(name);
1870 if constexpr (isFunctorNameType<T>())
1871 _params[name]._doc_string = appendFunctorDescription<T>(doc_string);
1872 else
1873 _params[name]._doc_string = doc_string;
1874}
1875
1876template <typename T, typename S>
1877void
1878InputParameters::setParamHelper(const std::string & /*name*/, T & l_value, const S & r_value)
1879{
1880 l_value = r_value;
1881}
1882
1883template <typename T>
1884void
1886 const std::string & syntax,
1887 const bool required,
1888 const bool value_required)
1889{
1891 "This type is not a supported command line parameter type. See "
1892 "CommandLine::populateCommandLineParams to add it as a supported type.");
1893
1894 auto & cl_data = at(name)._cl_data;
1895 cl_data = CommandLineMetadata();
1896
1897 // Split up the syntax by whitespace
1898 std::vector<std::string> syntax_split;
1899 MooseUtils::tokenize(syntax, syntax_split, 1, " \t\n\v\f\r");
1900
1901 // Set the single syntax string as the combined syntax with removed whitespace
1902 cl_data->syntax = MooseUtils::stringJoin(syntax_split);
1903 mooseAssert(cl_data->syntax.size(), "Empty token");
1904
1905 // Set the switches; only parse those that begin with "-" as we also
1906 // provide examples within the syntax
1907 for (const auto & val : syntax_split)
1908 if (val.rfind("-", 0) == 0)
1909 {
1910 if (!std::regex_search(val, std::regex("^\\-+[a-zA-Z]")))
1911 mooseError("The switch '",
1912 val,
1913 "' for the command line parameter '",
1914 name,
1915 "' is invalid. It must begin with an alphabetical character.");
1916
1917 cl_data->switches.push_back(val);
1919 }
1920
1921 cl_data->required = required;
1922 cl_data->global = false;
1923
1924 // No arguments needed for a boolean parameter
1925 if constexpr (std::is_same_v<T, bool>)
1926 {
1927 (void)value_required; // purposely unused; doesn't take a value
1928 cl_data->argument_type = CommandLineMetadata::ArgumentType::NONE;
1929 }
1930 // MooseEnums require a value
1931 else if constexpr (std::is_same_v<T, MooseEnum>)
1932 {
1933 (void)value_required; // purposely unused; always required
1934 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1935 }
1936 // The user didn't specify a default, so a value is required
1937 else if (value_required)
1938 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1939 // Otherwise, it's optional (user specified a default)
1940 else
1941 cl_data->argument_type = CommandLineMetadata::ArgumentType::OPTIONAL;
1942}
1943
1944template <typename T>
1945void
1947 const std::string & parsed_function,
1948 const std::string & doc_string)
1949{
1950 addRequiredParam<T>(name, doc_string);
1951 _params[name]._range_function = parsed_function;
1952}
1953
1954template <typename T>
1955void
1957 const T & value,
1958 const std::string & parsed_function,
1959 const std::string & doc_string)
1960{
1961 addParam<T>(name, value, doc_string);
1962 _params[name]._range_function = parsed_function;
1963}
1964
1965template <typename T>
1966void
1968 const std::string & parsed_function,
1969 const std::string & doc_string)
1970{
1971 addParam<T>(name, doc_string);
1972 _params[name]._range_function = parsed_function;
1973}
1974
1975template <typename T>
1976void
1978 const std::string & custom_type,
1979 const std::string & doc_string)
1980{
1981 addRequiredParam<T>(name, doc_string);
1982 _params[name]._custom_type = custom_type;
1983}
1984
1985template <typename T>
1986void
1988 const T & value,
1989 const std::string & custom_type,
1990 const std::string & doc_string)
1991{
1992 addParam<T>(name, value, doc_string);
1993 _params[name]._custom_type = custom_type;
1994}
1995
1996template <typename T>
1997void
1999 const std::string & custom_type,
2000 const std::string & doc_string)
2001{
2002 addParam<T>(name, doc_string);
2003 _params[name]._custom_type = custom_type;
2004}
2005
2006template <typename T>
2007void
2009 const std::string & custom_type,
2010 const std::string & doc_string,
2011 const std::string & deprecation_message)
2012{
2014 addParam<T>(name, doc_string);
2015 auto & metadata = _params[name];
2016 metadata._custom_type = custom_type;
2017
2018 metadata._deprecation_message = deprecation_message;
2020}
2021
2022template <typename T>
2023void
2024InputParameters::addPrivateParam(const std::string & name)
2025{
2026 checkParamName(name);
2027 checkConsistentType<T>(name);
2028
2029 InputParameters::insert<T>(name);
2030 _params[name]._is_private = true;
2031}
2032
2033template <typename T>
2034void
2035InputParameters::addPrivateParam(const std::string & name, const T & value)
2036{
2037 checkParamName(name);
2038 checkConsistentType<T>(name);
2039
2040 InputParameters::set<T>(name) = value;
2041 auto & metadata = _params[name];
2042 metadata._is_private = true;
2043 metadata._set_by_add_param = true;
2044}
2045
2046template <typename T>
2047void
2049 const std::string & syntax,
2050 const std::string & doc_string)
2051{
2052 static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool");
2053
2054 addRequiredParam<T>(name, doc_string);
2055 addCommandLineParamHelper<T>(name, syntax, /* required = */ true, /* value_required = */ 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, MooseEnum>,
2065 "addCommandLineParam() without a value cannot be used with a MooseEnum because a "
2066 "MooseEnum requires initialization");
2067
2068 auto constexpr is_bool = std::is_same_v<T, bool>;
2069 if constexpr (is_bool)
2070 addParam<T>(name, false, doc_string);
2071 else
2072 addParam<T>(name, doc_string);
2073
2074 addCommandLineParamHelper<T>(
2075 name, syntax, /* required = */ false, /* value_required = */ !is_bool);
2076}
2077
2078template <typename T>
2079void
2081 const std::string & syntax,
2082 const T & value,
2083 const std::string & doc_string)
2084{
2085 if constexpr (std::is_same_v<T, bool>)
2086 mooseAssert(!value, "Default for bool must be false");
2087
2088 addParam<T>(name, value, doc_string);
2089 addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ true);
2090}
2091
2092template <typename T>
2093void
2095 const std::string & syntax,
2096 const T & value,
2097 const std::string & doc_string)
2098{
2099 mooseAssert(name == "citations" || name == "csg_only" || name == "mesh_only" ||
2100 name == "recover" || name == "run",
2101 "Not supported for new parameters");
2102 static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool (does not take a value)");
2103 addParam<T>(name, value, doc_string);
2104 addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ false);
2105}
2106
2107template <typename T>
2108void
2109InputParameters::checkConsistentType(const std::string & name_in) const
2110{
2111 const auto & name = checkForRename(name_in);
2112
2113 // If we don't currently have the Parameter, can't be any inconsistency
2115 if (it == _values.end())
2116 return;
2117
2118 // Now, if we already have the Parameter, but it doesn't have the
2119 // right type, throw an error.
2120 if (!this->Parameters::have_parameter<T>(name))
2121 mooseError("Attempting to set parameter \"",
2122 name,
2123 "\" with type (",
2124 libMesh::demangle(typeid(T).name()),
2125 ")\nbut the parameter already exists as type (",
2126 it->second->type(),
2127 ")");
2128}
2129
2130template <typename T>
2131void
2132InputParameters::suppressParameter(const std::string & name_in)
2133{
2134 const auto & name = checkForRename(name_in);
2135 if (!this->have_parameter<T>(name))
2136 mooseError("Unable to suppress nonexistent parameter: ", name);
2137
2138 auto & metadata = _params[name];
2139 metadata._required = false;
2140 metadata._is_private = true;
2141 metadata._controllable = false;
2142}
2143
2144template <typename T>
2145void
2146InputParameters::ignoreParameter(const std::string & name_in)
2147{
2148 const auto & name = checkForRename(name_in);
2149 suppressParameter<T>(name);
2150 _params[name]._ignore = true;
2151}
2152
2153template <typename T>
2154void
2155InputParameters::makeParamRequired(const std::string & name_in)
2156{
2157 const auto & name = checkForRename(name_in);
2158
2159 if (!this->have_parameter<T>(name))
2160 mooseError("Unable to require nonexistent parameter: ", name);
2161
2162 _params[name]._required = true;
2163}
2164
2165template <typename T>
2166void
2167InputParameters::makeParamNotRequired(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 un-require nonexistent parameter: ", name);
2173
2174 _params[name]._required = false;
2175}
2176
2177template <typename T>
2178void
2180 const T & value,
2181 const std::string & doc_string,
2182 const std::string & deprecation_message)
2183{
2185 mooseAssert(!_old_to_new_name_and_dep.count(name),
2186 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2187 << name << "', already deprecated via deprecateParam or renamed via renameParam");
2188 addParam<T>(name, value, doc_string);
2189
2190 _params[name]._deprecation_message = deprecation_message;
2192}
2193
2194template <typename T>
2195void
2197 const std::string & doc_string,
2198 const std::string & deprecation_message)
2199{
2201 mooseAssert(!_old_to_new_name_and_dep.count(name),
2202 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2203 << name << "', already deprecated via deprecateParam or renamed via renameParam");
2204 addParam<T>(name, doc_string);
2205
2206 _params[name]._deprecation_message = deprecation_message;
2208}
2209
2210// Forward declare MooseEnum specializations for add*Param
2211template <>
2212void InputParameters::addRequiredParam<MooseEnum>(const std::string & name,
2213 const MooseEnum & moose_enum,
2214 const std::string & doc_string);
2215
2216template <>
2217void InputParameters::addRequiredParam<MultiMooseEnum>(const std::string & name,
2218 const MultiMooseEnum & moose_enum,
2219 const std::string & doc_string);
2220
2221template <>
2222void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2223 const std::string & name,
2224 const std::vector<MooseEnum> & moose_enums,
2225 const std::string & doc_string);
2226
2227template <>
2228void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2229 const std::string & name,
2230 const std::vector<MultiMooseEnum> & moose_enums,
2231 const std::string & doc_string);
2232
2233template <>
2234void InputParameters::addParam<MooseEnum>(const std::string & /*name*/,
2235 const std::string & /*doc_string*/);
2236
2237template <>
2238void InputParameters::addParam<MultiMooseEnum>(const std::string & /*name*/,
2239 const std::string & /*doc_string*/);
2240
2241template <>
2242void InputParameters::addParam<std::vector<MooseEnum>>(const std::string & /*name*/,
2243 const std::string & /*doc_string*/);
2244
2245template <>
2246void InputParameters::addParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2247 const std::string & /*doc_string*/);
2248
2249template <>
2250void
2251InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2252 const std::string & /*doc_string*/);
2253
2254template <>
2255void InputParameters::addPrivateParam<MooseEnum>(const std::string & /*name*/);
2256
2257template <>
2258void InputParameters::addPrivateParam<MultiMooseEnum>(const std::string & /*name*/);
2259
2260template <>
2261void InputParameters::addDeprecatedParam<MooseEnum>(const std::string & /*name*/,
2262 const std::string & /*doc_string*/,
2263 const std::string & /*deprecation_message*/);
2264
2265template <>
2266void
2267InputParameters::addDeprecatedParam<MultiMooseEnum>(const std::string & /*name*/,
2268 const std::string & /*doc_string*/,
2269 const std::string & /*deprecation_message*/);
2270
2271template <>
2272void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2273 const std::string & /*name*/,
2274 const std::string & /*doc_string*/,
2275 const std::string & /*deprecation_message*/);
2276
2277// Forward declare specializations for setParamHelper
2278template <>
2279void InputParameters::setParamHelper<PostprocessorName, Real>(const std::string & name,
2280 PostprocessorName & l_value,
2281 const Real & r_value);
2282
2283template <>
2284void InputParameters::setParamHelper<PostprocessorName, int>(const std::string & name,
2285 PostprocessorName & l_value,
2286 const int & r_value);
2287
2288template <>
2289void InputParameters::setParamHelper<FunctionName, Real>(const std::string & /*name*/,
2290 FunctionName & l_value,
2291 const Real & r_value);
2292
2293template <>
2294void InputParameters::setParamHelper<FunctionName, int>(const std::string & /*name*/,
2295 FunctionName & l_value,
2296 const int & r_value);
2297
2298template <>
2299void InputParameters::setParamHelper<MaterialPropertyName, Real>(const std::string & /*name*/,
2300 MaterialPropertyName & l_value,
2301 const Real & r_value);
2302
2303template <>
2304void InputParameters::setParamHelper<MaterialPropertyName, int>(const std::string & /*name*/,
2305 MaterialPropertyName & l_value,
2306 const int & r_value);
2307
2308template <>
2309void InputParameters::setParamHelper<MooseFunctorName, Real>(const std::string & /*name*/,
2310 MooseFunctorName & l_value,
2311 const Real & r_value);
2312
2313template <>
2314void InputParameters::setParamHelper<MooseFunctorName, int>(const std::string & /*name*/,
2315 MooseFunctorName & l_value,
2316 const int & r_value);
2317
2318template <typename T>
2319const T *
2320InputParameters::queryParam(const std::string & name) const
2321{
2322 return have_parameter<T>(name) && isParamValid(name) ? &getParamHelper<T>(name, *this) : nullptr;
2323}
2324
2325template <typename T>
2326const T &
2327InputParameters::getParamHelper(const std::string & name_in, const InputParameters & pars)
2328{
2329 const auto & name = pars.checkForRename(name_in);
2330
2331 if (!pars.isParamValid(name))
2332 pars.mooseError("The parameter \"", name, "\" is being retrieved before being set.");
2333
2334 return pars.get<T>(name);
2335}
2336
2337// Declare specializations so we don't fall back on the generic
2338// implementation, but the definition will be in InputParameters.C so
2339// we won't need to bring in *MooseEnum header files here.
2340template <>
2341const MooseEnum & InputParameters::getParamHelper<MooseEnum>(const std::string & name,
2342 const InputParameters & pars);
2343
2344template <>
2346InputParameters::getParamHelper<MultiMooseEnum>(const std::string & name,
2347 const InputParameters & pars);
2348
2349template <typename R1, typename R2, typename V1, typename V2>
2350std::vector<std::pair<R1, R2>>
2351InputParameters::get(const std::string & param1_in, const std::string & param2_in) const
2352{
2353 const auto & param1 = checkForRename(param1_in);
2354 const auto & param2 = checkForRename(param2_in);
2355
2356 const auto & v1 = get<V1>(param1);
2357 const auto & v2 = get<V2>(param2);
2358
2359 auto controllable = getControllableParameters();
2360 if (controllable.count(param1) || controllable.count(param2))
2361 mooseError("Parameters ",
2362 param1,
2363 " and/or ",
2364 param2 + " are controllable parameters and cannot be retireved using "
2365 "the MooseObject::getParam/InputParameters::get methods for pairs");
2366
2367 if (v1.size() != v2.size())
2368 paramError(param1,
2369 "Vector parameters ",
2370 param1,
2371 "(size: ",
2372 v1.size(),
2373 ") and " + param2,
2374 "(size: ",
2375 v2.size(),
2376 ") are of different lengths \n");
2377
2378 std::vector<std::pair<R1, R2>> parameter_pairs;
2379 auto i1 = v1.begin();
2380 auto i2 = v2.begin();
2381 for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
2382 parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
2383 return parameter_pairs;
2384}
2385
2387
2388template <typename T>
2389bool
2390InputParameters::isType(const std::string & name_in) const
2391{
2392 const auto & name = checkForRename(name_in);
2393
2394 if (!_params.count(name))
2395 mooseError("Parameter \"", name, "\" is not valid.");
2396 return have_parameter<T>(name);
2397}
2398
2399template <typename T>
2400const T &
2401InputParameters::get(std::string_view name_in) const
2402{
2403 const std::string name_str(name_in);
2404 const auto & name = checkForRename(name_str);
2405
2406 return Parameters::get<T>(name);
2407}
2408
2409template <typename T>
2410bool
2411InputParameters::have_parameter(std::string_view name_in) const
2412{
2413 const std::string name_str(name_in);
2414 const auto & name = checkForRename(name_str);
2415
2416 return Parameters::have_parameter<T>(name);
2417}
2418
2419template <typename T>
2420void
2422 const std::string & name_in,
2423 const std::string & new_name,
2424 const std::string & new_description)
2425{
2426 const auto & name = source_params.checkForRename(name_in);
2427 const auto p_name = new_name.empty() ? name_in : new_name;
2428 if (!source_params.have_parameter<T>(name) && !source_params.hasCoupledVar(name))
2429 mooseError("The '",
2430 name_in,
2431 "' parameter could not be transferred because it does not exist with type '",
2432 MooseUtils::prettyCppType<T>(),
2433 "' in the source parameters");
2434 if (name != name_in)
2435 mooseWarning("The transferred parameter " + name_in + " is deprecated in favor of " + name +
2436 " in the source parameters. The new name should likely be used for the parameter "
2437 "transfer instead.");
2438 const std::string description =
2439 new_description.empty() ? source_params.getDescription(name) : new_description;
2440
2441 if (source_params.isParamRequired(name))
2442 {
2443 // Check for a variable parameter
2444 if (source_params.hasCoupledVar(name))
2445 addRequiredCoupledVar(p_name, description);
2446 // Enums parameters have a default list of options
2447 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2448 addRequiredParam<T>(p_name, source_params.get<T>(name), description);
2449 else if (source_params.isRangeChecked(name))
2450 addRequiredRangeCheckedParam<T>(
2451 p_name, source_params.rangeCheckedFunction(name), description);
2452 else
2453 addRequiredParam<T>(p_name, description);
2454 }
2455 else
2456 {
2457 // Check for a variable parameter
2458 if (source_params.hasCoupledVar(name))
2459 {
2460 if (!source_params.hasDefaultCoupledValue(name))
2461 addCoupledVar(p_name, description);
2462 else if (source_params.numberDefaultCoupledValues(name) == 1)
2463 addCoupledVar(p_name, source_params.defaultCoupledValue(name), description);
2464 else
2465 {
2466 std::vector<Real> coupled_values;
2467 for (const auto i : libMesh::make_range(source_params.numberDefaultCoupledValues(name)))
2468 coupled_values.push_back(source_params.defaultCoupledValue(name, i));
2469 addCoupledVar(p_name, coupled_values, description);
2470 }
2471 }
2472 else if (source_params.isRangeChecked(name))
2473 {
2474 if (source_params.hasDefault(name))
2475 addRangeCheckedParam<T>(p_name,
2476 source_params.get<T>(name),
2477 source_params.rangeCheckedFunction(name),
2478 description);
2479 else
2480 addRangeCheckedParam<T>(p_name, source_params.rangeCheckedFunction(name), description);
2481 }
2482 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2483 addParam<T>(p_name, source_params.get<T>(name), description);
2484 else
2485 {
2486 if (source_params.hasDefault(name))
2487 addParam<T>(p_name, source_params.get<T>(name), description);
2488 else
2489 addParam<T>(p_name, description);
2490 }
2491 }
2492
2493 // Copy other attributes
2494 if (source_params.isPrivate(name))
2495 _params[p_name]._is_private = true;
2496 if (source_params.isControllable(name))
2497 _params[p_name]._controllable = true;
2498}
2499
2500template <typename... Args>
2501[[noreturn]] void
2502InputParameters::mooseError(Args &&... args) const
2503{
2504 std::ostringstream oss;
2505 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2506 callMooseError(oss.str());
2507}
2508
2509template <typename... Args>
2510std::string
2511InputParameters::paramMessage(const std::string & param, Args... args) const
2512{
2513 std::ostringstream oss;
2514 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2515 return paramMessagePrefix(param) + oss.str();
2516}
2517
2518template <typename... Args>
2519[[noreturn]] void
2520InputParameters::paramError(const std::string & param, Args... args) const
2521{
2522 std::ostringstream oss;
2523 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2524 const auto [prefix, node] = paramMessageContext(param);
2525 callMooseError(prefix + oss.str(), false, node, /* show_trace = */ false);
2526}
2527
2528namespace Moose
2529{
2530namespace internal
2531{
2532template <typename T>
2533constexpr T *
2535{
2536 return nullptr;
2537}
2538
2539#ifdef MOOSE_MFEM_ENABLED
2540
2541template <typename T>
2542constexpr bool
2544{
2545 return std::is_same_v<T, MFEMScalarCoefficientName> ||
2546 std::is_same_v<T, MFEMVectorCoefficientName>;
2547}
2548
2549template <typename T, typename A>
2550constexpr bool
2552{
2553 return isMFEMFunctorNameTypeHelper(getNullptrExample<T>());
2554}
2555
2556#endif
2557
2558template <typename T>
2559constexpr bool
2561{
2562 return std::is_same_v<T, MooseFunctorName>
2563#ifdef MOOSE_MFEM_ENABLED
2564 || std::is_same_v<T, MFEMScalarCoefficientName>
2565#endif
2566 ;
2567}
2568
2569template <typename T, typename A>
2570constexpr bool
2572{
2573 return isScalarFunctorNameTypeHelper(getNullptrExample<T>());
2574}
2575
2576template <typename T>
2577constexpr bool
2579{
2580#ifdef MOOSE_MFEM_ENABLED
2581 return std::is_same_v<T, MFEMVectorCoefficientName>;
2582#else
2583 return false;
2584#endif
2585}
2586
2587template <typename T, typename A>
2588constexpr bool
2590{
2591 return isVectorFunctorNameTypeHelper(getNullptrExample<T>());
2592}
2593
2594template <typename T>
2595constexpr bool
2600}
2601}
2602
2603template <typename T>
2604constexpr bool
2606{
2607 return Moose::internal::isFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>());
2608}
2609
2610template <typename T>
2611std::string
2612InputParameters::appendFunctorDescription(const std::string & doc_string) const
2613{
2614 auto numeric_value_type = []()
2615 {
2617 Moose::internal::getNullptrExample<T>()))
2618 return "number";
2620 Moose::internal::getNullptrExample<T>()))
2621 return "numeric vector value (enclosed in curly braces)";
2622 else
2623 {
2624 mooseAssert(false, "We control instantiations of this method");
2625 return "";
2626 }
2627 };
2628
2629 return MooseUtils::trim(doc_string, ". ") + ". A functor is any of the following: a variable, " +
2630 (
2631#ifdef MOOSE_MFEM_ENABLED
2632 Moose::internal::isMFEMFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>())
2633 ? "an MFEM"
2634 :
2635#endif
2636 "a functor") +
2637 " material property, a function, a postprocessor or a " + numeric_value_type() + ".";
2638}
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
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.