LCOV - code coverage report
Current view: top level - include/utils - InputParameters.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #33390 (250e9c) with base 846a5c Lines: 395 406 97.3 %
Date: 2026-07-31 18:15:22 Functions: 1682 1832 91.8 %
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             : #pragma once
      11             : 
      12             : // MOOSE includes
      13             : #include "MooseUtils.h"
      14             : #include "MooseError.h"
      15             : #include "MooseTypes.h"
      16             : #include "MooseEnum.h"
      17             : #include "MultiMooseEnum.h"
      18             : #include "ExecFlagEnum.h"
      19             : #include "Conversion.h"
      20             : #include "DataFileUtils.h"
      21             : #include "MoosePassKey.h"
      22             : 
      23             : #include "libmesh/parameters.h"
      24             : 
      25             : #ifdef LIBMESH_HAVE_FPARSER
      26             : #include "libmesh/fparser.hh"
      27             : #else
      28             : template <typename T>
      29             : class FunctionParserBase
      30             : {
      31             : }
      32             : #endif
      33             : 
      34             : #include <tuple>
      35             : #include <unordered_map>
      36             : #include <mutex>
      37             : #include <optional>
      38             : #include <filesystem>
      39             : #include <regex>
      40             : 
      41             : #include <gtest/gtest.h>
      42             : 
      43             : // Forward declarations
      44             : class Action;
      45             : class ActionFactory;
      46             : class Factory;
      47             : class FEProblemBase;
      48             : class InputParameters;
      49             : class MooseEnum;
      50             : class MooseObject;
      51             : class MultiMooseEnum;
      52             : class Problem;
      53             : namespace hit
      54             : {
      55             : class Node;
      56             : }
      57             : namespace Moose
      58             : {
      59             : class Builder;
      60             : }
      61             : class CommandLine;
      62             : 
      63             : /**
      64             :  * The main MOOSE class responsible for handling user-defined
      65             :  * parameters in almost every MOOSE system.
      66             :  */
      67             : class InputParameters : public libMesh::Parameters
      68             : {
      69             : public:
      70             :   InputParameters(const InputParameters & rhs);
      71             :   InputParameters(const Parameters & rhs);
      72             : 
      73    79206171 :   virtual ~InputParameters() = default;
      74             : 
      75             :   virtual void clear() override;
      76             : 
      77             :   /**
      78             :    * Structure for storing information about a command line parameter
      79             :    */
      80             :   struct CommandLineMetadata
      81             :   {
      82             :     enum ArgumentType
      83             :     {
      84             :       NONE,
      85             :       OPTIONAL,
      86             :       REQUIRED
      87             :     };
      88             : 
      89             :     /// The syntax for the parameter
      90             :     std::string syntax;
      91             :     /// The switches for the parameter (i.e., [-t, --timing])
      92             :     std::vector<std::string> switches;
      93             :     /// The type of argument
      94             :     ArgumentType argument_type;
      95             :     /// Whether or not the argument is required
      96             :     bool required;
      97             :     /// Whether or not the parameter was set by the CommandLine
      98             :     bool set_by_command_line = false;
      99             :     /// Whether or not the parameter is global (passed to MultiApps)
     100             :     bool global = false;
     101             :   };
     102             : 
     103             :   /**
     104             :    * Class that is used as a parameter to setHitNode() that allows only
     105             :    * relevant classes to set the hit node
     106             :    */
     107             :   class SetHitNodeKey
     108             :   {
     109             :     friend class Action;
     110             :     friend class ActionFactory;
     111             :     friend class Moose::Builder;
     112             :     friend class Factory;
     113             :     friend class FEProblemBase;
     114             :     friend class InputParameters;
     115             :     FRIEND_TEST(InputParametersTest, fileNames);
     116     5543889 :     SetHitNodeKey() {}
     117             :     SetHitNodeKey(const SetHitNodeKey &) {}
     118             :   };
     119             : 
     120             :   /**
     121             :    * Class that is used as a parameter to setHitNode(param) that allows only
     122             :    * relevant classes to set the hit node
     123             :    */
     124             :   class SetParamHitNodeKey
     125             :   {
     126             :     friend class Moose::Builder;
     127             :     FRIEND_TEST(InputParametersTest, fileNames);
     128     2696546 :     SetParamHitNodeKey() {}
     129             :     SetParamHitNodeKey(const SetParamHitNodeKey &) {}
     130             :   };
     131             : 
     132             :   /**
     133             :    * Determines whether or not the given type is a type that is supported for
     134             :    * a command line parameter.
     135             :    *
     136             :    * In particular, whether or not CommandLine::populateCommandLineParams
     137             :    * supports extracting these types.
     138             :    */
     139             :   template <typename T>
     140             :   struct isValidCommandLineType
     141             :   {
     142             :     static constexpr bool value =
     143             :         std::is_same_v<T, std::string> || std::is_same_v<T, std::vector<std::string>> ||
     144             :         std::is_same_v<T, Real> || std::is_same_v<T, unsigned int> || std::is_same_v<T, int> ||
     145             :         std::is_same_v<T, bool> || std::is_same_v<T, MooseEnum>;
     146             :   };
     147             : 
     148             :   /**
     149             :    * This method adds a description of the class that will be displayed
     150             :    * in the input file syntax dump
     151             :    */
     152             :   void addClassDescription(const std::string & doc_string);
     153             : 
     154             :   /**
     155             :    * Returns the class description
     156             :    */
     157             :   std::string getClassDescription() const;
     158             : 
     159             :   /**
     160             :    * Override from libMesh to set user-defined attributes on our parameter
     161             :    */
     162             :   virtual void set_attributes(const std::string & name, bool inserted_only) override;
     163             : 
     164             :   /**
     165             :    * @return The deprecated parameter message for the given parameter, if any
     166             :    */
     167             :   std::optional<std::string> queryDeprecatedParamMessage(const std::string & name) const;
     168             : 
     169             :   /// This functions is called in set as a 'callback' to avoid code duplication
     170             :   template <typename T>
     171             :   void setHelper(const std::string & name);
     172             : 
     173             :   /**
     174             :    * Returns a writable reference to the named parameters.  Note: This is not a virtual
     175             :    * function! Use caution when comparing to the parent class implementation
     176             :    * @param name The name of the parameter to set
     177             :    * @param quiet_mode When true the parameter is kept with set_by_add_param=true,
     178             :    * this is generally not needed.
     179             :    *
     180             :    * "quite_mode" returns a writable reference to the named parameter, without setting
     181             :    * set_by_add_param to false. Using this method of set will make the parameter to continue to
     182             :    * behave if its value where set ONLY by addParam and not by any other method.
     183             :    *
     184             :    * This was added for handling parameters in the Output objects that have behavior dependent
     185             :    * on whether the user modified the parameters.
     186             :    *
     187             :    */
     188             :   template <typename T>
     189             :   T & set(const std::string & name, bool quiet_mode = false);
     190             : 
     191             :   /**
     192             :    * Given a series of parameters names and values, sets each name to
     193             :    * the corresponding value.  Any number of name, value pairs can be
     194             :    * supplied.
     195             :    *
     196             :    * Note that each \p value must be of the correct type for the
     197             :    * parameter of that name, not merely of a type convertible to the
     198             :    * correct type.
     199             :    *
     200             :    * @param name The name of the first parameter to set
     201             :    */
     202             :   template <typename T, typename... Ts>
     203             :   void setParameters(const std::string & name, const T & value, Ts... extra_input_parameters);
     204             : 
     205             :   /**
     206             :    * Runs a range on the supplied parameter if it exists and throws an error if that check fails.
     207             :    * @returns Optional of whether or not the error is a user error (false = developer error) and
     208             :    * the associated error
     209             :    *
     210             :    * If \p include_param_path = true, include the parameter path in the error message
     211             :    */
     212             :   ///@{
     213             :   template <typename T, typename UP_T>
     214             :   std::optional<std::pair<bool, std::string>>
     215             :   rangeCheck(const std::string & full_name,
     216             :              const std::string & short_name,
     217             :              const InputParameters::Parameter<T> & param,
     218             :              const bool include_param_path = true);
     219             :   template <typename T, typename UP_T>
     220             :   std::optional<std::pair<bool, std::string>>
     221             :   rangeCheck(const std::string & full_name,
     222             :              const std::string & short_name,
     223             :              const InputParameters::Parameter<std::vector<T>> & param,
     224             :              const bool include_param_path = true);
     225             :   ///@}
     226             :   /**
     227             :    * Verifies that the requested parameter exists and is not NULL and returns it to the caller.
     228             :    * The template parameter must be a pointer or an error will be thrown.
     229             :    */
     230             :   template <typename T>
     231             :   T getCheckedPointerParam(const std::string & name, const std::string & error_string = "") const;
     232             : 
     233             :   /**
     234             :    * This method adds a parameter and documentation string to the InputParameters
     235             :    * object that will be extracted from the input file.  If the parameter is
     236             :    * missing in the input file, an error will be thrown
     237             :    */
     238             :   template <typename T>
     239             :   void addRequiredParam(const std::string & name, const std::string & doc_string);
     240             : 
     241             :   /**
     242             :    * This version of addRequiredParam is here for a consistent use with MooseEnums.  Use of
     243             :    * this function for any other type will throw an error.
     244             :    */
     245             :   template <typename T>
     246             :   void
     247             :   addRequiredParam(const std::string & name, const T & moose_enum, const std::string & doc_string);
     248             : 
     249             :   ///@{
     250             :   /**
     251             :    * These methods add an optional parameter and a documentation string to the InputParameters
     252             :    * object. The first version of this function takes a default value which is used if the parameter
     253             :    * is not found in the input file. The second method will leave the parameter uninitialized but
     254             :    * can be checked with "isParamValid" before use.
     255             :    */
     256             :   template <typename T, typename S>
     257             :   void addParam(const std::string & name, const S & value, const std::string & doc_string);
     258             :   template <typename T>
     259             :   void addParam(const std::string & name, const std::string & doc_string);
     260             :   ///@}
     261             : 
     262             :   /**
     263             :    * Enable support for initializer lists as default arguments for container type.
     264             :    */
     265             :   template <typename T>
     266     8275437 :   void addParam(const std::string & name,
     267             :                 const std::initializer_list<typename T::value_type> & value,
     268             :                 const std::string & doc_string)
     269             :   {
     270    16550874 :     addParam<T>(name, T{value}, doc_string);
     271     8275437 :   }
     272             : 
     273             :   ///@{
     274             :   // BEGIN RANGE CHECKED PARAMETER METHODS
     275             :   /**
     276             :    * These methods add an range checked parameters. A lower and upper bound can be supplied and the
     277             :    * supplied parameter will be checked to fall within that range.
     278             :    */
     279             :   template <typename T>
     280             :   void addRequiredRangeCheckedParam(const std::string & name,
     281             :                                     const std::string & parsed_function,
     282             :                                     const std::string & doc_string);
     283             :   template <typename T>
     284             :   void addRangeCheckedParam(const std::string & name,
     285             :                             const T & value,
     286             :                             const std::string & parsed_function,
     287             :                             const std::string & doc_string);
     288             :   template <typename T>
     289             :   void addRangeCheckedParam(const std::string & name,
     290             :                             const std::string & parsed_function,
     291             :                             const std::string & doc_string);
     292             :   // END RANGE CHECKED PARAMETER METHODS
     293             :   ///@}
     294             : 
     295             :   /**
     296             :    * These methods add an option parameter and with a customer type to the InputParameters object.
     297             :    * The custom type will be output in YAML dumps and can be used within the GUI application.
     298             :    */
     299             :   template <typename T>
     300             :   void addRequiredCustomTypeParam(const std::string & name,
     301             :                                   const std::string & custom_type,
     302             :                                   const std::string & doc_string);
     303             :   template <typename T>
     304             :   void addCustomTypeParam(const std::string & name,
     305             :                           const T & value,
     306             :                           const std::string & custom_type,
     307             :                           const std::string & doc_string);
     308             :   template <typename T>
     309             :   void addCustomTypeParam(const std::string & name,
     310             :                           const std::string & custom_type,
     311             :                           const std::string & doc_string);
     312             :   template <typename T>
     313             :   void addDeprecatedCustomTypeParam(const std::string & name,
     314             :                                     const std::string & custom_type,
     315             :                                     const std::string & doc_string,
     316             :                                     const std::string & deprecation_msg);
     317             : 
     318             :   /**
     319             :    * These method add a parameter to the InputParameters object which can be retrieved like any
     320             :    * other parameter. This parameter however is not printed in the Input file syntax dump or web
     321             :    * page dump so does not take a documentation string.  The first version of this function takes an
     322             :    * optional default value.
     323             :    */
     324             :   template <typename T>
     325             :   void addPrivateParam(const std::string & name, const T & value);
     326             :   template <typename T>
     327             :   void addPrivateParam(const std::string & name);
     328             : 
     329             :   /**
     330             :    * Add parameters for retrieval from the command line.
     331             :    *
     332             :    * NOTE: This ONLY works for App objects!  This is not valid for normal MOOSE objects!
     333             :    *
     334             :    * @param name The name of the parameter
     335             :    * @param syntax Space separated list of command-line switch syntax that can set this option
     336             :    * @param doc_string Documentation.  This will be shown for --help
     337             :    */
     338             :   template <typename T>
     339             :   void addRequiredCommandLineParam(const std::string & name,
     340             :                                    const std::string & syntax,
     341             :                                    const std::string & doc_string);
     342             :   template <typename T>
     343             :   void addCommandLineParam(const std::string & name,
     344             :                            const std::string & syntax,
     345             :                            const std::string & doc_string);
     346             :   template <typename T>
     347             :   void addCommandLineParam(const std::string & name,
     348             :                            const std::string & syntax,
     349             :                            const T & value,
     350             :                            const std::string & doc_string);
     351             :   template <typename T>
     352           4 :   void addCommandLineParam(const std::string & name,
     353             :                            const std::string & syntax,
     354             :                            const std::initializer_list<typename T::value_type> & value,
     355             :                            const std::string & doc_string)
     356             :   {
     357           8 :     addCommandLineParam<T>(name, syntax, T{value}, doc_string);
     358           4 :   }
     359             : 
     360             :   /**
     361             :    * Add a command line parameter with an optional value.
     362             :    *
     363             :    * This is a deprecated option and only remains for two parameters:
     364             :    * "mesh_only" and "recover". There are issues with command line
     365             :    * parameters with optional values because if a value following
     366             :    * one of these is a hit cli parameter, we don't know if we should
     367             :    * apply it to the optional option or as a hit parameter.
     368             :    *
     369             :    * It is also allowed for "run" as we take all arguments past
     370             :    * --run and pass to python.
     371             :    *
     372             :    * @param name The name of the parameer
     373             :    * @param syntax Space separated list of command-line switch syntax that can set this option
     374             :    * @param value The default value to assign
     375             :    * @param doc_string Documentation.  This will be shown for --help
     376             :    */
     377             :   template <typename T>
     378             :   void addOptionalValuedCommandLineParam(const std::string & name,
     379             :                                          const std::string & syntax,
     380             :                                          const T & value,
     381             :                                          const std::string & doc_string);
     382             : 
     383             :   /**
     384             :    * Sets the command line parameter with \p name as global.
     385             :    *
     386             :    * Global here means that it will be passed to all child MultiApps.
     387             :    */
     388             :   void setGlobalCommandLineParam(const std::string & name);
     389             : 
     390             :   /**
     391             :    * @param name The name of the parameter
     392             :    * @param value The default value of this parameter if it requires one
     393             :    * @param doc_string Documentation.  This will be shown for --help
     394             :    * @param deprecation_message The message that will will print about why this param was
     395             :    * deprecated.  It might mention the "new way".
     396             :    */
     397             :   template <typename T>
     398             :   void addDeprecatedParam(const std::string & name,
     399             :                           const T & value,
     400             :                           const std::string & doc_string,
     401             :                           const std::string & deprecation_message);
     402             : 
     403             :   template <typename T>
     404             :   void addDeprecatedParam(const std::string & name,
     405             :                           const std::string & doc_string,
     406             :                           const std::string & deprecation_message);
     407             : 
     408             :   /**
     409             :    * This method checks to make sure that we aren't adding a parameter with the same name but a
     410             :    * different type.  It
     411             :    * throws a MooseError if an inconsistent type is detected. While this state is supported by
     412             :    * libMesh it brings
     413             :    * nothing but blood and tears for those who try ;)
     414             :    *
     415             :    * @param name the name of the parameter
     416             :    */
     417             :   template <typename T>
     418             :   void checkConsistentType(const std::string & name) const;
     419             : 
     420             :   /**
     421             :    * @return Whether or not the parameter \p name is a command line parameter
     422             :    */
     423             :   bool isCommandLineParameter(const std::string & name) const;
     424             : 
     425             :   /**
     426             :    * @return Queries for the command line metadata for the parameter \p name
     427             :    *
     428             :    * Will return an empty optional if the parameter is not a command line param.
     429             :    */
     430             :   std::optional<InputParameters::CommandLineMetadata>
     431             :   queryCommandLineMetadata(const std::string & name) const;
     432             : 
     433             :   /**
     434             :    * @return The command line metadata for the parameter \p name.
     435             :    */
     436             :   const InputParameters::CommandLineMetadata &
     437             :   getCommandLineMetadata(const std::string & name) const;
     438             : 
     439             :   /**
     440             :    * Class that is used as a parameter to commandLineParamSet() that allows only
     441             :    * the CommandLine to set that a parmeter is set by the command line
     442             :    */
     443             :   class CommandLineParamSetKey
     444             :   {
     445             :     friend class CommandLine;
     446             :     FRIEND_TEST(InputParametersTest, commandLineParamSetNotCLParam);
     447      462080 :     CommandLineParamSetKey() {}
     448             :     CommandLineParamSetKey(const CommandLineParamSetKey &) {}
     449             :   };
     450             :   /**
     451             :    * Marks the command line parameter \p name as set by the CommandLine.
     452             :    *
     453             :    * Protected by the CommandLineParamSetKey so that only the CommandLine can call this.
     454             :    */
     455             :   void commandLineParamSet(const std::string & name, const CommandLineParamSetKey);
     456             : 
     457             :   /**
     458             :    * Get the documentation string for a parameter
     459             :    */
     460             :   const std::string & getDescription(const std::string & name) const;
     461             : 
     462             :   /**
     463             :    * This method takes a space delimited list of parameter names and adds them to the specified
     464             :    * group name.
     465             :    * This information is used in the GUI to group parameters into logical sections.
     466             :    */
     467             :   void addParamNamesToGroup(const std::string & space_delim_names, const std::string group_name);
     468             : 
     469             :   /**
     470             :    * This method renames a parameter group
     471             :    * @param old_name previous name of the parameter group
     472             :    * @param new_name new name of the parameter group
     473             :    */
     474             :   void renameParameterGroup(const std::string & old_name, const std::string & new_name);
     475             : 
     476             :   /**
     477             :    * This method retrieves the group name for the passed parameter name if one exists.  Otherwise an
     478             :    * empty string is returned.
     479             :    */
     480             :   std::string getGroupName(const std::string & param_name) const;
     481             : 
     482             :   /**
     483             :    * This method suppresses an inherited parameter so that it isn't required or valid
     484             :    * in the derived class. The parameter is added to the private parameter list.
     485             :    * Suppressing a parameter can have dire consequences.
     486             :    * Use at your own risk!
     487             :    */
     488             :   template <typename T>
     489             :   void suppressParameter(const std::string & name);
     490             : 
     491             :   /**
     492             :    * Changes the parameter to be required.
     493             :    * @param name The parameter name
     494             :    */
     495             :   template <typename T>
     496             :   void makeParamRequired(const std::string & name);
     497             : 
     498             :   /**
     499             :    * Changes the parameter to not be required.
     500             :    * @param name The parameter name
     501             :    */
     502             :   template <typename T>
     503             :   void makeParamNotRequired(const std::string & name);
     504             : 
     505             :   /**
     506             :    * This method adds a coupled variable name pair.  The parser will look for variable
     507             :    * name pair in the input file and can return a reference to the storage location
     508             :    * for the coupled variable if found
     509             :    */
     510             :   void addCoupledVar(const std::string & name, const std::string & doc_string);
     511             : 
     512             :   /**
     513             :    * This method adds a deprecated coupled variable name pair.  The parser will look for variable
     514             :    * name pair in the input file and can return a reference to the storage location
     515             :    * for the coupled variable if found. The doc string for the deprecated variable will be
     516             :    * constructed from the doc string for the new variable. A deprecation message will also be
     517             :    * automatically generated
     518             :    */
     519             :   void addDeprecatedCoupledVar(const std::string & old_name,
     520             :                                const std::string & new_name,
     521             :                                const std::string & removal_date = "");
     522             : 
     523             :   /**
     524             :    * This method adds a coupled variable name pair.  The parser will look for variable
     525             :    * name pair in the input file and can return a reference to the storage location
     526             :    * for the coupled variable if found
     527             :    *
     528             :    * Also - you can provide a default value for this variable in the case that an actual variable is
     529             :    * not provided.
     530             :    */
     531             :   void addCoupledVar(const std::string & name, const Real value, const std::string & doc_string);
     532             : 
     533             :   /**
     534             :    * This method adds a coupled variable name pair.  The parser will look for variable
     535             :    * name pair in the input file and can return a reference to the storage location
     536             :    * for the coupled variable if found
     537             :    *
     538             :    * Also - you can provide a vector of values for this variable in the case that an actual variable
     539             :    * is not provided.
     540             :    */
     541             :   void addCoupledVar(const std::string & name,
     542             :                      const std::vector<Real> & value,
     543             :                      const std::string & doc_string);
     544             : 
     545             :   ///@{
     546             :   /**
     547             :    * These methods add a coupled variable name pair. The parser will look for variable
     548             :    * name pair in the input file and can return a reference to the storage location
     549             :    * for the coupled variable if found.
     550             :    *
     551             :    * This version of the method will build a vector if the given the base_name and num_name
     552             :    * parameters exist
     553             :    * in the input file:
     554             :    *   e.g.
     555             :    *   [./foo]
     556             :    *     ...
     557             :    *     some_base = base_
     558             :    *     some_num  = 5
     559             :    *   [../]
     560             :    *
     561             :    *   # The coupling parameter will be passed this vector: "base_0 base_1 base_2 base_3 base_4"
     562             :    */
     563             :   void addCoupledVarWithAutoBuild(const std::string & name,
     564             :                                   const std::string & base_name,
     565             :                                   const std::string & num_name,
     566             :                                   const std::string & doc_string);
     567             :   void addRequiredCoupledVarWithAutoBuild(const std::string & name,
     568             :                                           const std::string & base_name,
     569             :                                           const std::string & num_name,
     570             :                                           const std::string & doc_string);
     571             :   ///@}
     572             : 
     573             :   /**
     574             :    * Utility functions for retrieving one of the MooseTypes variables into the common "string" base
     575             :    * class.
     576             :    * Scalar and Vector versions are supplied
     577             :    */
     578             :   std::string getMooseType(const std::string & name) const;
     579             :   std::vector<std::string> getVecMooseType(const std::string & name) const;
     580             : 
     581             :   /**
     582             :    * @returns Whether or not these parameters are for a MooseBase object, that is,
     583             :    * one with a name and type.
     584             :    *
     585             :    * Needed so that we can produce richer errors from within InputParameters
     586             :    * that have the context of the underlying object, if possible.
     587             :    */
     588             :   bool isMooseBaseObject() const;
     589             : 
     590             :   /**
     591             :    * @return The object type represented by these parameters, if any
     592             :    */
     593             :   const std::string * queryObjectType() const;
     594             : 
     595             :   /**
     596             :    * @returns The underlying owning object type, for MooseBase objects with parameters
     597             :    *
     598             :    * Will error if a type does not exist
     599             :    */
     600             :   const std::string & getObjectType() const;
     601             :   /**
     602             :    * @returns The underlying owning object name, for MooseBase objects with parameters
     603             :    */
     604             :   const std::string & getObjectName() const;
     605             : 
     606             :   /**
     607             :    * This method adds a coupled variable name pair.  The parser will look for variable
     608             :    * name pair in the input file and can return a reference to the storage location
     609             :    * for the coupled variable.  If the coupled variable is not supplied in the input
     610             :    * file, and error is thrown.
     611             :    *
     612             :    * Version 2: An auto built vector will be built from the base_name and num_name param. See
     613             :    * addCoupledVar for an example
     614             :    */
     615             :   void addRequiredCoupledVar(const std::string & name, const std::string & doc_string);
     616             : 
     617             :   /**
     618             :    * Returns the documentation string for the specified parameter name
     619             :    */
     620             :   std::string getDocString(const std::string & name) const;
     621             : 
     622             :   /**
     623             :    * Set the doc string of a parameter.
     624             :    *
     625             :    * This method is generally used from within the validParams function to modify the documentation
     626             :    * for an
     627             :    * existing parameter, such as a parameter that is supplied from an interface class.
     628             :    */
     629             :   void setDocString(const std::string & name, const std::string & doc);
     630             : 
     631             :   /**
     632             :    * Returns the documentation unit string for the specified parameter name
     633             :    */
     634             :   std::string getDocUnit(const std::string & name) const;
     635             : 
     636             :   /**
     637             :    * Set the unit string of a parameter.
     638             :    *
     639             :    * This method is only used within MooseDocs and the input syntax dump in order to provide a
     640             :    * developer-expected unit for software quality assurance purposes.
     641             :    */
     642             :   void setDocUnit(const std::string & name, const std::string & doc_unit);
     643             : 
     644             :   /**
     645             :    * Returns a boolean indicating whether the specified parameter is required or not
     646             :    */
     647             :   bool isParamRequired(const std::string & name) const;
     648             : 
     649             :   /**
     650             :    * Forces parameter of given name to be not required regardless of type
     651             :    */
     652             :   void makeParamNotRequired(const std::string & name);
     653             : 
     654             :   /**
     655             :    * This method returns parameters that have been initialized in one fashion or another,
     656             :    * i.e. The value was supplied as a default argument or read and properly converted from
     657             :    * the input file
     658             :    */
     659             :   bool isParamValid(const std::string & name) const;
     660             : 
     661             :   /**
     662             :    * Returns whether or not the parameter was set due to addParam. If not then it was either set
     663             :    * programmatically
     664             :    * or was read through the input file.
     665             :    */
     666             :   bool isParamSetByAddParam(const std::string & name) const;
     667             : 
     668             :   /**
     669             :    * Returns True if the parameters is deprecated.
     670             :    */
     671             :   bool isParamDeprecated(const std::string & name) const;
     672             : 
     673             : #ifdef MOOSE_KOKKOS_ENABLED
     674             :   /**
     675             :    * Returns whether this InputParameters belongs to a Kokkos object
     676             :    * Checks whether MooseBase::kokkos_object_param is valid
     677             :    */
     678             :   bool isKokkosObject() const;
     679             : #endif
     680             : 
     681             :   /**
     682             :    * This method returns true if all of the parameters in this object are valid
     683             :    * (i.e. isParamValid(name) == true - for all parameters)
     684             :    */
     685             :   bool areAllRequiredParamsValid() const;
     686             : 
     687             :   /**
     688             :    * Prints the type of the requested parameter by name
     689             :    */
     690             :   std::string type(const std::string & name) const;
     691             : 
     692             :   /**
     693             :    * Returns a Boolean indicating whether the specified parameter is private or not
     694             :    */
     695             :   bool isPrivate(const std::string & name) const;
     696             : 
     697             :   /**
     698             :    * Declare the given parameters as controllable
     699             :    */
     700             :   void declareControllable(const std::string & name, std::set<ExecFlagType> execute_flags = {});
     701             : 
     702             :   /**
     703             :    * Marker a parameter that has been changed by the Control system (this is for output purposes)
     704             :    */
     705             :   void markControlled(const std::string & name);
     706             : 
     707             :   /**
     708             :    * Returns a Boolean indicating whether the specified parameter is controllable
     709             :    */
     710             :   bool isControllable(const std::string & name) const;
     711             : 
     712             :   /**
     713             :    * Return the allowed execute flags for a controllable parameter
     714             :    */
     715             :   const std::set<ExecFlagType> & getControllableExecuteOnTypes(const std::string & name) const;
     716             : 
     717             :   /**
     718             :    * This method must be called from every base "Moose System" to create linkage with the Action
     719             :    * System.
     720             :    * See "Moose.C" for the registerMooseObjectTask() calls.
     721             :    */
     722             :   void registerBase(const std::string & value);
     723             : 
     724             :   /**
     725             :    * @return Whether or not the object has a registered base
     726             :    *
     727             :    * The base is registered with registerBase()
     728             :    */
     729             :   bool hasBase() const;
     730             : 
     731             :   /**
     732             :    * @return The base system of the object these parameters are for, if any
     733             :    *
     734             :    * Set via registerBase().
     735             :    */
     736             :   const std::string & getBase() const;
     737             : 
     738             :   /**
     739             :    * This method is used to define the MOOSE system name that is used by the TheWarehouse object
     740             :    * for storing objects to be retrieved for execution. The base class of every object class
     741             :    * that will be called for execution (e.g., UserObject objects) should call this method.
     742             :    *
     743             :    * This is different from registerBase because the name supplied to registerBase is used to
     744             :    * associate syntax, but the objects created often go to the same objects for execution, as is
     745             :    * the case for Postprocessor object which are executed with UserObjects.
     746             :    *
     747             :    * See the AttribSystem object for use Attribute.h/C.
     748             :    */
     749             :   void registerSystemAttributeName(const std::string & value);
     750             : 
     751             :   /**
     752             :    * Get the system attribute name if it was registered. Otherwise throw an error.
     753             :    * See the AttribSystem object for use Attribute.h/C.
     754             :    */
     755             :   const std::string & getSystemAttributeName() const;
     756             : 
     757             :   /**
     758             :    * This method is here to indicate which Moose types a particular Action may build. It takes a
     759             :    * space delimited list of registered MooseObjects.  TODO: For now we aren't actually checking
     760             :    * this list when we build objects. Since individual actions can do whatever they want it's not
     761             :    * exactly trivial to check this without changing the user API.  This function properly restricts
     762             :    * the syntax and YAML dumps.
     763             :    */
     764             :   void registerBuildableTypes(const std::string & names);
     765             : 
     766             :   /**
     767             :    * Tells MOOSE about a RelationshipManager that this object needs.  RelationshipManagers
     768             :    * handle element "ghosting", "non-local DOF access" and "sparsity pattern" relationships.
     769             :    *
     770             :    * Basically: if this object needs non-local (ie non-current-element) data access then you
     771             :    * probably need a relationship manager
     772             :    *
     773             :    * @param name The name of the RelationshipManager type
     774             :    * @param rm_type The type (GEOMETRIC/ALGEBRAIC) of the RelationshipManger.  Note: You can use
     775             :    * boolean logic to to "or" RelationshipManagerTypes together to make a RelationshipManager that
     776             :    * is multi-typed.
     777             :    * @param input_parameter_callback This is a function pointer that will get called to fill in the
     778             :    * RelationShipManager's InputParameters.  See MooseTypes.h for the signature of this function.
     779             :    */
     780             :   void addRelationshipManager(
     781             :       const std::string & name,
     782             :       Moose::RelationshipManagerType rm_type,
     783             :       Moose::RelationshipManagerInputParameterCallback input_parameter_callback = nullptr);
     784             : 
     785             :   /**
     786             :    * Clears all currently registered RelationshipManagers
     787             :    */
     788        6866 :   void clearRelationshipManagers() { _buildable_rm_types.clear(); }
     789             : 
     790             :   /**
     791             :    * Returns the list of buildable types as a std::vector<std::string>
     792             :    */
     793             :   const std::vector<std::string> & getBuildableTypes() const;
     794             : 
     795             :   /**
     796             :    * Returns the list of buildable (or required) RelationshipManager object types for this object.
     797             :    */
     798             :   const std::vector<std::tuple<std::string,
     799             :                                Moose::RelationshipManagerType,
     800             :                                Moose::RelationshipManagerInputParameterCallback>> &
     801             :   getBuildableRelationshipManagerTypes() const;
     802             : 
     803             :   ///@{
     804             :   /**
     805             :    * Mutators for controlling whether or not the outermost level of syntax will be collapsed when
     806             :    * printed.
     807             :    */
     808             :   void collapseSyntaxNesting(bool collapse);
     809             :   bool collapseSyntaxNesting() const;
     810             :   ///@}
     811             : 
     812             :   ///@{
     813             :   /**
     814             :    * Mutators for controlling whether or not the outermost level of syntax will be collapsed when
     815             :    * printed.
     816             :    */
     817             :   void mooseObjectSyntaxVisibility(bool visibility);
     818             :   bool mooseObjectSyntaxVisibility() const;
     819             :   ///@}
     820             : 
     821             :   ///@{
     822             :   /**
     823             :    * Copy and Copy/Add operators for the InputParameters object
     824             :    */
     825             :   using Parameters::operator=;
     826             :   using Parameters::operator+=;
     827             :   InputParameters & operator=(const InputParameters & rhs);
     828             :   InputParameters & operator+=(const InputParameters & rhs);
     829             :   ///@}
     830             : 
     831             :   /**
     832             :    * This function checks parameters stored in the object to make sure they are in the correct
     833             :    * state as the user expects:
     834             :    *   Required parameters are verified as valid meaning that they were either initialized when
     835             :    *   they were created, or were read from an input file or some other valid source
     836             :    */
     837             :   void checkParams(const std::string & parsing_syntax);
     838             : 
     839             :   /**
     840             :    * Performs a range check on the parameter (which must have a range check)
     841             :    *
     842             :    * @param value The parameter value
     843             :    * @param long_name The full path to the parameter
     844             :    * @param short_name The name of the parameter
     845             :    * @param include_param_path Whether or not to include the parameter path in errors
     846             :    * @return An error, if any; first is whether or not it is a user error and second is the message
     847             :    */
     848             :   std::optional<std::pair<bool, std::string>> parameterRangeCheck(const Parameters::Value & value,
     849             :                                                                   const std::string & long_name,
     850             :                                                                   const std::string & short_name,
     851             :                                                                   const bool include_param_path);
     852             : 
     853             :   /**
     854             :    * Finalizes the parameters, which must be done before constructing any objects
     855             :    * with these parameters (to be called in the corresponding factories).
     856             :    * typed parameters.
     857             :    *
     858             :    * This calls checkParams() and sets up the absolute paths for all file name.
     859             :    */
     860             :   void finalize(const std::string & parsing_syntax);
     861             : 
     862             :   /**
     863             :    * @return A file base to associate with these parameters.
     864             :    *
     865             :    * Optionally, an input parameter can be provided via \p param_name.
     866             :    *
     867             :    * If the parameter is provided, we have the following options:
     868             :    * - The parameter itself has a hit node set (context for that parameter)
     869             :    * - The InputParameters object has a hit node set (context for all parameters)
     870             :    * - Neither of the above and we die
     871             :    *
     872             :    * In the event that a the parameter is set via command line, this will
     873             :    * attempt to look at the parameter's parents to find a suitable context.
     874             :    */
     875             :   std::filesystem::path
     876             :   getFileBase(const std::optional<std::string> & param_name = std::optional<std::string>()) const;
     877             : 
     878             :   /**
     879             :    * Methods returning iterators to the coupled variables names stored in this
     880             :    * InputParameters object
     881             :    */
     882      967335 :   inline std::set<std::string>::const_iterator coupledVarsBegin() const
     883             :   {
     884      967335 :     return _coupled_vars.begin();
     885             :   }
     886     1380348 :   inline std::set<std::string>::const_iterator coupledVarsEnd() const
     887             :   {
     888     1380348 :     return _coupled_vars.end();
     889             :   }
     890             : 
     891             :   /**
     892             :    * Return the coupled variable parameter names.
     893             :    */
     894        4989 :   const std::set<std::string> & getCoupledVariableParamNames() const { return _coupled_vars; }
     895             : 
     896             :   /**
     897             :    * Return the new to deprecated variable name map
     898             :    */
     899      377160 :   const std::unordered_map<std::string, std::string> & getNewToDeprecatedVarMap() const
     900             :   {
     901      377160 :     return _new_to_deprecated_coupled_vars;
     902             :   }
     903             : 
     904             :   /// Return whether a parameter has a range check
     905             :   bool isRangeChecked(const std::string & param_name) const;
     906             : 
     907             :   /// Return the range check function for any parameter (empty string if it is not range checked)
     908             :   std::string rangeCheckedFunction(const std::string & name) const;
     909             : 
     910             :   /// Return whether a parameter has a default
     911             :   bool hasDefault(const std::string & param_name) const;
     912             : 
     913             :   /**
     914             :    * Return whether or not the coupled variable exists
     915             :    * @param coupling_name The name of the coupled variable to test for
     916             :    * @return True if the variable exists in the coupled variables for this InputParameters object
     917             :    */
     918             :   bool hasCoupledVar(const std::string & coupling_name) const;
     919             : 
     920             :   /**
     921             :    * Return whether or not the coupled variable exists
     922             :    * @param coupling_name The name of the coupled variable to test for
     923             :    * @return True if the variable exists in the coupled variables for this InputParameters object
     924             :    */
     925             :   bool hasCoupledValue(const std::string & coupling_name) const
     926             :   {
     927             :     mooseDeprecated("InputParameters::hasCoupledValue() is deprecated. Use "
     928             :                     "InputParameters::hasCoupledVar() instead.");
     929             :     return hasCoupledVar(coupling_name);
     930             :   }
     931             : 
     932             :   /**
     933             :    * Set a coupled variable parameter to a single variable name.
     934             :    *
     935             :    * @param coupling_name The name of the coupling parameter to set.
     936             :    * @param value The variable name to set.
     937             :    */
     938             :   void setCoupledVar(const std::string & coupling_name, const std::string & value);
     939             : 
     940             :   /**
     941             :    * Set a coupled variable parameter to multiple variable names.
     942             :    *
     943             :    * @param coupling_name The name of the coupling parameter to set.
     944             :    * @param values The variable names to set.
     945             :    */
     946             :   void setCoupledVar(const std::string & coupling_name, const std::vector<VariableName> & values);
     947             : 
     948             :   /**
     949             :    * Get a coupled variable parameter.
     950             :    *
     951             :    * @param coupling_name The name of the coupling parameter to get.
     952             :    */
     953             :   const std::vector<VariableName> & getCoupledVar(const std::string & coupling_name) const;
     954             : 
     955             :   /**
     956             :    * Return whether or not the requested parameter has a default coupled value.
     957             :    *
     958             :    * @param coupling_name The name of the coupling parameter to get the default value for.
     959             :    */
     960             :   bool hasDefaultCoupledValue(const std::string & coupling_name) const;
     961             : 
     962             :   /**
     963             :    * Get the default value for an optionally coupled variable.
     964             :    *
     965             :    * @param coupling_name The name of the coupling parameter to get the default value for.
     966             :    * @param i By default 0, in general the index of the requested coupled default value.
     967             :    */
     968             :   Real defaultCoupledValue(const std::string & coupling_name, unsigned int i = 0) const;
     969             : 
     970             :   /**
     971             :    * Get the number of defaulted coupled value entries
     972             :    *
     973             :    * @param coupling_name The name of the coupling parameter to get the default value for.
     974             :    */
     975             :   unsigned int numberDefaultCoupledValues(const std::string & coupling_name) const;
     976             : 
     977             :   /**
     978             :    * Set the default value for an optionally coupled variable (called by the Parser).
     979             :    *
     980             :    * @param coupling_name The name of the coupling parameter to get the default value for.
     981             :    * @param value Default value to set.
     982             :    * @param i By default 0, in general the index of the requested coupled default value.
     983             :    */
     984             :   void defaultCoupledValue(const std::string & coupling_name, Real value, unsigned int i = 0);
     985             : 
     986             :   /**
     987             :    * Returns the auto build vectors for all parameters.
     988             :    */
     989             :   std::map<std::string, std::pair<std::string, std::string>> getAutoBuildVectors() const;
     990             : 
     991             :   // BEGIN APPLY PARAMETER METHODS
     992             :   /**
     993             :    * Method for applying common parameters
     994             :    * @param common The set of parameters to apply to the parameters stored in this object
     995             :    * @param exclude A vector of parameters to exclude
     996             :    *
     997             :    * In order to apply common parameter 4 statements must be satisfied
     998             :    *   (1) A local parameter must exist with the same name as common parameter
     999             :    *   (2) Common parameter must be valid
    1000             :    *   (3) Local parameter must be invalid OR not have been set from its default
    1001             :    *   (4) Both cannot be private (unless \p allow_private = true)
    1002             :    *
    1003             :    * Output objects have a set of common parameters that are passed
    1004             :    * down to each of the output objects created. This method is used for
    1005             :    * applying those common parameters.
    1006             :    *
    1007             :    * @see CommonOutputAction AddOutputAction
    1008             :    */
    1009             :   void applyParameters(const InputParameters & common,
    1010             :                        const std::vector<std::string> & exclude = {},
    1011             :                        const bool allow_private = false);
    1012             : 
    1013             :   /**
    1014             :    * Variant of applyParameters that only applies parameters explicitly set by the user in
    1015             :    * @p common (i.e. isParamSetByUser() is true). Object-type defaults are therefore never
    1016             :    * overridden by common-block defaults, only by values the user actually wrote.
    1017             :    */
    1018             :   void applyCommonUserSetParameters(const InputParameters & common,
    1019             :                                     const std::vector<std::string> & exclude = {},
    1020             :                                     const bool allow_private = false);
    1021             : 
    1022             :   /**
    1023             :    * Method for applying common parameters
    1024             :    * @param common The set of parameters to apply to the parameters stored in this object
    1025             :    * @param include A vector of parameters to apply
    1026             :    *
    1027             :    * In order to apply common parameter 4 statements must be satisfied
    1028             :    *   (1) A local parameter must exist with the same name as common parameter
    1029             :    *   (2) Common parameter must valid
    1030             :    *   (3) Local parameter must be invalid OR not have been set from its default
    1031             :    *   (4) Both cannot be private
    1032             :    *
    1033             :    * Output objects have a set of common parameters that are passed
    1034             :    * down to each of the output objects created. This method is used for
    1035             :    * applying those common parameters.
    1036             :    *
    1037             :    * @see CommonOutputAction AddOutputAction
    1038             :    */
    1039             :   void applySpecificParameters(const InputParameters & common,
    1040             :                                const std::vector<std::string> & include,
    1041             :                                bool allow_private = false);
    1042             : 
    1043             :   /**
    1044             :    * Apply values from a single parameter in common, to a single parameter stored in this object
    1045             :    * @param common The set of InputParameters from which to extract parameters from
    1046             :    * @param common_name The name within common from which to get the parameter values
    1047             :    *
    1048             :    * In order to apply common parameter 4 statements must be satisfied
    1049             :    *   (1) A local parameter must exist with the same name as common parameter
    1050             :    *   (2) Common parameter must valid
    1051             :    *   (3) Local parameter must be invalid OR not have been set from its default
    1052             :    *   (4) Both cannot be private
    1053             :    */
    1054             :   void applyParameter(const InputParameters & common,
    1055             :                       const std::string & common_name,
    1056             :                       bool allow_private = false);
    1057             :   // END APPLY PARAMETER METHODS
    1058             : 
    1059             :   /**
    1060             :    * Apply properties of a single coupled variable in common, to a single coupled variable stored in
    1061             :    * this object
    1062             :    * @param common The set of InputParameters from which to extract the coupled variable's
    1063             :    * properties
    1064             :    * @param var_name The name of the coupled variable whose properties are to be applied
    1065             :    *
    1066             :    * In order to apply the properties, both the local parameters and the common parameters must
    1067             :    * have a coupled variable with name var_name
    1068             :    */
    1069             :   void applyCoupledVar(const InputParameters & common, const std::string & var_name);
    1070             : 
    1071             :   /**
    1072             :    * Deprecated method.  Use isParamSetByUser() instead.
    1073             :    */
    1074             :   bool paramSetByUser(const std::string & name) const;
    1075             : 
    1076             :   /**
    1077             :    * Method returns true if the parameter was set by the user
    1078             :    * @param name The parameter name
    1079             :    */
    1080             :   bool isParamSetByUser(const std::string & name) const;
    1081             : 
    1082             :   /**
    1083             :    * Method returns true if the parameter is defined for any type. If the
    1084             :    * type is known, use have_parameter<T>() instead.
    1085             :    * @param name The parameter name
    1086             :    */
    1087             :   bool isParamDefined(const std::string & name) const;
    1088             : 
    1089             :   /**
    1090             :    * Query a parameter
    1091             :    *
    1092             :    * If a parameter of the given name and type does not exist or if the
    1093             :    * parameter is not valid, nullptr will be returned
    1094             :    *
    1095             :    * @param name The name of the parameter
    1096             :    * @return A pointer to the parameter value, if it exists
    1097             :    */
    1098             :   template <typename T>
    1099             :   const T * queryParam(const std::string & name) const;
    1100             : 
    1101             :   ///@{
    1102             :   /*
    1103             :    * These methods are here to retrieve parameters for scalar and vector types respectively. We will
    1104             :    * throw errors
    1105             :    * when returning most scalar and vector types.
    1106             :    */
    1107             :   template <typename T>
    1108             :   static const T & getParamHelper(const std::string & name, const InputParameters & pars);
    1109             :   ///@}
    1110             : 
    1111             :   using Parameters::get;
    1112             : 
    1113             :   /// Combine two vector parameters into a single vector of pairs
    1114             :   template <typename R1,
    1115             :             typename R2,
    1116             :             typename V1 = typename std::conditional<std::is_same<R1, MooseEnumItem>::value,
    1117             :                                                     MultiMooseEnum,
    1118             :                                                     std::vector<R1>>::type,
    1119             :             typename V2 = typename std::conditional<std::is_same<R2, MooseEnumItem>::value,
    1120             :                                                     MultiMooseEnum,
    1121             :                                                     std::vector<R2>>::type>
    1122             :   std::vector<std::pair<R1, R2>> get(const std::string & param1, const std::string & param2) const;
    1123             : 
    1124             :   /**
    1125             :    * @returns list of all parameters
    1126             :    */
    1127             :   std::set<std::string> getParametersList() const;
    1128             : 
    1129             :   /**
    1130             :    * Return list of controllable parameters
    1131             :    */
    1132             :   std::set<std::string> getControllableParameters() const;
    1133             : 
    1134             :   /**
    1135             :    * Return names of parameters within a group.
    1136             :    */
    1137             :   std::set<std::string> getGroupParameters(const std::string & group) const;
    1138             : 
    1139             :   /**
    1140             :    * Provide a set of reserved values for a parameter. These are values that are in addition
    1141             :    * to the normal set of values the parameter can take.
    1142             :    */
    1143             :   void setReservedValues(const std::string & name, const std::set<std::string> & reserved);
    1144             : 
    1145             :   /**
    1146             :    * Get a set of reserved parameter values.
    1147             :    * Returns a set by value since we can return an empty set.
    1148             :    */
    1149             :   std::set<std::string> reservedValues(const std::string & name) const;
    1150             : 
    1151             :   /**
    1152             :    * @return A string representing the location (i.e. filename,linenum) in the input text for the
    1153             :    * block containing parameters for this object.
    1154             :    */
    1155             :   std::string blockLocation() const;
    1156             : 
    1157             :   /**
    1158             :    * @return A string representing the full HIT parameter path from the input file (e.g.
    1159             :    * "Mesh/foo") for the block containing parameters for this object.
    1160             :    */
    1161             :   std::string blockFullpath() const;
    1162             : 
    1163             :   /**
    1164             :    * @return The hit node associated with setting the parameter \p param, if any
    1165             :    */
    1166             :   const hit::Node * getHitNode(const std::string & param) const;
    1167             :   /**
    1168             :    * Sets the hit node associated with the parameter \p param to \p node
    1169             :    *
    1170             :    * Is protected to be called by only the Builder via the SetParamHitNodeKey.
    1171             :    */
    1172             :   void setHitNode(const std::string & param, const hit::Node & node, const SetParamHitNodeKey);
    1173             : 
    1174             :   /**
    1175             :    * @return A string representing the location in the input text the parameter originated from
    1176             :    * (i.e. filename,linenum) for the given param
    1177             :    */
    1178             :   std::string inputLocation(const std::string & param) const;
    1179             : 
    1180             :   /**
    1181             :    * @return A string representing the full HIT parameter path from the input file (e.g.
    1182             :    * "Mesh/foo/bar" for param "bar") for the given param.
    1183             :    */
    1184             :   std::string paramFullpath(const std::string & param) const;
    1185             : 
    1186             :   /**
    1187             :    * Returns a prefix containing the parameter name and location (if available)
    1188             :    */
    1189             :   std::string paramLocationPrefix(const std::string & param) const;
    1190             : 
    1191             :   /**
    1192             :    * @return A message used as a prefix for output relating to a parameter.
    1193             :    *
    1194             :    * Will first prefix with a path to the parameter, or the parameter that
    1195             :    * resulted in the creation of these parameters, if available. The message
    1196             :    * will then be prefixed with the block path to the parameter, if available.
    1197             :    */
    1198             :   template <typename... Args>
    1199             :   std::string paramMessage(const std::string & param, Args... args) const;
    1200             : 
    1201             :   /**
    1202             :    * Emits an error prefixed with the object information, if available.
    1203             :    */
    1204             :   template <typename... Args>
    1205             :   [[noreturn]] void mooseError(Args &&... args) const;
    1206             : 
    1207             :   /**
    1208             :    * Emits a parameter error prefixed with the parameter location and
    1209             :    * object information if available.
    1210             :    */
    1211             :   template <typename... Args>
    1212             :   [[noreturn]] void paramError(const std::string & param, Args... args) const;
    1213             : 
    1214             :   /**
    1215             :    * @return A string representing the raw, unmodified token text for the given param.
    1216             :    * This is only set if this parameter is parsed from hit
    1217             :    */
    1218             :   std::string rawParamVal(const std::string & param) const;
    1219             : 
    1220             :   /**
    1221             :    * Informs this object that values for this parameter set from the input file or from the command
    1222             :    * line should be ignored
    1223             :    */
    1224             :   template <typename T>
    1225             :   void ignoreParameter(const std::string & name);
    1226             : 
    1227             :   /**
    1228             :    * Whether to ignore the value of an input parameter set in the input file or from the command
    1229             :    * line.
    1230             :    */
    1231             :   bool shouldIgnore(const std::string & name);
    1232             : 
    1233             :   /**
    1234             :    * @returns True if the parameter with name \p name is of type T.
    1235             :    */
    1236             :   template <typename T>
    1237             :   bool isType(const std::string & name) const;
    1238             : 
    1239             :   /**
    1240             :    * Determine the actual variable name from the given variable \emph parameter name
    1241             :    * @param var_param_name the name of the variable parameter, e.g. 'variable'
    1242             :    * @param moose_object_with_var_param_name the name of the moose object holding the variable
    1243             :    * parameter. Used for potential error messaging
    1244             :    */
    1245             :   std::string varName(const std::string & var_param_name,
    1246             :                       const std::string & moose_object_with_var_param_name) const;
    1247             : 
    1248             :   /**
    1249             :    * Rename a parameter and provide a new documentation string
    1250             :    * @param old_name The old name of the parameter
    1251             :    * @param new_name The new name of the parameter
    1252             :    * @param new_docstring The new documentation string for the parameter
    1253             :    *                      If left empty, uses the old docstring for the renamed parameter
    1254             :    */
    1255             :   void renameParam(const std::string & old_name,
    1256             :                    const std::string & new_name,
    1257             :                    const std::string & new_docstring);
    1258             : 
    1259             :   /**
    1260             :    * Rename a coupled variable and provide a new documentation string
    1261             :    * @param old_name The old name of the coupled variable
    1262             :    * @param new_name The new name of the coupled variable
    1263             :    * @param new_docstring The new documentation string for the coupled variable
    1264             :    */
    1265             :   void renameCoupledVar(const std::string & old_name,
    1266             :                         const std::string & new_name,
    1267             :                         const std::string & new_docstring);
    1268             : 
    1269             :   void deprecateParam(const std::string & old_name,
    1270             :                       const std::string & new_name,
    1271             :                       const std::string & removal_date);
    1272             : 
    1273             :   void deprecateCoupledVar(const std::string & old_name,
    1274             :                            const std::string & new_name,
    1275             :                            const std::string & removal_date);
    1276             : 
    1277             :   /**
    1278             :    * Checks whether the provided name is a renamed parameter name. If so we return the 'new' name.
    1279             :    * If not we return the incoming name
    1280             :    * @param name The name to check for whether it is a renamed name
    1281             :    * @return The new name if the incoming \p name is a renamed name, else \p name
    1282             :    */
    1283             :   std::string checkForRename(const std::string & name) const;
    1284             : 
    1285             :   /**
    1286             :    * A wrapper around the \p Parameters base class method. Checks for parameter rename before
    1287             :    * calling the base class method
    1288             :    * @param name The name to query the parameter values map with
    1289             :    * @return The parameter value corresponding to the (possibly renamed) name
    1290             :    */
    1291             :   template <typename T>
    1292             :   const T & get(std::string_view name) const;
    1293             : 
    1294             :   /**
    1295             :    * A wrapper around the \p Parameters base class method. Checks for parameter rename before
    1296             :    * calling the base class method. This method tells whether a parameter with a known type is
    1297             :    * defined. If the type is unknown, use isParamDefined().
    1298             :    * @param name The name to query the parameter values map with
    1299             :    * @return Whether there is a key in the parameter values map corresponding to the (possibly
    1300             :    * renamed) name
    1301             :    */
    1302             :   template <typename T>
    1303             :   bool have_parameter(std::string_view name) const;
    1304             : 
    1305             :   /**
    1306             :    * A routine to transfer a parameter from one class' validParams to another
    1307             :    * @param source_param The parameters list holding the param we would like to transfer
    1308             :    * @param name The name of the parameter to transfer
    1309             :    * @param new_description A new description of the parameter. If unspecified, uses the
    1310             :    * source_params'
    1311             :    */
    1312             :   template <typename T>
    1313             :   void transferParam(const InputParameters & source_param,
    1314             :                      const std::string & name,
    1315             :                      const std::string & new_name = "",
    1316             :                      const std::string & new_description = "");
    1317             : 
    1318             :   /**
    1319             :    * Return all the aliased names associated with \p param_name. The returned container will always
    1320             :    * contain \p param_name itself. Other aliases in addition to \p param_name will include the base
    1321             :    * class parameter name if \p param_name is the derived class parameter name, or deprecated names
    1322             :    * that \p param_name is meant to replace.
    1323             :    * @param param_name The name of the parameter that we want to lookup aliases for. This parameter
    1324             :    * name must exist in our metadata and parameter names to values map, e.g. this parameter must
    1325             :    * represent the derived class parameter name if a base class parameter has been renamed or the
    1326             :    * blessed parameter name in situations where associated parameter names have been deprecated
    1327             :    * @return All aliases which logically resolve-to/are-associated-with \p param_name, including \p
    1328             :    * param_name itself
    1329             :    */
    1330             :   std::vector<std::string> paramAliases(const std::string & param_name) const;
    1331             : 
    1332             :   /**
    1333             :    * @return The hit node that represents the syntax responsible for creating
    1334             :    * these parameters, if any
    1335             :    */
    1336    24228125 :   const hit::Node * getHitNode() const { return _hit_node; }
    1337             :   /**
    1338             :    * Sets the hit node that represents the syntax responsible for creating
    1339             :    * these parameters
    1340             :    *
    1341             :    * Is protected to be called by only the ActionFactory, Builder, and Factory
    1342             :    * via the SetHitNodeKey.
    1343             :    */
    1344     5543889 :   void setHitNode(const hit::Node & node, const SetHitNodeKey) { _hit_node = &node; }
    1345             : 
    1346             :   /**
    1347             :    * @return Whether or not finalize() has been called
    1348             :    */
    1349             :   bool isFinalized() const { return _finalized; }
    1350             : 
    1351             :   /**
    1352             :    * @return The DataFileName path for the parameter \p name (if any).
    1353             :    */
    1354             :   std::optional<Moose::DataFileUtils::Path> queryDataFileNamePath(const std::string & name) const;
    1355             : 
    1356             :   /**
    1357             :    * Entrypoint for the Builder to setup a std::vector<VariableName> parameter,
    1358             :    * which will setup the default variable names if appropriate
    1359             :    *
    1360             :    * @param names The variable names
    1361             :    * @param node The hit node that produced this parameter
    1362             :    * @return An error message, if any
    1363             :    */
    1364             :   std::optional<std::string> setupVariableNames(std::vector<VariableName> & names,
    1365             :                                                 const hit::Node & node,
    1366             :                                                 const Moose::PassKey<Moose::Builder>);
    1367             : 
    1368             : private:
    1369             :   // Private constructor so that InputParameters can only be created in certain places.
    1370             :   InputParameters();
    1371             : 
    1372             :   /**
    1373             :    * Method to terminate the recursive setParameters definition
    1374             :    */
    1375       17899 :   void setParameters() {}
    1376             : 
    1377             :   template <typename T>
    1378             :   static constexpr bool isFunctorNameType();
    1379             : 
    1380             :   /**
    1381             :    * Appends description of what a functor is to a doc string.
    1382             :    */
    1383             :   template <typename T>
    1384             :   std::string appendFunctorDescription(const std::string & doc_string) const;
    1385             : 
    1386             :   /**
    1387             :    * Private method for setting deprecated coupled variable documentation strings
    1388             :    */
    1389             :   void setDeprecatedVarDocString(const std::string & new_name, const std::string & doc_string);
    1390             : 
    1391             :   void renameParamInternal(const std::string & old_name,
    1392             :                            const std::string & new_name,
    1393             :                            const std::string & docstring,
    1394             :                            const std::string & removal_date);
    1395             : 
    1396             :   void renameCoupledVarInternal(const std::string & old_name,
    1397             :                                 const std::string & new_name,
    1398             :                                 const std::string & docstring,
    1399             :                                 const std::string & removal_date);
    1400             : 
    1401             :   /**
    1402             :    * Get the context associated with a parameter for a message.
    1403             :    * @param param The parameter name
    1404             :    * @return Pair that is the string prefix for the parameter (fullpath) and a pointer to the best
    1405             :    * hit node that can be associated with the parameter (if any)
    1406             :    */
    1407             :   std::pair<std::string, const hit::Node *> paramMessageContext(const std::string & param) const;
    1408             :   /**
    1409             :    * Get a prefix for messages associated with a parameter.
    1410             :    *
    1411             :    * Will include the best file path possible for the parameter and the parameter's fullpath.
    1412             :    */
    1413             :   std::string paramMessagePrefix(const std::string & param) const;
    1414             : 
    1415             :   struct Metadata
    1416             :   {
    1417             :     std::string _doc_string;
    1418             :     /// The developer-designated unit of the parameter for use in documentation
    1419             :     std::string _doc_unit;
    1420             :     /// The custom type that will be printed in the YAML dump for a parameter if supplied
    1421             :     std::string _custom_type;
    1422             :     /// The data pertaining to a command line parameter (empty if not a command line param)
    1423             :     std::optional<CommandLineMetadata> _cl_data;
    1424             :     /// The searched path information pertaining to a DataFileName parameter
    1425             :     std::optional<Moose::DataFileUtils::Path> _data_file_name_path;
    1426             :     /// The names of the parameters organized into groups
    1427             :     std::string _group;
    1428             :     /// The map of functions used for range checked parameters
    1429             :     std::string _range_function;
    1430             :     /// directions for auto build vectors (base_, 5) -> "base_0 base_1 base_2 base_3 base_4")
    1431             :     std::pair<std::string, std::string> _autobuild_vecs;
    1432             :     /// True for parameters that are required (i.e. will cause an abort if not supplied)
    1433             :     bool _required = false;
    1434             :     /**
    1435             :      * Whether the parameter is either explicitly set or provided a default value when added
    1436             :      * Note: We do not store MooseEnum names in valid params, instead we ask MooseEnums whether
    1437             :      *       they are valid or not.
    1438             :      */
    1439             :     bool _valid = false;
    1440             :     /// The set of parameters that will NOT appear in the the dump of the parser tree
    1441             :     bool _is_private = false;
    1442             :     bool _have_coupled_default = false;
    1443             :     /// The default value for optionally coupled variables
    1444             :     std::vector<Real> _coupled_default = {0};
    1445             :     /// True if a parameters value was set by addParam, and not set again.
    1446             :     bool _set_by_add_param = false;
    1447             :     /// The reserved option names for a parameter
    1448             :     std::set<std::string> _reserved_values;
    1449             :     /// If non-empty, this parameter is deprecated.
    1450             :     std::string _deprecation_message;
    1451             :     /// Original location of parameter node; used for error messages
    1452             :     const hit::Node * _hit_node;
    1453             :     /// True if the parameters is controllable
    1454             :     bool _controllable = false;
    1455             :     /// Controllable execute flag restriction
    1456             :     std::set<ExecFlagType> _controllable_flags;
    1457             :     /// whether user setting of this parameter should be ignored
    1458             :     bool _ignore = false;
    1459             :   };
    1460             : 
    1461    13562764 :   Metadata & at(const std::string & param_name)
    1462             :   {
    1463    13562764 :     const auto param = checkForRename(param_name);
    1464    13562764 :     if (_params.count(param) == 0)
    1465           0 :       mooseError("param '", param, "' not present in InputParams");
    1466    27125528 :     return _params[param];
    1467    13562764 :   }
    1468    29635857 :   const Metadata & at(const std::string & param_name) const
    1469             :   {
    1470    29635857 :     const auto param = checkForRename(param_name);
    1471    29635857 :     if (_params.count(param) == 0)
    1472           0 :       mooseError("param '", param, "' not present in InputParams");
    1473    59271714 :     return _params.at(param);
    1474    29635857 :   }
    1475             : 
    1476             :   /**
    1477             :    * Toggle the availability of the copy constructor
    1478             :    *
    1479             :    * When MooseObject is created via the Factory this flag is set to false, so when a MooseObject is
    1480             :    * created if
    1481             :    * the constructor is not a const reference an error is produced. This method allows the
    1482             :    * InputParameterWarehouse
    1483             :    * to disable copying.
    1484             :    */
    1485     8380638 :   void allowCopy(bool status) { _allow_copy = status; }
    1486             : 
    1487             :   /**
    1488             :    * Make sure the parameter name doesn't have any invalid characters.
    1489             :    */
    1490             :   void checkParamName(const std::string & name) const;
    1491             : 
    1492             :   /**
    1493             :    * This method is called when adding a Parameter with a default value, can be specialized for
    1494             :    * non-matching types.
    1495             :    */
    1496             :   template <typename T, typename S>
    1497             :   void setParamHelper(const std::string & name, T & l_value, const S & r_value);
    1498             : 
    1499             :   /**
    1500             :    * Helper for all of the addCommandLineParam() calls, which sets up _cl_data in the metadata
    1501             :    *
    1502             :    * @param name The parameter name
    1503             :    * @param syntax The parameter syntax
    1504             :    * @param required Whether or not the parameter is required
    1505             :    * @param value_required Whethre or not the parameter requires a value
    1506             :    */
    1507             :   template <typename T>
    1508             :   void addCommandLineParamHelper(const std::string & name,
    1509             :                                  const std::string & syntax,
    1510             :                                  const bool required,
    1511             :                                  const bool value_required);
    1512             : 
    1513             :   /**
    1514             :    * Internal helper for calling back to mooseError(), ideally from the underlying
    1515             :    * MooseBase object if it is available (for more context)
    1516             :    */
    1517             :   [[noreturn]] void callMooseError(std::string msg,
    1518             :                                    const bool with_prefix = true,
    1519             :                                    const hit::Node * node = nullptr,
    1520             :                                    const bool show_trace = true) const;
    1521             : 
    1522             :   /// The actual parameter data. Each Metadata object contains attributes for the corresponding
    1523             :   /// parameter.
    1524             :   std::map<std::string, Metadata> _params;
    1525             : 
    1526             :   /// The coupled variables set
    1527             :   std::set<std::string> _coupled_vars;
    1528             : 
    1529             :   /// The class description for the owning object. This string is used in many places including
    1530             :   /// mouse-over events, and external documentation produced from the source code.
    1531             :   std::string _class_description;
    1532             : 
    1533             :   /// The parameter is used to restrict types that can be built.  Typically this is used for
    1534             :   /// MooseObjectAction derived Actions.
    1535             :   std::vector<std::string> _buildable_types;
    1536             : 
    1537             :   /// The RelationshipManagers that this object may either build or require.
    1538             :   /// The optional second argument may be supplied to "downgrade" the functionality of the corresponding
    1539             :   /// relationship manager (e.g. An AlgebraicRelationshipManager could be only used as a
    1540             :   /// GeometricRelationshipManager for a given simulation).
    1541             :   std::vector<std::tuple<std::string,
    1542             :                          Moose::RelationshipManagerType,
    1543             :                          Moose::RelationshipManagerInputParameterCallback>>
    1544             :       _buildable_rm_types;
    1545             : 
    1546             :   /// This parameter collapses one level of nesting in the syntax blocks.  It is used
    1547             :   /// in conjunction with MooseObjectAction derived Actions.
    1548             :   bool _collapse_nesting;
    1549             : 
    1550             :   /// This parameter hides derived MOOSE object types from appearing in syntax dumps
    1551             :   bool _moose_object_syntax_visibility;
    1552             : 
    1553             :   /// Flag for disabling deprecated parameters message, this is used by applyParameters to avoid
    1554             :   /// dumping messages.
    1555             :   bool _show_deprecated_message;
    1556             : 
    1557             :   /// A flag for toggling the error message in the copy constructor.
    1558             :   bool _allow_copy;
    1559             : 
    1560             :   /// A map from deprecated coupled variable names to the new blessed name
    1561             :   std::unordered_map<std::string, std::string> _new_to_deprecated_coupled_vars;
    1562             : 
    1563             :   /// A map from base-class/deprecated parameter names to derived-class/blessed parameter names and
    1564             :   /// the deprecation messages in the case that the "old" parameter name is a deprecated parameter
    1565             :   /// name. The deprecation message will be empty if the "old" parameter name represents a base
    1566             :   /// class parameter name
    1567             :   std::map<std::string, std::pair<std::string, std::string>> _old_to_new_name_and_dep;
    1568             : 
    1569             :   /// A map from derived-class/blessed parameter names to associated base-class/deprecated parameter
    1570             :   /// names
    1571             :   std::multimap<std::string, std::string> _new_to_old_names;
    1572             : 
    1573             :   /// The hit node representing the syntax that created these parameters, if any
    1574             :   const hit::Node * _hit_node;
    1575             : 
    1576             :   /// Whether or not we've called finalize() on these parameters yet
    1577             :   bool _finalized;
    1578             : 
    1579             :   // These are the only objects allowed to _create_ InputParameters
    1580             :   friend InputParameters emptyInputParameters();
    1581             :   friend class InputParameterWarehouse;
    1582             :   friend class Parser;
    1583             :   // for the printInputFile function in the action warehouse
    1584             :   friend class ActionWarehouse;
    1585             : };
    1586             : 
    1587             : template <typename T>
    1588             : void
    1589   377259720 : InputParameters::setHelper(const std::string & /*name*/)
    1590             : {
    1591   377259720 : }
    1592             : 
    1593             : // Template and inline function implementations
    1594             : template <typename T>
    1595             : T &
    1596   377259720 : InputParameters::set(const std::string & name_in, bool quiet_mode)
    1597             : {
    1598   377259720 :   const auto name = checkForRename(name_in);
    1599             : 
    1600   377259720 :   checkParamName(name);
    1601   377259720 :   checkConsistentType<T>(name);
    1602             : 
    1603   377259720 :   T & result = this->Parameters::set<T>(name);
    1604             : 
    1605   377259720 :   if (quiet_mode)
    1606     6484693 :     _params[name]._set_by_add_param = true;
    1607             : 
    1608   377259720 :   setHelper<T>(name);
    1609             : 
    1610   377259720 :   return result;
    1611   377259720 : }
    1612             : 
    1613             : template <typename T, typename... Ts>
    1614             : void
    1615       17899 : InputParameters::setParameters(const std::string & name,
    1616             :                                const T & value,
    1617             :                                Ts... extra_input_parameters)
    1618             : {
    1619       17899 :   this->set<T>(name) = value;
    1620       17899 :   this->setParameters(extra_input_parameters...);
    1621       17899 : }
    1622             : 
    1623             : template <typename T, typename UP_T>
    1624             : std::optional<std::pair<bool, std::string>>
    1625     1438993 : InputParameters::rangeCheck(const std::string & full_name,
    1626             :                             const std::string & short_name,
    1627             :                             const InputParameters::Parameter<std::vector<T>> & param,
    1628             :                             const bool include_param_path)
    1629             : {
    1630     1438993 :   if (!isParamValid(short_name))
    1631      770326 :     return {};
    1632             : 
    1633      668667 :   const auto & range_function = _params[short_name]._range_function;
    1634      668667 :   if (range_function.empty())
    1635      544461 :     return {};
    1636             : 
    1637             :   /**
    1638             :    * Automatically detect the variables used in the range checking expression.
    1639             :    * We allow the following variables (where snam is the short_name of the parameter)
    1640             :    *
    1641             :    * snam       : tests every component in the vector
    1642             :    *              'snam > 0'
    1643             :    * snam_size  : the size of the vector
    1644             :    *              'snam_size = 5'
    1645             :    * snam_i     : where i is a number from 0 to sname_size-1 tests a specific component
    1646             :    *              'snam_0 > snam_1'
    1647             :    */
    1648      124206 :   FunctionParserBase<UP_T> fp;
    1649      124206 :   std::vector<std::string> vars;
    1650      124206 :   if (fp.ParseAndDeduceVariables(range_function, vars) != -1) // -1 for success
    1651             :     return {{false,
    1652           2 :              "Error parsing expression '" + range_function + "' for parameter " + short_name + ""}};
    1653             : 
    1654             :   // Fparser parameter buffer
    1655      124204 :   std::vector<UP_T> parbuf(vars.size());
    1656             : 
    1657             :   // parameter vector
    1658      124204 :   const std::vector<T> & value = param.get();
    1659             : 
    1660             :   // iterate over all vector values (maybe ;)
    1661      124204 :   bool need_to_iterate = false;
    1662      124204 :   unsigned int i = 0;
    1663             :   do
    1664             :   {
    1665             :     // set parameters
    1666      251658 :     for (unsigned int j = 0; j < vars.size(); j++)
    1667             :     {
    1668      125890 :       if (vars[j] == short_name)
    1669             :       {
    1670      125560 :         if (value.size() == 0)
    1671             :         {
    1672           5 :           std::ostringstream oss;
    1673           5 :           oss << "Range checking empty vector";
    1674           5 :           if (include_param_path)
    1675           5 :             oss << " parameter " << full_name;
    1676           5 :           oss << "; expression = '" << range_function << "'";
    1677           5 :           return {{true, oss.str()}};
    1678           5 :         }
    1679             : 
    1680      125555 :         parbuf[j] = value[i];
    1681      125555 :         need_to_iterate = true;
    1682             :       }
    1683         330 :       else if (vars[j] == short_name + "_size")
    1684          81 :         parbuf[j] = value.size();
    1685             :       else
    1686             :       {
    1687         249 :         if (vars[j].substr(0, short_name.size() + 1) != short_name + "_")
    1688           2 :           return {{false, "Error parsing expression '" + range_function + "'"}};
    1689         247 :         std::istringstream iss(vars[j]);
    1690         247 :         iss.seekg(short_name.size() + 1);
    1691             : 
    1692             :         size_t index;
    1693         247 :         if (iss >> index && iss.eof())
    1694             :         {
    1695         245 :           if (index >= value.size())
    1696             :           {
    1697           5 :             std::ostringstream oss;
    1698           5 :             oss << "Error parsing expression '" + range_function + "'";
    1699           5 :             if (include_param_path)
    1700           5 :               oss << " for parameter " << full_name;
    1701           5 :             oss << "; out of range variable '" + vars[j] << "'";
    1702           5 :             return {{true, oss.str()}};
    1703           5 :           }
    1704         240 :           parbuf[j] = value[index];
    1705             :         }
    1706             :         else
    1707             :           return {{false,
    1708           2 :                    "Error parsing expression '" + range_function + "'; invalid variable '" +
    1709           2 :                        vars[j] + "'"}};
    1710         247 :       }
    1711             :     }
    1712             : 
    1713             :     // ensure range-checked input file parameter comparison functions
    1714             :     // do absolute floating point comparisons instead of using a default epsilon.
    1715      125768 :     auto tmp_eps = fp.epsilon();
    1716      125768 :     fp.setEpsilon(0);
    1717      125768 :     UP_T result = fp.Eval(&parbuf[0]);
    1718      125768 :     fp.setEpsilon(tmp_eps);
    1719             : 
    1720             :     // test function using the parameters determined above
    1721      125768 :     if (fp.EvalError())
    1722           0 :       return {{false, "Error evaluating expression '" + range_function + "'"}};
    1723             : 
    1724      125768 :     if (!result)
    1725             :     {
    1726          21 :       std::ostringstream oss;
    1727          21 :       oss << "Range check failed";
    1728          21 :       if (include_param_path)
    1729          21 :         oss << " for parameter " << full_name;
    1730          21 :       oss << "; expression = '" << range_function << "'";
    1731          21 :       if (need_to_iterate)
    1732           3 :         oss << ", component " << i;
    1733          21 :       return {{true, oss.str()}};
    1734          21 :     }
    1735             : 
    1736      125747 :   } while (need_to_iterate && ++i < value.size());
    1737             : 
    1738      124169 :   return {};
    1739      124206 : }
    1740             : 
    1741             : template <typename T, typename UP_T>
    1742             : std::optional<std::pair<bool, std::string>>
    1743    16558962 : InputParameters::rangeCheck(const std::string & full_name,
    1744             :                             const std::string & short_name,
    1745             :                             const InputParameters::Parameter<T> & param,
    1746             :                             const bool include_param_path)
    1747             : {
    1748    16558962 :   if (!isParamValid(short_name))
    1749     2813068 :     return {};
    1750             : 
    1751    13745894 :   const auto & range_function = _params[short_name]._range_function;
    1752    13745894 :   if (range_function.empty())
    1753    11995983 :     return {};
    1754             : 
    1755             :   // Parse the expression
    1756     1749911 :   FunctionParserBase<UP_T> fp;
    1757     1749911 :   if (fp.Parse(range_function, short_name) != -1) // -1 for success
    1758             :     return {{false,
    1759           2 :              "Error parsing expression '" + range_function + "'" + " for parameter " + short_name}};
    1760             : 
    1761             :   // ensure range-checked input file parameter comparison functions
    1762             :   // do absolute floating point comparisons instead of using a default epsilon.
    1763     1749909 :   auto tmp_eps = fp.epsilon();
    1764     1749909 :   fp.setEpsilon(0);
    1765             :   // We require a non-const value for the implicit upscaling of the parameter type
    1766     1749909 :   std::vector<UP_T> value(1, param.get());
    1767     1749909 :   UP_T result = fp.Eval(&value[0]);
    1768     1749909 :   fp.setEpsilon(tmp_eps);
    1769             : 
    1770     1749909 :   if (fp.EvalError())
    1771             :     return {{true,
    1772             :              "Error evaluating expression '" + range_function + "' for parameter " + short_name +
    1773           0 :                  "; perhaps you used the wrong variable name?"}};
    1774             : 
    1775     1749909 :   if (!result)
    1776             :   {
    1777          11 :     std::ostringstream oss;
    1778          11 :     oss << "Range check failed";
    1779          11 :     if (include_param_path)
    1780           9 :       oss << " for parameter " << full_name;
    1781          11 :     oss << "; expression = '" << range_function << "', value = " << value[0];
    1782          11 :     return {{true, oss.str()}};
    1783          11 :   }
    1784             : 
    1785     1749898 :   return {};
    1786     1749911 : }
    1787             : 
    1788             : template <typename T>
    1789             : T
    1790    27244992 : InputParameters::getCheckedPointerParam(const std::string & name_in,
    1791             :                                         const std::string & error_string) const
    1792             : {
    1793    27244992 :   const auto name = checkForRename(name_in);
    1794             : 
    1795    27244992 :   T param = this->get<T>(name);
    1796             : 
    1797             :   // Note: You will receive a compile error on this line if you attempt to pass a non-pointer
    1798             :   // template type to this method
    1799    27244992 :   if (!param)
    1800           9 :     mooseError("Parameter ", name, " is NULL.\n", error_string);
    1801    54489966 :   return this->get<T>(name);
    1802    27244983 : }
    1803             : 
    1804             : template <typename T>
    1805             : void
    1806    15535324 : InputParameters::addRequiredParam(const std::string & name, const std::string & doc_string)
    1807             : {
    1808    15535324 :   checkParamName(name);
    1809    15535324 :   checkConsistentType<T>(name);
    1810             : 
    1811    15535324 :   InputParameters::insert<T>(name);
    1812    15535324 :   auto & metadata = _params[name];
    1813    15535324 :   metadata._required = true;
    1814             :   if constexpr (isFunctorNameType<T>())
    1815      364439 :     metadata._doc_string = appendFunctorDescription<T>(doc_string);
    1816             :   else
    1817    15170885 :     metadata._doc_string = doc_string;
    1818    15535324 : }
    1819             : 
    1820             : template <typename T>
    1821             : void
    1822             : InputParameters::addRequiredParam(const std::string & /*name*/,
    1823             :                                   const T & /*value*/,
    1824             :                                   const std::string & /*doc_string*/)
    1825             : {
    1826             :   mooseError("You cannot call addRequiredParam and supply a default value for this type, please "
    1827             :              "use addParam instead");
    1828             : }
    1829             : 
    1830             : template <typename T, typename S>
    1831             : void
    1832   160318074 : InputParameters::addParam(const std::string & name, const S & value, const std::string & doc_string)
    1833             : {
    1834   160318074 :   checkParamName(name);
    1835   160318074 :   checkConsistentType<T>(name);
    1836             : 
    1837   160318074 :   T & l_value = InputParameters::set<T>(name);
    1838   160318074 :   auto & metadata = _params[name];
    1839             :   if constexpr (isFunctorNameType<T>())
    1840      323148 :     metadata._doc_string = appendFunctorDescription<T>(doc_string);
    1841             :   else
    1842   159994926 :     metadata._doc_string = doc_string;
    1843             : 
    1844             :   // Set the parameter now
    1845   160318074 :   setParamHelper(name, l_value, value);
    1846             : 
    1847             :   /* Indicate the default value, as set via addParam, is being used. The parameter is removed from
    1848             :      the list whenever
    1849             :      it changes, see set_attributes */
    1850   160318074 :   metadata._set_by_add_param = true;
    1851   160318074 : }
    1852             : 
    1853             : template <typename T>
    1854             : void
    1855    66837822 : InputParameters::addParam(const std::string & name, const std::string & doc_string)
    1856             : {
    1857    66837822 :   checkParamName(name);
    1858    66837816 :   checkConsistentType<T>(name);
    1859             : 
    1860    66837816 :   InputParameters::insert<T>(name);
    1861             :   if constexpr (isFunctorNameType<T>())
    1862      155761 :     _params[name]._doc_string = appendFunctorDescription<T>(doc_string);
    1863             :   else
    1864    66682055 :     _params[name]._doc_string = doc_string;
    1865    66837816 : }
    1866             : 
    1867             : template <typename T, typename S>
    1868             : void
    1869   159847369 : InputParameters::setParamHelper(const std::string & /*name*/, T & l_value, const S & r_value)
    1870             : {
    1871   159847369 :   l_value = r_value;
    1872   159847369 : }
    1873             : 
    1874             : template <typename T>
    1875             : void
    1876     5223003 : InputParameters::addCommandLineParamHelper(const std::string & name,
    1877             :                                            const std::string & syntax,
    1878             :                                            const bool required,
    1879             :                                            const bool value_required)
    1880             : {
    1881             :   static_assert(isValidCommandLineType<T>::value,
    1882             :                 "This type is not a supported command line parameter type. See "
    1883             :                 "CommandLine::populateCommandLineParams to add it as a supported type.");
    1884             : 
    1885     5223003 :   auto & cl_data = at(name)._cl_data;
    1886     5223003 :   cl_data = CommandLineMetadata();
    1887             : 
    1888             :   // Split up the syntax by whitespace
    1889     5223003 :   std::vector<std::string> syntax_split;
    1890    10446006 :   MooseUtils::tokenize(syntax, syntax_split, 1, " \t\n\v\f\r");
    1891             : 
    1892             :   // Set the single syntax string as the combined syntax with removed whitespace
    1893     5223003 :   cl_data->syntax = MooseUtils::stringJoin(syntax_split);
    1894             :   mooseAssert(cl_data->syntax.size(), "Empty token");
    1895             : 
    1896             :   // Set the switches; only parse those that begin with "-" as we also
    1897             :   // provide examples within the syntax
    1898    12863084 :   for (const auto & val : syntax_split)
    1899     7640083 :     if (val.rfind("-", 0) == 0)
    1900             :     {
    1901     5632209 :       if (!std::regex_search(val, std::regex("^\\-+[a-zA-Z]")))
    1902           2 :         mooseError("The switch '",
    1903             :                    val,
    1904             :                    "' for the command line parameter '",
    1905             :                    name,
    1906             :                    "' is invalid. It must begin with an alphabetical character.");
    1907             : 
    1908     5632207 :       cl_data->switches.push_back(val);
    1909     5632207 :       libMesh::add_command_line_name(val);
    1910             :     }
    1911             : 
    1912     5223001 :   cl_data->required = required;
    1913     5223001 :   cl_data->global = false;
    1914             : 
    1915             :   // No arguments needed for a boolean parameter
    1916             :   if constexpr (std::is_same_v<T, bool>)
    1917             :   {
    1918             :     (void)value_required; // purposely unused; doesn't take a value
    1919     3339151 :     cl_data->argument_type = CommandLineMetadata::ArgumentType::NONE;
    1920             :   }
    1921             :   // MooseEnums require a value
    1922             :   else if constexpr (std::is_same_v<T, MooseEnum>)
    1923             :   {
    1924             :     (void)value_required; // purposely unused; always required
    1925      136394 :     cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
    1926             :   }
    1927             :   // The user didn't specify a default, so a value is required
    1928     1747456 :   else if (value_required)
    1929     1406477 :     cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
    1930             :   // Otherwise, it's optional (user specified a default)
    1931             :   else
    1932      340979 :     cl_data->argument_type = CommandLineMetadata::ArgumentType::OPTIONAL;
    1933     5223003 : }
    1934             : 
    1935             : template <typename T>
    1936             : void
    1937      165415 : InputParameters::addRequiredRangeCheckedParam(const std::string & name,
    1938             :                                               const std::string & parsed_function,
    1939             :                                               const std::string & doc_string)
    1940             : {
    1941      165415 :   addRequiredParam<T>(name, doc_string);
    1942      165415 :   _params[name]._range_function = parsed_function;
    1943      165415 : }
    1944             : 
    1945             : template <typename T>
    1946             : void
    1947     5800001 : InputParameters::addRangeCheckedParam(const std::string & name,
    1948             :                                       const T & value,
    1949             :                                       const std::string & parsed_function,
    1950             :                                       const std::string & doc_string)
    1951             : {
    1952     5800001 :   addParam<T>(name, value, doc_string);
    1953     5800001 :   _params[name]._range_function = parsed_function;
    1954     5800001 : }
    1955             : 
    1956             : template <typename T>
    1957             : void
    1958      779489 : InputParameters::addRangeCheckedParam(const std::string & name,
    1959             :                                       const std::string & parsed_function,
    1960             :                                       const std::string & doc_string)
    1961             : {
    1962      779489 :   addParam<T>(name, doc_string);
    1963      779489 :   _params[name]._range_function = parsed_function;
    1964      779489 : }
    1965             : 
    1966             : template <typename T>
    1967             : void
    1968      139607 : InputParameters::addRequiredCustomTypeParam(const std::string & name,
    1969             :                                             const std::string & custom_type,
    1970             :                                             const std::string & doc_string)
    1971             : {
    1972      139607 :   addRequiredParam<T>(name, doc_string);
    1973      139607 :   _params[name]._custom_type = custom_type;
    1974      139607 : }
    1975             : 
    1976             : template <typename T>
    1977             : void
    1978       34407 : InputParameters::addCustomTypeParam(const std::string & name,
    1979             :                                     const T & value,
    1980             :                                     const std::string & custom_type,
    1981             :                                     const std::string & doc_string)
    1982             : {
    1983       34407 :   addParam<T>(name, value, doc_string);
    1984       34407 :   _params[name]._custom_type = custom_type;
    1985       34407 : }
    1986             : 
    1987             : template <typename T>
    1988             : void
    1989       25101 : InputParameters::addCustomTypeParam(const std::string & name,
    1990             :                                     const std::string & custom_type,
    1991             :                                     const std::string & doc_string)
    1992             : {
    1993       25101 :   addParam<T>(name, doc_string);
    1994       25101 :   _params[name]._custom_type = custom_type;
    1995       25101 : }
    1996             : 
    1997             : template <typename T>
    1998             : void
    1999       18177 : InputParameters::addDeprecatedCustomTypeParam(const std::string & name,
    2000             :                                               const std::string & custom_type,
    2001             :                                               const std::string & doc_string,
    2002             :                                               const std::string & deprecation_message)
    2003             : {
    2004       18177 :   _show_deprecated_message = false;
    2005       18177 :   addParam<T>(name, doc_string);
    2006       18177 :   auto & metadata = _params[name];
    2007       18177 :   metadata._custom_type = custom_type;
    2008             : 
    2009       18177 :   metadata._deprecation_message = deprecation_message;
    2010       18177 :   _show_deprecated_message = true;
    2011       18177 : }
    2012             : 
    2013             : template <typename T>
    2014             : void
    2015   109171998 : InputParameters::addPrivateParam(const std::string & name)
    2016             : {
    2017   109171998 :   checkParamName(name);
    2018   109171998 :   checkConsistentType<T>(name);
    2019             : 
    2020   109171998 :   InputParameters::insert<T>(name);
    2021   109171998 :   _params[name]._is_private = true;
    2022   109171998 : }
    2023             : 
    2024             : template <typename T>
    2025             : void
    2026   142639285 : InputParameters::addPrivateParam(const std::string & name, const T & value)
    2027             : {
    2028   142639285 :   checkParamName(name);
    2029   142639285 :   checkConsistentType<T>(name);
    2030             : 
    2031   142639285 :   InputParameters::set<T>(name) = value;
    2032   142639285 :   auto & metadata = _params[name];
    2033   142639285 :   metadata._is_private = true;
    2034   142639285 :   metadata._set_by_add_param = true;
    2035   142639285 : }
    2036             : 
    2037             : template <typename T>
    2038             : void
    2039           2 : InputParameters::addRequiredCommandLineParam(const std::string & name,
    2040             :                                              const std::string & syntax,
    2041             :                                              const std::string & doc_string)
    2042             : {
    2043             :   static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool");
    2044             : 
    2045           2 :   addRequiredParam<T>(name, doc_string);
    2046           2 :   addCommandLineParamHelper<T>(name, syntax, /* required = */ true, /* value_required = */ true);
    2047           2 : }
    2048             : 
    2049             : template <typename T>
    2050             : void
    2051     4405232 : InputParameters::addCommandLineParam(const std::string & name,
    2052             :                                      const std::string & syntax,
    2053             :                                      const std::string & doc_string)
    2054             : {
    2055             :   static_assert(!std::is_same_v<T, MooseEnum>,
    2056             :                 "addCommandLineParam() without a value cannot be used with a MooseEnum because a "
    2057             :                 "MooseEnum requires initialization");
    2058             : 
    2059     4405232 :   auto constexpr is_bool = std::is_same_v<T, bool>;
    2060             :   if constexpr (is_bool)
    2061     3134568 :     addParam<T>(name, false, doc_string);
    2062             :   else
    2063     1270664 :     addParam<T>(name, doc_string);
    2064             : 
    2065     4405232 :   addCommandLineParamHelper<T>(
    2066             :       name, syntax, /* required = */ false, /* value_required = */ !is_bool);
    2067     4405230 : }
    2068             : 
    2069             : template <typename T>
    2070             : void
    2071      476790 : InputParameters::addCommandLineParam(const std::string & name,
    2072             :                                      const std::string & syntax,
    2073             :                                      const T & value,
    2074             :                                      const std::string & doc_string)
    2075             : {
    2076             :   if constexpr (std::is_same_v<T, bool>)
    2077             :     mooseAssert(!value, "Default for bool must be false");
    2078             : 
    2079      476790 :   addParam<T>(name, value, doc_string);
    2080      476790 :   addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ true);
    2081      476790 : }
    2082             : 
    2083             : template <typename T>
    2084             : void
    2085      340979 : InputParameters::addOptionalValuedCommandLineParam(const std::string & name,
    2086             :                                                    const std::string & syntax,
    2087             :                                                    const T & value,
    2088             :                                                    const std::string & doc_string)
    2089             : {
    2090             :   mooseAssert(name == "citations" || name == "csg_only" || name == "mesh_only" ||
    2091             :                   name == "recover" || name == "run",
    2092             :               "Not supported for new parameters");
    2093             :   static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool (does not take a value)");
    2094      340979 :   addParam<T>(name, value, doc_string);
    2095      340979 :   addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ false);
    2096      340979 : }
    2097             : 
    2098             : template <typename T>
    2099             : void
    2100   871762223 : InputParameters::checkConsistentType(const std::string & name_in) const
    2101             : {
    2102   871762223 :   const auto name = checkForRename(name_in);
    2103             : 
    2104             :   // If we don't currently have the Parameter, can't be any inconsistency
    2105   871762223 :   InputParameters::const_iterator it = _values.find(name);
    2106   871762223 :   if (it == _values.end())
    2107   781356434 :     return;
    2108             : 
    2109             :   // Now, if we already have the Parameter, but it doesn't have the
    2110             :   // right type, throw an error.
    2111    90405789 :   if (!this->Parameters::have_parameter<T>(name))
    2112           0 :     mooseError("Attempting to set parameter \"",
    2113             :                name,
    2114             :                "\" with type (",
    2115             :                libMesh::demangle(typeid(T).name()),
    2116             :                ")\nbut the parameter already exists as type (",
    2117           0 :                it->second->type(),
    2118             :                ")");
    2119   871762223 : }
    2120             : 
    2121             : template <typename T>
    2122             : void
    2123     5755841 : InputParameters::suppressParameter(const std::string & name_in)
    2124             : {
    2125     5755841 :   const auto name = checkForRename(name_in);
    2126     5755841 :   if (!this->have_parameter<T>(name))
    2127           2 :     mooseError("Unable to suppress nonexistent parameter: ", name);
    2128             : 
    2129     5755839 :   auto & metadata = _params[name];
    2130     5755839 :   metadata._required = false;
    2131     5755839 :   metadata._is_private = true;
    2132     5755839 :   metadata._controllable = false;
    2133     5755841 : }
    2134             : 
    2135             : template <typename T>
    2136             : void
    2137        2788 : InputParameters::ignoreParameter(const std::string & name_in)
    2138             : {
    2139        2788 :   const auto name = checkForRename(name_in);
    2140        2788 :   suppressParameter<T>(name);
    2141        2788 :   _params[name]._ignore = true;
    2142        2788 : }
    2143             : 
    2144             : template <typename T>
    2145             : void
    2146       25087 : InputParameters::makeParamRequired(const std::string & name_in)
    2147             : {
    2148       25087 :   const auto name = checkForRename(name_in);
    2149             : 
    2150       25087 :   if (!this->have_parameter<T>(name))
    2151           4 :     mooseError("Unable to require nonexistent parameter: ", name);
    2152             : 
    2153       25083 :   _params[name]._required = true;
    2154       25087 : }
    2155             : 
    2156             : template <typename T>
    2157             : void
    2158       52170 : InputParameters::makeParamNotRequired(const std::string & name_in)
    2159             : {
    2160       52170 :   const auto name = checkForRename(name_in);
    2161             : 
    2162       52170 :   if (!this->have_parameter<T>(name))
    2163           0 :     mooseError("Unable to un-require nonexistent parameter: ", name);
    2164             : 
    2165       52170 :   _params[name]._required = false;
    2166       52170 : }
    2167             : 
    2168             : template <typename T>
    2169             : void
    2170     3278216 : InputParameters::addDeprecatedParam(const std::string & name,
    2171             :                                     const T & value,
    2172             :                                     const std::string & doc_string,
    2173             :                                     const std::string & deprecation_message)
    2174             : {
    2175     3278216 :   _show_deprecated_message = false;
    2176             :   mooseAssert(!_old_to_new_name_and_dep.count(name),
    2177             :               "Attempting to deprecate via addDeprecatedParam the parameter, '"
    2178             :                   << name << "', already deprecated via deprecateParam or renamed via renameParam");
    2179     3278216 :   addParam<T>(name, value, doc_string);
    2180             : 
    2181     3278216 :   _params[name]._deprecation_message = deprecation_message;
    2182     3278216 :   _show_deprecated_message = true;
    2183     3278216 : }
    2184             : 
    2185             : template <typename T>
    2186             : void
    2187     1321780 : InputParameters::addDeprecatedParam(const std::string & name,
    2188             :                                     const std::string & doc_string,
    2189             :                                     const std::string & deprecation_message)
    2190             : {
    2191     1321780 :   _show_deprecated_message = false;
    2192             :   mooseAssert(!_old_to_new_name_and_dep.count(name),
    2193             :               "Attempting to deprecate via addDeprecatedParam the parameter, '"
    2194             :                   << name << "', already deprecated via deprecateParam or renamed via renameParam");
    2195     1321780 :   addParam<T>(name, doc_string);
    2196             : 
    2197     1321780 :   _params[name]._deprecation_message = deprecation_message;
    2198     1321780 :   _show_deprecated_message = true;
    2199     1321780 : }
    2200             : 
    2201             : // Forward declare MooseEnum specializations for add*Param
    2202             : template <>
    2203             : void InputParameters::addRequiredParam<MooseEnum>(const std::string & name,
    2204             :                                                   const MooseEnum & moose_enum,
    2205             :                                                   const std::string & doc_string);
    2206             : 
    2207             : template <>
    2208             : void InputParameters::addRequiredParam<MultiMooseEnum>(const std::string & name,
    2209             :                                                        const MultiMooseEnum & moose_enum,
    2210             :                                                        const std::string & doc_string);
    2211             : 
    2212             : template <>
    2213             : void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
    2214             :     const std::string & name,
    2215             :     const std::vector<MooseEnum> & moose_enums,
    2216             :     const std::string & doc_string);
    2217             : 
    2218             : template <>
    2219             : void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
    2220             :     const std::string & name,
    2221             :     const std::vector<MultiMooseEnum> & moose_enums,
    2222             :     const std::string & doc_string);
    2223             : 
    2224             : template <>
    2225             : void InputParameters::addParam<MooseEnum>(const std::string & /*name*/,
    2226             :                                           const std::string & /*doc_string*/);
    2227             : 
    2228             : template <>
    2229             : void InputParameters::addParam<MultiMooseEnum>(const std::string & /*name*/,
    2230             :                                                const std::string & /*doc_string*/);
    2231             : 
    2232             : template <>
    2233             : void InputParameters::addParam<std::vector<MooseEnum>>(const std::string & /*name*/,
    2234             :                                                        const std::string & /*doc_string*/);
    2235             : 
    2236             : template <>
    2237             : void InputParameters::addParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
    2238             :                                                             const std::string & /*doc_string*/);
    2239             : 
    2240             : template <>
    2241             : void
    2242             : InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
    2243             :                                                                const std::string & /*doc_string*/);
    2244             : 
    2245             : template <>
    2246             : void InputParameters::addPrivateParam<MooseEnum>(const std::string & /*name*/);
    2247             : 
    2248             : template <>
    2249             : void InputParameters::addPrivateParam<MultiMooseEnum>(const std::string & /*name*/);
    2250             : 
    2251             : template <>
    2252             : void InputParameters::addDeprecatedParam<MooseEnum>(const std::string & /*name*/,
    2253             :                                                     const std::string & /*doc_string*/,
    2254             :                                                     const std::string & /*deprecation_message*/);
    2255             : 
    2256             : template <>
    2257             : void
    2258             : InputParameters::addDeprecatedParam<MultiMooseEnum>(const std::string & /*name*/,
    2259             :                                                     const std::string & /*doc_string*/,
    2260             :                                                     const std::string & /*deprecation_message*/);
    2261             : 
    2262             : template <>
    2263             : void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
    2264             :     const std::string & /*name*/,
    2265             :     const std::string & /*doc_string*/,
    2266             :     const std::string & /*deprecation_message*/);
    2267             : 
    2268             : // Forward declare specializations for setParamHelper
    2269             : template <>
    2270             : void InputParameters::setParamHelper<PostprocessorName, Real>(const std::string & name,
    2271             :                                                               PostprocessorName & l_value,
    2272             :                                                               const Real & r_value);
    2273             : 
    2274             : template <>
    2275             : void InputParameters::setParamHelper<PostprocessorName, int>(const std::string & name,
    2276             :                                                              PostprocessorName & l_value,
    2277             :                                                              const int & r_value);
    2278             : 
    2279             : template <>
    2280             : void InputParameters::setParamHelper<FunctionName, Real>(const std::string & /*name*/,
    2281             :                                                          FunctionName & l_value,
    2282             :                                                          const Real & r_value);
    2283             : 
    2284             : template <>
    2285             : void InputParameters::setParamHelper<FunctionName, int>(const std::string & /*name*/,
    2286             :                                                         FunctionName & l_value,
    2287             :                                                         const int & r_value);
    2288             : 
    2289             : template <>
    2290             : void InputParameters::setParamHelper<MaterialPropertyName, Real>(const std::string & /*name*/,
    2291             :                                                                  MaterialPropertyName & l_value,
    2292             :                                                                  const Real & r_value);
    2293             : 
    2294             : template <>
    2295             : void InputParameters::setParamHelper<MaterialPropertyName, int>(const std::string & /*name*/,
    2296             :                                                                 MaterialPropertyName & l_value,
    2297             :                                                                 const int & r_value);
    2298             : 
    2299             : template <>
    2300             : void InputParameters::setParamHelper<MooseFunctorName, Real>(const std::string & /*name*/,
    2301             :                                                              MooseFunctorName & l_value,
    2302             :                                                              const Real & r_value);
    2303             : 
    2304             : template <>
    2305             : void InputParameters::setParamHelper<MooseFunctorName, int>(const std::string & /*name*/,
    2306             :                                                             MooseFunctorName & l_value,
    2307             :                                                             const int & r_value);
    2308             : 
    2309             : template <typename T>
    2310             : const T *
    2311       50194 : InputParameters::queryParam(const std::string & name) const
    2312             : {
    2313       50194 :   return have_parameter<T>(name) && isParamValid(name) ? &getParamHelper<T>(name, *this) : nullptr;
    2314             : }
    2315             : 
    2316             : template <typename T>
    2317             : const T &
    2318    43523959 : InputParameters::getParamHelper(const std::string & name_in, const InputParameters & pars)
    2319             : {
    2320    43523959 :   const auto name = pars.checkForRename(name_in);
    2321             : 
    2322    43523959 :   if (!pars.isParamValid(name))
    2323           4 :     pars.mooseError("The parameter \"", name, "\" is being retrieved before being set.");
    2324             : 
    2325    87047910 :   return pars.get<T>(name);
    2326    43523959 : }
    2327             : 
    2328             : // Declare specializations so we don't fall back on the generic
    2329             : // implementation, but the definition will be in InputParameters.C so
    2330             : // we won't need to bring in *MooseEnum header files here.
    2331             : template <>
    2332             : const MooseEnum & InputParameters::getParamHelper<MooseEnum>(const std::string & name,
    2333             :                                                              const InputParameters & pars);
    2334             : 
    2335             : template <>
    2336             : const MultiMooseEnum &
    2337             : InputParameters::getParamHelper<MultiMooseEnum>(const std::string & name,
    2338             :                                                 const InputParameters & pars);
    2339             : 
    2340             : template <typename R1, typename R2, typename V1, typename V2>
    2341             : std::vector<std::pair<R1, R2>>
    2342      142739 : InputParameters::get(const std::string & param1_in, const std::string & param2_in) const
    2343             : {
    2344      142739 :   const auto param1 = checkForRename(param1_in);
    2345      142739 :   const auto param2 = checkForRename(param2_in);
    2346             : 
    2347      142739 :   const auto & v1 = get<V1>(param1);
    2348      142739 :   const auto & v2 = get<V2>(param2);
    2349             : 
    2350      142739 :   auto controllable = getControllableParameters();
    2351      142739 :   if (controllable.count(param1) || controllable.count(param2))
    2352           4 :     mooseError("Parameters ",
    2353             :                param1,
    2354             :                " and/or ",
    2355             :                param2 + " are controllable parameters and cannot be retireved using "
    2356             :                         "the MooseObject::getParam/InputParameters::get methods for pairs");
    2357             : 
    2358      142737 :   if (v1.size() != v2.size())
    2359          12 :     paramError(param1,
    2360             :                "Vector parameters ",
    2361             :                param1,
    2362             :                "(size: ",
    2363             :                v1.size(),
    2364             :                ") and " + param2,
    2365             :                "(size: ",
    2366             :                v2.size(),
    2367             :                ") are of different lengths \n");
    2368             : 
    2369      142729 :   std::vector<std::pair<R1, R2>> parameter_pairs;
    2370      142729 :   auto i1 = v1.begin();
    2371      142729 :   auto i2 = v2.begin();
    2372      196471 :   for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
    2373       53742 :     parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
    2374      285458 :   return parameter_pairs;
    2375      142741 : }
    2376             : 
    2377             : InputParameters emptyInputParameters();
    2378             : 
    2379             : template <typename T>
    2380             : bool
    2381       87231 : InputParameters::isType(const std::string & name_in) const
    2382             : {
    2383       87231 :   const auto name = checkForRename(name_in);
    2384             : 
    2385       87231 :   if (!_params.count(name))
    2386           0 :     mooseError("Parameter \"", name, "\" is not valid.");
    2387      174462 :   return have_parameter<T>(name);
    2388       87231 : }
    2389             : 
    2390             : template <typename T>
    2391             : const T &
    2392   202621639 : InputParameters::get(std::string_view name_in) const
    2393             : {
    2394   202621639 :   const auto name = checkForRename(std::string(name_in));
    2395             : 
    2396   405243278 :   return Parameters::get<T>(name);
    2397   202621639 : }
    2398             : 
    2399             : template <typename T>
    2400             : bool
    2401  2574612282 : InputParameters::have_parameter(std::string_view name_in) const
    2402             : {
    2403  2574612282 :   const auto name = checkForRename(std::string(name_in));
    2404             : 
    2405  5149224564 :   return Parameters::have_parameter<T>(name);
    2406  2574612282 : }
    2407             : 
    2408             : template <typename T>
    2409             : void
    2410     4244216 : InputParameters::transferParam(const InputParameters & source_params,
    2411             :                                const std::string & name_in,
    2412             :                                const std::string & new_name,
    2413             :                                const std::string & new_description)
    2414             : {
    2415     4244216 :   const auto name = source_params.checkForRename(std::string(name_in));
    2416     4244216 :   const auto p_name = new_name.empty() ? name_in : new_name;
    2417     4244216 :   if (!source_params.have_parameter<T>(name) && !source_params.hasCoupledVar(name))
    2418           0 :     mooseError("The '",
    2419             :                name_in,
    2420             :                "' parameter could not be transferred because it does not exist with type '",
    2421             :                MooseUtils::prettyCppType<T>(),
    2422             :                "' in the source parameters");
    2423     4244216 :   if (name != name_in)
    2424           0 :     mooseWarning("The transferred parameter " + name_in + " is deprecated in favor of " + name +
    2425             :                  " in the source parameters. The new name should likely be used for the parameter "
    2426             :                  "transfer instead.");
    2427     8488432 :   const std::string description =
    2428     8488432 :       new_description.empty() ? source_params.getDescription(name) : new_description;
    2429             : 
    2430     4244216 :   if (source_params.isParamRequired(name))
    2431             :   {
    2432             :     // Check for a variable parameter
    2433          10 :     if (source_params.hasCoupledVar(name))
    2434           2 :       addRequiredCoupledVar(p_name, description);
    2435             :     // Enums parameters have a default list of options
    2436             :     else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
    2437           4 :       addRequiredParam<T>(p_name, source_params.get<T>(name), description);
    2438           4 :     else if (source_params.isRangeChecked(name))
    2439           2 :       addRequiredRangeCheckedParam<T>(
    2440             :           p_name, source_params.rangeCheckedFunction(name), description);
    2441             :     else
    2442           2 :       addRequiredParam<T>(p_name, description);
    2443             :   }
    2444             :   else
    2445             :   {
    2446             :     // Check for a variable parameter
    2447     4244206 :     if (source_params.hasCoupledVar(name))
    2448             :     {
    2449           6 :       if (!source_params.hasDefaultCoupledValue(name))
    2450           2 :         addCoupledVar(p_name, description);
    2451           4 :       else if (source_params.numberDefaultCoupledValues(name) == 1)
    2452           2 :         addCoupledVar(p_name, source_params.defaultCoupledValue(name), description);
    2453             :       else
    2454             :       {
    2455           2 :         std::vector<Real> coupled_values;
    2456           6 :         for (const auto i : libMesh::make_range(source_params.numberDefaultCoupledValues(name)))
    2457           4 :           coupled_values.push_back(source_params.defaultCoupledValue(name, i));
    2458           2 :         addCoupledVar(p_name, coupled_values, description);
    2459           2 :       }
    2460             :     }
    2461     4244200 :     else if (source_params.isRangeChecked(name))
    2462             :     {
    2463           4 :       if (source_params.hasDefault(name))
    2464           0 :         addRangeCheckedParam<T>(p_name,
    2465             :                                 source_params.get<T>(name),
    2466             :                                 source_params.rangeCheckedFunction(name),
    2467             :                                 description);
    2468             :       else
    2469           4 :         addRangeCheckedParam<T>(p_name, source_params.rangeCheckedFunction(name), description);
    2470             :     }
    2471             :     else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
    2472      823695 :       addParam<T>(p_name, source_params.get<T>(name), description);
    2473             :     else
    2474             :     {
    2475     3420501 :       if (source_params.hasDefault(name))
    2476           4 :         addParam<T>(p_name, source_params.get<T>(name), description);
    2477             :       else
    2478     3420497 :         addParam<T>(p_name, description);
    2479             :     }
    2480             :   }
    2481             : 
    2482             :   // Copy other attributes
    2483     4244216 :   if (source_params.isPrivate(name))
    2484           2 :     _params[p_name]._is_private = true;
    2485     4244216 :   if (source_params.isControllable(name))
    2486           2 :     _params[p_name]._controllable = true;
    2487     4244216 : }
    2488             : 
    2489             : template <typename... Args>
    2490             : [[noreturn]] void
    2491          80 : InputParameters::mooseError(Args &&... args) const
    2492             : {
    2493          80 :   std::ostringstream oss;
    2494          80 :   moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
    2495         118 :   callMooseError(oss.str());
    2496          38 : }
    2497             : 
    2498             : template <typename... Args>
    2499             : std::string
    2500         206 : InputParameters::paramMessage(const std::string & param, Args... args) const
    2501             : {
    2502         206 :   std::ostringstream oss;
    2503         206 :   moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
    2504         412 :   return paramMessagePrefix(param) + oss.str();
    2505         206 : }
    2506             : 
    2507             : template <typename... Args>
    2508             : [[noreturn]] void
    2509        1297 : InputParameters::paramError(const std::string & param, Args... args) const
    2510             : {
    2511        1297 :   std::ostringstream oss;
    2512        1297 :   moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
    2513        1297 :   const auto [prefix, node] = paramMessageContext(param);
    2514        1389 :   callMooseError(prefix + oss.str(), false, node, /* show_trace = */ false);
    2515          92 : }
    2516             : 
    2517             : namespace Moose
    2518             : {
    2519             : namespace internal
    2520             : {
    2521             : template <typename T>
    2522             : constexpr T *
    2523             : getNullptrExample()
    2524             : {
    2525             :   return nullptr;
    2526             : }
    2527             : 
    2528             : #ifdef MOOSE_MFEM_ENABLED
    2529             : 
    2530             : template <typename T>
    2531             : constexpr bool
    2532             : isMFEMFunctorNameTypeHelper(T *)
    2533             : {
    2534             :   return std::is_same_v<T, MFEMScalarCoefficientName> ||
    2535             :          std::is_same_v<T, MFEMVectorCoefficientName>;
    2536             : }
    2537             : 
    2538             : template <typename T, typename A>
    2539             : constexpr bool
    2540             : isMFEMFunctorNameTypeHelper(std::vector<T, A> *)
    2541             : {
    2542             :   return isMFEMFunctorNameTypeHelper(getNullptrExample<T>());
    2543             : }
    2544             : 
    2545             : #endif
    2546             : 
    2547             : template <typename T>
    2548             : constexpr bool
    2549             : isScalarFunctorNameTypeHelper(T *)
    2550             : {
    2551             :   return std::is_same_v<T, MooseFunctorName>
    2552             : #ifdef MOOSE_MFEM_ENABLED
    2553             :          || std::is_same_v<T, MFEMScalarCoefficientName>
    2554             : #endif
    2555             :       ;
    2556             : }
    2557             : 
    2558             : template <typename T, typename A>
    2559             : constexpr bool
    2560             : isScalarFunctorNameTypeHelper(std::vector<T, A> *)
    2561             : {
    2562             :   return isScalarFunctorNameTypeHelper(getNullptrExample<T>());
    2563             : }
    2564             : 
    2565             : template <typename T>
    2566             : constexpr bool
    2567             : isVectorFunctorNameTypeHelper(T *)
    2568             : {
    2569             : #ifdef MOOSE_MFEM_ENABLED
    2570             :   return std::is_same_v<T, MFEMVectorCoefficientName>;
    2571             : #else
    2572             :   return false;
    2573             : #endif
    2574             : }
    2575             : 
    2576             : template <typename T, typename A>
    2577             : constexpr bool
    2578             : isVectorFunctorNameTypeHelper(std::vector<T, A> *)
    2579             : {
    2580             :   return isVectorFunctorNameTypeHelper(getNullptrExample<T>());
    2581             : }
    2582             : 
    2583             : template <typename T>
    2584             : constexpr bool
    2585             : isFunctorNameTypeHelper(T * ex)
    2586             : {
    2587             :   return isScalarFunctorNameTypeHelper(ex) || isVectorFunctorNameTypeHelper(ex);
    2588             : }
    2589             : }
    2590             : }
    2591             : 
    2592             : template <typename T>
    2593             : constexpr bool
    2594             : InputParameters::isFunctorNameType()
    2595             : {
    2596             :   return Moose::internal::isFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>());
    2597             : }
    2598             : 
    2599             : template <typename T>
    2600             : std::string
    2601      843348 : InputParameters::appendFunctorDescription(const std::string & doc_string) const
    2602             : {
    2603      843348 :   auto numeric_value_type = []()
    2604             :   {
    2605             :     if constexpr (Moose::internal::isScalarFunctorNameTypeHelper(
    2606             :                       Moose::internal::getNullptrExample<T>()))
    2607      788974 :       return "number";
    2608             :     else if constexpr (Moose::internal::isVectorFunctorNameTypeHelper(
    2609             :                            Moose::internal::getNullptrExample<T>()))
    2610       54374 :       return "numeric vector value (enclosed in curly braces)";
    2611             :     else
    2612             :     {
    2613             :       mooseAssert(false, "We control instantiations of this method");
    2614             :       return "";
    2615             :     }
    2616             :   };
    2617             : 
    2618             :   return MooseUtils::trim(doc_string, ". ") + ". A functor is any of the following: a variable, " +
    2619             :          (
    2620             : #ifdef MOOSE_MFEM_ENABLED
    2621             :              Moose::internal::isMFEMFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>())
    2622             :                  ? "an MFEM"
    2623             :                  :
    2624             : #endif
    2625             :                  "a functor") +
    2626     2530044 :          " material property, a function, a postprocessor or a " + numeric_value_type() + ".";
    2627             : }

Generated by: LCOV version 1.14