diff --git a/framework/doc/content/syntax/Controls/index.md b/framework/doc/content/syntax/Controls/index.md index 0291e6c8e1fa..ad3da1619c55 100644 --- a/framework/doc/content/syntax/Controls/index.md +++ b/framework/doc/content/syntax/Controls/index.md @@ -152,7 +152,7 @@ The two postprocessors in [controls_tags] declare the same control tag `tag`. Thus their controllable parameter `point` can be set by controls simultaneously with `tag/*/point` as in [controls_tags_use]. !listing test/tests/controls/tag_based_naming_access/param.i - block=Postprocessors + block=Controls id=controls_tags_use caption=Example of usinging the tagged controllable parameters. diff --git a/framework/include/actions/GlobalParamsAction.h b/framework/include/actions/GlobalParamsAction.h index 68e54ba5bc16..94283e7386ed 100644 --- a/framework/include/actions/GlobalParamsAction.h +++ b/framework/include/actions/GlobalParamsAction.h @@ -27,6 +27,9 @@ class GlobalParamsAction : public Action */ void remove(const std::string & name); + /** + * Obtain a non-const reference of the action parameters in the InputParameterWarehouse. + */ InputParameters & parameters(); template diff --git a/framework/include/interfaces/MeshMetaDataInterface.h b/framework/include/interfaces/MeshMetaDataInterface.h index bc7e3b5a9644..7f215f3c5daf 100644 --- a/framework/include/interfaces/MeshMetaDataInterface.h +++ b/framework/include/interfaces/MeshMetaDataInterface.h @@ -9,15 +9,14 @@ #pragma once -#include "MooseObject.h" #include "MooseError.h" -#include "InputParameters.h" #include "RestartableData.h" #include class MooseApp; class MeshGenerator; +class MooseObject; /** * The Interface used to retrieve mesh meta data (attributes) set by the MeshGenerator system. diff --git a/framework/include/interfaces/PerfGraphInterface.h b/framework/include/interfaces/PerfGraphInterface.h index 58b870cce486..cec2e46d7618 100644 --- a/framework/include/interfaces/PerfGraphInterface.h +++ b/framework/include/interfaces/PerfGraphInterface.h @@ -11,7 +11,6 @@ #include "Moose.h" #include "PerfGuard.h" -#include "InputParameters.h" #ifndef MOOSE_NO_PERF_GRAPH #define TIME_SECTION1(id) \ @@ -39,6 +38,9 @@ #define TIME_SECTION(...) \ GET_MACRO(__VA_ARGS__, TIME_SECTION4, TIME_SECTION3, TIME_SECTION2, TIME_SECTION1, )(__VA_ARGS__) +class InputParameters; +class MooseObject; + /** * Interface for objects interacting with the PerfGraph. * diff --git a/framework/include/utils/InputParameters.h b/framework/include/utils/InputParameters.h index 64c4da3ca379..8091e100fecf 100644 --- a/framework/include/utils/InputParameters.h +++ b/framework/include/utils/InputParameters.h @@ -1015,6 +1015,7 @@ class InputParameters : public Parameters friend InputParameters emptyInputParameters(); friend class InputParameterWarehouse; friend class Parser; + // for the printInputFile function in the action warehouse friend class ActionWarehouse; // For setting _from_legacy_construction (remove with #19440) diff --git a/framework/src/actions/ActionFactory.C b/framework/src/actions/ActionFactory.C index b2fb35b82fd7..0cc3a4886112 100644 --- a/framework/src/actions/ActionFactory.C +++ b/framework/src/actions/ActionFactory.C @@ -43,25 +43,21 @@ ActionFactory::reg(const std::string & name, std::shared_ptr ActionFactory::create(const std::string & action, const std::string & full_action_name, - InputParameters & parameters) + InputParameters & incoming_parser_params) { std::string action_name = MooseUtils::shortName(full_action_name); - parameters.addPrivateParam("_moose_app", &_app); - parameters.addPrivateParam("action_type", action); + incoming_parser_params.addPrivateParam("_moose_app", &_app); + incoming_parser_params.addPrivateParam("action_type", action); std::pair iters; - if (!(parameters.have_parameter("isObjectAction") && - parameters.get("isObjectAction"))) - parameters.set>("control_tags") - .push_back(MooseUtils::baseName(full_action_name)); - - std::string unique_action_name = action + parameters.get("task") + full_action_name; + std::string unique_action_name = + action + incoming_parser_params.get("task") + full_action_name; // Create the actual parameters object that the object will reference - InputParameters & params = - _app.getInputParameterWarehouse().addInputParameters(unique_action_name, parameters); + InputParameters & action_params = _app.getInputParameterWarehouse().addInputParameters( + unique_action_name, incoming_parser_params); // Check to make sure that all required parameters are supplied - params.checkParams(action_name); + action_params.checkParams(action_name); iters = _name_to_build_info.equal_range(action); BuildInfo * build_info = &(iters.first->second); @@ -71,11 +67,11 @@ ActionFactory::create(const std::string & action, action_name); // Add the name to the parameters and create the object - params.set("_action_name") = action_name; - params.set("_unique_action_name") = unique_action_name; - std::shared_ptr action_obj = (*build_info->_build_pointer)(params); + action_params.set("_action_name") = action_name; + action_params.set("_unique_action_name") = unique_action_name; + std::shared_ptr action_obj = (*build_info->_build_pointer)(action_params); - if (parameters.get("task") == "") + if (action_params.get("task") == "") action_obj->appendTask(build_info->_task); return action_obj; diff --git a/framework/src/actions/GlobalParamsAction.C b/framework/src/actions/GlobalParamsAction.C index ba9a28677b3e..c78683b2ecc4 100644 --- a/framework/src/actions/GlobalParamsAction.C +++ b/framework/src/actions/GlobalParamsAction.C @@ -44,6 +44,5 @@ GlobalParamsAction::remove(const std::string & name) InputParameters & GlobalParamsAction::parameters() { - const auto & params = _app.getInputParameterWarehouse().getInputParameters(); - return *(params.find(uniqueActionName())->second.get()); + return const_cast(_pars); } diff --git a/framework/src/parser/Parser.C b/framework/src/parser/Parser.C index 70fbce9851a8..8e358add1bee 100644 --- a/framework/src/parser/Parser.C +++ b/framework/src/parser/Parser.C @@ -484,6 +484,10 @@ Parser::walkRaw(std::string /*fullpath*/, std::string /*nodepath*/, hit::Node * params.blockLocation() = n->filename() + ":" + std::to_string(n->line()); params.blockFullpath() = n->fullpath(); + if (!(params.have_parameter("isObjectAction") && params.get("isObjectAction"))) + params.set>("control_tags") + .push_back(MooseUtils::baseName(curr_identifier)); + // Create the Action std::shared_ptr action_obj = _action_factory.create(it->second._action, curr_identifier, params);