27#include "libmesh/fe_interface.h"
38 params.
addParam<std::vector<VariableName>>(
41 "A list of the variables and postprocessors that should NOT be output to the Exodus "
42 "file (may include Variables, ScalarVariables, and Postprocessor names).");
44 params.
addParam<std::vector<VariableName>>(
47 "A list of the variables and postprocessors that should be output to the Exodus file "
48 "(may include Variables, ScalarVariables, and Postprocessor names).");
52 "postprocessors_as_reporters",
false,
"Output Postprocessors values as Reporter values.");
53 params.
addParam<
bool>(
"vectorpostprocessors_as_reporters",
55 "Output VectorsPostprocessors vectors as Reporter values.");
62 "Conversions before output");
67 "Enable/disable the output of postprocessors",
68 "'execute_postprocessors_on' has replaced this parameter");
71 "Enable/disable the output of vector postprocessors",
72 "'execute_vector_postprocessors_on' has replaced this parameter");
75 "Enable/disable the output of the simulation information",
76 "'execute_system_information_on' has replaced this parameter");
79 "Enable/disable the output of elemental variables",
80 "'execute_elemental_on' has replaced this parameter");
83 "Enable/disable the output of nodal variables",
84 "'execute_nodal_on' has replaced this parameter");
87 "Enable/disable the output of aux scalar variables",
88 "'execute_scalars_on' has replaced this parameter");
91 "Enable/disable the output of input file information",
92 "'execute_input_on' has replaced this parameter");
101 addAdvancedOutputParams(params);
109 return MultiMooseEnum(
"nodal=0 elemental=1 scalar=2 postprocessor=3 vector_postprocessor=4 "
110 "input=5 system_information=6 reporter=7");
127 output_types = names;
137 _elemental_as_nodal(isParamValid(
"elemental_as_nodal") ? getParam<bool>(
"elemental_as_nodal")
139 _scalar_as_nodal(isParamValid(
"scalar_as_nodal") ? getParam<bool>(
"scalar_as_nodal") : false),
140 _reporter_data(_problem_ptr->getReporterData()),
141 _last_execute_time(declareRecoverableData<
std::map<
std::string, Real>>(
"last_execute_time")),
142 _postprocessors_as_reporters(getParam<bool>(
"postprocessors_as_reporters")),
143 _vectorpostprocessors_as_reporters(getParam<bool>(
"vectorpostprocessors_as_reporters"))
170 getParam<std::vector<VariableName>>(
"hide"));
179 nodal.
show.insert(elemental.
show.begin(), elemental.
show.end());
180 nodal.
hide.insert(elemental.
hide.begin(), elemental.
hide.end());
189 nodal.
show.insert(scalar.
show.begin(), scalar.
show.end());
190 nodal.
hide.insert(scalar.
hide.begin(), scalar.
hide.end());
204 mooseError(
"Individual output of nodal variables is not support for the output object named '",
213 "Individual output of elemental variables is not support for this output object named '",
221 mooseError(
"Individual output of postprocessors is not support for this output object named '",
230 "Individual output of VectorPostprocessors is not support for this output object named '",
239 "Individual output of scalars is not support for this output object named '",
name(),
"'");
246 "Output of system information is not support for this output object named '",
name(),
"'");
252 mooseError(
"Output of the input file information is not support for this output object named '",
261 "Output of the Reporter value(s) is not support for this output object named '",
name(),
"'");
352 bool execute_data_flag =
true;
357 execute_data_flag =
false;
361 execute_data_flag =
false;
417 initPostprocessorOrVectorPostprocessorLists<Postprocessor>(
"postprocessors");
424 initPostprocessorOrVectorPostprocessorLists<VectorPostprocessor>(
"vector_postprocessors");
430 for (
const auto & var_name : variables)
440 const auto & outputs = var.
getParam<std::vector<OutputName>>(
"outputs");
441 if (outputs.size() && std::find(outputs.begin(), outputs.end(),
name()) == outputs.end() &&
447 for (
unsigned int i = 0; i < var.
count(); ++i)
449 VariableName vname = var_name;
457 type.family != MONOMIAL_VEC)
461 const auto geom_type = ((
type.family == MONOMIAL_VEC) && (
type.order == CONSTANT) &&
502 std::string param_name =
"execute_";
503 param_name +=
name +
"_on";
507 input = getParam<ExecFlagEnum>(param_name);
520 const std::vector<VariableName> & hide)
524 std::set<std::string> unknown;
532 for (
const auto & var_name : show)
539 for (
unsigned int i = 0; i < var.
count(); ++i)
541 VariableName vname = var_name;
545 if (
type.order == CONSTANT)
549 const auto geom_type =
550 ((
type.family == MONOMIAL_VEC) && (
type.order == CONSTANT)) ?
"elemental" :
"nodal";
577 _execute_data[
"vector_postprocessors"].show.insert(var_name);
578 else if ((var_name.find(
"/") != std::string::npos) &&
582 unknown.insert(var_name);
586 for (
const auto & var_name : hide)
593 for (
unsigned int i = 0; i < var.
count(); ++i)
595 VariableName vname = var_name;
599 if (
type.order == CONSTANT)
629 _execute_data[
"vector_postprocessors"].hide.insert(var_name);
630 else if ((var_name.find(
"/") != std::string::npos) &&
635 unknown.insert(var_name);
639 if (!unknown.empty())
641 std::ostringstream oss;
642 oss <<
"Output(s) do not exist (must be variable, scalar, postprocessor, or vector "
653 std::set<std::string> & hide = data.
hide;
654 std::set<std::string> & show = data.
show;
655 std::set<std::string> & avail = data.
available;
659 std::set<std::string> interface_hide_all_types;
663 std::set<std::string> interface_hide;
664 std::set_intersection(interface_hide_all_types.begin(),
665 interface_hide_all_types.end(),
668 std::inserter(interface_hide, interface_hide.begin()));
671 hide.insert(interface_hide.begin(), interface_hide.end());
683 std::set_difference(avail.begin(),
693 std::vector<std::string> tmp;
694 std::set_intersection(
695 hide.begin(), hide.end(), show.begin(), show.end(), std::inserter(tmp, tmp.begin()));
698 std::ostringstream oss;
699 oss <<
"Output(s) specified to be both shown and hidden: ";
719 "execute_nodal_on", empty_execute_on,
"Control the output of nodal variables");
727 "execute_elemental_on", empty_execute_on,
"Control the output of elemental variables");
731 params.
addParam<
bool>(
"output_material_properties",
733 "Flag indicating if material properties should be output");
734 params.
addParam<std::vector<std::string>>(
735 "show_material_properties",
736 "List of material properties that should be written to the output");
737 params.
addParamNamesToGroup(
"output_material_properties show_material_properties",
"Materials");
741 "output_extra_element_ids",
743 "Flag indicating if extra element ids defined on the mesh should be outputted");
744 params.
addParam<std::vector<std::string>>(
745 "extra_element_ids_to_output",
746 "List of extra element ids defined on the mesh that should be written to the output.");
754 "execute_scalars_on", empty_execute_on,
"Control the output of scalar variables");
761 params.
addParam<
bool>(
"scalar_as_nodal",
false,
"Output scalar variables as nodal");
769 "elemental_as_nodal",
false,
"Output elemental nonlinear variables as nodal");
777 "execute_postprocessors_on", empty_execute_on,
"Control of when postprocessors are output");
786 "Enable/disable the output of VectorPostprocessors");
788 "Selection/restriction of output");
795 "execute_reporters_on", empty_execute_on,
"Control of when Reporter values are output");
803 "execute_input_on", empty_execute_on,
"Enable/disable the output of the input file");
812 "Control when the output of the simulation information occurs");
813 params.
addParamNamesToGroup(
"execute_system_information_on",
"Selection/restriction of output");
830const std::set<std::string> &
842const std::set<std::string> &
854const std::set<std::string> &
866const std::set<std::string> &
878const std::set<std::string> &
890const std::set<std::string> &
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const ExecFlagType EXEC_FORCED
const ExecFlagType EXEC_FAILED
const ExecFlagType EXEC_FINAL
virtual bool hasOutput()
Returns true if any of the other has methods return true.
bool hasReporterOutput()
Returns true if there exists Reporter for output.
bool hasOutputHelper(const std::string &name)
Helper method for checking if output types exists.
virtual void outputScalarVariables()
Performs output of scalar variables The child class must define this method to output the scalar vari...
const std::set< std::string > & getReporterOutput()
The list of Reporter names that are set for output.
void initExecutionTypes(const std::string &name, ExecFlagEnum &input)
Initialize the possible execution types.
void initAvailableLists()
Initializes the available lists for each of the output types.
static InputParameters enableOutputTypes(const std::string &names=std::string())
A method for enabling individual output type control.
virtual void output()
A single call to this function should output all the necessary data for a single timestep.
virtual void initialSetup()
Call init() method on setup.
virtual void outputSystemInformation()
bool hasElementalVariableOutput()
Returns true if there exists elemental nonlinear variables for output.
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
const std::set< std::string > & getElementalVariableOutput()
The list of elemental nonlinear variables names that are set for output.
bool hasNodalVariableOutput()
Returns true if there exists nodal nonlinear variables for output.
const bool _postprocessors_as_reporters
Flags for outputting PP/VPP data as a reporter.
bool _elemental_as_nodal
Flags to control nodal output.
bool hasPostprocessorOutput()
Returns true if there exists postprocessors for output.
AdvancedOutput(const InputParameters ¶meters)
Class constructor.
std::map< std::string, Real > & _last_execute_time
Storage for the last output time for the various output types, this is used to avoid duplicate output...
const ReporterData & _reporter_data
Storage for Reporter values.
void clearLastExecuteTime()
Clears bookkeeping used to suppress duplicate EXEC_FINAL output at the same time.
const bool _vectorpostprocessors_as_reporters
const std::set< std::string > & getNodalVariableOutput()
The list of nodal nonlinear variables names that are set for output.
static InputParameters validParams()
static MultiMooseEnum getOutputTypes()
Get the supported types of output (e.g., postprocessors, etc.)
bool hasScalarOutput()
Returns true if there exists scalar variables for output.
const std::set< std::string > & getScalarOutput()
The list of scalar variables names that are set for output.
void initShowHideLists(const std::vector< VariableName > &show, const std::vector< VariableName > &hide)
Parses the user-supplied input for hiding and showing variables and postprocessors into a list for ea...
bool wantOutput(const std::string &name, const ExecFlagType &type)
Handles logic for determining if a step should be output.
virtual void outputElementalVariables()
Performs output of elemental nonlinear variables The child class must define this method to output th...
virtual ~AdvancedOutput()
Class destructor.
virtual void outputReporters()
Output Reporter values.
bool hasVectorPostprocessorOutput()
Returns true if there exists VectorPostprocessors for output.
virtual void outputPostprocessors()
Performs output of postprocessors The child class must define this method to output the postprocessor...
virtual void outputVectorPostprocessors()
Performs output of VectorPostprocessors The child class must define this method to output the VectorP...
const std::set< std::string > & getVectorPostprocessorOutput()
The list of VectorPostprocessor names that are set for output.
virtual void outputInput()
Performs the output of the input file By default this method does nothing and is not called,...
virtual void init()
Populates the various data structures needed to control the output.
OutputDataWarehouse _execute_data
Storage structures for the various output types.
virtual void outputNodalVariables()
Performs output of nodal nonlinear variables The child class must define this method to output the no...
void initOutputList(OutputData &data)
Initializes the list of items to be output using the available, show, and hide lists.
const std::set< std::string > & getPostprocessorOutput()
The list of postprocessor names that are set for output.
static void addValidParams(InputParameters ¶ms, const MultiMooseEnum &types)
Method for defining the available parameters based on the types of outputs.
const OutputOnWarehouse & advancedExecuteOn() const
Get the current advanced 'execute_on' selections for display.
A MultiMooseEnum object to hold "execute_on" flags.
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
virtual bool hasScalarVariable(const std::string &var_name) const override
Returns a Boolean indicating whether any system contains a variable with the name provided.
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
virtual bool hasVariable(const std::string &var_name) const override
Whether or not this problem has the variable.
virtual std::vector< VariableName > getVariableNames()
Returns a list of all the variables in the problem (both from the NL and Aux systems.
An outputter with filename support.
static InputParameters validParams()
bool checkFilename()
Checks the filename for output Checks the output against the 'output_if_base_contians' list.
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
const InputParameters & parameters() const
Get the parameters of the object.
const std::string & type() const
Get the type of this class.
const std::string & name() const
Get the name of the class.
const InputParameters & _pars
The object's parameters.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
std::string getRawNames() const
Method for returning the raw name strings for this instance.
Class for containing MooseEnum item information.
MooseApp & _app
The MOOSE application this is associated with.
const libMesh::FEType & feType() const
Get the type of finite element object.
virtual bool isArray() const
const std::string & arrayVariableComponent(const unsigned int i) const
Returns the variable name of a component of an array variable.
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one.
This class provides an interface for common operations on field variables of both FE and FV types wit...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
void clearSetValues()
Clear the MultiMooseEnum.
void reset()
Clear existing lists for re-initialization.
bool hasShowList()
False when the show lists for all variables is empty.
void setHasShowList(bool value)
Set the show list bool.
std::map< std::string, T >::iterator end()
bool contains(const std::string &name) const
A method for testing of a key exists.
std::map< std::string, T >::iterator find(const std::string &name)
A helper warehouse class for storing the "execute_on" settings for the various output types.
void buildInterfaceHideVariables(const std::string &output_name, std::set< std::string > &hide)
Return the list of hidden variables for the given output name.
ExecFlagEnum _execute_on
The common Execution types; this is used as the default execution type for everything except system i...
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
bool _is_advanced
Flag for advanced output testing.
ExecFlagType _current_execute_flag
Current execute on flag.
libMesh::EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Real & _time
The current time for output purposes.
OutputOnWarehouse _advanced_execute_on
Storage for the individual component execute flags.
bool hasPostprocessorByName(const PostprocessorName &name) const
Determine if the Postprocessor data exists.
std::set< ReporterName > getReporterNames() const
Return a list of all reporter names.
bool hasReporterValueByName(const ReporterName &reporter_name) const
The Reporter system is comprised of objects that can contain any number of data values.
bool havePRefinement() const
Query whether p-refinement has been requested at any point during the simulation.
bool hasVectorPostprocessorByName(const VectorPostprocessorName &name, const std::string &vector_name) const
Determine if the VectorPostprocessor data exists by name.
GCC9 currently hits a "no type named 'value_type'" error during build if this is removed and iterator...
const MeshBase & get_mesh() const
unsigned int spatial_dimension() const
ExecFlagEnum getDefaultExecFlagEnum()
A structure for storing the various lists that contain the names of the items to be exported.
std::set< std::string > show
User-supplied list of outputs to display.
std::set< std::string > available
A list of all possible outputs.
std::set< std::string > output
A list of the outputs to write.
std::set< std::string > hide
User-supplied list of outputs to hide.