https://mooseframework.inl.gov
PostprocessorAsControlAction.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 #include "Simulation.h"
12 #include "THMProblem.h"
13 
14 registerMooseAction("ThermalHydraulicsApp", PostprocessorAsControlAction, "add_postprocessor");
15 
18 {
20  params.addClassDescription(
21  "This action adds a control object that copies a postprocessor value into the control "
22  "system so that users can work with the postprocessor name directly.");
23  return params;
24 }
25 
27  : MooseObjectAction(params)
28 {
29 }
30 
31 void
33 {
34  THMProblem * thm_problem = dynamic_cast<THMProblem *>(_problem.get());
35  if (thm_problem)
36  {
37  const std::string class_name = "THMAddControlAction";
38  InputParameters params = _action_factory.getValidParams(class_name);
39  params.set<std::string>("type") = "CopyPostprocessorValueControl";
40 
41  std::shared_ptr<MooseObjectAction> action = std::static_pointer_cast<MooseObjectAction>(
42  _action_factory.create(class_name, _name + "_copy_ctrl", params));
43 
44  action->getObjectParams().set<PostprocessorName>("postprocessor") = _name;
45 
46  _awh.addActionBlock(action);
47  }
48 }
Specialization of FEProblem to run with component subsystem.
Definition: THMProblem.h:18
ActionWarehouse & _awh
InputParameters getValidParams(const std::string &name)
static InputParameters validParams()
T & set(const std::string &name, bool quiet_mode=false)
void addActionBlock(std::shared_ptr< Action > blk)
std::shared_ptr< Action > create(const std::string &action, const std::string &action_name, InputParameters &parameters)
InputParameters & getObjectParams()
ActionFactory & _action_factory
const std::string _name
This action creates a control value named the same as the postprocessor being added.
PostprocessorAsControlAction(const InputParameters &params)
void addClassDescription(const std::string &doc_string)
std::shared_ptr< FEProblemBase > & _problem
registerMooseAction("ThermalHydraulicsApp", PostprocessorAsControlAction, "add_postprocessor")