www.mooseframework.org
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
OutputInterface Class Reference

A class to provide an common interface to objects requiring "outputs" option. More...

#include <OutputInterface.h>

Inheritance diagram for OutputInterface:
[legend]

Public Member Functions

 OutputInterface (const InputParameters &parameters, bool build_list=true)
 Handles 'outputs' parameter for objects that desire control of variable outputs. More...
 
void buildOutputHideVariableList (std::set< std::string > variable_names)
 Builds hide lists for output objects NOT listed in the 'outputs' parameter. More...
 
const std::set< OutputName > & getOutputs ()
 Get the list of output objects that this class is restricted. More...
 

Static Public Member Functions

static InputParameters validParams ()
 

Private Attributes

MooseApp_oi_moose_app
 Reference the the MooseApp; neede for access to the OutputWarehouse. More...
 
OutputWarehouse_oi_output_warehouse
 Reference to the OutputWarehouse for populating the Output object hide lists. More...
 
std::set< OutputName > _oi_outputs
 The set of Output object names listed in the 'outputs' parameter. More...
 

Detailed Description

A class to provide an common interface to objects requiring "outputs" option.

The 'outputs' option, when set restricts the output of the variable(s) associated with this object to only occur on output objects listed.

Definition at line 33 of file OutputInterface.h.

Constructor & Destructor Documentation

◆ OutputInterface()

OutputInterface::OutputInterface ( const InputParameters parameters,
bool  build_list = true 
)

Handles 'outputs' parameter for objects that desire control of variable outputs.

Parameters
parametersThe parameters object holding data for the class to use.
build_listIf false the buildOutputHideVariableList must be called explicitly, this behavior is required for automatic output of material properties

Definition at line 35 of file OutputInterface.C.

36  : _oi_moose_app(*parameters.getCheckedPointerParam<MooseApp *>("_moose_app")),
38  _oi_outputs(parameters.get<std::vector<OutputName>>("outputs").begin(),
39  parameters.get<std::vector<OutputName>>("outputs").end())
40 {
41 
42  // By default it is assumed that the variable name associated with 'outputs' is the name
43  // of the block, this is the case for Markers, Indicators, VectorPostprocessors, and
44  // Postprocessors.
45  // However, for Materials this is not the case, so the call to buildOutputHideVariableList must be
46  // disabled, the build_list allows for this behavior. The hide lists are handled by
47  // MaterialOutputAction in this case.
48  //
49  // Variables/AuxVariables also call the buildOutputHideVariableList method later, because when
50  // their actions are called the Output objects do not exist. This case is handled by the
51  // CheckOutputAction::checkVariableOutput.
52  if (build_list)
53  {
54  std::set<std::string> names_set;
55  names_set.insert(parameters.get<std::string>("_object_name"));
56  buildOutputHideVariableList(names_set);
57  }
58 }
OutputWarehouse & _oi_output_warehouse
Reference to the OutputWarehouse for populating the Output object hide lists.
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.
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
Base class for MOOSE-based applications.
Definition: MooseApp.h:73
std::set< OutputName > _oi_outputs
The set of Output object names listed in the &#39;outputs&#39; parameter.
void buildOutputHideVariableList(std::set< std::string > variable_names)
Builds hide lists for output objects NOT listed in the &#39;outputs&#39; parameter.
MooseApp & _oi_moose_app
Reference the the MooseApp; neede for access to the OutputWarehouse.
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
Definition: MooseApp.C:1766

Member Function Documentation

◆ buildOutputHideVariableList()

void OutputInterface::buildOutputHideVariableList ( std::set< std::string >  variable_names)

Builds hide lists for output objects NOT listed in the 'outputs' parameter.

Parameters
variable_namesA set of variables for which the 'outputs' parameter controls

By default this is called by the constructor and passes the block name as the list of variables. This needs to be called explicitly if the build_list flag is set to False in the constructor. The latter cases is needed by the Material object to work correctly with the automatic material output capability.

Definition at line 61 of file OutputInterface.C.

Referenced by ReporterTransferInterface::hideVariableHelper(), and OutputInterface().

62 {
63  // Set of available names
64  const std::set<OutputName> & avail = _oi_output_warehouse.getOutputNames();
65 
66  // Check for 'none'; hide variables on all outputs
67  if (_oi_outputs.find("none") != _oi_outputs.end())
68  for (const auto & name : avail)
69  _oi_output_warehouse.addInterfaceHideVariables(name, variable_names);
70 
71  // Check for empty and 'all' in 'outputs' parameter; do not perform any variable restrictions in
72  // these cases
73  else if (_oi_outputs.empty() || _oi_outputs.find("all") != _oi_outputs.end())
74  return;
75 
76  // Limit the variable output to Output objects listed
77  else
78  {
79  // Create a list of outputs where the variable should be hidden
80  std::set<OutputName> hide;
81  std::set_difference(avail.begin(),
82  avail.end(),
83  _oi_outputs.begin(),
84  _oi_outputs.end(),
85  std::inserter(hide, hide.begin()));
86 
87  // If 'outputs' is specified add the object name to the list of items to hide
88  for (const auto & name : hide)
89  _oi_output_warehouse.addInterfaceHideVariables(name, variable_names);
90  }
91 }
OutputWarehouse & _oi_output_warehouse
Reference to the OutputWarehouse for populating the Output object hide lists.
std::set< OutputName > _oi_outputs
The set of Output object names listed in the &#39;outputs&#39; parameter.
const std::set< OutputName > & getOutputNames()
Get a complete set of all output object names.
void addInterfaceHideVariables(const std::string &output_name, const std::set< std::string > &variable_names)
Insert variable names for hiding via the OutoutInterface.

◆ getOutputs()

const std::set< OutputName > & OutputInterface::getOutputs ( )

Get the list of output objects that this class is restricted.

Returns
A set of OutputNames

Definition at line 94 of file OutputInterface.C.

95 {
96  return _oi_outputs;
97 }
std::set< OutputName > _oi_outputs
The set of Output object names listed in the &#39;outputs&#39; parameter.

◆ validParams()

InputParameters OutputInterface::validParams ( )
static

Definition at line 18 of file OutputInterface.C.

Referenced by Postprocessor::validParams(), VectorPostprocessor::validParams(), Indicator::validParams(), MooseVariableBase::validParams(), Marker::validParams(), Reporter::validParams(), and MaterialBase::validParams().

19 {
20 
22  params.addClassDescription("Interface to handle the restriction of outputs from objects");
23  params.addParam<std::vector<OutputName>>("outputs",
24  "Vector of output names where you would like "
25  "to restrict the output of variables(s) "
26  "associated with this object");
27 
28  params.addParamNamesToGroup("outputs", "Advanced");
29  std::set<std::string> reserved = {"all", "none"};
30  params.setReservedValues("outputs", reserved);
31 
32  return params;
33 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters emptyInputParameters()
void setReservedValues(const std::string &name, const std::set< std::string > &reserved)
Provide a set of reserved values for a parameter.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...

Member Data Documentation

◆ _oi_moose_app

MooseApp& OutputInterface::_oi_moose_app
private

Reference the the MooseApp; neede for access to the OutputWarehouse.

Definition at line 66 of file OutputInterface.h.

◆ _oi_output_warehouse

OutputWarehouse& OutputInterface::_oi_output_warehouse
private

Reference to the OutputWarehouse for populating the Output object hide lists.

Definition at line 69 of file OutputInterface.h.

Referenced by buildOutputHideVariableList().

◆ _oi_outputs

std::set<OutputName> OutputInterface::_oi_outputs
private

The set of Output object names listed in the 'outputs' parameter.

Definition at line 72 of file OutputInterface.h.

Referenced by buildOutputHideVariableList(), and getOutputs().


The documentation for this class was generated from the following files: