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");
829 return _params.count(coupling_name) > 0 &&
_params.at(coupling_name)._have_coupled_default &&
837 _params[actual_name]._coupled_default.resize(i + 1);
839 _params[actual_name]._have_coupled_default =
true;
845 auto value_it =
_params.find(coupling_name);
847 if (value_it ==
_params.end() || !value_it->second._have_coupled_default)
848 mooseError(
"Attempted to retrieve default value for coupled variable '",
850 "' when none was provided. \n\nThere are three reasons why this may have " 851 "occurred:\n 1. The other version of params.addCoupledVar() should be used in order " 852 "to provide a default value. \n 2. This should have been a required coupled " 853 "variable added with params.addRequiredCoupledVar() \n 3. The call to get the " 854 "coupled value should have been properly guarded with isCoupled()\n");
856 return value_it->second._coupled_default.at(i);
862 auto value_it =
_params.find(coupling_name);
864 mooseError(
"Attempted to retrieve default value for coupled variable '",
866 "' when none was provided.");
867 return value_it->second._coupled_default.size();
870 std::map<std::string, std::pair<std::string, std::string>>
873 std::map<std::string, std::pair<std::string, std::string>> abv;
876 if (!it->second._autobuild_vecs.first.empty())
877 abv[it->first] = it->second._autobuild_vecs;
890 return "std::vector<VariableName>";
902 if (have_parameter<VariableName>(
name))
903 var = get<VariableName>(
name);
904 else if (have_parameter<NonlinearVariableName>(
name))
905 var = get<NonlinearVariableName>(
name);
906 else if (have_parameter<LinearVariableName>(
name))
907 var = get<LinearVariableName>(
name);
908 else if (have_parameter<AuxVariableName>(
name))
909 var = get<AuxVariableName>(
name);
910 else if (have_parameter<PostprocessorName>(
name))
911 var = get<PostprocessorName>(
name);
912 else if (have_parameter<VectorPostprocessorName>(
name))
913 var = get<VectorPostprocessorName>(
name);
914 else if (have_parameter<FunctionName>(
name))
915 var = get<FunctionName>(
name);
916 else if (have_parameter<UserObjectName>(
name))
917 var = get<UserObjectName>(
name);
918 else if (have_parameter<MaterialPropertyName>(
name))
919 var = get<MaterialPropertyName>(
name);
920 else if (have_parameter<std::string>(
name))
921 var = get<std::string>(
name);
926 std::vector<std::string>
930 std::vector<std::string> svars;
934 std::vector<VariableName>
vars = get<std::vector<VariableName>>(
name);
935 std::copy(
vars.begin(),
vars.end(), std::back_inserter(svars));
939 std::vector<NonlinearVariableName>
vars = get<std::vector<NonlinearVariableName>>(
name);
940 std::copy(
vars.begin(),
vars.end(), std::back_inserter(svars));
944 std::vector<AuxVariableName>
vars = get<std::vector<AuxVariableName>>(
name);
945 std::copy(
vars.begin(),
vars.end(), std::back_inserter(svars));
949 std::vector<MaterialPropertyName>
vars = get<std::vector<MaterialPropertyName>>(
name);
950 std::copy(
vars.begin(),
vars.end(), std::back_inserter(svars));
954 std::vector<std::string>
vars = get<std::vector<std::string>>(
name);
955 std::copy(
vars.begin(),
vars.end(), std::back_inserter(svars));
995 const std::string group_name)
997 std::vector<std::string> elements;
1002 std::set<std::string> param_names;
1003 for (
const auto & it : *
this)
1004 param_names.insert(it.first);
1006 for (
const auto & param_name : elements)
1007 if (
_params.count(param_name) > 0)
1008 _params[param_name]._group = group_name;
1010 mooseError(
"Unable to find a parameter with name: ",
1012 " when adding to group ",
1021 if (param.second._group == old_name)
1022 param.second._group = new_name;
1030 mooseError(
"InputParameters::setGlobalCommandLineParam: The parameter '",
1032 "' is not a command line parameter");
1033 cl_data->global =
true;
1042 std::optional<InputParameters::CommandLineMetadata>
1056 mooseError(
"InputParameters::getCommandLineMetadata: The parameter '",
1058 "' is not a command line parameter");
1067 mooseError(
"InputParameters::commandLineParamSet: The parameter '",
1069 "' is not a command line parameter");
1070 cl_data->set_by_command_line =
true;
1077 auto it =
_params.find(param_name);
1079 return it->second._group;
1080 return std::string();
1085 const std::vector<std::string> & exclude,
1086 const bool allow_private)
1093 for (
const auto & it : common)
1096 const std::string & common_name = it.first;
1098 if (
std::find(exclude.begin(), exclude.end(), common_name) != exclude.end())
1105 for (
const auto & var_name : common._coupled_vars)
1108 if (
std::find(exclude.begin(), exclude.end(), var_name) != exclude.end())
1117 const std::vector<std::string> & exclude,
1118 const bool allow_private)
1120 for (
const auto & it : common)
1122 const std::string & common_name = it.first;
1123 if (
std::find(exclude.begin(), exclude.end(), common_name) != exclude.end())
1125 if (!common.isParamSetByUser(common_name))
1130 for (
const auto & var_name : common._coupled_vars)
1132 if (
std::find(exclude.begin(), exclude.end(), var_name) != exclude.end())
1134 if (!common.isParamSetByUser(var_name))
1142 const std::vector<std::string> & include,
1146 for (
const auto & it : common)
1149 const std::string & common_name = it.first;
1152 if (
std::find(include.begin(), include.end(), common_name) == include.end())
1159 for (std::set<std::string>::const_iterator it = common.coupledVarsBegin();
1160 it != common.coupledVarsEnd();
1164 const std::string var_name = *it;
1167 if (
std::find(include.begin(), include.end(), var_name) == include.end())
1203 const std::string & common_name,
1213 const bool local_exist =
_values.find(local_name) !=
_values.end();
1214 const bool local_set =
_params.count(local_name) > 0 && !
_params[local_name]._set_by_add_param;
1215 const bool local_priv = allow_private ? false :
isPrivate(local_name);
1219 const bool common_exist = common.
_values.find(common_name) != common.
_values.end();
1220 const bool common_priv = allow_private ? false : common.
isPrivate(common_name);
1221 const bool common_valid = common.
isParamValid(common_name);
1229 if (local_exist && common_exist && common_valid && (!local_valid || !local_set) &&
1230 (!common_priv || !local_priv))
1233 _values[local_name] = common.
_values.find(common_name)->second->clone();
1235 _params[local_name]._set_by_add_param =
1236 libmesh_map_find(common.
_params, common_name)._set_by_add_param;
1242 else if (!local_exist && !common_exist)
1243 mooseError(
"InputParameters::applyParameter(): Attempted to apply invalid parameter \"",
1255 mooseDeprecated(
"paramSetByUser() is deprecated. Use isParamSetByUser() instead.");
1271 return cl_data->set_by_command_line;
1290 return it->second._doc_string;
1295 InputParameters::addRequiredParam<MooseEnum>(
const std::string &
name,
1297 const std::string & doc_string)
1299 InputParameters::set<MooseEnum>(
name) = moose_enum;
1300 auto & metadata = _params[
name];
1301 metadata._required =
true;
1302 metadata._doc_string = doc_string;
1307 InputParameters::addRequiredParam<MultiMooseEnum>(
const std::string &
name,
1309 const std::string & doc_string)
1311 InputParameters::set<MultiMooseEnum>(
name) =
1313 auto & metadata = _params[
name];
1314 metadata._required =
true;
1315 metadata._doc_string = doc_string;
1320 InputParameters::addRequiredParam<std::vector<MooseEnum>>(
1321 const std::string &
name,
1322 const std::vector<MooseEnum> & moose_enums,
1323 const std::string & doc_string)
1325 InputParameters::set<std::vector<MooseEnum>>(
name) =
1327 auto & metadata = _params[
name];
1328 metadata._required =
true;
1329 metadata._doc_string = doc_string;
1334 InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
1335 const std::string &
name,
1336 const std::vector<MultiMooseEnum> & moose_enums,
1337 const std::string & doc_string)
1340 moose_enums.size() == 1,
1341 "Only 1 MultiMooseEnum is supported in addRequiredParam<std::vector<MultiMooseEnum>> for " +
1343 mooseAssert(!moose_enums[0].items().empty(),
1344 "The MultiMooseEnum in addRequiredParam<std::vector<MultiMooseEnum>> is empty for " +
1346 InputParameters::set<std::vector<MultiMooseEnum>>(
name) =
1348 auto & metadata = _params[
name];
1349 metadata._required =
true;
1350 metadata._doc_string = doc_string;
1355 InputParameters::addParam<MooseEnum>(
const std::string & ,
1356 const std::string & )
1358 mooseError(
"You must supply a MooseEnum object when using addParam, even if the parameter is not " 1364 InputParameters::addParam<MultiMooseEnum>(
const std::string & ,
1365 const std::string & )
1367 mooseError(
"You must supply a MultiMooseEnum object when using addParam, even if the parameter " 1368 "is not required!");
1373 InputParameters::addParam<std::vector<MooseEnum>>(
const std::string & ,
1374 const std::string & )
1376 mooseError(
"You must supply a vector of MooseEnum object(s) when using addParam, even if the " 1377 "parameter is not required!");
1382 InputParameters::addParam<std::vector<MultiMooseEnum>>(
const std::string & ,
1383 const std::string & )
1386 "You must supply a vector of MultiMooseEnum object(s) when using addParam, even if the " 1387 "parameter is not required!");
1392 InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
const std::string & ,
1393 const std::string & )
1395 mooseError(
"You must supply a vector of MultiMooseEnum object(s) when using addRequiredParam!");
1400 InputParameters::addPrivateParam<MooseEnum>(
const std::string & )
1402 mooseError(
"You must supply a MooseEnum object when using addPrivateParam, even if the parameter " 1403 "is not required!");
1408 InputParameters::addPrivateParam<MultiMooseEnum>(
const std::string & )
1410 mooseError(
"You must supply a MultiMooseEnum object when using addPrivateParam, even if the " 1411 "parameter is not required!");
1416 InputParameters::addDeprecatedParam<MooseEnum>(
const std::string & ,
1417 const std::string & ,
1418 const std::string & )
1420 mooseError(
"You must supply a MooseEnum object and the deprecation string when using " 1421 "addDeprecatedParam, even if the parameter is not required!");
1426 InputParameters::addDeprecatedParam<MultiMooseEnum>(
const std::string & ,
1427 const std::string & ,
1428 const std::string & )
1430 mooseError(
"You must supply a MultiMooseEnum object and the deprecation string when using " 1431 "addDeprecatedParam, even if the parameter is not required!");
1436 InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
1437 const std::string & ,
1438 const std::string & ,
1439 const std::string & )
1441 mooseError(
"You must supply a vector of MooseEnum object(s) and the deprecation string when " 1442 "using addDeprecatedParam, even if the parameter is not required!");
1447 InputParameters::setParamHelper<PostprocessorName, Real>(
const std::string & ,
1448 PostprocessorName & l_value,
1449 const Real & r_value)
1452 std::ostringstream oss;
1454 l_value = oss.str();
1459 InputParameters::setParamHelper<PostprocessorName, int>(
const std::string & ,
1460 PostprocessorName & l_value,
1461 const int & r_value)
1464 std::ostringstream oss;
1466 l_value = oss.str();
1471 InputParameters::setParamHelper<FunctionName, Real>(
const std::string & ,
1472 FunctionName & l_value,
1473 const Real & r_value)
1476 std::ostringstream oss;
1478 l_value = oss.str();
1483 InputParameters::setParamHelper<FunctionName, int>(
const std::string & ,
1484 FunctionName & l_value,
1485 const int & r_value)
1488 std::ostringstream oss;
1490 l_value = oss.str();
1495 InputParameters::setParamHelper<MaterialPropertyName, Real>(
const std::string & ,
1496 MaterialPropertyName & l_value,
1497 const Real & r_value)
1500 std::ostringstream oss;
1502 l_value = oss.str();
1507 InputParameters::setParamHelper<MaterialPropertyName, int>(
const std::string & ,
1508 MaterialPropertyName & l_value,
1509 const int & r_value)
1512 std::ostringstream oss;
1514 l_value = oss.str();
1519 InputParameters::setParamHelper<MooseFunctorName, Real>(
const std::string & ,
1520 MooseFunctorName & l_value,
1521 const Real & r_value)
1524 std::ostringstream oss;
1526 l_value = oss.str();
1531 InputParameters::setParamHelper<MooseFunctorName, int>(
const std::string & ,
1532 MooseFunctorName & l_value,
1533 const int & r_value)
1536 std::ostringstream oss;
1538 l_value = oss.str();
1543 InputParameters::getParamHelper<MooseEnum>(
const std::string & name_in,
1546 const auto name = pars.checkForRename(name_in);
1552 InputParameters::getParamHelper<MultiMooseEnum>(
const std::string & name_in,
1555 const auto name = pars.checkForRename(name_in);
1561 const std::set<std::string> & reserved)
1567 std::set<std::string>
1573 return std::set<std::string>();
1574 return it->second._reserved_values;
1581 return hit_node->fileLocation(
false);
1589 return hit_node->fullpath();
1601 const hit::Node & node,
1604 mooseAssert(node.type() == hit::NodeType::Field,
"Must be a field");
1612 return hit_node->fileLocation(
false);
1620 return hit_node->fullpath();
1627 const static pcrecpp::RE
valid(
"[\\w:/]+");
1638 return it->second._ignore;
1642 std::set<std::string>
1645 std::set<std::string> names;
1647 if (it->second._group == group)
1648 names.emplace(it->first);
1652 std::set<std::string>
1655 std::set<std::string> param_set;
1657 param_set.emplace(it->first);
1661 std::set<std::string>
1664 std::set<std::string> controllable;
1666 if (it->second._controllable)
1667 controllable.emplace(it->first);
1668 return controllable;
1674 auto prefix = param +
":";
1684 return hit_node->strVal();
1690 const std::string & moose_object_with_var_param_name)
const 1693 std::string variable_name =
getMooseType(var_param_name);
1694 if (variable_name ==
"")
1704 moose_object_with_var_param_name,
1705 "' while retrieving value for '",
1707 "' parameter! Did you forget to set '",
1709 "' or set it to '' (empty string) by accident?");
1713 variable_name = vec[0];
1716 return variable_name;
1721 const std::string & new_name,
1723 const std::string & removal_date)
1725 auto params_it =
_params.find(old_name);
1726 if (params_it ==
_params.end())
1727 mooseError(
"Requested to rename parameter '",
1729 "' but that parameter name doesn't exist in the parameters object.");
1730 mooseAssert(params_it->second._deprecation_message.empty(),
1731 "Attempting to rename the parameter, '" << old_name <<
"', that is deprecated");
1733 auto new_metadata = std::move(params_it->second);
1736 _params.emplace(new_name, std::move(new_metadata));
1739 auto values_it =
_values.find(old_name);
1740 auto new_value = std::move(values_it->second);
1741 _values.emplace(new_name, std::move(new_value));
1744 std::string deprecation_message;
1745 if (!removal_date.empty())
1746 deprecation_message =
"'" + old_name +
"' has been deprecated and will be removed on " +
1747 removal_date +
". Please use '" + new_name +
"' instead.";
1755 const std::string & new_name,
1757 const std::string & removal_date)
1761 mooseError(
"Requested to rename coupled variable '",
1763 "' but that coupled variable name doesn't exist in the parameters object.");
1773 const std::string & new_name,
1774 const std::string & new_docstring)
1781 const std::string & new_name,
1782 const std::string & new_docstring)
1789 const std::string & new_name,
1790 const std::string & removal_date)
1797 const std::string & new_name,
1798 const std::string & removal_date)
1807 return it->second.first;
1812 std::vector<std::string>
1816 "The parameter we are searching for aliases for should exist in our parameter map");
1817 std::vector<std::string> aliases = {param_name};
1820 aliases.push_back(pr.second);
1825 std::optional<Moose::DataFileUtils::Path>
1831 std::optional<std::string>
1833 const hit::Node & node,
1837 bool has_name =
false;
1839 bool has_default =
false;
1847 auto &
name = names[i];
1849 if (MooseUtils::convert<Real>(
name, real_value,
false))
1861 return {
"invalid value for '" + node.fullpath() +
1862 "': coupled vectors where some parameters are reals and others are variables are not " 1872 std::pair<std::string, const hit::Node *>
1875 const hit::Node * node =
nullptr;
1877 std::string fullpath;
1879 if (
const hit::Node * param_node =
getHitNode(param))
1881 fullpath = param_node->fullpath();
1885 else if (
const hit::Node * block_node =
getHitNode())
1888 fullpath = block_node->fullpath() +
"/" + param;
1894 return {fullpath +
": ", node};
1908 const bool with_prefix ,
1909 const hit::Node * node ,
1910 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.