LCOV - code coverage report
Current view: top level - src/utils - InputParameters.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #33416 (b10b36) with base 9fbd27 Lines: 784 942 83.2 %
Date: 2026-07-23 16:15:30 Functions: 126 146 86.3 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #include "InputParameters.h"
      11             : 
      12             : // MOOSE includes
      13             : #include "MooseEnum.h"
      14             : #include "MooseTypes.h"
      15             : #include "MooseUtils.h"
      16             : #include "MultiMooseEnum.h"
      17             : #include "ExecFlagEnum.h"
      18             : #include "MooseObject.h"
      19             : #include "MooseApp.h"
      20             : 
      21             : #include "libmesh/utility.h"
      22             : #include "libmesh/simple_range.h"
      23             : 
      24             : #include "pcrecpp.h"
      25             : #include "hit/parse.h"
      26             : 
      27             : #include <cmath>
      28             : #include <filesystem>
      29             : 
      30             : InputParameters
      31    68389652 : emptyInputParameters()
      32             : {
      33    68389652 :   InputParameters params;
      34    68389652 :   return params;
      35             : }
      36             : 
      37    68389652 : InputParameters::InputParameters()
      38             :   : Parameters(),
      39    68389652 :     _collapse_nesting(false),
      40    68389652 :     _moose_object_syntax_visibility(true),
      41    68389652 :     _show_deprecated_message(true),
      42    68389652 :     _allow_copy(true),
      43    68389652 :     _hit_node(nullptr),
      44    68389652 :     _finalized(false)
      45             : {
      46    68389652 : }
      47             : 
      48     8724235 : InputParameters::InputParameters(const InputParameters & rhs)
      49     8724235 :   : Parameters(), _show_deprecated_message(true), _allow_copy(true)
      50             : {
      51     8724235 :   *this = rhs;
      52     8724232 : }
      53             : 
      54           0 : InputParameters::InputParameters(const Parameters & rhs)
      55           0 :   : _show_deprecated_message(true), _allow_copy(true)
      56             : {
      57           0 :   _params.clear();
      58           0 :   Parameters::operator=(rhs);
      59           0 :   _collapse_nesting = false;
      60           0 :   _moose_object_syntax_visibility = true;
      61           0 : }
      62             : 
      63             : void
      64           0 : InputParameters::clear()
      65             : {
      66           0 :   Parameters::clear();
      67           0 :   _params.clear();
      68           0 :   _coupled_vars.clear();
      69           0 :   _new_to_deprecated_coupled_vars.clear();
      70           0 :   _collapse_nesting = false;
      71           0 :   _moose_object_syntax_visibility = true;
      72           0 :   _show_deprecated_message = true;
      73           0 :   _allow_copy = true;
      74           0 :   _old_to_new_name_and_dep.clear();
      75           0 :   _new_to_old_names.clear();
      76           0 :   _hit_node = nullptr;
      77           0 :   _finalized = false;
      78           0 : }
      79             : 
      80             : void
      81    20843991 : InputParameters::addClassDescription(const std::string & doc_string)
      82             : {
      83    20843991 :   _class_description = doc_string;
      84    20843991 : }
      85             : 
      86             : void
      87   573032271 : InputParameters::set_attributes(const std::string & name_in, bool inserted_only)
      88             : {
      89   573032271 :   const auto name = checkForRename(name_in);
      90             : 
      91   573032271 :   if (!inserted_only)
      92             :   {
      93   382025657 :     auto & metadata = _params[name];
      94             :     /**
      95             :      * "._set_by_add_param" and ".deprecated_params" are not populated until after
      96             :      * the default value has already been set in libMesh (first callback to this
      97             :      * method). Therefore if a variable is in/not in one of these sets, you can
      98             :      * be assured it was put there outside of the "addParam*()" calls.
      99             :      */
     100   382025657 :     metadata._set_by_add_param = false;
     101             : 
     102             :     // valid_params don't make sense for MooseEnums
     103   382025657 :     if (!have_parameter<MooseEnum>(name) && !have_parameter<MultiMooseEnum>(name))
     104   360654570 :       metadata._valid = true;
     105             :   }
     106   573032271 : }
     107             : 
     108             : std::optional<std::string>
     109     2631281 : InputParameters::queryDeprecatedParamMessage(const std::string & name_in) const
     110             : {
     111     2631281 :   const auto name = checkForRename(name_in);
     112     2631281 :   if (_show_deprecated_message)
     113             :   {
     114        1024 :     auto deprecation_message = [this](const auto & name, const auto & message) -> std::string
     115        1024 :     { return paramMessagePrefix(name) + message; };
     116             : 
     117     2631281 :     if (_params.count(name) && !libmesh_map_find(_params, name)._deprecation_message.empty())
     118        1462 :       return deprecation_message(name,
     119        1462 :                                  "The parameter '" + name + "' is deprecated.\n" +
     120        1462 :                                      libmesh_map_find(_params, name)._deprecation_message);
     121     2630550 :     else if (auto it = _old_to_new_name_and_dep.find(name_in);
     122     2630550 :              it != _old_to_new_name_and_dep.end() && !it->second.second.empty())
     123         293 :       return deprecation_message(name_in, it->second.second);
     124             :   }
     125     2630257 :   return {};
     126     2631281 : }
     127             : 
     128             : std::string
     129      767137 : InputParameters::getClassDescription() const
     130             : {
     131      767137 :   return _class_description;
     132             : }
     133             : 
     134             : InputParameters &
     135    10259964 : InputParameters::operator=(const InputParameters & rhs)
     136             : {
     137             :   // An error to help minimize the segmentation faults that occure when MooseObjects do not have the
     138             :   // correct constructor
     139    10259964 :   if (!rhs._allow_copy)
     140             :   {
     141             :     // If _allow_parameter_copy is set, these should be too (see
     142             :     // InputParameterWarehouse::addInputParameters)
     143           3 :     const std::string & name = rhs.getObjectName();
     144           3 :     const std::string & type = rhs.getObjectType(); // could be empty
     145           3 :     const std::string name_example = type.size() ? type : "the " + name + " object";
     146           3 :     const std::string type_example = type.size() ? type : "MyObject";
     147           3 :     ::mooseError(
     148             :         "Copying of the InputParameters object for ",
     149             :         name_example,
     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",
     153             :         "    ",
     154             :         type_example,
     155             :         "::",
     156             :         type_example,
     157             :         "(const InputParameters & parameters);");
     158           0 :   }
     159             : 
     160    10259961 :   Parameters::operator=(rhs);
     161             : 
     162    10259961 :   _params = rhs._params;
     163             : 
     164    10259961 :   _buildable_types = rhs._buildable_types;
     165    10259961 :   _buildable_rm_types = rhs._buildable_rm_types;
     166    10259961 :   _collapse_nesting = rhs._collapse_nesting;
     167    10259961 :   _moose_object_syntax_visibility = rhs._moose_object_syntax_visibility;
     168    10259961 :   _coupled_vars = rhs._coupled_vars;
     169    10259961 :   _new_to_deprecated_coupled_vars = rhs._new_to_deprecated_coupled_vars;
     170    10259961 :   _allow_copy = rhs._allow_copy;
     171    10259961 :   _old_to_new_name_and_dep = rhs._old_to_new_name_and_dep;
     172    10259961 :   _new_to_old_names = rhs._new_to_old_names;
     173    10259961 :   _hit_node = rhs._hit_node;
     174    10259961 :   _finalized = false;
     175             : 
     176    10259961 :   return *this;
     177             : }
     178             : 
     179             : InputParameters &
     180    48637378 : InputParameters::operator+=(const InputParameters & rhs)
     181             : {
     182    48637378 :   Parameters::operator+=(rhs);
     183             : 
     184             :   // TODO: this is not a proper merge - if a particular parameter exists in both this and rhs,
     185             :   // then we should actually smartly merge both metadata structs before storing in this.
     186   151350021 :   for (auto it = rhs._params.begin(); it != rhs._params.end(); ++it)
     187   102712643 :     _params[it->first] = it->second;
     188             : 
     189    97274756 :   _buildable_types.insert(
     190    48637378 :       _buildable_types.end(), rhs._buildable_types.begin(), rhs._buildable_types.end());
     191    97274756 :   _buildable_rm_types.insert(
     192    48637378 :       _buildable_rm_types.end(), rhs._buildable_rm_types.begin(), rhs._buildable_rm_types.end());
     193             : 
     194             :   // Collapse nesting and moose object syntax hiding are not modified with +=
     195    48637378 :   _coupled_vars.insert(rhs._coupled_vars.begin(), rhs._coupled_vars.end());
     196    48637378 :   _new_to_deprecated_coupled_vars.insert(rhs._new_to_deprecated_coupled_vars.begin(),
     197             :                                          rhs._new_to_deprecated_coupled_vars.end());
     198             : 
     199    48637378 :   _old_to_new_name_and_dep.insert(rhs._old_to_new_name_and_dep.begin(),
     200             :                                   rhs._old_to_new_name_and_dep.end());
     201    48637378 :   _new_to_old_names.insert(rhs._new_to_old_names.begin(), rhs._new_to_old_names.end());
     202    48637378 :   return *this;
     203             : }
     204             : 
     205             : void
     206     1404796 : InputParameters::setDeprecatedVarDocString(const std::string & new_name,
     207             :                                            const std::string & doc_string)
     208             : {
     209     1404796 :   auto coupled_vars_it = _new_to_deprecated_coupled_vars.find(new_name);
     210     1404796 :   if (coupled_vars_it != _new_to_deprecated_coupled_vars.end())
     211             :   {
     212           0 :     auto params_it = _params.find(coupled_vars_it->second);
     213           0 :     if (params_it == _params.end())
     214           0 :       mooseError("There must have been a mistake in the construction of the new to deprecated "
     215             :                  "coupled vars map because the old name ",
     216           0 :                  coupled_vars_it->second,
     217             :                  " doesn't exist in the parameters data.");
     218             : 
     219           0 :     params_it->second._doc_string = doc_string;
     220             :   }
     221     1404796 : }
     222             : 
     223             : void
     224       83549 : InputParameters::addCoupledVar(const std::string & name, Real value, const std::string & doc_string)
     225             : {
     226       83549 :   addParam<std::vector<VariableName>>(name, doc_string);
     227       83549 :   _coupled_vars.insert(name);
     228       83549 :   auto & metadata = _params[name];
     229       83549 :   metadata._coupled_default.assign(1, value);
     230       83549 :   metadata._have_coupled_default = true;
     231             : 
     232             :   // Set the doc string for any associated deprecated coupled var
     233       83549 :   setDeprecatedVarDocString(name, doc_string);
     234       83549 : }
     235             : 
     236             : void
     237       25945 : InputParameters::addCoupledVar(const std::string & name,
     238             :                                const std::vector<Real> & value,
     239             :                                const std::string & doc_string)
     240             : {
     241             :   // std::vector<VariableName>(1, Moose::stringify(value)),
     242       25945 :   addParam<std::vector<VariableName>>(name, doc_string);
     243       25945 :   _coupled_vars.insert(name);
     244       25945 :   auto & metadata = _params[name];
     245       25945 :   metadata._coupled_default = value;
     246       25945 :   metadata._have_coupled_default = true;
     247             : 
     248             :   // Set the doc string for any associated deprecated coupled var
     249       25945 :   setDeprecatedVarDocString(name, doc_string);
     250       25945 : }
     251             : 
     252             : void
     253     1295302 : InputParameters::addCoupledVar(const std::string & name, const std::string & doc_string)
     254             : {
     255     1295302 :   addParam<std::vector<VariableName>>(name, doc_string);
     256     1295302 :   _coupled_vars.insert(name);
     257             : 
     258             :   // Set the doc string for any associated deprecated coupled var
     259     1295302 :   setDeprecatedVarDocString(name, doc_string);
     260     1295302 : }
     261             : 
     262             : void
     263           0 : InputParameters::addDeprecatedCoupledVar(const std::string & old_name,
     264             :                                          const std::string & new_name,
     265             :                                          const std::string & removal_date /*=""*/)
     266             : {
     267           0 :   mooseDeprecated("Please use 'deprecateCoupledVar'");
     268             : 
     269           0 :   _show_deprecated_message = false;
     270             : 
     271             :   // Set the doc string if we are adding the deprecated var after the new var has already been added
     272           0 :   auto params_it = _params.find(new_name);
     273           0 :   std::string doc_string;
     274           0 :   if (params_it != _params.end())
     275           0 :     doc_string = params_it->second._doc_string;
     276             : 
     277           0 :   addParam<std::vector<VariableName>>(old_name, doc_string);
     278           0 :   _coupled_vars.insert(old_name);
     279           0 :   _new_to_deprecated_coupled_vars.emplace(new_name, old_name);
     280             : 
     281             :   std::string deprecation_message =
     282           0 :       "The coupled variable parameter '" + old_name + "' has been deprecated";
     283           0 :   if (!removal_date.empty())
     284           0 :     deprecation_message += " and will be removed " + removal_date;
     285           0 :   deprecation_message += ". Please use the '" + new_name + "' coupled variable parameter instead.";
     286           0 :   _params[old_name]._deprecation_message = deprecation_message;
     287           0 :   _show_deprecated_message = true;
     288           0 : }
     289             : 
     290             : void
     291           4 : InputParameters::addCoupledVarWithAutoBuild(const std::string & name,
     292             :                                             const std::string & base_name,
     293             :                                             const std::string & num_name,
     294             :                                             const std::string & doc_string)
     295             : {
     296           4 :   addParam<std::vector<VariableName>>(name, doc_string);
     297           4 :   _coupled_vars.insert(name);
     298           4 :   _params[name]._autobuild_vecs = std::make_pair(base_name, num_name);
     299             : 
     300             :   // Additionally there are two more parameters that need to be added:
     301           4 :   addParam<std::string>(base_name, doc_string + " (base_name)");
     302           4 :   addParam<unsigned int>(num_name, doc_string + " (num_name)");
     303           4 : }
     304             : 
     305             : void
     306           4 : InputParameters::addRequiredCoupledVarWithAutoBuild(const std::string & name,
     307             :                                                     const std::string & base_name,
     308             :                                                     const std::string & num_name,
     309             :                                                     const std::string & doc_string)
     310             : {
     311           4 :   addRequiredParam<std::vector<VariableName>>(name, doc_string);
     312             : 
     313           4 :   addCoupledVarWithAutoBuild(name, base_name, num_name, doc_string);
     314           4 : }
     315             : 
     316             : void
     317     1144567 : InputParameters::addRequiredCoupledVar(const std::string & name, const std::string & doc_string)
     318             : {
     319     1144567 :   addRequiredParam<std::vector<VariableName>>(name, doc_string);
     320     1144567 :   _coupled_vars.insert(name);
     321     1144567 : }
     322             : 
     323             : std::string
     324     6323370 : InputParameters::getDocString(const std::string & name_in) const
     325             : {
     326     6323370 :   const auto name = checkForRename(name_in);
     327             : 
     328     6323370 :   std::string doc_string;
     329     6323370 :   auto it = _params.find(name);
     330     6323370 :   if (it != _params.end())
     331   453713383 :     for (const auto & ch : it->second._doc_string)
     332             :     {
     333   447390013 :       if (ch == '\n')
     334           0 :         doc_string += " ... ";
     335             :       else
     336   447390013 :         doc_string += ch;
     337             :     }
     338             : 
     339    12646740 :   return doc_string;
     340     6323370 : }
     341             : 
     342             : void
     343     2022552 : InputParameters::setDocString(const std::string & name_in, const std::string & doc)
     344             : {
     345     2022552 :   const auto name = checkForRename(name_in);
     346             : 
     347     2022552 :   auto it = _params.find(name);
     348     2022552 :   if (it == _params.end())
     349           2 :     mooseError("Unable to set the documentation string (using setDocString) for the \"",
     350             :                name,
     351             :                "\" parameter, the parameter does not exist.");
     352     2022550 :   it->second._doc_string = doc;
     353     2022552 : }
     354             : 
     355             : std::string
     356     1173988 : InputParameters::getDocUnit(const std::string & name_in) const
     357             : {
     358     1173988 :   const auto name = checkForRename(name_in);
     359     2347976 :   return _params.at(name)._doc_unit;
     360     1173988 : }
     361             : 
     362             : void
     363      686794 : InputParameters::setDocUnit(const std::string & name_in, const std::string & doc_unit)
     364             : {
     365      686794 :   const auto name = checkForRename(name_in);
     366      686794 :   _params[name]._doc_unit = doc_unit;
     367      686794 : }
     368             : 
     369             : bool
     370    61480897 : InputParameters::isParamRequired(const std::string & name_in) const
     371             : {
     372    61480897 :   const auto name = checkForRename(name_in);
     373   122961794 :   return _params.count(name) > 0 && _params.at(name)._required;
     374    61480897 : }
     375             : 
     376             : void
     377        6554 : InputParameters::makeParamNotRequired(const std::string & name_in)
     378             : {
     379        6554 :   const auto name = checkForRename(name_in);
     380             : 
     381        6554 :   if (_params.count(name))
     382        6550 :     _params[name]._required = false;
     383        6554 : }
     384             : 
     385             : bool
     386   349196231 : InputParameters::isParamValid(const std::string & name_in) const
     387             : {
     388   349196231 :   const auto name = checkForRename(name_in);
     389   349196231 :   if (have_parameter<MooseEnum>(name))
     390     6880664 :     return get<MooseEnum>(name).isValid();
     391   342315567 :   else if (have_parameter<std::vector<MooseEnum>>(name))
     392             :   {
     393       10726 :     for (auto it = get<std::vector<MooseEnum>>(name).begin();
     394       22081 :          it != get<std::vector<MooseEnum>>(name).end();
     395       11355 :          ++it)
     396       11359 :       if (!it->isValid())
     397           4 :         return false;
     398       10722 :     return true;
     399             :   }
     400   342304841 :   else if (have_parameter<MultiMooseEnum>(name))
     401     1688909 :     return get<MultiMooseEnum>(name).isValid();
     402   340615932 :   else if (have_parameter<std::vector<MultiMooseEnum>>(name))
     403             :   {
     404          84 :     for (auto it = get<std::vector<MultiMooseEnum>>(name).begin();
     405         324 :          it != get<std::vector<MultiMooseEnum>>(name).end();
     406         240 :          ++it)
     407         264 :       if (!it->isValid())
     408          24 :         return false;
     409          60 :     return true;
     410             :   }
     411   340615848 :   else if (have_parameter<ExecFlagEnum>(name))
     412     6516423 :     return get<ExecFlagEnum>(name).isValid();
     413             :   else
     414   334099425 :     return _params.count(name) > 0 && _params.at(name)._valid;
     415   349196231 : }
     416             : 
     417             : bool
     418     3817917 : InputParameters::isParamSetByAddParam(const std::string & name_in) const
     419             : {
     420     3817917 :   const auto name = checkForRename(name_in);
     421     7635834 :   return _params.count(name) > 0 && _params.at(name)._set_by_add_param;
     422     3817917 : }
     423             : 
     424             : bool
     425      760460 : InputParameters::isParamDeprecated(const std::string & name_in) const
     426             : {
     427      760460 :   const auto name = checkForRename(name_in);
     428     1520920 :   return _params.count(name) > 0 && !_params.at(name)._deprecation_message.empty();
     429      760460 : }
     430             : 
     431             : #ifdef MOOSE_KOKKOS_ENABLED
     432             : bool
     433     1846737 : InputParameters::isKokkosObject() const
     434             : {
     435     1846737 :   return isParamValid(MooseBase::kokkos_object_param);
     436             : }
     437             : #endif
     438             : 
     439             : bool
     440     2350110 : InputParameters::areAllRequiredParamsValid() const
     441             : {
     442    39338485 :   for (const auto & it : *this)
     443    37104709 :     if (isParamRequired(it.first) && !isParamValid(it.first))
     444      116334 :       return false;
     445     2233776 :   return true;
     446             : }
     447             : 
     448             : bool
     449   170974294 : InputParameters::isPrivate(const std::string & name_in) const
     450             : {
     451   170974294 :   const auto name = checkForRename(name_in);
     452   341948588 :   return _params.count(name) > 0 && _params.at(name)._is_private;
     453   170974294 : }
     454             : 
     455             : void
     456     6112981 : InputParameters::declareControllable(const std::string & input_names,
     457             :                                      std::set<ExecFlagType> execute_flags)
     458             : {
     459     6112981 :   std::vector<std::string> names;
     460     6112981 :   MooseUtils::tokenize<std::string>(input_names, names, 1, " ");
     461    12256317 :   for (auto & name_in : names)
     462             :   {
     463     6143338 :     const auto name = checkForRename(name_in);
     464     6143338 :     auto map_iter = _params.find(name);
     465     6143338 :     if (map_iter != _params.end()) // error is handled by checkParams method
     466             :     {
     467     6143336 :       map_iter->second._controllable = true;
     468     6143336 :       map_iter->second._controllable_flags = execute_flags;
     469             :     }
     470             :     else
     471           2 :       mooseError("The input parameter '",
     472             :                  name,
     473             :                  "' does not exist, thus cannot be marked as controllable.");
     474     6143338 :   }
     475     6112981 : }
     476             : 
     477             : bool
     478   134727032 : InputParameters::isControllable(const std::string & name_in) const
     479             : {
     480   134727032 :   const auto name = checkForRename(name_in);
     481   269454064 :   return _params.count(name) > 0 && _params.at(name)._controllable;
     482   134727032 : }
     483             : 
     484             : const std::set<ExecFlagType> &
     485     1405311 : InputParameters::getControllableExecuteOnTypes(const std::string & name_in) const
     486             : {
     487     1405311 :   const auto name = checkForRename(name_in);
     488     2810622 :   return at(name)._controllable_flags;
     489     1405311 : }
     490             : 
     491             : void
     492    21347180 : InputParameters::registerBase(const std::string & value)
     493             : {
     494    21347180 :   InputParameters::set<std::string>(MooseBase::moose_base_param) = value;
     495    21347180 :   _params[MooseBase::moose_base_param]._is_private = true;
     496    21347180 : }
     497             : 
     498             : bool
     499     6608364 : InputParameters::hasBase() const
     500             : {
     501     6608364 :   return have_parameter<std::string>(MooseBase::moose_base_param);
     502             : }
     503             : 
     504             : const std::string &
     505    13487171 : InputParameters::getBase() const
     506             : {
     507    13487171 :   if (!have_parameter<std::string>(MooseBase::moose_base_param))
     508           0 :     mooseError("InputParameters::getBase(): Parameters do not have base; one needs to be set with "
     509             :                "registerBase()");
     510    13487171 :   return get<std::string>(MooseBase::moose_base_param);
     511             : }
     512             : 
     513             : void
     514     4105646 : InputParameters::registerSystemAttributeName(const std::string & value)
     515             : {
     516     4105646 :   InputParameters::set<std::string>("_moose_warehouse_system_name") = value;
     517     8211292 :   _params["_moose_warehouse_system_name"]._is_private = true;
     518     4105646 : }
     519             : 
     520             : const std::string &
     521      311330 : InputParameters::getSystemAttributeName() const
     522             : {
     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      311330 :   return Parameters::get<std::string>("_moose_warehouse_system_name");
     527             : }
     528             : 
     529             : void
     530           0 : InputParameters::registerBuildableTypes(const std::string & names)
     531             : {
     532           0 :   _buildable_types.clear();
     533           0 :   MooseUtils::tokenize(names, _buildable_types, 1, " \t\n\v\f\r"); // tokenize on whitespace
     534           0 : }
     535             : 
     536             : void
     537     2282154 : InputParameters::addRelationshipManager(
     538             :     const std::string & name,
     539             :     Moose::RelationshipManagerType rm_type,
     540             :     Moose::RelationshipManagerInputParameterCallback input_parameter_callback)
     541             : {
     542     2282154 :   _buildable_rm_types.emplace_back(name, rm_type, input_parameter_callback);
     543     2282154 : }
     544             : 
     545             : const std::vector<std::string> &
     546     5185339 : InputParameters::getBuildableTypes() const
     547             : {
     548     5185339 :   return _buildable_types;
     549             : }
     550             : 
     551             : const std::vector<std::tuple<std::string,
     552             :                              Moose::RelationshipManagerType,
     553             :                              Moose::RelationshipManagerInputParameterCallback>> &
     554     2948595 : InputParameters::getBuildableRelationshipManagerTypes() const
     555             : {
     556     2948595 :   return _buildable_rm_types;
     557             : }
     558             : 
     559             : void
     560           0 : InputParameters::collapseSyntaxNesting(bool collapse)
     561             : {
     562           0 :   _collapse_nesting = collapse;
     563           0 : }
     564             : 
     565             : bool
     566       99247 : InputParameters::collapseSyntaxNesting() const
     567             : {
     568       99247 :   return _collapse_nesting;
     569             : }
     570             : 
     571             : void
     572           0 : InputParameters::mooseObjectSyntaxVisibility(bool visibility)
     573             : {
     574           0 :   _moose_object_syntax_visibility = visibility;
     575           0 : }
     576             : 
     577             : bool
     578      112129 : InputParameters::mooseObjectSyntaxVisibility() const
     579             : {
     580      112129 :   return _moose_object_syntax_visibility;
     581             : }
     582             : 
     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";
     587             : 
     588             : void
     589     5649021 : InputParameters::checkParams(const std::string & parsing_syntax)
     590             : {
     591     5649021 :   const std::string parampath = blockFullpath() != "" ? blockFullpath() : parsing_syntax;
     592             : 
     593             :   // Required parameters
     594     5649021 :   std::vector<std::string> required_param_errors;
     595   146158570 :   for (const auto & it : *this)
     596             :   {
     597   140509549 :     const auto param_name = checkForRename(it.first);
     598   140509549 :     if (!isParamValid(param_name) && isParamRequired(param_name))
     599             :     {
     600             :       // check if an old, deprecated name exists for this parameter that may be specified
     601          29 :       auto oit = _new_to_deprecated_coupled_vars.find(param_name);
     602          29 :       if (oit != _new_to_deprecated_coupled_vars.end() && isParamValid(oit->second))
     603           0 :         continue;
     604             : 
     605          87 :       required_param_errors.push_back("missing required parameter '" + parampath + "/" +
     606          58 :                                       param_name + "'\n\tDoc String: \"" +
     607         116 :                                       getDocString(param_name) + "\"");
     608             :     }
     609   140509549 :   }
     610             : 
     611     5649021 :   if (required_param_errors.size())
     612          33 :     mooseError(MooseUtils::stringJoin(required_param_errors, "\n"));
     613             : 
     614             :   // Range checked parameters
     615   146157451 :   for (const auto & [name, param_ptr] : *this)
     616             :   {
     617   140508461 :     if (const auto error = parameterRangeCheck(*param_ptr, parampath + "/" + name, name, false))
     618             :     {
     619           2 :       if (error->first)
     620           4 :         paramError(name, error->second);
     621             :       else
     622           0 :         mooseError("For range checked parameter '" + name + "': " + error->second);
     623   140508461 :     }
     624             :   }
     625             : 
     626             :   // Controllable parameters
     627     6560678 :   for (const auto & param_name : getControllableParameters())
     628             :   {
     629      911692 :     if (isPrivate(param_name))
     630           2 :       paramError(param_name,
     631          10 :                  "private parameter '" + paramFullpath(param_name) + "' marked controllable");
     632             : 
     633      911690 :     std::optional<std::string> error;
     634      911690 :     checkMooseType(NonlinearVariableName, param_name);
     635      911690 :     checkMooseType(AuxVariableName, param_name);
     636      911690 :     checkMooseType(VariableName, param_name);
     637      911690 :     checkMooseType(BoundaryName, param_name);
     638      911690 :     checkMooseType(SubdomainName, param_name);
     639      911690 :     checkMooseType(PostprocessorName, param_name);
     640      911690 :     checkMooseType(VectorPostprocessorName, param_name);
     641      911690 :     checkMooseType(UserObjectName, param_name);
     642      911690 :     checkMooseType(MaterialPropertyName, param_name);
     643      911690 :     if (error)
     644           4 :       paramError(param_name, *error);
     645     6560680 :   }
     646     5649002 : }
     647             : 
     648             : std::optional<std::pair<bool, std::string>>
     649   140525380 : InputParameters::parameterRangeCheck(const Parameters::Value & value,
     650             :                                      const std::string & long_name,
     651             :                                      const std::string & short_name,
     652             :                                      const bool include_param_path)
     653             : {
     654             : #define dynamicCastRangeCheck(type, up_type, long_name, short_name)                                \
     655             :   do                                                                                               \
     656             :   {                                                                                                \
     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);      \
     662             :   } while (0)
     663             : 
     664   140525380 :   dynamicCastRangeCheck(Real, Real, long_name, short_name);
     665   133245436 :   dynamicCastRangeCheck(int, long, long_name, short_name);
     666   132535110 :   dynamicCastRangeCheck(long, long, long_name, short_name);
     667   132535058 :   dynamicCastRangeCheck(unsigned int, long, long_name, short_name);
     668             : #undef dynamicCastRangeCheck
     669             : 
     670   122559567 :   return {};
     671             : }
     672             : 
     673             : void
     674     5615135 : InputParameters::finalize(const std::string & parsing_syntax)
     675             : {
     676             :   mooseAssert(!isFinalized(), "Already finalized");
     677             : 
     678     5615135 :   checkParams(parsing_syntax);
     679             : 
     680             :   // Set parameters that represent file types
     681   145248502 :   for (const auto & name_value : *this)
     682             :   {
     683   139633420 :     const auto & param_name = name_value.first;
     684   139633420 :     const auto & param_value = name_value.second;
     685             : 
     686             :     // Helper for setting a file typed parameter value
     687      256733 :     const auto set_filename = [&](auto & value)
     688             :     {
     689      256733 :       constexpr bool is_data_file_name =
     690             :           std::is_same_v<std::decay_t<decltype(value)>, DataFileName>;
     691             : 
     692             :       // We have behavior (which is gross) that requires that for
     693             :       // everything but DataFileName, if the value is empty we
     694             :       // don't bother looking for it
     695             :       if constexpr (!is_data_file_name)
     696             :       {
     697      256519 :         if (value.empty())
     698      235191 :           return;
     699             :       }
     700             : 
     701             :       // Setup options for searching for the path
     702       21542 :       Moose::DataFileUtils::GetPathOptions options;
     703             :       // Associate relative path searches with the folder
     704             :       // that input file that has this parameter is located
     705       21542 :       options.base = getFileBase(param_name);
     706             :       // If we don't explicitly have a DataFileName parameter,
     707             :       // we only want to augment cases where a data name is
     708             :       // explicitly set (like moose:file). We don't want to
     709             :       // search all other data. To presere previous behavior,
     710             :       // we also don't want to error if nothing is found; for
     711             :       // example if a relative or absolute path is not found.
     712             :       // The only time we'll error is if the data name is
     713             :       // explicitly set and the path doesn't exist in the data
     714             :       // or if that data name isn't registered.
     715             :       if constexpr (!is_data_file_name)
     716             :       {
     717       21328 :         options.search_all_data = false;
     718       21328 :         options.graceful = true;
     719             :       }
     720             : 
     721       21542 :       Moose::DataFileUtils::Path path;
     722             :       try
     723             :       {
     724       21542 :         Moose::ScopedThrowOnError scoped_throw_on_error;
     725       21569 :         path = Moose::DataFileUtils::getPath(value, options);
     726       21542 :       }
     727          51 :       catch (std::exception & e)
     728             :       {
     729          27 :         paramError(param_name, e.what());
     730             :       }
     731             : 
     732       21515 :       value = path.path;
     733       21515 :       at(param_name)._data_file_name_path = path;
     734   139654983 :     };
     735             : 
     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)
     741             : 
     742             :     if (false)
     743             :       ;
     744   139642963 :     set_if_filename(FileName);
     745   139534939 :     set_if_filename(FileNameNoExtension);
     746   139409316 :     set_if_filename(MeshFileName);
     747   139362849 :     set_if_filename(MatrixFileName);
     748   139360447 :     set_if_filename(DataFileName);
     749             : #undef set_if_filename
     750             :   }
     751             : 
     752     5615082 :   _finalized = true;
     753     5615082 : }
     754             : 
     755             : std::filesystem::path
     756       21542 : InputParameters::getFileBase(const std::optional<std::string> & param_name) const
     757             : {
     758             :   mooseAssert(!have_parameter<std::string>("_app_name"),
     759             :               "Not currently setup to work with app FileName parameters");
     760             : 
     761       21542 :   const hit::Node * hit_node = nullptr;
     762             : 
     763             :   // Context from the individual parameter
     764       21542 :   if (param_name)
     765       21542 :     hit_node = getHitNode(*param_name);
     766             :   // Context from the parameters
     767       21542 :   if (!hit_node)
     768        1221 :     hit_node = getHitNode();
     769             :   // No hit node, so use the cwd (no input files)
     770       21542 :   if (!hit_node)
     771         402 :     return std::filesystem::current_path();
     772             : 
     773             :   // Find any context that isn't command line arguments
     774       21790 :   while (hit_node && hit_node->filename() == "CLI_ARGS")
     775         650 :     hit_node = hit_node->parent();
     776             : 
     777             :   // Failed to find a node up the tree that isn't a command line argument
     778       21140 :   if (!hit_node)
     779             :   {
     780             :     const std::string error = "Input context was set via a command-line argument and does not have "
     781           0 :                               "sufficient context for determining a file path.";
     782           0 :     if (param_name)
     783           0 :       paramError(*param_name, error);
     784             :     else
     785           0 :       mooseError(error);
     786           0 :   }
     787             : 
     788       21140 :   return std::filesystem::absolute(std::filesystem::path(hit_node->filename()).parent_path());
     789             : }
     790             : 
     791             : bool
     792     8099095 : InputParameters::isRangeChecked(const std::string & param_name) const
     793             : {
     794     8099095 :   const auto name = checkForRename(param_name);
     795    16198190 :   return !_params.find(name)->second._range_function.empty();
     796     8099095 : }
     797             : 
     798             : std::string
     799       16393 : InputParameters::rangeCheckedFunction(const std::string & param_name) const
     800             : {
     801       16393 :   const auto name = checkForRename(param_name);
     802       32786 :   return _params.at(name)._range_function;
     803       16393 : }
     804             : 
     805             : bool
     806     3414771 : InputParameters::hasDefault(const std::string & param_name) const
     807             : {
     808     3414771 :   const auto name = checkForRename(param_name);
     809     3414771 :   if (hasDefaultCoupledValue(name))
     810           0 :     return true;
     811             :   // If it has a default, it's already valid
     812     3414771 :   else if (isParamSetByAddParam(name))
     813           4 :     return true;
     814     3414767 :   else if (isParamValid(name))
     815           0 :     mooseError("No way to know if the parameter '", param_name, "' has a default");
     816             :   else
     817     3414767 :     return false;
     818     3414771 : }
     819             : 
     820             : bool
     821     4362051 : InputParameters::hasCoupledVar(const std::string & coupling_name) const
     822             : {
     823     4362051 :   return _coupled_vars.find(coupling_name) != _coupled_vars.end();
     824             : }
     825             : 
     826             : void
     827           4 : InputParameters::setCoupledVar(const std::string & coupling_name, const std::string & value)
     828             : {
     829          14 :   setCoupledVar(coupling_name, std::vector<VariableName>{value});
     830           8 : }
     831             : 
     832             : void
     833           6 : InputParameters::setCoupledVar(const std::string & coupling_name,
     834             :                                const std::vector<VariableName> & values)
     835             : {
     836           6 :   const auto actual_name = checkForRename(coupling_name);
     837             : 
     838           6 :   if (!hasCoupledVar(actual_name))
     839           2 :     mooseError("Unable to set coupled variable parameter '",
     840             :                coupling_name,
     841             :                "' because it was not added with addCoupledVar or addRequiredCoupledVar.");
     842             : 
     843           4 :   set<std::vector<VariableName>>(actual_name) = values;
     844           6 : }
     845             : 
     846             : const std::vector<VariableName> &
     847           6 : InputParameters::getCoupledVar(const std::string & coupling_name) const
     848             : {
     849           6 :   const auto actual_name = checkForRename(coupling_name);
     850             : 
     851           6 :   if (!hasCoupledVar(actual_name))
     852           2 :     mooseError("Unable to get coupled variable parameter '",
     853             :                coupling_name,
     854             :                "' because it was not added with addCoupledVar or addRequiredCoupledVar.");
     855             : 
     856           8 :   return get<std::vector<VariableName>>(actual_name);
     857           6 : }
     858             : 
     859             : bool
     860     8271096 : InputParameters::hasDefaultCoupledValue(const std::string & coupling_name) const
     861             : {
     862     8272653 :   return _params.count(coupling_name) > 0 && _params.at(coupling_name)._have_coupled_default &&
     863     8272653 :          _coupled_vars.count(coupling_name) > 0;
     864             : }
     865             : 
     866             : void
     867        1079 : InputParameters::defaultCoupledValue(const std::string & coupling_name, Real value, unsigned int i)
     868             : {
     869        1079 :   const auto actual_name = checkForRename(coupling_name);
     870        1079 :   _params[actual_name]._coupled_default.resize(i + 1);
     871        1079 :   _params[actual_name]._coupled_default[i] = value;
     872        1079 :   _params[actual_name]._have_coupled_default = true;
     873        1079 : }
     874             : 
     875             : Real
     876      929920 : InputParameters::defaultCoupledValue(const std::string & coupling_name, unsigned int i) const
     877             : {
     878      929920 :   auto value_it = _params.find(coupling_name);
     879             : 
     880      929920 :   if (value_it == _params.end() || !value_it->second._have_coupled_default)
     881           0 :     mooseError("Attempted to retrieve default value for coupled variable '",
     882             :                coupling_name,
     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");
     888             : 
     889     1849840 :   return value_it->second._coupled_default.at(i);
     890             : }
     891             : 
     892             : unsigned int
     893      150735 : InputParameters::numberDefaultCoupledValues(const std::string & coupling_name) const
     894             : {
     895      150735 :   auto value_it = _params.find(coupling_name);
     896      150735 :   if (value_it == _params.end())
     897           0 :     mooseError("Attempted to retrieve default value for coupled variable '",
     898             :                coupling_name,
     899             :                "' when none was provided.");
     900      301470 :   return value_it->second._coupled_default.size();
     901             : }
     902             : 
     903             : std::map<std::string, std::pair<std::string, std::string>>
     904     2349146 : InputParameters::getAutoBuildVectors() const
     905             : {
     906     2349146 :   std::map<std::string, std::pair<std::string, std::string>> abv;
     907    66240705 :   for (auto it = _params.begin(); it != _params.end(); ++it)
     908             :   {
     909    63891559 :     if (!it->second._autobuild_vecs.first.empty())
     910           2 :       abv[it->first] = it->second._autobuild_vecs;
     911             :   }
     912     2349146 :   return abv;
     913           0 : }
     914             : 
     915             : std::string
     916     1175996 : InputParameters::type(const std::string & name_in) const
     917             : {
     918     1175996 :   const auto name = checkForRename(name_in);
     919     1175996 :   if (!_values.count(name))
     920           0 :     mooseError("Parameter \"", name, "\" not found.\n\n", *this);
     921             : 
     922     1175996 :   if (_coupled_vars.find(name) != _coupled_vars.end())
     923       57856 :     return "std::vector<VariableName>";
     924     1147068 :   else if (_params.count(name) > 0 && !_params.at(name)._custom_type.empty())
     925        1251 :     return _params.at(name)._custom_type;
     926     1145817 :   return _values.at(name)->type();
     927     1175996 : }
     928             : 
     929             : std::string
     930     1422614 : InputParameters::getMooseType(const std::string & name_in) const
     931             : {
     932     1422614 :   const auto name = checkForRename(name_in);
     933     1422614 :   std::string var;
     934             : 
     935     1422614 :   if (have_parameter<VariableName>(name))
     936       84879 :     var = get<VariableName>(name);
     937     1337735 :   else if (have_parameter<NonlinearVariableName>(name))
     938      756841 :     var = get<NonlinearVariableName>(name);
     939      580894 :   else if (have_parameter<LinearVariableName>(name))
     940       14368 :     var = get<LinearVariableName>(name);
     941      566526 :   else if (have_parameter<AuxVariableName>(name))
     942      438801 :     var = get<AuxVariableName>(name);
     943      127725 :   else if (have_parameter<PostprocessorName>(name))
     944           0 :     var = get<PostprocessorName>(name);
     945      127725 :   else if (have_parameter<VectorPostprocessorName>(name))
     946           0 :     var = get<VectorPostprocessorName>(name);
     947      127725 :   else if (have_parameter<FunctionName>(name))
     948           0 :     var = get<FunctionName>(name);
     949      127725 :   else if (have_parameter<UserObjectName>(name))
     950           0 :     var = get<UserObjectName>(name);
     951      127725 :   else if (have_parameter<MaterialPropertyName>(name))
     952           0 :     var = get<MaterialPropertyName>(name);
     953      127725 :   else if (have_parameter<std::string>(name))
     954           9 :     var = get<std::string>(name);
     955             : 
     956     2845228 :   return var;
     957     1422614 : }
     958             : 
     959             : std::vector<std::string>
     960      585924 : InputParameters::getVecMooseType(const std::string & name_in) const
     961             : {
     962      585924 :   const auto name = checkForRename(name_in);
     963      585924 :   std::vector<std::string> svars;
     964             : 
     965      585924 :   if (have_parameter<std::vector<VariableName>>(name))
     966             :   {
     967      585918 :     std::vector<VariableName> vars = get<std::vector<VariableName>>(name);
     968      585918 :     std::copy(vars.begin(), vars.end(), std::back_inserter(svars));
     969      585918 :   }
     970           6 :   else if (have_parameter<std::vector<NonlinearVariableName>>(name))
     971             :   {
     972           0 :     std::vector<NonlinearVariableName> vars = get<std::vector<NonlinearVariableName>>(name);
     973           0 :     std::copy(vars.begin(), vars.end(), std::back_inserter(svars));
     974           0 :   }
     975           6 :   else if (have_parameter<std::vector<AuxVariableName>>(name))
     976             :   {
     977           0 :     std::vector<AuxVariableName> vars = get<std::vector<AuxVariableName>>(name);
     978           0 :     std::copy(vars.begin(), vars.end(), std::back_inserter(svars));
     979           0 :   }
     980           6 :   else if (have_parameter<std::vector<MaterialPropertyName>>(name))
     981             :   {
     982           0 :     std::vector<MaterialPropertyName> vars = get<std::vector<MaterialPropertyName>>(name);
     983           0 :     std::copy(vars.begin(), vars.end(), std::back_inserter(svars));
     984           0 :   }
     985           6 :   else if (have_parameter<std::vector<std::string>>(name))
     986             :   {
     987           0 :     std::vector<std::string> vars = get<std::vector<std::string>>(name);
     988           0 :     std::copy(vars.begin(), vars.end(), std::back_inserter(svars));
     989           0 :   }
     990             : 
     991     1171848 :   return svars;
     992      585924 : }
     993             : 
     994             : bool
     995       19235 : InputParameters::isMooseBaseObject() const
     996             : {
     997       38366 :   return have_parameter<std::string>(MooseBase::type_param) &&
     998       38366 :          get<std::string>(MooseBase::type_param).size() &&
     999       38339 :          have_parameter<std::string>(MooseBase::name_param);
    1000             : }
    1001             : 
    1002             : const std::string *
    1003    12753442 : InputParameters::queryObjectType() const
    1004             : {
    1005    12753442 :   return have_parameter<std::string>(MooseBase::type_param)
    1006    12753442 :              ? &get<std::string>(MooseBase::type_param)
    1007    12753442 :              : nullptr;
    1008             : }
    1009             : 
    1010             : const std::string &
    1011    12752414 : InputParameters::getObjectType() const
    1012             : {
    1013    12752414 :   if (const auto type_ptr = queryObjectType())
    1014    12752412 :     return *type_ptr;
    1015           2 :   ::mooseError("InputParameters::getObjectType(): Missing '", MooseBase::type_param, "' param");
    1016             : }
    1017             : 
    1018             : const std::string &
    1019    13832409 : InputParameters::getObjectName() const
    1020             : {
    1021    13832409 :   if (!have_parameter<std::string>(MooseBase::name_param))
    1022           0 :     ::mooseError("InputParameters::getObjectName(): Missing '", MooseBase::name_param, "' param");
    1023    13832409 :   return get<std::string>(MooseBase::name_param);
    1024             : }
    1025             : 
    1026             : void
    1027    64222515 : InputParameters::addParamNamesToGroup(const std::string & space_delim_names,
    1028             :                                       const std::string group_name)
    1029             : {
    1030    64222515 :   std::vector<std::string> elements;
    1031    64222515 :   MooseUtils::tokenize(space_delim_names, elements, 1, " \t\n\v\f\r"); // tokenize on whitespace
    1032             : 
    1033             :   // Since we don't require types (templates) for this method, we need
    1034             :   // to get a raw list of parameter names to compare against.
    1035    64222515 :   std::set<std::string> param_names;
    1036  1022333852 :   for (const auto & it : *this)
    1037   958111337 :     param_names.insert(it.first);
    1038             : 
    1039   206020050 :   for (const auto & param_name : elements)
    1040   141797535 :     if (_params.count(param_name) > 0)
    1041   141797535 :       _params[param_name]._group = group_name;
    1042             :     else
    1043           0 :       mooseError("Unable to find a parameter with name: ",
    1044             :                  param_name,
    1045             :                  " when adding to group ",
    1046             :                  group_name,
    1047           0 :                  '.');
    1048    64222515 : }
    1049             : 
    1050             : void
    1051        9755 : InputParameters::renameParameterGroup(const std::string & old_name, const std::string & new_name)
    1052             : {
    1053      169181 :   for (auto & param : _params)
    1054      159426 :     if (param.second._group == old_name)
    1055       33010 :       param.second._group = new_name;
    1056        9755 : }
    1057             : 
    1058             : void
    1059     1906252 : InputParameters::setGlobalCommandLineParam(const std::string & name)
    1060             : {
    1061     1906252 :   auto & cl_data = at(checkForRename(name))._cl_data;
    1062     1906252 :   if (!cl_data)
    1063           2 :     mooseError("InputParameters::setGlobalCommandLineParam: The parameter '",
    1064             :                name,
    1065             :                "' is not a command line parameter");
    1066     1906250 :   cl_data->global = true;
    1067     1906250 : }
    1068             : 
    1069             : bool
    1070           4 : InputParameters::isCommandLineParameter(const std::string & name) const
    1071             : {
    1072           4 :   return at(checkForRename(name))._cl_data.has_value();
    1073             : }
    1074             : 
    1075             : std::optional<InputParameters::CommandLineMetadata>
    1076    24627763 : InputParameters::queryCommandLineMetadata(const std::string & name) const
    1077             : {
    1078    24627763 :   const auto & cl_data = at(checkForRename(name))._cl_data;
    1079    24627763 :   if (!cl_data)
    1080    18791751 :     return {};
    1081     5836012 :   return *cl_data;
    1082             : }
    1083             : 
    1084             : const InputParameters::CommandLineMetadata &
    1085          11 : InputParameters::getCommandLineMetadata(const std::string & name) const
    1086             : {
    1087          11 :   const auto & cl_data = at(checkForRename(name))._cl_data;
    1088          11 :   if (!cl_data)
    1089           2 :     mooseError("InputParameters::getCommandLineMetadata: The parameter '",
    1090             :                name,
    1091             :                "' is not a command line parameter");
    1092           9 :   return *cl_data;
    1093             : }
    1094             : 
    1095             : void
    1096      461215 : InputParameters::commandLineParamSet(const std::string & name, const CommandLineParamSetKey)
    1097             : {
    1098      461215 :   auto & cl_data = at(checkForRename(name))._cl_data;
    1099      461215 :   if (!cl_data)
    1100           2 :     mooseError("InputParameters::commandLineParamSet: The parameter '",
    1101             :                name,
    1102             :                "' is not a command line parameter");
    1103      461213 :   cl_data->set_by_command_line = true;
    1104      461213 : }
    1105             : 
    1106             : std::string
    1107     1173984 : InputParameters::getGroupName(const std::string & param_name_in) const
    1108             : {
    1109     1173984 :   const auto param_name = checkForRename(param_name_in);
    1110     1173984 :   auto it = _params.find(param_name);
    1111     1173984 :   if (it != _params.end())
    1112     1173984 :     return it->second._group;
    1113           0 :   return std::string();
    1114     1173984 : }
    1115             : 
    1116             : void
    1117      331501 : InputParameters::applyParameters(const InputParameters & common,
    1118             :                                  const std::vector<std::string> & exclude,
    1119             :                                  const bool allow_private)
    1120             : {
    1121             :   // If we're applying all of the things, also associate the top level hit node
    1122      331501 :   if (exclude.empty() && !getHitNode() && common.getHitNode())
    1123      178115 :     setHitNode(*common.getHitNode(), {});
    1124             : 
    1125             :   // Loop through the common parameters
    1126    24922881 :   for (const auto & it : common)
    1127             :   {
    1128             :     // Common parameter name
    1129    24591380 :     const std::string & common_name = it.first;
    1130             :     // Continue to next parameter, if the current is in list of  excluded parameters
    1131    24591380 :     if (std::find(exclude.begin(), exclude.end(), common_name) != exclude.end())
    1132           0 :       continue;
    1133             : 
    1134    24591380 :     applyParameter(common, common_name, allow_private);
    1135             :   }
    1136             : 
    1137             :   // Loop through the coupled variables
    1138      332928 :   for (const auto & var_name : common._coupled_vars)
    1139             :   {
    1140             :     // Continue to next variable, if the current is in list of  excluded parameters
    1141        1427 :     if (std::find(exclude.begin(), exclude.end(), var_name) != exclude.end())
    1142           0 :       continue;
    1143             : 
    1144        1427 :     applyCoupledVar(common, var_name);
    1145             :   }
    1146      331501 : }
    1147             : 
    1148             : void
    1149      290471 : InputParameters::applyCommonUserSetParameters(const InputParameters & common,
    1150             :                                               const std::vector<std::string> & exclude,
    1151             :                                               const bool allow_private)
    1152             : {
    1153    15975905 :   for (const auto & it : common)
    1154             :   {
    1155    15685434 :     const std::string & common_name = it.first;
    1156    15685434 :     if (std::find(exclude.begin(), exclude.end(), common_name) != exclude.end())
    1157           0 :       continue;
    1158    15685434 :     if (!common.isParamSetByUser(common_name))
    1159    14771501 :       continue;
    1160      913933 :     applyParameter(common, common_name, allow_private);
    1161             :   }
    1162             : 
    1163      290471 :   for (const auto & var_name : common._coupled_vars)
    1164             :   {
    1165           0 :     if (std::find(exclude.begin(), exclude.end(), var_name) != exclude.end())
    1166           0 :       continue;
    1167           0 :     if (!common.isParamSetByUser(var_name))
    1168           0 :       continue;
    1169           0 :     applyCoupledVar(common, var_name);
    1170             :   }
    1171      290471 : }
    1172             : 
    1173             : void
    1174      126055 : InputParameters::applySpecificParameters(const InputParameters & common,
    1175             :                                          const std::vector<std::string> & include,
    1176             :                                          bool allow_private)
    1177             : {
    1178             :   // Loop through the common parameters
    1179     2766209 :   for (const auto & it : common)
    1180             :   {
    1181             :     // Common parameter name
    1182     2640154 :     const std::string & common_name = it.first;
    1183             : 
    1184             :     // Continue to next parameter, if the current is not in list of included parameters
    1185     2640154 :     if (std::find(include.begin(), include.end(), common_name) == include.end())
    1186     2269016 :       continue;
    1187             : 
    1188      371138 :     applyParameter(common, common_name, allow_private);
    1189             :   }
    1190             : 
    1191             :   // Loop through the coupled variables
    1192      126055 :   for (std::set<std::string>::const_iterator it = common.coupledVarsBegin();
    1193      126055 :        it != common.coupledVarsEnd();
    1194           0 :        ++it)
    1195             :   {
    1196             :     // Variable name
    1197           0 :     const std::string var_name = *it;
    1198             : 
    1199             :     // Continue to next variable, if the current is not in list of included parameters
    1200           0 :     if (std::find(include.begin(), include.end(), var_name) == include.end())
    1201           0 :       continue;
    1202             : 
    1203           0 :     applyCoupledVar(common, var_name);
    1204           0 :   }
    1205      126055 : }
    1206             : 
    1207             : void
    1208        1427 : InputParameters::applyCoupledVar(const InputParameters & common, const std::string & var_name)
    1209             : {
    1210             :   // Disable the display of deprecated message when applying common parameters, this avoids a dump
    1211             :   // of messages
    1212        1427 :   _show_deprecated_message = false;
    1213             : 
    1214             :   // If the local parameters has a coupled variable, populate it with the value from the common
    1215             :   // parameters, if the common parameters has the coupled variable too
    1216        1427 :   if (hasCoupledVar(var_name))
    1217             :   {
    1218        1423 :     if (common.hasDefaultCoupledValue(var_name))
    1219             :     {
    1220             :       // prepare a vector of default coupled values
    1221           0 :       std::vector<Real> defaults(common.numberDefaultCoupledValues(var_name));
    1222           0 :       for (unsigned int j = 0; j < common.numberDefaultCoupledValues(var_name); ++j)
    1223           0 :         defaults[j] = common.defaultCoupledValue(var_name, j);
    1224           0 :       addCoupledVar(var_name, defaults, common.getDocString(var_name));
    1225           0 :     }
    1226        1423 :     else if (common.hasCoupledVar(var_name))
    1227        1423 :       addCoupledVar(var_name, common.getDocString(var_name));
    1228             :   }
    1229             : 
    1230             :   // Enable deprecated message printing
    1231        1427 :   _show_deprecated_message = true;
    1232        1427 : }
    1233             : 
    1234             : void
    1235    25876598 : InputParameters::applyParameter(const InputParameters & common,
    1236             :                                 const std::string & common_name,
    1237             :                                 bool allow_private)
    1238             : {
    1239             :   // Disable the display of deprecated message when applying common parameters, this avoids a dump
    1240             :   // of messages
    1241    25876598 :   _show_deprecated_message = false;
    1242             : 
    1243    25876598 :   const auto local_name = checkForRename(common_name);
    1244             : 
    1245             :   // Extract the properties from the local parameter for the current common parameter name
    1246    25876598 :   const bool local_exist = _values.find(local_name) != _values.end();
    1247    25876598 :   const bool local_set = _params.count(local_name) > 0 && !_params[local_name]._set_by_add_param;
    1248    25876598 :   const bool local_priv = allow_private ? false : isPrivate(local_name);
    1249    25876598 :   const bool local_valid = isParamValid(local_name);
    1250             : 
    1251             :   // Extract the properties from the common parameter
    1252    25876598 :   const bool common_exist = common._values.find(common_name) != common._values.end();
    1253    25876598 :   const bool common_priv = allow_private ? false : common.isPrivate(common_name);
    1254    25876598 :   const bool common_valid = common.isParamValid(common_name);
    1255             : 
    1256             :   /* In order to apply a common parameter 4 statements must be satisfied
    1257             :    * (1) A local parameter must exist with the same name as the common parameter
    1258             :    * (2) Common parameter must be valid and exist
    1259             :    * (3) Local parameter must be invalid OR not have been set from its default
    1260             :    * (4) Both cannot be private
    1261             :    */
    1262    25876598 :   if (local_exist && common_exist && common_valid && (!local_valid || !local_set) &&
    1263     7424366 :       (!common_priv || !local_priv))
    1264             :   {
    1265     3243612 :     remove(local_name);
    1266     3243612 :     _values[local_name] = common._values.find(common_name)->second->clone();
    1267     3243612 :     set_attributes(local_name, false);
    1268     6487224 :     _params[local_name]._set_by_add_param =
    1269     3243612 :         libmesh_map_find(common._params, common_name)._set_by_add_param;
    1270             :     // Keep track of where this param came from if we can. This will enable us to
    1271             :     // produce param errors from objects created within an action that link to
    1272             :     // the parameter in the action
    1273     3243612 :     at(local_name)._hit_node = common.getHitNode(common_name);
    1274             :   }
    1275    22632986 :   else if (!local_exist && !common_exist)
    1276           2 :     mooseError("InputParameters::applyParameter(): Attempted to apply invalid parameter \"",
    1277             :                common_name,
    1278             :                "\"");
    1279             : 
    1280             :   // Enable deprecated message printing
    1281    25876596 :   _show_deprecated_message = true;
    1282    25876598 : }
    1283             : 
    1284             : ///Deprecated method
    1285             : bool
    1286           0 : InputParameters::paramSetByUser(const std::string & name) const
    1287             : {
    1288           0 :   mooseDeprecated("paramSetByUser() is deprecated. Use isParamSetByUser() instead.");
    1289           0 :   return isParamSetByUser(name);
    1290             : }
    1291             : 
    1292             : bool
    1293    20484587 : InputParameters::isParamSetByUser(const std::string & name_in) const
    1294             : {
    1295    20484587 :   const auto name = checkForRename(name_in);
    1296             :   // Invalid; for sure not set by the user
    1297    20484587 :   if (!isParamValid(name))
    1298     2345001 :     return false;
    1299             :   // Parameter is not located in the list (called Parameters::set)
    1300    18139586 :   if (!_params.count(name))
    1301           0 :     return false;
    1302             :   // Special case for a command line option, which is a private parameter
    1303    18139586 :   if (const auto cl_data = queryCommandLineMetadata(name))
    1304    18139586 :     return cl_data->set_by_command_line;
    1305             :   // Not a command line option, not set by addParam and not private
    1306    17451330 :   return !_params.at(name)._set_by_add_param && !_params.at(name)._is_private;
    1307    20484587 : }
    1308             : 
    1309             : bool
    1310           4 : InputParameters::isParamDefined(const std::string & name_in) const
    1311             : {
    1312           4 :   const auto name = checkForRename(name_in);
    1313           8 :   return _params.count(name) > 0;
    1314           4 : }
    1315             : 
    1316             : const std::string &
    1317     4237118 : InputParameters::getDescription(const std::string & name_in) const
    1318             : {
    1319     4237118 :   const auto name = checkForRename(name_in);
    1320     4237118 :   auto it = _params.find(name);
    1321     4237118 :   if (it == _params.end())
    1322           0 :     mooseError("No parameter exists with the name ", name);
    1323     8474236 :   return it->second._doc_string;
    1324     4237118 : }
    1325             : 
    1326             : template <>
    1327             : void
    1328      503872 : InputParameters::addRequiredParam<MooseEnum>(const std::string & name,
    1329             :                                              const MooseEnum & moose_enum,
    1330             :                                              const std::string & doc_string)
    1331             : {
    1332      503872 :   InputParameters::set<MooseEnum>(name) = moose_enum; // valid parameter is set by set_attributes
    1333      503872 :   auto & metadata = _params[name];
    1334      503872 :   metadata._required = true;
    1335      503872 :   metadata._doc_string = doc_string;
    1336      503872 : }
    1337             : 
    1338             : template <>
    1339             : void
    1340           4 : InputParameters::addRequiredParam<MultiMooseEnum>(const std::string & name,
    1341             :                                                   const MultiMooseEnum & moose_enum,
    1342             :                                                   const std::string & doc_string)
    1343             : {
    1344           4 :   InputParameters::set<MultiMooseEnum>(name) =
    1345           4 :       moose_enum; // valid parameter is set by set_attributes
    1346           4 :   auto & metadata = _params[name];
    1347           4 :   metadata._required = true;
    1348           4 :   metadata._doc_string = doc_string;
    1349           4 : }
    1350             : 
    1351             : template <>
    1352             : void
    1353           4 : InputParameters::addRequiredParam<std::vector<MooseEnum>>(
    1354             :     const std::string & name,
    1355             :     const std::vector<MooseEnum> & moose_enums,
    1356             :     const std::string & doc_string)
    1357             : {
    1358           4 :   InputParameters::set<std::vector<MooseEnum>>(name) =
    1359           4 :       moose_enums; // valid parameter is set by set_attributes
    1360           4 :   auto & metadata = _params[name];
    1361           4 :   metadata._required = true;
    1362           4 :   metadata._doc_string = doc_string;
    1363           4 : }
    1364             : 
    1365             : template <>
    1366             : void
    1367        3130 : InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
    1368             :     const std::string & name,
    1369             :     const std::vector<MultiMooseEnum> & moose_enums,
    1370             :     const std::string & doc_string)
    1371             : {
    1372             :   mooseAssert(
    1373             :       moose_enums.size() == 1,
    1374             :       "Only 1 MultiMooseEnum is supported in addRequiredParam<std::vector<MultiMooseEnum>> for " +
    1375             :           name);
    1376             :   mooseAssert(!moose_enums[0].items().empty(),
    1377             :               "The MultiMooseEnum in addRequiredParam<std::vector<MultiMooseEnum>> is empty for " +
    1378             :                   name);
    1379        3130 :   InputParameters::set<std::vector<MultiMooseEnum>>(name) =
    1380        3130 :       moose_enums; // valid parameter is set by set_attributes
    1381        3130 :   auto & metadata = _params[name];
    1382        3130 :   metadata._required = true;
    1383        3130 :   metadata._doc_string = doc_string;
    1384        3130 : }
    1385             : 
    1386             : template <>
    1387             : void
    1388           0 : InputParameters::addParam<MooseEnum>(const std::string & /*name*/,
    1389             :                                      const std::string & /*doc_string*/)
    1390             : {
    1391           0 :   mooseError("You must supply a MooseEnum object when using addParam, even if the parameter is not "
    1392             :              "required!");
    1393             : }
    1394             : 
    1395             : template <>
    1396             : void
    1397           0 : InputParameters::addParam<MultiMooseEnum>(const std::string & /*name*/,
    1398             :                                           const std::string & /*doc_string*/)
    1399             : {
    1400           0 :   mooseError("You must supply a MultiMooseEnum object when using addParam, even if the parameter "
    1401             :              "is not required!");
    1402             : }
    1403             : 
    1404             : template <>
    1405             : void
    1406           0 : InputParameters::addParam<std::vector<MooseEnum>>(const std::string & /*name*/,
    1407             :                                                   const std::string & /*doc_string*/)
    1408             : {
    1409           0 :   mooseError("You must supply a vector of MooseEnum object(s) when using addParam, even if the "
    1410             :              "parameter is not required!");
    1411             : }
    1412             : 
    1413             : template <>
    1414             : void
    1415           0 : InputParameters::addParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
    1416             :                                                        const std::string & /*doc_string*/)
    1417             : {
    1418           0 :   mooseError(
    1419             :       "You must supply a vector of MultiMooseEnum object(s) when using addParam, even if the "
    1420             :       "parameter is not required!");
    1421             : }
    1422             : 
    1423             : template <>
    1424             : void
    1425           0 : InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
    1426             :                                                                const std::string & /*doc_string*/)
    1427             : {
    1428           0 :   mooseError("You must supply a vector of MultiMooseEnum object(s) when using addRequiredParam!");
    1429             : }
    1430             : 
    1431             : template <>
    1432             : void
    1433           0 : InputParameters::addPrivateParam<MooseEnum>(const std::string & /*name*/)
    1434             : {
    1435           0 :   mooseError("You must supply a MooseEnum object when using addPrivateParam, even if the parameter "
    1436             :              "is not required!");
    1437             : }
    1438             : 
    1439             : template <>
    1440             : void
    1441           0 : InputParameters::addPrivateParam<MultiMooseEnum>(const std::string & /*name*/)
    1442             : {
    1443           0 :   mooseError("You must supply a MultiMooseEnum object when using addPrivateParam, even if the "
    1444             :              "parameter is not required!");
    1445             : }
    1446             : 
    1447             : template <>
    1448             : void
    1449           0 : InputParameters::addDeprecatedParam<MooseEnum>(const std::string & /*name*/,
    1450             :                                                const std::string & /*doc_string*/,
    1451             :                                                const std::string & /*deprecation_message*/)
    1452             : {
    1453           0 :   mooseError("You must supply a MooseEnum object and the deprecation string when using "
    1454             :              "addDeprecatedParam, even if the parameter is not required!");
    1455             : }
    1456             : 
    1457             : template <>
    1458             : void
    1459           0 : InputParameters::addDeprecatedParam<MultiMooseEnum>(const std::string & /*name*/,
    1460             :                                                     const std::string & /*doc_string*/,
    1461             :                                                     const std::string & /*deprecation_message*/)
    1462             : {
    1463           0 :   mooseError("You must supply a MultiMooseEnum object and the deprecation string when using "
    1464             :              "addDeprecatedParam, even if the parameter is not required!");
    1465             : }
    1466             : 
    1467             : template <>
    1468             : void
    1469           0 : InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
    1470             :     const std::string & /*name*/,
    1471             :     const std::string & /*doc_string*/,
    1472             :     const std::string & /*deprecation_message*/)
    1473             : {
    1474           0 :   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!");
    1476             : }
    1477             : 
    1478             : template <>
    1479             : void
    1480       38634 : InputParameters::setParamHelper<PostprocessorName, Real>(const std::string & /*name*/,
    1481             :                                                          PostprocessorName & l_value,
    1482             :                                                          const Real & r_value)
    1483             : {
    1484             :   // Assign the default value so that it appears in the dump
    1485       38634 :   std::ostringstream oss;
    1486       38634 :   oss << r_value;
    1487       38634 :   l_value = oss.str();
    1488       38634 : }
    1489             : 
    1490             : template <>
    1491             : void
    1492       61989 : InputParameters::setParamHelper<PostprocessorName, int>(const std::string & /*name*/,
    1493             :                                                         PostprocessorName & l_value,
    1494             :                                                         const int & r_value)
    1495             : {
    1496             :   // Assign the default value so that it appears in the dump
    1497       61989 :   std::ostringstream oss;
    1498       61989 :   oss << r_value;
    1499       61989 :   l_value = oss.str();
    1500       61989 : }
    1501             : 
    1502             : template <>
    1503             : void
    1504        9746 : InputParameters::setParamHelper<FunctionName, Real>(const std::string & /*name*/,
    1505             :                                                     FunctionName & l_value,
    1506             :                                                     const Real & r_value)
    1507             : {
    1508             :   // Assign the default value so that it appears in the dump
    1509        9746 :   std::ostringstream oss;
    1510        9746 :   oss << r_value;
    1511        9746 :   l_value = oss.str();
    1512        9746 : }
    1513             : 
    1514             : template <>
    1515             : void
    1516      170438 : InputParameters::setParamHelper<FunctionName, int>(const std::string & /*name*/,
    1517             :                                                    FunctionName & l_value,
    1518             :                                                    const int & r_value)
    1519             : {
    1520             :   // Assign the default value so that it appears in the dump
    1521      170438 :   std::ostringstream oss;
    1522      170438 :   oss << r_value;
    1523      170438 :   l_value = oss.str();
    1524      170438 : }
    1525             : 
    1526             : template <>
    1527             : void
    1528       26808 : InputParameters::setParamHelper<MaterialPropertyName, Real>(const std::string & /*name*/,
    1529             :                                                             MaterialPropertyName & l_value,
    1530             :                                                             const Real & r_value)
    1531             : {
    1532             :   // Assign the default value so that it appears in the dump
    1533       26808 :   std::ostringstream oss;
    1534       26808 :   oss << r_value;
    1535       26808 :   l_value = oss.str();
    1536       26808 : }
    1537             : 
    1538             : template <>
    1539             : void
    1540       31596 : InputParameters::setParamHelper<MaterialPropertyName, int>(const std::string & /*name*/,
    1541             :                                                            MaterialPropertyName & l_value,
    1542             :                                                            const int & r_value)
    1543             : {
    1544             :   // Assign the default value so that it appears in the dump
    1545       31596 :   std::ostringstream oss;
    1546       31596 :   oss << r_value;
    1547       31596 :   l_value = oss.str();
    1548       31596 : }
    1549             : 
    1550             : template <>
    1551             : void
    1552       53591 : InputParameters::setParamHelper<MooseFunctorName, Real>(const std::string & /*name*/,
    1553             :                                                         MooseFunctorName & l_value,
    1554             :                                                         const Real & r_value)
    1555             : {
    1556             :   // Assign the default value so that it appears in the dump
    1557       53591 :   std::ostringstream oss;
    1558       53591 :   oss << r_value;
    1559       53591 :   l_value = oss.str();
    1560       53591 : }
    1561             : 
    1562             : template <>
    1563             : void
    1564       77577 : InputParameters::setParamHelper<MooseFunctorName, int>(const std::string & /*name*/,
    1565             :                                                        MooseFunctorName & l_value,
    1566             :                                                        const int & r_value)
    1567             : {
    1568             :   // Assign the default value so that it appears in the dump
    1569       77577 :   std::ostringstream oss;
    1570       77577 :   oss << r_value;
    1571       77577 :   l_value = oss.str();
    1572       77577 : }
    1573             : 
    1574             : template <>
    1575             : const MooseEnum &
    1576     2332077 : InputParameters::getParamHelper<MooseEnum>(const std::string & name_in,
    1577             :                                            const InputParameters & pars)
    1578             : {
    1579     2332077 :   const auto name = pars.checkForRename(name_in);
    1580     4664154 :   return pars.get<MooseEnum>(name);
    1581     2332077 : }
    1582             : 
    1583             : template <>
    1584             : const MultiMooseEnum &
    1585      202274 : InputParameters::getParamHelper<MultiMooseEnum>(const std::string & name_in,
    1586             :                                                 const InputParameters & pars)
    1587             : {
    1588      202274 :   const auto name = pars.checkForRename(name_in);
    1589      404548 :   return pars.get<MultiMooseEnum>(name);
    1590      202274 : }
    1591             : 
    1592             : void
    1593     2266942 : InputParameters::setReservedValues(const std::string & name_in,
    1594             :                                    const std::set<std::string> & reserved)
    1595             : {
    1596     2266942 :   const auto name = checkForRename(name_in);
    1597     2266942 :   _params[name]._reserved_values = reserved;
    1598     2266942 : }
    1599             : 
    1600             : std::set<std::string>
    1601      719991 : InputParameters::reservedValues(const std::string & name_in) const
    1602             : {
    1603      719991 :   const auto name = checkForRename(name_in);
    1604      719991 :   auto it = _params.find(name);
    1605      719991 :   if (it == _params.end())
    1606           0 :     return std::set<std::string>();
    1607      719991 :   return it->second._reserved_values;
    1608      719991 : }
    1609             : 
    1610             : std::string
    1611           0 : InputParameters::blockLocation() const
    1612             : {
    1613           0 :   if (const auto hit_node = getHitNode())
    1614           0 :     return hit_node->fileLocation(/* with_column = */ false);
    1615           0 :   return "";
    1616             : }
    1617             : 
    1618             : std::string
    1619    15137183 : InputParameters::blockFullpath() const
    1620             : {
    1621    15137183 :   if (const auto hit_node = getHitNode())
    1622    14022178 :     return hit_node->fullpath();
    1623     2230010 :   return "";
    1624             : }
    1625             : 
    1626             : const hit::Node *
    1627     3539419 : InputParameters::getHitNode(const std::string & param) const
    1628             : {
    1629     3539419 :   return at(param)._hit_node;
    1630             : }
    1631             : 
    1632             : void
    1633     2688164 : InputParameters::setHitNode(const std::string & param,
    1634             :                             const hit::Node & node,
    1635             :                             const InputParameters::SetParamHitNodeKey)
    1636             : {
    1637             :   mooseAssert(node.type() == hit::NodeType::Field, "Must be a field");
    1638     2688164 :   at(param)._hit_node = &node;
    1639     2688164 : }
    1640             : 
    1641             : std::string
    1642          24 : InputParameters::inputLocation(const std::string & param) const
    1643             : {
    1644          24 :   if (const auto hit_node = getHitNode(param))
    1645          24 :     return hit_node->fileLocation(/* with_column = */ false);
    1646           0 :   return "";
    1647             : }
    1648             : 
    1649             : std::string
    1650          34 : InputParameters::paramFullpath(const std::string & param) const
    1651             : {
    1652          34 :   if (const auto hit_node = getHitNode(param))
    1653          30 :     return hit_node->fullpath();
    1654           8 :   return "";
    1655             : }
    1656             : 
    1657             : void
    1658   869096002 : InputParameters::checkParamName(const std::string & name) const
    1659             : {
    1660   869096002 :   const static pcrecpp::RE valid("[\\w:/]+");
    1661   869096002 :   if (!valid.FullMatch(name))
    1662           6 :     mooseError("Invalid parameter name: '", name, "'");
    1663   869095996 : }
    1664             : 
    1665             : bool
    1666    63891559 : InputParameters::shouldIgnore(const std::string & name_in)
    1667             : {
    1668    63891559 :   const auto name = checkForRename(name_in);
    1669    63891559 :   auto it = _params.find(name);
    1670    63891559 :   if (it != _params.end())
    1671   127783118 :     return it->second._ignore;
    1672           0 :   mooseError("Parameter ", name, " does not exist");
    1673    63891559 : }
    1674             : 
    1675             : std::set<std::string>
    1676           0 : InputParameters::getGroupParameters(const std::string & group) const
    1677             : {
    1678           0 :   std::set<std::string> names;
    1679           0 :   for (auto it = _params.begin(); it != _params.end(); ++it)
    1680           0 :     if (it->second._group == group)
    1681           0 :       names.emplace(it->first);
    1682           0 :   return names;
    1683           0 : }
    1684             : 
    1685             : std::set<std::string>
    1686         695 : InputParameters::getParametersList() const
    1687             : {
    1688         695 :   std::set<std::string> param_set;
    1689       28357 :   for (auto it = _params.begin(); it != _params.end(); ++it)
    1690       27662 :     param_set.emplace(it->first);
    1691         695 :   return param_set;
    1692           0 : }
    1693             : 
    1694             : std::set<std::string>
    1695     5795713 : InputParameters::getControllableParameters() const
    1696             : {
    1697     5795713 :   std::set<std::string> controllable;
    1698   153951221 :   for (auto it = _params.begin(); it != _params.end(); ++it)
    1699   148155508 :     if (it->second._controllable)
    1700      913116 :       controllable.emplace(it->first);
    1701     5795713 :   return controllable;
    1702           0 : }
    1703             : 
    1704             : std::string
    1705          12 : InputParameters::paramLocationPrefix(const std::string & param) const
    1706             : {
    1707          12 :   auto prefix = param + ":";
    1708          12 :   if (!inputLocation(param).empty())
    1709          12 :     prefix = inputLocation(param) + ": (" + paramFullpath(param) + ")";
    1710          12 :   return prefix;
    1711           0 : }
    1712             : 
    1713             : std::string
    1714           0 : InputParameters::rawParamVal(const std::string & param) const
    1715             : {
    1716           0 :   if (const auto hit_node = getHitNode(param))
    1717           0 :     return hit_node->strVal();
    1718           0 :   return "";
    1719             : }
    1720             : 
    1721             : std::string
    1722      517706 : InputParameters::varName(const std::string & var_param_name,
    1723             :                          const std::string & moose_object_with_var_param_name) const
    1724             : {
    1725             :   // Try the scalar version first
    1726      517706 :   std::string variable_name = getMooseType(var_param_name);
    1727      517706 :   if (variable_name == "")
    1728             :   {
    1729       65922 :     auto vec = getVecMooseType(var_param_name);
    1730             : 
    1731             :     // Catch the (very unlikely) case where a user specifies
    1732             :     // variable = '' (the empty string)
    1733             :     // in their input file. This could happen if e.g. something goes
    1734             :     // wrong with dollar bracket expression expansion.
    1735       65922 :     if (vec.empty())
    1736           6 :       mooseError("Error constructing object '",
    1737             :                  moose_object_with_var_param_name,
    1738             :                  "' while retrieving value for '",
    1739             :                  var_param_name,
    1740             :                  "' parameter! Did you forget to set '",
    1741             :                  var_param_name,
    1742             :                  "' or set it to '' (empty string) by accident?");
    1743             : 
    1744             :     // When using vector variables, we are only going to use the first one in the list at the
    1745             :     // interface level...
    1746       65916 :     variable_name = vec[0];
    1747       65916 :   }
    1748             : 
    1749      517700 :   return variable_name;
    1750           0 : }
    1751             : 
    1752             : void
    1753      157462 : InputParameters::renameParamInternal(const std::string & old_name,
    1754             :                                      const std::string & new_name,
    1755             :                                      const std::string & docstring,
    1756             :                                      const std::string & removal_date)
    1757             : {
    1758      157462 :   auto params_it = _params.find(old_name);
    1759      157462 :   if (params_it == _params.end())
    1760           0 :     mooseError("Requested to rename parameter '",
    1761             :                old_name,
    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");
    1765             : 
    1766      157462 :   auto new_metadata = std::move(params_it->second);
    1767      157462 :   if (!docstring.empty())
    1768      110461 :     new_metadata._doc_string = docstring;
    1769      157462 :   _params.emplace(new_name, std::move(new_metadata));
    1770      157462 :   _params.erase(params_it);
    1771             : 
    1772      157462 :   auto values_it = _values.find(old_name);
    1773      157462 :   auto new_value = std::move(values_it->second);
    1774      157462 :   _values.emplace(new_name, std::move(new_value));
    1775      157462 :   _values.erase(values_it);
    1776             : 
    1777      157462 :   std::string deprecation_message;
    1778      157462 :   if (!removal_date.empty())
    1779       51962 :     deprecation_message = "'" + old_name + "' has been deprecated and will be removed on " +
    1780       51962 :                           removal_date + ". Please use '" + new_name + "' instead.";
    1781             : 
    1782      157462 :   _old_to_new_name_and_dep.emplace(old_name, std::make_pair(new_name, deprecation_message));
    1783      157462 :   _new_to_old_names.emplace(new_name, old_name);
    1784      157462 : }
    1785             : 
    1786             : void
    1787       48166 : InputParameters::renameCoupledVarInternal(const std::string & old_name,
    1788             :                                           const std::string & new_name,
    1789             :                                           const std::string & docstring,
    1790             :                                           const std::string & removal_date)
    1791             : {
    1792       48166 :   auto coupled_vars_it = _coupled_vars.find(old_name);
    1793       48166 :   if (coupled_vars_it == _coupled_vars.end())
    1794           0 :     mooseError("Requested to rename coupled variable '",
    1795             :                old_name,
    1796             :                "' but that coupled variable name doesn't exist in the parameters object.");
    1797             : 
    1798       48166 :   _coupled_vars.insert(new_name);
    1799       48166 :   _coupled_vars.erase(coupled_vars_it);
    1800             : 
    1801       48166 :   renameParamInternal(old_name, new_name, docstring, removal_date);
    1802       48166 : }
    1803             : 
    1804             : void
    1805       96593 : InputParameters::renameParam(const std::string & old_name,
    1806             :                              const std::string & new_name,
    1807             :                              const std::string & new_docstring)
    1808             : {
    1809       96593 :   renameParamInternal(old_name, new_name, new_docstring, "");
    1810       96593 : }
    1811             : 
    1812             : void
    1813       34888 : InputParameters::renameCoupledVar(const std::string & old_name,
    1814             :                                   const std::string & new_name,
    1815             :                                   const std::string & new_docstring)
    1816             : {
    1817       34888 :   renameCoupledVarInternal(old_name, new_name, new_docstring, "");
    1818       34888 : }
    1819             : 
    1820             : void
    1821       12703 : InputParameters::deprecateParam(const std::string & old_name,
    1822             :                                 const std::string & new_name,
    1823             :                                 const std::string & removal_date)
    1824             : {
    1825       12703 :   renameParamInternal(old_name, new_name, "", removal_date);
    1826       12703 : }
    1827             : 
    1828             : void
    1829       13278 : InputParameters::deprecateCoupledVar(const std::string & old_name,
    1830             :                                      const std::string & new_name,
    1831             :                                      const std::string & removal_date)
    1832             : {
    1833       13278 :   renameCoupledVarInternal(old_name, new_name, "", removal_date);
    1834       13278 : }
    1835             : 
    1836             : std::string
    1837  5759402653 : InputParameters::checkForRename(const std::string & name) const
    1838             : {
    1839  5759402653 :   if (auto it = _old_to_new_name_and_dep.find(name); it != _old_to_new_name_and_dep.end())
    1840       37435 :     return it->second.first;
    1841             :   else
    1842  5759365218 :     return name;
    1843             : }
    1844             : 
    1845             : std::vector<std::string>
    1846    63888873 : InputParameters::paramAliases(const std::string & param_name) const
    1847             : {
    1848             :   mooseAssert(_values.find(param_name) != _values.end(),
    1849             :               "The parameter we are searching for aliases for should exist in our parameter map");
    1850   191666619 :   std::vector<std::string> aliases = {param_name};
    1851             : 
    1852    63905138 :   for (const auto & pr : as_range(_new_to_old_names.equal_range(param_name)))
    1853       16265 :     aliases.push_back(pr.second);
    1854             : 
    1855    63888873 :   return aliases;
    1856    63888873 : }
    1857             : 
    1858             : std::optional<Moose::DataFileUtils::Path>
    1859       11427 : InputParameters::queryDataFileNamePath(const std::string & name) const
    1860             : {
    1861       11427 :   return at(checkForRename(name))._data_file_name_path;
    1862             : }
    1863             : 
    1864             : std::optional<std::string>
    1865       77423 : InputParameters::setupVariableNames(std::vector<VariableName> & names,
    1866             :                                     const hit::Node & node,
    1867             :                                     const Moose::PassKey<Moose::Builder>)
    1868             : {
    1869             :   // Whether or not a name was found
    1870       77423 :   bool has_name = false;
    1871             :   // Whether or not a default value (real) was found
    1872       77423 :   bool has_default = false;
    1873             : 
    1874             :   // Search through the names for values that convert to Real values,
    1875             :   // which are default values. If defaults are found, set appropriately
    1876             :   // in the InputParameters object. Keep track of if names or defaults
    1877             :   // were found because we don't allow having both
    1878      164234 :   for (const auto i : index_range(names))
    1879             :   {
    1880       86811 :     auto & name = names[i];
    1881             :     Real real_value;
    1882       86811 :     if (MooseUtils::convert<Real>(name, real_value, false))
    1883             :     {
    1884        1079 :       has_default = true;
    1885        1079 :       defaultCoupledValue(node.path(), real_value, i);
    1886             :     }
    1887             :     else
    1888       85732 :       has_name = true;
    1889             :   }
    1890             : 
    1891       77423 :   if (has_default)
    1892             :   {
    1893         538 :     if (has_name)
    1894           6 :       return {"invalid value for '" + node.fullpath() +
    1895             :               "': coupled vectors where some parameters are reals and others are variables are not "
    1896           3 :               "supported"};
    1897             : 
    1898             :     // Don't actually use the names if these don't represent names
    1899         535 :     names.clear();
    1900             :   }
    1901             : 
    1902       77420 :   return {};
    1903             : }
    1904             : 
    1905             : std::pair<std::string, const hit::Node *>
    1906        2524 : InputParameters::paramMessageContext(const std::string & param) const
    1907             : {
    1908        2524 :   const hit::Node * node = nullptr;
    1909             : 
    1910        2524 :   std::string fullpath;
    1911             :   // First try to find the parameter
    1912        2524 :   if (const hit::Node * param_node = getHitNode(param))
    1913             :   {
    1914        2341 :     fullpath = param_node->fullpath();
    1915        2341 :     node = param_node;
    1916             :   }
    1917             :   // If no parameter node, hope for a block node
    1918         183 :   else if (const hit::Node * block_node = getHitNode())
    1919             :   {
    1920         139 :     node = block_node;
    1921         139 :     fullpath = block_node->fullpath() + "/" + param;
    1922             :   }
    1923             :   // Didn't find anything, at least use the parameter
    1924             :   else
    1925          44 :     fullpath = param;
    1926             : 
    1927        5048 :   return {fullpath + ": ", node};
    1928        2524 : }
    1929             : 
    1930             : std::string
    1931        1230 : InputParameters::paramMessagePrefix(const std::string & param) const
    1932             : {
    1933        1230 :   auto [prefix, node] = paramMessageContext(param);
    1934        1230 :   if (node)
    1935        1230 :     prefix = Moose::hitMessagePrefix(*node) + prefix;
    1936        2460 :   return prefix;
    1937        1230 : }
    1938             : 
    1939             : [[noreturn]] void
    1940        1374 : InputParameters::callMooseError(std::string msg,
    1941             :                                 const bool with_prefix /* = true */,
    1942             :                                 const hit::Node * node /* = nullptr */,
    1943             :                                 const bool show_trace /* = true */) const
    1944             : {
    1945             :   // Find the context of the app if we can. This will let our errors be
    1946             :   // prefixed by the multiapp name (if applicable) and will flush the
    1947             :   // console before outputting an error
    1948        1374 :   MooseApp * app = nullptr;
    1949        1374 :   if (isMooseBaseObject() && have_parameter<MooseApp *>(MooseBase::app_param))
    1950        1288 :     app = get<MooseApp *>(MooseBase::app_param);
    1951             : 
    1952        1374 :   MooseBase::callMooseError(app, *this, msg, with_prefix, node, show_trace);
    1953             : }

Generated by: LCOV version 1.14