27#include "libmesh/fe_interface.h"
40 params.
addParam<std::vector<VariableName>>(
43 "A list of the variables and postprocessors that should NOT be output to the Exodus "
44 "file (may include Variables, ScalarVariables, and Postprocessor names).");
46 params.
addParam<std::vector<VariableName>>(
49 "A list of the variables and postprocessors that should be output to the Exodus file "
50 "(may include Variables, ScalarVariables, and Postprocessor names).");
54 "postprocessors_as_reporters",
false,
"Output Postprocessors values as Reporter values.");
55 params.
addParam<
bool>(
"vectorpostprocessors_as_reporters",
57 "Output VectorsPostprocessors vectors as Reporter values.");
64 "Conversions before output");
69 "Enable/disable the output of postprocessors",
70 "'execute_postprocessors_on' has replaced this parameter");
73 "Enable/disable the output of vector postprocessors",
74 "'execute_vector_postprocessors_on' has replaced this parameter");
77 "Enable/disable the output of the simulation information",
78 "'execute_system_information_on' has replaced this parameter");
81 "Enable/disable the output of elemental variables",
82 "'execute_elemental_on' has replaced this parameter");
85 "Enable/disable the output of nodal variables",
86 "'execute_nodal_on' has replaced this parameter");
89 "Enable/disable the output of aux scalar variables",
90 "'execute_scalars_on' has replaced this parameter");
93 "Enable/disable the output of input file information",
94 "'execute_input_on' has replaced this parameter");
103 addAdvancedOutputParams(params);
111 return MultiMooseEnum(
"nodal=0 elemental=1 scalar=2 postprocessor=3 vector_postprocessor=4 "
112 "input=5 system_information=6 reporter=7");
129 output_types = names;
139 _elemental_as_nodal(isParamValid(
"elemental_as_nodal") ? getParam<bool>(
"elemental_as_nodal")
141 _scalar_as_nodal(isParamValid(
"scalar_as_nodal") ? getParam<bool>(
"scalar_as_nodal") : false),
142 _reporter_data(_problem_ptr->getReporterData()),
143 _last_execute_time(declareRecoverableData<
std::map<
std::string,
Real>>(
"last_execute_time")),
144 _postprocessors_as_reporters(getParam<bool>(
"postprocessors_as_reporters")),
145 _vectorpostprocessors_as_reporters(getParam<bool>(
"vectorpostprocessors_as_reporters"))
172 getParam<std::vector<VariableName>>(
"hide"));
181 nodal.
show.insert(elemental.
show.begin(), elemental.
show.end());
182 nodal.
hide.insert(elemental.
hide.begin(), elemental.
hide.end());
191 nodal.
show.insert(scalar.
show.begin(), scalar.
show.end());
192 nodal.
hide.insert(scalar.
hide.begin(), scalar.
hide.end());
206 mooseError(
"Individual output of nodal variables is not support for the output object named '",
215 "Individual output of elemental variables is not support for this output object named '",
223 mooseError(
"Individual output of postprocessors is not support for this output object named '",
232 "Individual output of VectorPostprocessors is not support for this output object named '",
241 "Individual output of scalars is not support for this output object named '",
name(),
"'");
248 "Output of system information is not support for this output object named '",
name(),
"'");
254 mooseError(
"Output of the input file information is not support for this output object named '",
263 "Output of the Reporter value(s) is not support for this output object named '",
name(),
"'");
354 bool execute_data_flag =
true;
359 execute_data_flag =
false;
363 execute_data_flag =
false;
419 initPostprocessorOrVectorPostprocessorLists<Postprocessor>(
"postprocessors");
426 initPostprocessorOrVectorPostprocessorLists<VectorPostprocessor>(
"vector_postprocessors");
432 for (
const auto & var_name : variables)
442 const auto & outputs = var.
getParam<std::vector<OutputName>>(
"outputs");
443 if (outputs.size() && std::find(outputs.begin(), outputs.end(),
name()) == outputs.end() &&
449 for (
unsigned int i = 0; i < var.
count(); ++i)
451 VariableName vname = var_name;
504 std::string param_name =
"execute_";
505 param_name +=
name +
"_on";
509 input = getParam<ExecFlagEnum>(param_name);
522 const std::vector<VariableName> & hide)
526 std::set<std::string> unknown;
534 for (
const auto & var_name : show)
541 for (
unsigned int i = 0; i < var.
count(); ++i)
543 VariableName vname = var_name;
551 const auto geom_type =
579 _execute_data[
"vector_postprocessors"].show.insert(var_name);
580 else if ((var_name.find(
"/") != std::string::npos) &&
584 unknown.insert(var_name);
588 for (
const auto & var_name : hide)
595 for (
unsigned int i = 0; i < var.
count(); ++i)
597 VariableName vname = var_name;
631 _execute_data[
"vector_postprocessors"].hide.insert(var_name);
632 else if ((var_name.find(
"/") != std::string::npos) &&
637 unknown.insert(var_name);
641 if (!unknown.empty())
643 std::ostringstream oss;
644 oss <<
"Output(s) do not exist (must be variable, scalar, postprocessor, or vector "
655 std::set<std::string> & hide = data.
hide;
656 std::set<std::string> & show = data.
show;
657 std::set<std::string> & avail = data.
available;
661 std::set<std::string> interface_hide_all_types;
665 std::set<std::string> interface_hide;
666 std::set_intersection(interface_hide_all_types.begin(),
667 interface_hide_all_types.end(),
670 std::inserter(interface_hide, interface_hide.begin()));
673 hide.insert(interface_hide.begin(), interface_hide.end());
685 std::set_difference(avail.begin(),
695 std::vector<std::string> tmp;
696 std::set_intersection(
697 hide.begin(), hide.end(), show.begin(), show.end(), std::inserter(tmp, tmp.begin()));
700 std::ostringstream oss;
701 oss <<
"Output(s) specified to be both shown and hidden: ";
721 "execute_nodal_on", empty_execute_on,
"Control the output of nodal variables");
729 "execute_elemental_on", empty_execute_on,
"Control the output of elemental variables");
733 params.
addParam<
bool>(
"output_material_properties",
735 "Flag indicating if material properties should be output");
736 params.
addParam<std::vector<std::string>>(
737 "show_material_properties",
738 "List of material properties that should be written to the output");
739 params.
addParamNamesToGroup(
"output_material_properties show_material_properties",
"Materials");
743 "output_extra_element_ids",
745 "Flag indicating if extra element ids defined on the mesh should be outputted");
746 params.
addParam<std::vector<std::string>>(
747 "extra_element_ids_to_output",
748 "List of extra element ids defined on the mesh that should be written to the output.");
756 "execute_scalars_on", empty_execute_on,
"Control the output of scalar variables");
763 params.
addParam<
bool>(
"scalar_as_nodal",
false,
"Output scalar variables as nodal");
771 "elemental_as_nodal",
false,
"Output elemental nonlinear variables as nodal");
779 "execute_postprocessors_on", empty_execute_on,
"Control of when postprocessors are output");
788 "Enable/disable the output of VectorPostprocessors");
790 "Selection/restriction of output");
797 "execute_reporters_on", empty_execute_on,
"Control of when Reporter values are output");
805 "execute_input_on", empty_execute_on,
"Enable/disable the output of the input file");
814 "Control when the output of the simulation information occurs");
815 params.
addParamNamesToGroup(
"execute_system_information_on",
"Selection/restriction of output");
832const std::set<std::string> &
844const std::set<std::string> &
856const std::set<std::string> &
868const std::set<std::string> &
880const std::set<std::string> &
892const 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
static FEFieldType field_type(const FEType &fe_type)
unsigned int spatial_dimension() const
ExecFlagEnum getDefaultExecFlagEnum()
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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.