21 #include "libmesh/utility.h" 22 #include "libmesh/simple_range.h" 25 #include "hit/parse.h" 39 _collapse_nesting(false),
40 _moose_object_syntax_visibility(true),
41 _show_deprecated_message(true),
49 : Parameters(), _show_deprecated_message(true), _allow_copy(true)
55 : _show_deprecated_message(true), _allow_copy(true)
100 metadata._set_by_add_param =
false;
103 if (!have_parameter<MooseEnum>(
name) && !have_parameter<MultiMooseEnum>(
name))
104 metadata._valid =
true;
108 std::optional<std::string>
114 auto deprecation_message = [
this](
const auto &
name,
const auto & message) -> std::string
118 return deprecation_message(
name,
119 "The parameter '" +
name +
"' is deprecated.\n" +
120 libmesh_map_find(
_params,
name)._deprecation_message);
123 return deprecation_message(name_in, it->second.second);
145 const std::string name_example =
type.size() ?
type :
"the " +
name +
" object";
146 const std::string type_example =
type.size() ?
type :
"MyObject";
148 "Copying of the InputParameters object for ",
150 " is not allowed.\n\nThe likely cause for this error ",
151 "is having a constructor that does not use a const reference, all constructors\nfor " 152 "MooseObject based classes should be as follows:\n\n",
157 "(const InputParameters & parameters);");
182 Parameters::operator+=(rhs);
186 for (
auto it = rhs.
_params.begin(); it != rhs.
_params.end(); ++it)
187 _params[it->first] = it->second;
207 const std::string & doc_string)
212 auto params_it =
_params.find(coupled_vars_it->second);
213 if (params_it ==
_params.end())
214 mooseError(
"There must have been a mistake in the construction of the new to deprecated " 215 "coupled vars map because the old name ",
216 coupled_vars_it->second,
217 " doesn't exist in the parameters data.");
219 params_it->second._doc_string = doc_string;
226 addParam<std::vector<VariableName>>(
name, doc_string);
229 metadata._coupled_default.assign(1,
value);
230 metadata._have_coupled_default =
true;
238 const std::vector<Real> & value,
239 const std::string & doc_string)
242 addParam<std::vector<VariableName>>(
name, doc_string);
245 metadata._coupled_default =
value;
246 metadata._have_coupled_default =
true;
255 addParam<std::vector<VariableName>>(
name, doc_string);
264 const std::string & new_name,
265 const std::string & removal_date )
272 auto params_it =
_params.find(new_name);
273 std::string doc_string;
274 if (params_it !=
_params.end())
275 doc_string = params_it->second._doc_string;
277 addParam<std::vector<VariableName>>(old_name, doc_string);
281 std::string deprecation_message =
282 "The coupled variable parameter '" + old_name +
"' has been deprecated";
283 if (!removal_date.empty())
284 deprecation_message +=
" and will be removed " + removal_date;
285 deprecation_message +=
". Please use the '" + new_name +
"' coupled variable parameter instead.";
286 _params[old_name]._deprecation_message = deprecation_message;
292 const std::string & base_name,
293 const std::string & num_name,
294 const std::string & doc_string)
296 addParam<std::vector<VariableName>>(
name, doc_string);
298 _params[
name]._autobuild_vecs = std::make_pair(base_name, num_name);
301 addParam<std::string>(base_name, doc_string +
" (base_name)");
302 addParam<unsigned int>(num_name, doc_string +
" (num_name)");
307 const std::string & base_name,
308 const std::string & num_name,
309 const std::string & doc_string)
311 addRequiredParam<std::vector<VariableName>>(
name, doc_string);
319 addRequiredParam<std::vector<VariableName>>(
name, doc_string);
328 std::string doc_string;
331 for (
const auto & ch : it->second._doc_string)
334 doc_string +=
" ... ";
349 mooseError(
"Unable to set the documentation string (using setDocString) for the \"",
351 "\" parameter, the parameter does not exist.");
352 it->second._doc_string = doc;
389 if (have_parameter<MooseEnum>(
name))
393 for (
auto it =
get<std::vector<MooseEnum>>(
name).
begin();
394 it != get<std::vector<MooseEnum>>(
name).
end();
400 else if (have_parameter<MultiMooseEnum>(
name))
401 return get<MultiMooseEnum>(
name).isValid();
404 for (
auto it =
get<std::vector<MultiMooseEnum>>(
name).
begin();
405 it != get<std::vector<MultiMooseEnum>>(
name).
end();
411 else if (have_parameter<ExecFlagEnum>(
name))
412 return get<ExecFlagEnum>(
name).isValid();
431 #ifdef MOOSE_KOKKOS_ENABLED 442 for (
const auto & it : *
this)
459 std::vector<std::string> names;
460 MooseUtils::tokenize<std::string>(input_names, names, 1,
" ");
461 for (
auto & name_in : names)
467 map_iter->second._controllable =
true;
473 "' does not exist, thus cannot be marked as controllable.");
484 const std::set<ExecFlagType> &
508 mooseError(
"InputParameters::getBase(): Parameters do not have base; one needs to be set with " 516 InputParameters::set<std::string>(
"_moose_warehouse_system_name") =
value;
517 _params[
"_moose_warehouse_system_name"]._is_private =
true;
523 mooseAssert(have_parameter<std::string>(
"_moose_warehouse_system_name"),
524 "SystemAttributeName is not available! Call 'registerSystemAttributeName' (usually " 525 "in the validParams function) before you try accessing it!");
526 return Parameters::get<std::string>(
"_moose_warehouse_system_name");
538 const std::string & name,
545 const std::vector<std::string> &
551 const std::vector<std::tuple<std::string,
583 #define checkMooseType(param_type, name) \ 584 if (have_parameter<param_type>(name) || have_parameter<std::vector<param_type>>(name)) \ 585 error = "non-controllable type '" + type(name) + "' for parameter '" + \ 586 paramFullpath(param_name) + "' marked controllable"; 594 std::vector<std::string> required_param_errors;
595 for (
const auto & it : *
this)
605 required_param_errors.push_back(
"missing required parameter '" + parampath +
"/" +
606 param_name +
"'\n\tDoc String: \"" +
611 if (required_param_errors.size())
615 for (
const auto & [
name, param_ptr] : *
this)
622 mooseError(
"For range checked parameter '" +
name +
"': " + error->second);
631 "private parameter '" +
paramFullpath(param_name) +
"' marked controllable");
633 std::optional<std::string> error;
634 checkMooseType(NonlinearVariableName, param_name);
635 checkMooseType(AuxVariableName, param_name);
636 checkMooseType(VariableName, param_name);
637 checkMooseType(BoundaryName, param_name);
638 checkMooseType(SubdomainName, param_name);
639 checkMooseType(PostprocessorName, param_name);
640 checkMooseType(VectorPostprocessorName, param_name);
641 checkMooseType(UserObjectName, param_name);
642 checkMooseType(MaterialPropertyName, param_name);
648 std::optional<std::pair<bool, std::string>>
650 const std::string & long_name,
651 const std::string & short_name,
652 const bool include_param_path)
654 #define dynamicCastRangeCheck(type, up_type, long_name, short_name) \ 657 if (const auto scalar_p = dynamic_cast<const InputParameters::Parameter<type> *>(&value)) \ 658 return rangeCheck<type, up_type>(long_name, short_name, *scalar_p, include_param_path); \ 659 if (const auto vector_p = \ 660 dynamic_cast<const InputParameters::Parameter<std::vector<type>> *>(&value)) \ 661 return rangeCheck<type, up_type>(long_name, short_name, *vector_p, include_param_path); \ 664 dynamicCastRangeCheck(
Real,
Real, long_name, short_name);
665 dynamicCastRangeCheck(
int,
long, long_name, short_name);
666 dynamicCastRangeCheck(
long,
long, long_name, short_name);
667 dynamicCastRangeCheck(
unsigned int,
long, long_name, short_name);
668 #undef dynamicCastRangeCheck 681 for (
const auto & name_value : *
this)
683 const auto & param_name = name_value.first;
684 const auto & param_value = name_value.second;
687 const auto set_filename = [&](
auto &
value)
689 constexpr
bool is_data_file_name =
690 std::is_same_v<std::decay_t<decltype(value)>, DataFileName>;
695 if constexpr (!is_data_file_name)
715 if constexpr (!is_data_file_name)
727 catch (std::exception & e)
736 #define set_if_filename(type) \ 737 else if (auto type_value = dynamic_cast<Parameters::Parameter<type> *>(param_value.get())) \ 738 set_filename(type_value->set()); \ 739 else if (auto type_values = dynamic_cast<Parameters::Parameter<std::vector<type>> *>( \ 740 param_value.get())) for (auto & value : type_values->set()) set_filename(value) 744 set_if_filename(FileName);
745 set_if_filename(FileNameNoExtension);
746 set_if_filename(MeshFileName);
747 set_if_filename(MatrixFileName);
748 set_if_filename(DataFileName);
749 #undef set_if_filename 755 std::filesystem::path
758 mooseAssert(!have_parameter<std::string>(
"_app_name"),
759 "Not currently setup to work with app FileName parameters");
761 const hit::Node * hit_node =
nullptr;
771 return std::filesystem::current_path();
774 while (hit_node && hit_node->filename() ==
"CLI_ARGS")
775 hit_node = hit_node->parent();
780 const std::string error =
"Input context was set via a command-line argument and does not have " 781 "sufficient context for determining a file path.";
788 return std::filesystem::absolute(std::filesystem::path(hit_node->filename()).parent_path());
795 return !
_params.find(
name)->second._range_function.empty();
815 mooseError(
"No way to know if the parameter '", param_name,
"' has a default");
834 const std::vector<VariableName> & values)
839 mooseError(
"Unable to set coupled variable parameter '",
841 "' because it was not added with addCoupledVar or addRequiredCoupledVar.");
843 set<std::vector<VariableName>>(actual_name) = values;
846 const std::vector<VariableName> &
852 mooseError(
"Unable to get coupled variable parameter '",
854 "' because it was not added with addCoupledVar or addRequiredCoupledVar.");
856 return get<std::vector<VariableName>>(actual_name);
862 return _params.count(coupling_name) > 0 &&
_params.at(coupling_name)._have_coupled_default &&
870 _params[actual_name]._coupled_default.resize(i + 1);
872 _params[actual_name]._have_coupled_default =
true;
878 auto value_it =
_params.find(coupling_name);
880 if (value_it ==
_params.end() || !value_it->second._have_coupled_default)
881 mooseError(
"Attempted to retrieve default value for coupled variable '",
883 "' when none was provided. \n\nThere are three reasons why this may have " 884 "occurred:\n 1. The other version of params.addCoupledVar() should be used in order " 885 "to provide a default value. \n 2. This should have been a required coupled " 886 "variable added with params.addRequiredCoupledVar() \n 3. The call to get the " 887 "coupled value should have been properly guarded with isCoupled()\n");
889 return value_it->second._coupled_default.at(i);
895 auto value_it =
_params.find(coupling_name);
897 mooseError(
"Attempted to retrieve default value for coupled variable '",
899 "' when none was provided.");
900 return value_it->second._coupled_default.size();
903 std::map<std::string, std::pair<std::string, std::string>>
906 std::map<std::string, std::pair<std::string, std::string>> abv;
909 if (!it->second._autobuild_vecs.first.empty())
910 abv[it->first] = it->second._autobuild_vecs;
923 return "std::vector<VariableName>";
935 if (have_parameter<VariableName>(
name))
936 var = get<VariableName>(
name);
937 else if (have_parameter<NonlinearVariableName>(
name))
938 var = get<NonlinearVariableName>(
name);
939 else if (have_parameter<LinearVariableName>(
name))
940 var = get<LinearVariableName>(
name);
941 else if (have_parameter<AuxVariableName>(
name))
942 var = get<AuxVariableName>(
name);
943 else if (have_parameter<PostprocessorName>(
name))
944 var = get<PostprocessorName>(
name);
945 else if (have_parameter<VectorPostprocessorName>(
name))
946 var = get<VectorPostprocessorName>(
name);
947 else if (have_parameter<FunctionName>(
name))
948 var = get<FunctionName>(
name);
949 else if (have_parameter<UserObjectName>(
name))
950 var = get<UserObjectName>(
name);
951 else if (have_parameter<MaterialPropertyName>(
name))
952 var = get<MaterialPropertyName>(
name);
953 else if (have_parameter<std::string>(
name))
954 var = get<std::string>(
name);
959 std::vector<std::string>
963 std::vector<std::string> svars;
967 std::vector<VariableName>
vars = get<std::vector<VariableName>>(
name);
968 std::copy(
vars.begin(),
vars.end(), std::back_inserter(svars));
972 std::vector<NonlinearVariableName>
vars = get<std::vector<NonlinearVariableName>>(
name);
973 std::copy(
vars.begin(),
vars.end(), std::back_inserter(svars));
977 std::vector<AuxVariableName>
vars = get<std::vector<AuxVariableName>>(
name);
978 std::copy(
vars.begin(),
vars.end(), std::back_inserter(svars));
982 std::vector<MaterialPropertyName>
vars = get<std::vector<MaterialPropertyName>>(
name);
983 std::copy(
vars.begin(),
vars.end(), std::back_inserter(svars));
987 std::vector<std::string>
vars = get<std::vector<std::string>>(
name);
988 std::copy(
vars.begin(),
vars.end(), std::back_inserter(svars));
1028 const std::string group_name)
1030 std::vector<std::string> elements;
1035 std::set<std::string> param_names;
1036 for (
const auto & it : *
this)
1037 param_names.insert(it.first);
1039 for (
const auto & param_name : elements)
1040 if (
_params.count(param_name) > 0)
1041 _params[param_name]._group = group_name;
1043 mooseError(
"Unable to find a parameter with name: ",
1045 " when adding to group ",
1054 if (param.second._group == old_name)
1055 param.second._group = new_name;
1063 mooseError(
"InputParameters::setGlobalCommandLineParam: The parameter '",
1065 "' is not a command line parameter");
1066 cl_data->global =
true;
1075 std::optional<InputParameters::CommandLineMetadata>
1089 mooseError(
"InputParameters::getCommandLineMetadata: The parameter '",
1091 "' is not a command line parameter");
1100 mooseError(
"InputParameters::commandLineParamSet: The parameter '",
1102 "' is not a command line parameter");
1103 cl_data->set_by_command_line =
true;
1110 auto it =
_params.find(param_name);
1112 return it->second._group;
1113 return std::string();
1118 const std::vector<std::string> & exclude,
1119 const bool allow_private)
1126 for (
const auto & it : common)
1129 const std::string & common_name = it.first;
1131 if (
std::find(exclude.begin(), exclude.end(), common_name) != exclude.end())
1138 for (
const auto & var_name : common._coupled_vars)
1141 if (
std::find(exclude.begin(), exclude.end(), var_name) != exclude.end())
1150 const std::vector<std::string> & exclude,
1151 const bool allow_private)
1153 for (
const auto & it : common)
1155 const std::string & common_name = it.first;
1156 if (
std::find(exclude.begin(), exclude.end(), common_name) != exclude.end())
1158 if (!common.isParamSetByUser(common_name))
1163 for (
const auto & var_name : common._coupled_vars)
1165 if (
std::find(exclude.begin(), exclude.end(), var_name) != exclude.end())
1167 if (!common.isParamSetByUser(var_name))
1175 const std::vector<std::string> & include,
1179 for (
const auto & it : common)
1182 const std::string & common_name = it.first;
1185 if (
std::find(include.begin(), include.end(), common_name) == include.end())
1192 for (std::set<std::string>::const_iterator it = common.coupledVarsBegin();
1193 it != common.coupledVarsEnd();
1197 const std::string var_name = *it;
1200 if (
std::find(include.begin(), include.end(), var_name) == include.end())
1236 const std::string & common_name,
1246 const bool local_exist =
_values.find(local_name) !=
_values.end();
1247 const bool local_set =
_params.count(local_name) > 0 && !
_params[local_name]._set_by_add_param;
1248 const bool local_priv = allow_private ? false :
isPrivate(local_name);
1252 const bool common_exist = common.
_values.find(common_name) != common.
_values.end();
1253 const bool common_priv = allow_private ? false : common.
isPrivate(common_name);
1254 const bool common_valid = common.
isParamValid(common_name);
1262 if (local_exist && common_exist && common_valid && (!local_valid || !local_set) &&
1263 (!common_priv || !local_priv))
1266 _values[local_name] = common.
_values.find(common_name)->second->clone();
1268 _params[local_name]._set_by_add_param =
1269 libmesh_map_find(common.
_params, common_name)._set_by_add_param;
1275 else if (!local_exist && !common_exist)
1276 mooseError(
"InputParameters::applyParameter(): Attempted to apply invalid parameter \"",
1288 mooseDeprecated(
"paramSetByUser() is deprecated. Use isParamSetByUser() instead.");
1304 return cl_data->set_by_command_line;
1323 return it->second._doc_string;
1328 InputParameters::addRequiredParam<MooseEnum>(
const std::string &
name,
1330 const std::string & doc_string)
1332 InputParameters::set<MooseEnum>(
name) = moose_enum;
1333 auto & metadata = _params[
name];
1334 metadata._required =
true;
1335 metadata._doc_string = doc_string;
1340 InputParameters::addRequiredParam<MultiMooseEnum>(
const std::string &
name,
1342 const std::string & doc_string)
1344 InputParameters::set<MultiMooseEnum>(
name) =
1346 auto & metadata = _params[
name];
1347 metadata._required =
true;
1348 metadata._doc_string = doc_string;
1353 InputParameters::addRequiredParam<std::vector<MooseEnum>>(
1354 const std::string &
name,
1355 const std::vector<MooseEnum> & moose_enums,
1356 const std::string & doc_string)
1358 InputParameters::set<std::vector<MooseEnum>>(
name) =
1360 auto & metadata = _params[
name];
1361 metadata._required =
true;
1362 metadata._doc_string = doc_string;
1367 InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
1368 const std::string &
name,
1369 const std::vector<MultiMooseEnum> & moose_enums,
1370 const std::string & doc_string)
1373 moose_enums.size() == 1,
1374 "Only 1 MultiMooseEnum is supported in addRequiredParam<std::vector<MultiMooseEnum>> for " +
1376 mooseAssert(!moose_enums[0].items().empty(),
1377 "The MultiMooseEnum in addRequiredParam<std::vector<MultiMooseEnum>> is empty for " +
1379 InputParameters::set<std::vector<MultiMooseEnum>>(
name) =
1381 auto & metadata = _params[
name];
1382 metadata._required =
true;
1383 metadata._doc_string = doc_string;
1388 InputParameters::addParam<MooseEnum>(
const std::string & ,
1389 const std::string & )
1391 mooseError(
"You must supply a MooseEnum object when using addParam, even if the parameter is not " 1397 InputParameters::addParam<MultiMooseEnum>(
const std::string & ,
1398 const std::string & )
1400 mooseError(
"You must supply a MultiMooseEnum object when using addParam, even if the parameter " 1401 "is not required!");
1406 InputParameters::addParam<std::vector<MooseEnum>>(
const std::string & ,
1407 const std::string & )
1409 mooseError(
"You must supply a vector of MooseEnum object(s) when using addParam, even if the " 1410 "parameter is not required!");
1415 InputParameters::addParam<std::vector<MultiMooseEnum>>(
const std::string & ,
1416 const std::string & )
1419 "You must supply a vector of MultiMooseEnum object(s) when using addParam, even if the " 1420 "parameter is not required!");
1425 InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
const std::string & ,
1426 const std::string & )
1428 mooseError(
"You must supply a vector of MultiMooseEnum object(s) when using addRequiredParam!");
1433 InputParameters::addPrivateParam<MooseEnum>(
const std::string & )
1435 mooseError(
"You must supply a MooseEnum object when using addPrivateParam, even if the parameter " 1436 "is not required!");
1441 InputParameters::addPrivateParam<MultiMooseEnum>(
const std::string & )
1443 mooseError(
"You must supply a MultiMooseEnum object when using addPrivateParam, even if the " 1444 "parameter is not required!");
1449 InputParameters::addDeprecatedParam<MooseEnum>(
const std::string & ,
1450 const std::string & ,
1451 const std::string & )
1453 mooseError(
"You must supply a MooseEnum object and the deprecation string when using " 1454 "addDeprecatedParam, even if the parameter is not required!");
1459 InputParameters::addDeprecatedParam<MultiMooseEnum>(
const std::string & ,
1460 const std::string & ,
1461 const std::string & )
1463 mooseError(
"You must supply a MultiMooseEnum object and the deprecation string when using " 1464 "addDeprecatedParam, even if the parameter is not required!");
1469 InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
1470 const std::string & ,
1471 const std::string & ,
1472 const std::string & )
1474 mooseError(
"You must supply a vector of MooseEnum object(s) and the deprecation string when " 1475 "using addDeprecatedParam, even if the parameter is not required!");
1480 InputParameters::setParamHelper<PostprocessorName, Real>(
const std::string & ,
1481 PostprocessorName & l_value,
1482 const Real & r_value)
1485 std::ostringstream oss;
1487 l_value = oss.str();
1492 InputParameters::setParamHelper<PostprocessorName, int>(
const std::string & ,
1493 PostprocessorName & l_value,
1494 const int & r_value)
1497 std::ostringstream oss;
1499 l_value = oss.str();
1504 InputParameters::setParamHelper<FunctionName, Real>(
const std::string & ,
1505 FunctionName & l_value,
1506 const Real & r_value)
1509 std::ostringstream oss;
1511 l_value = oss.str();
1516 InputParameters::setParamHelper<FunctionName, int>(
const std::string & ,
1517 FunctionName & l_value,
1518 const int & r_value)
1521 std::ostringstream oss;
1523 l_value = oss.str();
1528 InputParameters::setParamHelper<MaterialPropertyName, Real>(
const std::string & ,
1529 MaterialPropertyName & l_value,
1530 const Real & r_value)
1533 std::ostringstream oss;
1535 l_value = oss.str();
1540 InputParameters::setParamHelper<MaterialPropertyName, int>(
const std::string & ,
1541 MaterialPropertyName & l_value,
1542 const int & r_value)
1545 std::ostringstream oss;
1547 l_value = oss.str();
1552 InputParameters::setParamHelper<MooseFunctorName, Real>(
const std::string & ,
1553 MooseFunctorName & l_value,
1554 const Real & r_value)
1557 std::ostringstream oss;
1559 l_value = oss.str();
1564 InputParameters::setParamHelper<MooseFunctorName, int>(
const std::string & ,
1565 MooseFunctorName & l_value,
1566 const int & r_value)
1569 std::ostringstream oss;
1571 l_value = oss.str();
1576 InputParameters::getParamHelper<MooseEnum>(
const std::string & name_in,
1579 const auto name = pars.checkForRename(name_in);
1585 InputParameters::getParamHelper<MultiMooseEnum>(
const std::string & name_in,
1588 const auto name = pars.checkForRename(name_in);
1594 const std::set<std::string> & reserved)
1600 std::set<std::string>
1606 return std::set<std::string>();
1607 return it->second._reserved_values;
1614 return hit_node->fileLocation(
false);
1622 return hit_node->fullpath();
1634 const hit::Node & node,
1637 mooseAssert(node.type() == hit::NodeType::Field,
"Must be a field");
1645 return hit_node->fileLocation(
false);
1653 return hit_node->fullpath();
1660 const static pcrecpp::RE
valid(
"[\\w:/]+");
1671 return it->second._ignore;
1675 std::set<std::string>
1678 std::set<std::string> names;
1680 if (it->second._group == group)
1681 names.emplace(it->first);
1685 std::set<std::string>
1688 std::set<std::string> param_set;
1690 param_set.emplace(it->first);
1694 std::set<std::string>
1697 std::set<std::string> controllable;
1699 if (it->second._controllable)
1700 controllable.emplace(it->first);
1701 return controllable;
1707 auto prefix = param +
":";
1717 return hit_node->strVal();
1723 const std::string & moose_object_with_var_param_name)
const 1726 std::string variable_name =
getMooseType(var_param_name);
1727 if (variable_name ==
"")
1737 moose_object_with_var_param_name,
1738 "' while retrieving value for '",
1740 "' parameter! Did you forget to set '",
1742 "' or set it to '' (empty string) by accident?");
1746 variable_name = vec[0];
1749 return variable_name;
1754 const std::string & new_name,
1756 const std::string & removal_date)
1758 auto params_it =
_params.find(old_name);
1759 if (params_it ==
_params.end())
1760 mooseError(
"Requested to rename parameter '",
1762 "' but that parameter name doesn't exist in the parameters object.");
1763 mooseAssert(params_it->second._deprecation_message.empty(),
1764 "Attempting to rename the parameter, '" << old_name <<
"', that is deprecated");
1766 auto new_metadata = std::move(params_it->second);
1769 _params.emplace(new_name, std::move(new_metadata));
1772 auto values_it =
_values.find(old_name);
1773 auto new_value = std::move(values_it->second);
1774 _values.emplace(new_name, std::move(new_value));
1777 std::string deprecation_message;
1778 if (!removal_date.empty())
1779 deprecation_message =
"'" + old_name +
"' has been deprecated and will be removed on " +
1780 removal_date +
". Please use '" + new_name +
"' instead.";
1788 const std::string & new_name,
1790 const std::string & removal_date)
1794 mooseError(
"Requested to rename coupled variable '",
1796 "' but that coupled variable name doesn't exist in the parameters object.");
1806 const std::string & new_name,
1807 const std::string & new_docstring)
1814 const std::string & new_name,
1815 const std::string & new_docstring)
1822 const std::string & new_name,
1823 const std::string & removal_date)
1830 const std::string & new_name,
1831 const std::string & removal_date)
1840 return it->second.first;
1845 std::vector<std::string>
1849 "The parameter we are searching for aliases for should exist in our parameter map");
1850 std::vector<std::string> aliases = {param_name};
1853 aliases.push_back(pr.second);
1858 std::optional<Moose::DataFileUtils::Path>
1864 std::optional<std::string>
1866 const hit::Node & node,
1870 bool has_name =
false;
1872 bool has_default =
false;
1880 auto &
name = names[i];
1882 if (MooseUtils::convert<Real>(
name, real_value,
false))
1894 return {
"invalid value for '" + node.fullpath() +
1895 "': coupled vectors where some parameters are reals and others are variables are not " 1905 std::pair<std::string, const hit::Node *>
1908 const hit::Node * node =
nullptr;
1910 std::string fullpath;
1912 if (
const hit::Node * param_node =
getHitNode(param))
1914 fullpath = param_node->fullpath();
1918 else if (
const hit::Node * block_node =
getHitNode())
1921 fullpath = block_node->fullpath() +
"/" + param;
1927 return {fullpath +
": ", node};
1941 const bool with_prefix ,
1942 const hit::Node * node ,
1943 const bool show_trace )
const
std::string name(const ElemQuality q)
static const std::string name_param
The name of the parameter that contains the object name.
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
static const std::string app_param
The name of the parameter that contains the MooseApp.
void isValid(MooseObject *obj)
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 ...
bool search_all_data
Whether or not to search all registered data.
RelationshipManagerType
Main types of Relationship Managers.
static const std::string type_param
The name of the parameter that contains the object type.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Base class for MOOSE-based applications.
bool graceful
Whether or not to error whenever a path is not found.
Path getPath(std::string path, const GetPathOptions &options={})
Get the data path for a given path, searching the registered data.
static const std::string moose_base_param
The name of the parameter that contains the moose system base.
static const std::string kokkos_object_param
The name of the parameter that indicates an object is a Kokkos functor.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
std::function< void(const InputParameters &, InputParameters &)> RelationshipManagerInputParameterCallback
The type for the callback to set RelationshipManager parameters.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
std::string docstring(const std::string &desc)
Augment docstring if NEML2 is not enabled.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Options to be passed to getPath().
Representation of a data file path.
std::optional< std::string > base
The base path by which to search for relative paths.
infix_ostream_iterator< T, charT, traits > & operator=(T const &item)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Scoped helper for setting Moose::_throw_on_error during this scope.
void callMooseError(std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const
External method for calling moose error with added object context.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
std::vector< ElemQuality > valid(const ElemType t)
std::string hitMessagePrefix(const hit::Node &node)
Get the prefix to be associated with a hit node for a message.
std::string stringJoin(const std::vector< std::string > &values, const std::string &separator=" ")
Concatenates value into a single string separated by separator.
auto index_range(const T &sizable)
ExecFlagEnum execute_flags
Storage for the registered execute flags.