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
1275 std::string varParamName() const;
1276
1284 void renameParam(const std::string & old_name,
1285 const std::string & new_name,
1286 const std::string & new_docstring);
1287
1294 void renameCoupledVar(const std::string & old_name,
1295 const std::string & new_name,
1296 const std::string & new_docstring);
1297
1298 void deprecateParam(const std::string & old_name,
1299 const std::string & new_name,
1300 const std::string & removal_date);
1301
1302 void deprecateCoupledVar(const std::string & old_name,
1303 const std::string & new_name,
1304 const std::string & removal_date);
1305
1312 const std::string & checkForRename(const std::string & name) const;
1313
1320 template <typename T>
1321 const T & get(std::string_view name) const;
1322
1331 template <typename T>
1332 bool have_parameter(std::string_view name) const;
1333
1341 template <typename T>
1342 void transferParam(const InputParameters & source_param,
1343 const std::string & name,
1344 const std::string & new_name = "",
1345 const std::string & new_description = "");
1346
1359 std::vector<std::string> paramAliases(const std::string & param_name) const;
1360
1365 const hit::Node * getHitNode() const { return _hit_node; }
1373 void setHitNode(const hit::Node & node, const SetHitNodeKey) { _hit_node = &node; }
1374
1378 bool isFinalized() const { return _finalized; }
1379
1383 std::optional<Moose::DataFileUtils::Path> queryDataFileNamePath(const std::string & name) const;
1384
1393 std::optional<std::string> setupVariableNames(std::vector<VariableName> & names,
1394 const hit::Node & node,
1396
1397private:
1398 // Private constructor so that InputParameters can only be created in certain places.
1400
1405
1406 template <typename T>
1407 static constexpr bool isFunctorNameType();
1408
1412 template <typename T>
1413 std::string appendFunctorDescription(const std::string & doc_string) const;
1414
1418 void setDeprecatedVarDocString(const std::string & new_name, const std::string & doc_string);
1419
1420 void renameParamInternal(const std::string & old_name,
1421 const std::string & new_name,
1422 const std::string & docstring,
1423 const std::string & removal_date);
1424
1425 void renameCoupledVarInternal(const std::string & old_name,
1426 const std::string & new_name,
1427 const std::string & docstring,
1428 const std::string & removal_date);
1429
1436 std::pair<std::string, const hit::Node *> paramMessageContext(const std::string & param) const;
1442 std::string paramMessagePrefix(const std::string & param) const;
1443
1445 {
1446 std::string _doc_string;
1448 std::string _doc_unit;
1450 std::string _custom_type;
1452 std::optional<CommandLineMetadata> _cl_data;
1454 std::optional<Moose::DataFileUtils::Path> _data_file_name_path;
1456 std::string _group;
1458 std::string _range_function;
1460 std::pair<std::string, std::string> _autobuild_vecs;
1462 bool _required = false;
1468 bool _valid = false;
1470 bool _is_private = false;
1473 std::vector<Real> _coupled_default = {0};
1475 bool _set_by_add_param = false;
1477 std::set<std::string> _reserved_values;
1481 const hit::Node * _hit_node;
1483 bool _controllable = false;
1485 std::set<ExecFlagType> _controllable_flags;
1487 bool _ignore = false;
1488 };
1489
1490 Metadata & at(const std::string & param_name)
1491 {
1492 const auto & param = checkForRename(param_name);
1493 if (_params.count(param) == 0)
1494 mooseError("param '", param, "' not present in InputParams");
1495 return _params[param];
1496 }
1497 const Metadata & at(const std::string & param_name) const
1498 {
1499 const auto & param = checkForRename(param_name);
1500 if (_params.count(param) == 0)
1501 mooseError("param '", param, "' not present in InputParams");
1502 return _params.at(param);
1503 }
1504
1514 void allowCopy(bool status) { _allow_copy = status; }
1515
1519 void checkParamName(const std::string & name) const;
1520
1525 template <typename T, typename S>
1526 void setParamHelper(const std::string & name, T & l_value, const S & r_value);
1527
1536 template <typename T>
1537 void addCommandLineParamHelper(const std::string & name,
1538 const std::string & syntax,
1539 const bool required,
1540 const bool value_required);
1541
1546 [[noreturn]] void callMooseError(std::string msg,
1547 const bool with_prefix = true,
1548 const hit::Node * node = nullptr,
1549 const bool show_trace = true) const;
1550
1553 std::map<std::string, Metadata> _params;
1554
1556 std::set<std::string> _coupled_vars;
1557
1561
1564 std::vector<std::string> _buildable_types;
1565
1570 std::vector<std::tuple<std::string,
1574
1578
1581
1585
1588
1590 std::unordered_map<std::string, std::string> _new_to_deprecated_coupled_vars;
1591
1596 std::map<std::string, std::pair<std::string, std::string>> _old_to_new_name_and_dep;
1597
1600 std::multimap<std::string, std::string> _new_to_old_names;
1601
1603 const hit::Node * _hit_node;
1604
1607
1608 // These are the only objects allowed to _create_ InputParameters
1611 friend class Parser;
1612 // for the printInputFile function in the action warehouse
1613 friend class ActionWarehouse;
1614};
1615
1616template <typename T>
1617void
1618InputParameters::setHelper(const std::string & /*name*/)
1619{
1620}
1621
1622// Template and inline function implementations
1623template <typename T>
1624T &
1625InputParameters::set(const std::string & name_in, bool quiet_mode)
1626{
1627 const auto & name = checkForRename(name_in);
1628
1629 checkParamName(name);
1630 checkConsistentType<T>(name);
1631
1632 T & result = this->Parameters::set<T>(name);
1633
1634 if (quiet_mode)
1635 _params[name]._set_by_add_param = true;
1636
1637 setHelper<T>(name);
1638
1639 return result;
1640}
1641
1642template <typename T, typename... Ts>
1643void
1644InputParameters::setParameters(const std::string & name,
1645 const T & value,
1646 Ts... extra_input_parameters)
1647{
1648 this->set<T>(name) = value;
1649 this->setParameters(extra_input_parameters...);
1650}
1651
1652template <typename T, typename UP_T>
1653std::optional<std::pair<bool, std::string>>
1654InputParameters::rangeCheck(const std::string & full_name,
1655 const std::string & short_name,
1656 const InputParameters::Parameter<std::vector<T>> & param,
1657 const bool include_param_path)
1658{
1659 if (!isParamValid(short_name))
1660 return {};
1661
1662 const auto & range_function = _params[short_name]._range_function;
1663 if (range_function.empty())
1664 return {};
1665
1678 std::vector<std::string> vars;
1679 if (fp.ParseAndDeduceVariables(range_function, vars) != -1) // -1 for success
1680 return {{false,
1681 "Error parsing expression '" + range_function + "' for parameter " + short_name + ""}};
1682
1683 // Fparser parameter buffer
1684 std::vector<UP_T> parbuf(vars.size());
1685
1686 // parameter vector
1687 const std::vector<T> & value = param.get();
1688
1689 // iterate over all vector values (maybe ;)
1690 bool need_to_iterate = false;
1691 unsigned int i = 0;
1692 do
1693 {
1694 // set parameters
1695 for (unsigned int j = 0; j < vars.size(); j++)
1696 {
1697 if (vars[j] == short_name)
1698 {
1699 if (value.size() == 0)
1700 {
1701 std::ostringstream oss;
1702 oss << "Range checking empty vector";
1703 if (include_param_path)
1704 oss << " parameter " << full_name;
1705 oss << "; expression = '" << range_function << "'";
1706 return {{true, oss.str()}};
1707 }
1708
1709 parbuf[j] = value[i];
1710 need_to_iterate = true;
1711 }
1712 else if (vars[j] == short_name + "_size")
1713 parbuf[j] = value.size();
1714 else
1715 {
1716 if (vars[j].substr(0, short_name.size() + 1) != short_name + "_")
1717 return {{false, "Error parsing expression '" + range_function + "'"}};
1718 std::istringstream iss(vars[j]);
1719 iss.seekg(short_name.size() + 1);
1720
1721 size_t index;
1722 if (iss >> index && iss.eof())
1723 {
1724 if (index >= value.size())
1725 {
1726 std::ostringstream oss;
1727 oss << "Error parsing expression '" + range_function + "'";
1728 if (include_param_path)
1729 oss << " for parameter " << full_name;
1730 oss << "; out of range variable '" + vars[j] << "'";
1731 return {{true, oss.str()}};
1732 }
1733 parbuf[j] = value[index];
1734 }
1735 else
1736 return {{false,
1737 "Error parsing expression '" + range_function + "'; invalid variable '" +
1738 vars[j] + "'"}};
1739 }
1740 }
1741
1742 // ensure range-checked input file parameter comparison functions
1743 // do absolute floating point comparisons instead of using a default epsilon.
1744 auto tmp_eps = fp.epsilon();
1745 fp.setEpsilon(0);
1746 UP_T result = fp.Eval(&parbuf[0]);
1747 fp.setEpsilon(tmp_eps);
1748
1749 // test function using the parameters determined above
1750 if (fp.EvalError())
1751 return {{false, "Error evaluating expression '" + range_function + "'"}};
1752
1753 if (!result)
1754 {
1755 std::ostringstream oss;
1756 oss << "Range check failed";
1757 if (include_param_path)
1758 oss << " for parameter " << full_name;
1759 oss << "; expression = '" << range_function << "'";
1760 if (need_to_iterate)
1761 oss << ", component " << i;
1762 return {{true, oss.str()}};
1763 }
1764
1765 } while (need_to_iterate && ++i < value.size());
1766
1767 return {};
1768}
1769
1770template <typename T, typename UP_T>
1771std::optional<std::pair<bool, std::string>>
1772InputParameters::rangeCheck(const std::string & full_name,
1773 const std::string & short_name,
1774 const InputParameters::Parameter<T> & param,
1775 const bool include_param_path)
1776{
1777 if (!isParamValid(short_name))
1778 return {};
1779
1780 const auto & range_function = _params[short_name]._range_function;
1781 if (range_function.empty())
1782 return {};
1783
1784 // Parse the expression
1786 if (fp.Parse(range_function, short_name) != -1) // -1 for success
1787 return {{false,
1788 "Error parsing expression '" + range_function + "'" + " for parameter " + short_name}};
1789
1790 // ensure range-checked input file parameter comparison functions
1791 // do absolute floating point comparisons instead of using a default epsilon.
1792 auto tmp_eps = fp.epsilon();
1793 fp.setEpsilon(0);
1794 // We require a non-const value for the implicit upscaling of the parameter type
1795 std::vector<UP_T> value(1, param.get());
1796 UP_T result = fp.Eval(&value[0]);
1797 fp.setEpsilon(tmp_eps);
1798
1799 if (fp.EvalError())
1800 return {{true,
1801 "Error evaluating expression '" + range_function + "' for parameter " + short_name +
1802 "; perhaps you used the wrong variable name?"}};
1803
1804 if (!result)
1805 {
1806 std::ostringstream oss;
1807 oss << "Range check failed";
1808 if (include_param_path)
1809 oss << " for parameter " << full_name;
1810 oss << "; expression = '" << range_function << "', value = " << value[0];
1811 return {{true, oss.str()}};
1812 }
1813
1814 return {};
1815}
1816
1817template <typename T>
1818T
1820 const std::string & error_string) const
1821{
1822 const auto & name = checkForRename(name_in);
1823
1824 T param = this->get<T>(name);
1825
1826 // Note: You will receive a compile error on this line if you attempt to pass a non-pointer
1827 // template type to this method
1828 if (!param)
1829 mooseError("Parameter ", name, " is NULL.\n", error_string);
1830 return param;
1831}
1832
1833template <typename T>
1834void
1835InputParameters::addRequiredParam(const std::string & name, const std::string & doc_string)
1836{
1837 checkParamName(name);
1838 checkConsistentType<T>(name);
1839
1840 InputParameters::insert<T>(name);
1841 auto & metadata = _params[name];
1842 metadata._required = true;
1843 if constexpr (isFunctorNameType<T>())
1844 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1845 else
1846 metadata._doc_string = doc_string;
1847}
1848
1849template <typename T>
1850void
1851InputParameters::addRequiredParam(const std::string & /*name*/,
1852 const T & /*value*/,
1853 const std::string & /*doc_string*/)
1854{
1855 mooseError("You cannot call addRequiredParam and supply a default value for this type, please "
1856 "use addParam instead");
1857}
1858
1859template <typename T, typename S>
1860void
1861InputParameters::addParam(const std::string & name, const S & value, const std::string & doc_string)
1862{
1863 checkParamName(name);
1864 checkConsistentType<T>(name);
1865
1866 T & l_value = InputParameters::set<T>(name);
1867 auto & metadata = _params[name];
1868 if constexpr (isFunctorNameType<T>())
1869 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1870 else
1871 metadata._doc_string = doc_string;
1872
1873 // Set the parameter now
1874 setParamHelper(name, l_value, value);
1875
1876 /* Indicate the default value, as set via addParam, is being used. The parameter is removed from
1877 the list whenever
1878 it changes, see set_attributes */
1879 metadata._set_by_add_param = true;
1880}
1881
1882template <typename T>
1883void
1884InputParameters::addParam(const std::string & name, const std::string & doc_string)
1885{
1886 checkParamName(name);
1887 checkConsistentType<T>(name);
1888
1889 InputParameters::insert<T>(name);
1890 if constexpr (isFunctorNameType<T>())
1891 _params[name]._doc_string = appendFunctorDescription<T>(doc_string);
1892 else
1893 _params[name]._doc_string = doc_string;
1894}
1895
1896template <typename T, typename S>
1897void
1898InputParameters::setParamHelper(const std::string & /*name*/, T & l_value, const S & r_value)
1899{
1900 l_value = r_value;
1901}
1902
1903template <typename T>
1904void
1906 const std::string & syntax,
1907 const bool required,
1908 const bool value_required)
1909{
1911 "This type is not a supported command line parameter type. See "
1912 "CommandLine::populateCommandLineParams to add it as a supported type.");
1913
1914 auto & cl_data = at(name)._cl_data;
1915 cl_data = CommandLineMetadata();
1916
1917 // Split up the syntax by whitespace
1918 std::vector<std::string> syntax_split;
1919 MooseUtils::tokenize(syntax, syntax_split, 1, " \t\n\v\f\r");
1920
1921 // Set the single syntax string as the combined syntax with removed whitespace
1922 cl_data->syntax = MooseUtils::stringJoin(syntax_split);
1923 mooseAssert(cl_data->syntax.size(), "Empty token");
1924
1925 // Set the switches; only parse those that begin with "-" as we also
1926 // provide examples within the syntax
1927 for (const auto & val : syntax_split)
1928 if (val.rfind("-", 0) == 0)
1929 {
1930 if (!std::regex_search(val, std::regex("^\\-+[a-zA-Z]")))
1931 mooseError("The switch '",
1932 val,
1933 "' for the command line parameter '",
1934 name,
1935 "' is invalid. It must begin with an alphabetical character.");
1936
1937 cl_data->switches.push_back(val);
1939 }
1940
1941 cl_data->required = required;
1942 cl_data->global = false;
1943
1944 // No arguments needed for a boolean parameter
1945 if constexpr (std::is_same_v<T, bool>)
1946 {
1947 (void)value_required; // purposely unused; doesn't take a value
1948 cl_data->argument_type = CommandLineMetadata::ArgumentType::NONE;
1949 }
1950 // MooseEnums require a value
1951 else if constexpr (std::is_same_v<T, MooseEnum>)
1952 {
1953 (void)value_required; // purposely unused; always required
1954 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1955 }
1956 // The user didn't specify a default, so a value is required
1957 else if (value_required)
1958 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1959 // Otherwise, it's optional (user specified a default)
1960 else
1961 cl_data->argument_type = CommandLineMetadata::ArgumentType::OPTIONAL;
1962}
1963
1964template <typename T>
1965void
1967 const std::string & parsed_function,
1968 const std::string & doc_string)
1969{
1970 addRequiredParam<T>(name, doc_string);
1971 _params[name]._range_function = parsed_function;
1972}
1973
1974template <typename T>
1975void
1977 const T & value,
1978 const std::string & parsed_function,
1979 const std::string & doc_string)
1980{
1981 addParam<T>(name, value, doc_string);
1982 _params[name]._range_function = parsed_function;
1983}
1984
1985template <typename T>
1986void
1988 const std::string & parsed_function,
1989 const std::string & doc_string)
1990{
1991 addParam<T>(name, doc_string);
1992 _params[name]._range_function = parsed_function;
1993}
1994
1995template <typename T>
1996void
1998 const std::string & custom_type,
1999 const std::string & doc_string)
2000{
2001 addRequiredParam<T>(name, doc_string);
2002 _params[name]._custom_type = custom_type;
2003}
2004
2005template <typename T>
2006void
2008 const T & value,
2009 const std::string & custom_type,
2010 const std::string & doc_string)
2011{
2012 addParam<T>(name, value, doc_string);
2013 _params[name]._custom_type = custom_type;
2014}
2015
2016template <typename T>
2017void
2019 const std::string & custom_type,
2020 const std::string & doc_string)
2021{
2022 addParam<T>(name, doc_string);
2023 _params[name]._custom_type = custom_type;
2024}
2025
2026template <typename T>
2027void
2029 const std::string & custom_type,
2030 const std::string & doc_string,
2031 const std::string & deprecation_message)
2032{
2034 addParam<T>(name, doc_string);
2035 auto & metadata = _params[name];
2036 metadata._custom_type = custom_type;
2037
2038 metadata._deprecation_message = deprecation_message;
2040}
2041
2042template <typename T>
2043void
2044InputParameters::addPrivateParam(const std::string & name)
2045{
2046 checkParamName(name);
2047 checkConsistentType<T>(name);
2048
2049 InputParameters::insert<T>(name);
2050 _params[name]._is_private = true;
2051}
2052
2053template <typename T>
2054void
2055InputParameters::addPrivateParam(const std::string & name, const T & value)
2056{
2057 checkParamName(name);
2058 checkConsistentType<T>(name);
2059
2060 InputParameters::set<T>(name) = value;
2061 auto & metadata = _params[name];
2062 metadata._is_private = true;
2063 metadata._set_by_add_param = true;
2064}
2065
2066template <typename T>
2067void
2069 const std::string & syntax,
2070 const std::string & doc_string)
2071{
2072 static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool");
2073
2074 addRequiredParam<T>(name, doc_string);
2075 addCommandLineParamHelper<T>(name, syntax, /* required = */ true, /* value_required = */ true);
2076}
2077
2078template <typename T>
2079void
2081 const std::string & syntax,
2082 const std::string & doc_string)
2083{
2084 static_assert(!std::is_same_v<T, MooseEnum>,
2085 "addCommandLineParam() without a value cannot be used with a MooseEnum because a "
2086 "MooseEnum requires initialization");
2087
2088 auto constexpr is_bool = std::is_same_v<T, bool>;
2089 if constexpr (is_bool)
2090 addParam<T>(name, false, doc_string);
2091 else
2092 addParam<T>(name, doc_string);
2093
2094 addCommandLineParamHelper<T>(
2095 name, syntax, /* required = */ false, /* value_required = */ !is_bool);
2096}
2097
2098template <typename T>
2099void
2101 const std::string & syntax,
2102 const T & value,
2103 const std::string & doc_string)
2104{
2105 if constexpr (std::is_same_v<T, bool>)
2106 mooseAssert(!value, "Default for bool must be false");
2107
2108 addParam<T>(name, value, doc_string);
2109 addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ true);
2110}
2111
2112template <typename T>
2113void
2115 const std::string & syntax,
2116 const T & value,
2117 const std::string & doc_string)
2118{
2119 mooseAssert(name == "citations" || name == "csg_only" || name == "mesh_only" ||
2120 name == "recover" || name == "run",
2121 "Not supported for new parameters");
2122 static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool (does not take a value)");
2123 addParam<T>(name, value, doc_string);
2124 addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ false);
2125}
2126
2127template <typename T>
2128void
2129InputParameters::checkConsistentType(const std::string & name_in) const
2130{
2131 const auto & name = checkForRename(name_in);
2132
2133 // If we don't currently have the Parameter, can't be any inconsistency
2135 if (it == _values.end())
2136 return;
2137
2138 // Now, if we already have the Parameter, but it doesn't have the
2139 // right type, throw an error.
2140 if (!this->Parameters::have_parameter<T>(name))
2141 mooseError("Attempting to set parameter \"",
2142 name,
2143 "\" with type (",
2144 libMesh::demangle(typeid(T).name()),
2145 ")\nbut the parameter already exists as type (",
2146 it->second->type(),
2147 ")");
2148}
2149
2150template <typename T>
2151void
2152InputParameters::suppressParameter(const std::string & name_in)
2153{
2154 const auto & name = checkForRename(name_in);
2155 if (!this->have_parameter<T>(name))
2156 mooseError("Unable to suppress nonexistent parameter: ", name);
2157
2158 auto & metadata = _params[name];
2159 metadata._required = false;
2160 metadata._is_private = true;
2161 metadata._controllable = false;
2162}
2163
2164template <typename T>
2165void
2166InputParameters::ignoreParameter(const std::string & name_in)
2167{
2168 const auto & name = checkForRename(name_in);
2169 suppressParameter<T>(name);
2170 _params[name]._ignore = true;
2171}
2172
2173template <typename T>
2174void
2175InputParameters::makeParamRequired(const std::string & name_in)
2176{
2177 const auto & name = checkForRename(name_in);
2178
2179 if (!this->have_parameter<T>(name))
2180 mooseError("Unable to require nonexistent parameter: ", name);
2181
2182 _params[name]._required = true;
2183}
2184
2185template <typename T>
2186void
2187InputParameters::makeParamNotRequired(const std::string & name_in)
2188{
2189 const auto & name = checkForRename(name_in);
2190
2191 if (!this->have_parameter<T>(name))
2192 mooseError("Unable to un-require nonexistent parameter: ", name);
2193
2194 _params[name]._required = false;
2195}
2196
2197template <typename T>
2198void
2200 const T & value,
2201 const std::string & doc_string,
2202 const std::string & deprecation_message)
2203{
2205 mooseAssert(!_old_to_new_name_and_dep.count(name),
2206 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2207 << name << "', already deprecated via deprecateParam or renamed via renameParam");
2208 addParam<T>(name, value, doc_string);
2209
2210 _params[name]._deprecation_message = deprecation_message;
2212}
2213
2214template <typename T>
2215void
2217 const std::string & doc_string,
2218 const std::string & deprecation_message)
2219{
2221 mooseAssert(!_old_to_new_name_and_dep.count(name),
2222 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2223 << name << "', already deprecated via deprecateParam or renamed via renameParam");
2224 addParam<T>(name, doc_string);
2225
2226 _params[name]._deprecation_message = deprecation_message;
2228}
2229
2230// Forward declare MooseEnum specializations for add*Param
2231template <>
2232void InputParameters::addRequiredParam<MooseEnum>(const std::string & name,
2233 const MooseEnum & moose_enum,
2234 const std::string & doc_string);
2235
2236template <>
2237void InputParameters::addRequiredParam<MultiMooseEnum>(const std::string & name,
2238 const MultiMooseEnum & moose_enum,
2239 const std::string & doc_string);
2240
2241template <>
2242void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2243 const std::string & name,
2244 const std::vector<MooseEnum> & moose_enums,
2245 const std::string & doc_string);
2246
2247template <>
2248void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2249 const std::string & name,
2250 const std::vector<MultiMooseEnum> & moose_enums,
2251 const std::string & doc_string);
2252
2253template <>
2254void InputParameters::addParam<MooseEnum>(const std::string & /*name*/,
2255 const std::string & /*doc_string*/);
2256
2257template <>
2258void InputParameters::addParam<MultiMooseEnum>(const std::string & /*name*/,
2259 const std::string & /*doc_string*/);
2260
2261template <>
2262void InputParameters::addParam<std::vector<MooseEnum>>(const std::string & /*name*/,
2263 const std::string & /*doc_string*/);
2264
2265template <>
2266void InputParameters::addParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2267 const std::string & /*doc_string*/);
2268
2269template <>
2270void
2271InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2272 const std::string & /*doc_string*/);
2273
2274template <>
2275void InputParameters::addPrivateParam<MooseEnum>(const std::string & /*name*/);
2276
2277template <>
2278void InputParameters::addPrivateParam<MultiMooseEnum>(const std::string & /*name*/);
2279
2280template <>
2281void InputParameters::addDeprecatedParam<MooseEnum>(const std::string & /*name*/,
2282 const std::string & /*doc_string*/,
2283 const std::string & /*deprecation_message*/);
2284
2285template <>
2286void
2287InputParameters::addDeprecatedParam<MultiMooseEnum>(const std::string & /*name*/,
2288 const std::string & /*doc_string*/,
2289 const std::string & /*deprecation_message*/);
2290
2291template <>
2292void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2293 const std::string & /*name*/,
2294 const std::string & /*doc_string*/,
2295 const std::string & /*deprecation_message*/);
2296
2297// Forward declare specializations for setParamHelper
2298template <>
2299void InputParameters::setParamHelper<PostprocessorName, Real>(const std::string & name,
2300 PostprocessorName & l_value,
2301 const Real & r_value);
2302
2303template <>
2304void InputParameters::setParamHelper<PostprocessorName, int>(const std::string & name,
2305 PostprocessorName & l_value,
2306 const int & r_value);
2307
2308template <>
2309void InputParameters::setParamHelper<FunctionName, Real>(const std::string & /*name*/,
2310 FunctionName & l_value,
2311 const Real & r_value);
2312
2313template <>
2314void InputParameters::setParamHelper<FunctionName, int>(const std::string & /*name*/,
2315 FunctionName & l_value,
2316 const int & r_value);
2317
2318template <>
2319void InputParameters::setParamHelper<MaterialPropertyName, Real>(const std::string & /*name*/,
2320 MaterialPropertyName & l_value,
2321 const Real & r_value);
2322
2323template <>
2324void InputParameters::setParamHelper<MaterialPropertyName, int>(const std::string & /*name*/,
2325 MaterialPropertyName & l_value,
2326 const int & r_value);
2327
2328template <>
2329void InputParameters::setParamHelper<MooseFunctorName, Real>(const std::string & /*name*/,
2330 MooseFunctorName & l_value,
2331 const Real & r_value);
2332
2333template <>
2334void InputParameters::setParamHelper<MooseFunctorName, int>(const std::string & /*name*/,
2335 MooseFunctorName & l_value,
2336 const int & r_value);
2337
2338template <typename T>
2339const T *
2340InputParameters::queryParam(const std::string & name) const
2341{
2342 return have_parameter<T>(name) && isParamValid(name) ? &getParamHelper<T>(name, *this) : nullptr;
2343}
2344
2345template <typename T>
2346const T &
2347InputParameters::getParamHelper(const std::string & name_in, const InputParameters & pars)
2348{
2349 const auto & name = pars.checkForRename(name_in);
2350
2351 if (!pars.isParamValid(name))
2352 pars.mooseError("The parameter \"", name, "\" is being retrieved before being set.");
2353
2354 return pars.get<T>(name);
2355}
2356
2357// Declare specializations so we don't fall back on the generic
2358// implementation, but the definition will be in InputParameters.C so
2359// we won't need to bring in *MooseEnum header files here.
2360template <>
2361const MooseEnum & InputParameters::getParamHelper<MooseEnum>(const std::string & name,
2362 const InputParameters & pars);
2363
2364template <>
2366InputParameters::getParamHelper<MultiMooseEnum>(const std::string & name,
2367 const InputParameters & pars);
2368
2369template <typename R1, typename R2, typename V1, typename V2>
2370std::vector<std::pair<R1, R2>>
2371InputParameters::get(const std::string & param1_in, const std::string & param2_in) const
2372{
2373 const auto & param1 = checkForRename(param1_in);
2374 const auto & param2 = checkForRename(param2_in);
2375
2376 const auto & v1 = get<V1>(param1);
2377 const auto & v2 = get<V2>(param2);
2378
2379 auto controllable = getControllableParameters();
2380 if (controllable.count(param1) || controllable.count(param2))
2381 mooseError("Parameters ",
2382 param1,
2383 " and/or ",
2384 param2 + " are controllable parameters and cannot be retireved using "
2385 "the MooseObject::getParam/InputParameters::get methods for pairs");
2386
2387 if (v1.size() != v2.size())
2388 paramError(param1,
2389 "Vector parameters ",
2390 param1,
2391 "(size: ",
2392 v1.size(),
2393 ") and " + param2,
2394 "(size: ",
2395 v2.size(),
2396 ") are of different lengths \n");
2397
2398 std::vector<std::pair<R1, R2>> parameter_pairs;
2399 auto i1 = v1.begin();
2400 auto i2 = v2.begin();
2401 for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
2402 parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
2403 return parameter_pairs;
2404}
2405
2407
2408template <typename T>
2409bool
2410InputParameters::isType(const std::string & name_in) const
2411{
2412 const auto & name = checkForRename(name_in);
2413
2414 if (!_params.count(name))
2415 mooseError("Parameter \"", name, "\" is not valid.");
2416 return have_parameter<T>(name);
2417}
2418
2419template <typename T>
2420const T &
2421InputParameters::get(std::string_view name_in) const
2422{
2423 const std::string name_str(name_in);
2424 const auto & name = checkForRename(name_str);
2425
2426 return Parameters::get<T>(name);
2427}
2428
2429template <typename T>
2430bool
2431InputParameters::have_parameter(std::string_view name_in) const
2432{
2433 const std::string name_str(name_in);
2434 const auto & name = checkForRename(name_str);
2435
2436 return Parameters::have_parameter<T>(name);
2437}
2438
2439template <typename T>
2440void
2442 const std::string & name_in,
2443 const std::string & new_name,
2444 const std::string & new_description)
2445{
2446 const auto & name = source_params.checkForRename(name_in);
2447 const auto p_name = new_name.empty() ? name_in : new_name;
2448 if (!source_params.have_parameter<T>(name) && !source_params.hasCoupledVar(name))
2449 mooseError("The '",
2450 name_in,
2451 "' parameter could not be transferred because it does not exist with type '",
2452 MooseUtils::prettyCppType<T>(),
2453 "' in the source parameters");
2454 if (name != name_in)
2455 mooseWarning("The transferred parameter " + name_in + " is deprecated in favor of " + name +
2456 " in the source parameters. The new name should likely be used for the parameter "
2457 "transfer instead.");
2458 const std::string description =
2459 new_description.empty() ? source_params.getDescription(name) : new_description;
2460
2461 if (source_params.isParamRequired(name))
2462 {
2463 // Check for a variable parameter
2464 if (source_params.hasCoupledVar(name))
2465 addRequiredCoupledVar(p_name, description);
2466 // Enums parameters have a default list of options
2467 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2468 addRequiredParam<T>(p_name, source_params.get<T>(name), description);
2469 else if (source_params.isRangeChecked(name))
2470 addRequiredRangeCheckedParam<T>(
2471 p_name, source_params.rangeCheckedFunction(name), description);
2472 else
2473 addRequiredParam<T>(p_name, description);
2474 }
2475 else
2476 {
2477 // Check for a variable parameter
2478 if (source_params.hasCoupledVar(name))
2479 {
2480 if (!source_params.hasDefaultCoupledValue(name))
2481 addCoupledVar(p_name, description);
2482 else if (source_params.numberDefaultCoupledValues(name) == 1)
2483 addCoupledVar(p_name, source_params.defaultCoupledValue(name), description);
2484 else
2485 {
2486 std::vector<Real> coupled_values;
2487 for (const auto i : libMesh::make_range(source_params.numberDefaultCoupledValues(name)))
2488 coupled_values.push_back(source_params.defaultCoupledValue(name, i));
2489 addCoupledVar(p_name, coupled_values, description);
2490 }
2491 }
2492 else if (source_params.isRangeChecked(name))
2493 {
2494 if (source_params.hasDefault(name))
2495 addRangeCheckedParam<T>(p_name,
2496 source_params.get<T>(name),
2497 source_params.rangeCheckedFunction(name),
2498 description);
2499 else
2500 addRangeCheckedParam<T>(p_name, source_params.rangeCheckedFunction(name), description);
2501 }
2502 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2503 addParam<T>(p_name, source_params.get<T>(name), description);
2504 else
2505 {
2506 if (source_params.hasDefault(name))
2507 addParam<T>(p_name, source_params.get<T>(name), description);
2508 else
2509 addParam<T>(p_name, description);
2510 }
2511 }
2512
2513 // Copy other attributes
2514 if (source_params.isPrivate(name))
2515 _params[p_name]._is_private = true;
2516 if (source_params.isControllable(name))
2517 _params[p_name]._controllable = true;
2518}
2519
2520template <typename... Args>
2521[[noreturn]] void
2522InputParameters::mooseError(Args &&... args) const
2523{
2524 std::ostringstream oss;
2525 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2526 callMooseError(oss.str());
2527}
2528
2529template <typename... Args>
2530std::string
2531InputParameters::paramMessage(const std::string & param, Args... args) const
2532{
2533 std::ostringstream oss;
2534 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2535 return paramMessagePrefix(param) + oss.str();
2536}
2537
2538template <typename... Args>
2539[[noreturn]] void
2540InputParameters::paramError(const std::string & param, Args... args) const
2541{
2542 std::ostringstream oss;
2543 moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2544 const auto [prefix, node] = paramMessageContext(param);
2545 callMooseError(prefix + oss.str(), false, node, /* show_trace = */ false);
2546}
2547
2548namespace Moose
2549{
2550namespace internal
2551{
2552template <typename T>
2553constexpr T *
2555{
2556 return nullptr;
2557}
2558
2559#ifdef MOOSE_MFEM_ENABLED
2560
2561template <typename T>
2562constexpr bool
2564{
2565 return std::is_same_v<T, MFEMScalarCoefficientName> ||
2566 std::is_same_v<T, MFEMVectorCoefficientName>;
2567}
2568
2569template <typename T, typename A>
2570constexpr bool
2572{
2573 return isMFEMFunctorNameTypeHelper(getNullptrExample<T>());
2574}
2575
2576#endif
2577
2578template <typename T>
2579constexpr bool
2581{
2582 return std::is_same_v<T, MooseFunctorName>
2583#ifdef MOOSE_MFEM_ENABLED
2584 || std::is_same_v<T, MFEMScalarCoefficientName>
2585#endif
2586 ;
2587}
2588
2589template <typename T, typename A>
2590constexpr bool
2592{
2593 return isScalarFunctorNameTypeHelper(getNullptrExample<T>());
2594}
2595
2596template <typename T>
2597constexpr bool
2599{
2600#ifdef MOOSE_MFEM_ENABLED
2601 return std::is_same_v<T, MFEMVectorCoefficientName>;
2602#else
2603 return false;
2604#endif
2605}
2606
2607template <typename T, typename A>
2608constexpr bool
2610{
2611 return isVectorFunctorNameTypeHelper(getNullptrExample<T>());
2612}
2613
2614template <typename T>
2615constexpr bool
2620}
2621}
2622
2623template <typename T>
2624constexpr bool
2626{
2627 return Moose::internal::isFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>());
2628}
2629
2630template <typename T>
2631std::string
2632InputParameters::appendFunctorDescription(const std::string & doc_string) const
2633{
2634 auto numeric_value_type = []()
2635 {
2637 Moose::internal::getNullptrExample<T>()))
2638 return "number";
2640 Moose::internal::getNullptrExample<T>()))
2641 return "numeric vector value (enclosed in curly braces)";
2642 else
2643 {
2644 mooseAssert(false, "We control instantiations of this method");
2645 return "";
2646 }
2647 };
2648
2649 return MooseUtils::trim(doc_string, ". ") + ". A functor is any of the following: a variable, " +
2650 (
2651#ifdef MOOSE_MFEM_ENABLED
2652 Moose::internal::isMFEMFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>())
2653 ? "an MFEM"
2654 :
2655#endif
2656 "a functor") +
2657 " material property, a function, a postprocessor or a " + numeric_value_type() + ".";
2658}
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::string varParamName() const
Determine which parameter specifies the variable(s) of an object.
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.