Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "MooseBaseParameterInterface.h" 11 : 12 : #include "MooseApp.h" 13 : #include "InputParameterWarehouse.h" 14 : 15 : std::string 16 1630 : paramErrorPrefix(const InputParameters & params, const std::string & param) 17 : { 18 1630 : return params.errorPrefix(param); 19 : } 20 : 21 5213724 : MooseBaseParameterInterface::MooseBaseParameterInterface(const MooseBase & base, 22 5213724 : const InputParameters & parameters) 23 5213724 : : _pars(parameters), 24 5213724 : _factory(base.getMooseApp().getFactory()), 25 5213724 : _action_factory(base.getMooseApp().getActionFactory()), 26 5213724 : _moose_base(base) 27 : { 28 : // This enforces that we call finalizeParams (checkParams() and setting file paths) 29 : mooseAssert(_pars.isFinalized(), "Params are not finalized"); 30 5213724 : } 31 : 32 : void 33 24 : MooseBaseParameterInterface::connectControllableParams(const std::string & parameter, 34 : const std::string & object_type, 35 : const std::string & object_name, 36 : const std::string & object_parameter) const 37 : { 38 24 : MooseObjectParameterName primary_name(uniqueName(), parameter); 39 24 : const auto base_type = _factory.getValidParams(object_type).get<std::string>("_moose_base"); 40 24 : MooseObjectParameterName secondary_name(base_type, object_name, object_parameter); 41 24 : _moose_base.getMooseApp().getInputParameterWarehouse().addControllableParameterConnection( 42 : primary_name, secondary_name); 43 : 44 24 : const auto & tags = _pars.get<std::vector<std::string>>("control_tags"); 45 48 : for (const auto & tag : tags) 46 : { 47 24 : if (!tag.empty()) 48 : { 49 : // Only adds the parameter with the different control tags if the derived class 50 : // properly registers the parameter to its own syntax 51 24 : MooseObjectParameterName tagged_name(tag, _moose_base.name(), parameter); 52 24 : _moose_base.getMooseApp().getInputParameterWarehouse().addControllableParameterConnection( 53 : tagged_name, secondary_name, /*error_on_empty=*/false); 54 24 : } 55 : } 56 24 : }