www.mooseframework.org
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...
 

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 38 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 34 of file OutputInterface.C.

35  : _oi_moose_app(*parameters.getCheckedPointerParam<MooseApp *>("_moose_app")),
37  _oi_outputs(parameters.get<std::vector<OutputName>>("outputs").begin(),
38  parameters.get<std::vector<OutputName>>("outputs").end())
39 {
40 
41  // By default it is assumed that the variable name associated with 'outputs' is the name
42  // of the block, this is the case for Markers, Indicators, VectorPostprocessors, and
43  // Postprocessors.
44  // However, for Materials this is not the case, so the call to buildOutputHideVariableList must be
45  // disabled, the build_list allows for this behavior. The hide lists are handled by
46  // MaterialOutputAction
47  // in this case.
48  //
49  // Variables/AuxVariables also call the buildOutputHideVariableList method later, because when
50  // their actions
51  // are called the Output objects do not exist. This case is handled by the
52  // CheckOutputAction::checkVariableOutput.
53  if (build_list)
54  {
55  std::set<std::string> names_set;
56  names_set.insert(parameters.get<std::string>("_object_name"));
57  buildOutputHideVariableList(names_set);
58  }
59 }
OutputWarehouse & _oi_output_warehouse
Reference to the OutputWarehouse for populating the Output object hide lists.
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:58
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:1056

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 62 of file OutputInterface.C.

Referenced by CheckOutputAction::checkVariableOutput(), and OutputInterface().

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

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

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 69 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 72 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 75 of file OutputInterface.h.

Referenced by buildOutputHideVariableList(), and getOutputs().


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