https://mooseframework.inl.gov
MooseBaseParameterInterface.C
Go to the documentation of this file.
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 
11 
12 #include "MooseApp.h"
14 
15 std::string
16 paramErrorPrefix(const InputParameters & params, const std::string & param)
17 {
18  return params.errorPrefix(param);
19 }
20 
22  const InputParameters & parameters)
23  : _pars(parameters),
24  _factory(base.getMooseApp().getFactory()),
25  _action_factory(base.getMooseApp().getActionFactory()),
26  _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 }
31 
32 void
34  const std::string & object_type,
35  const std::string & object_name,
36  const std::string & object_parameter) const
37 {
38  MooseObjectParameterName primary_name(uniqueName(), parameter);
39  const auto base_type = _factory.getValidParams(object_type).get<std::string>("_moose_base");
40  MooseObjectParameterName secondary_name(base_type, object_name, object_parameter);
42  primary_name, secondary_name);
43 
44  const auto & tags = _pars.get<std::vector<std::string>>("control_tags");
45  for (const auto & tag : tags)
46  {
47  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  MooseObjectParameterName tagged_name(tag, _moose_base.name(), parameter);
53  tagged_name, secondary_name, /*error_on_empty=*/false);
54  }
55  }
56 }
void addControllableParameterConnection(const MooseObjectParameterName &primary, const MooseObjectParameterName &secondary, bool error_on_empty=true)
Method for linking control parameters of different names.
const MooseBase & _moose_base
The MooseBase object that inherits this class.
Base class for everything in MOOSE with a name and a type.
Definition: MooseBase.h:32
std::string paramErrorPrefix(const InputParameters &params, const std::string &param)
Get canonical paramError prefix for param-related error/warning/info messages.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
InputParameterWarehouse & getInputParameterWarehouse()
Get the InputParameterWarehouse for MooseObjects.
Definition: MooseApp.C:2872
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
Definition: Factory.C:68
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition: MooseBase.h:45
Factory & _factory
The Factory associated with the MooseApp.
MooseBaseParameterInterface(const MooseBase &base, const InputParameters &parameters)
MooseObjectName uniqueName() const
The unique name for accessing input parameters of this object in the InputParameterWarehouse.
void connectControllableParams(const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
Connect controllable parameter of this action with the controllable parameters of the objects added b...
bool isFinalized() const
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
A class for storing an input parameter name.
std::string errorPrefix(const std::string &param) const
generate error message prefix with parameter name and location (if available)