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;
132 addValidParams(params, output_types);
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 _postprocessors_as_reporters(getParam<bool>(
"postprocessors_as_reporters")),
144 _vectorpostprocessors_as_reporters(getParam<bool>(
"vectorpostprocessors_as_reporters"))
171 getParam<std::vector<VariableName>>(
"hide"));
180 nodal.
show.insert(elemental.
show.begin(), elemental.
show.end());
181 nodal.
hide.insert(elemental.
hide.begin(), elemental.
hide.end());
190 nodal.
show.insert(scalar.
show.begin(), scalar.
show.end());
191 nodal.
hide.insert(scalar.
hide.begin(), scalar.
hide.end());
205 mooseError(
"Individual output of nodal variables is not support for the output object named '",
214 "Individual output of elemental variables is not support for this output object named '",
222 mooseError(
"Individual output of postprocessors is not support for this output object named '",
231 "Individual output of VectorPostprocessors is not support for this output object named '",
240 "Individual output of scalars is not support for this output object named '",
name(),
"'");
247 "Output of system information is not support for this output object named '",
name(),
"'");
253 mooseError(
"Output of the input file information is not support for this output object named '",
262 "Output of the Reporter value(s) is not support for this output object named '",
name(),
"'");
347 bool execute_data_flag =
true;
352 execute_data_flag =
false;
356 execute_data_flag =
false;
412 initPostprocessorOrVectorPostprocessorLists<Postprocessor>(
"postprocessors");
419 initPostprocessorOrVectorPostprocessorLists<VectorPostprocessor>(
"vector_postprocessors");
425 for (
const auto & var_name : variables)
433 for (
unsigned int i = 0; i < var.
count(); ++i)
435 VariableName vname = var_name;
488 std::string param_name =
"execute_";
489 param_name +=
name +
"_on";
493 input = getParam<ExecFlagEnum>(param_name);
506 const std::vector<VariableName> & hide)
510 std::set<std::string> unknown;
518 for (
const auto & var_name : show)
525 for (
unsigned int i = 0; i < var.
count(); ++i)
527 VariableName vname = var_name;
535 const auto geom_type =
563 _execute_data[
"vector_postprocessors"].show.insert(var_name);
564 else if ((var_name.find(
"/") != std::string::npos) &&
568 unknown.insert(var_name);
572 for (
const auto & var_name : hide)
579 for (
unsigned int i = 0; i < var.
count(); ++i)
581 VariableName vname = var_name;
615 _execute_data[
"vector_postprocessors"].hide.insert(var_name);
616 else if ((var_name.find(
"/") != std::string::npos) &&
621 unknown.insert(var_name);
625 if (!unknown.empty())
627 std::ostringstream oss;
628 oss <<
"Output(s) do not exist (must be variable, scalar, postprocessor, or vector " 630 std::copy(unknown.begin(), unknown.end(), infix_ostream_iterator<std::string>(oss,
" "));
639 std::set<std::string> & hide = data.
hide;
640 std::set<std::string> & show = data.
show;
641 std::set<std::string> & avail = data.
available;
645 std::set<std::string> interface_hide;
647 hide.insert(interface_hide.begin(), interface_hide.end());
654 else if (!show.empty() && hide.empty())
658 else if (show.empty() && !hide.empty())
659 std::set_difference(avail.begin(),
669 std::vector<std::string> tmp;
670 std::set_intersection(
671 hide.begin(), hide.end(), show.begin(), show.end(), std::inserter(tmp, tmp.begin()));
674 std::ostringstream oss;
675 oss <<
"Output(s) specified to be both shown and hidden: ";
676 std::copy(tmp.begin(), tmp.end(), infix_ostream_iterator<std::string>(oss,
" "));
695 "execute_nodal_on", empty_execute_on,
"Control the output of nodal variables");
703 "execute_elemental_on", empty_execute_on,
"Control the output of elemental variables");
707 params.
addParam<
bool>(
"output_material_properties",
709 "Flag indicating if material properties should be output");
710 params.
addParam<std::vector<std::string>>(
711 "show_material_properties",
712 "List of material properties that should be written to the output");
713 params.
addParamNamesToGroup(
"output_material_properties show_material_properties",
"Materials");
717 "output_extra_element_ids",
719 "Flag indicating if extra element ids defined on the mesh should be outputted");
720 params.
addParam<std::vector<std::string>>(
721 "extra_element_ids_to_output",
722 "List of extra element ids defined on the mesh that should be written to the output.");
730 "execute_scalars_on", empty_execute_on,
"Control the output of scalar variables");
737 params.
addParam<
bool>(
"scalar_as_nodal",
false,
"Output scalar variables as nodal");
745 "elemental_as_nodal",
false,
"Output elemental nonlinear variables as nodal");
753 "execute_postprocessors_on", empty_execute_on,
"Control of when postprocessors are output");
762 "Enable/disable the output of VectorPostprocessors");
764 "Selection/restriction of output");
771 "execute_reporters_on", empty_execute_on,
"Control of when Reporter values are output");
779 "execute_input_on", empty_execute_on,
"Enable/disable the output of the input file");
788 "Control when the output of the simulation information occurs");
789 params.
addParamNamesToGroup(
"execute_system_information_on",
"Selection/restriction of output");
806 const std::set<std::string> &
818 const std::set<std::string> &
830 const std::set<std::string> &
842 const std::set<std::string> &
854 const std::set<std::string> &
866 const std::set<std::string> &
virtual void outputVectorPostprocessors()
Performs output of VectorPostprocessors The child class must define this method to output the VectorP...
virtual bool hasVariable(const std::string &var_name) const override
Whether or not this problem has the variable.
virtual void outputSystemInformation()
const std::set< std::string > & getPostprocessorOutput()
The list of postprocessor names that are set for output.
std::set< std::string > output
A list of the outputs to write.
const ExecFlagType EXEC_FAILED
bool hasPostprocessorOutput()
Returns true if there exists postprocessors for output.
virtual bool hasOutput()
Returns true if any of the other has methods return true.
const libMesh::FEType & feType() const
Get the type of finite element object.
A MultiMooseEnum object to hold "execute_on" flags.
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...
ExecFlagEnum _execute_on
The common Execution types; this is used as the default execution type for everything except system i...
bool hasVectorPostprocessorOutput()
Returns true if there exists VectorPostprocessors for output.
const bool _postprocessors_as_reporters
Flags for outputting PP/VPP data as a reporter.
const ExecFlagType EXEC_FORCED
OutputOnWarehouse _advanced_execute_on
Storage for the individual component execute flags.
AdvancedOutput(const InputParameters ¶meters)
Class constructor.
virtual void outputElementalVariables()
Performs output of elemental nonlinear variables The child class must define this method to output th...
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one...
bool hasOutputHelper(const std::string &name)
Helper method for checking if output types exists.
bool _elemental_as_nodal
Flags to control nodal 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...
OutputDataWarehouse _execute_data
Storage structures for the various output types.
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 bool shouldOutput()
Handles logic for determining if a step should be output.
virtual ~AdvancedOutput()
Class destructor.
virtual void output()
A single call to this function should output all the necessary data for a single timestep.
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
This class provides an interface for common operations on field variables of both FE and FV types wit...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const std::set< std::string > & getVectorPostprocessorOutput()
The list of VectorPostprocessor names that are set for output.
std::string getRawNames() const
Method for returning the raw name strings for this instance.
A structure for storing the various lists that contain the names of the items to be exported...
void initOutputList(OutputData &data)
Initializes the list of items to be output using the available, show, and hide lists.
virtual const std::string & name() const
Get the name of the class.
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 void outputScalarVariables()
Performs output of scalar variables The child class must define this method to output the scalar vari...
ExecFlagEnum getDefaultExecFlagEnum()
Return the default ExecFlagEnum for MOOSE.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
const OutputOnWarehouse & advancedExecuteOn() const
Get the current advanced 'execute_on' selections for display.
void initAvailableLists()
Initializes the available lists for each of the output types.
const std::set< std::string > & getReporterOutput()
The list of Reporter names that are set for output.
bool hasShowList()
False when the show lists for all variables is empty.
virtual std::vector< VariableName > getVariableNames()
Returns a list of all the variables in the problem (both from the NL and Aux systems.
bool hasNodalVariableOutput()
Returns true if there exists nodal nonlinear variables for output.
virtual void outputNodalVariables()
Performs output of nodal nonlinear variables The child class must define this method to output the no...
bool havePRefinement() const
Query whether p-refinement has been requested at any point during the simulation. ...
void reset()
Clear existing lists for re-initialization.
const std::set< std::string > & getScalarOutput()
The list of scalar variables names that are set for output.
std::set< std::string > available
A list of all possible outputs.
bool hasPostprocessorByName(const PostprocessorName &name) const
Determine if the Postprocessor data exists.
virtual void outputInput()
Performs the output of the input file By default this method does nothing and is not called...
ExecFlagType _current_execute_flag
Current execute on flag.
bool contains(const std::string &name) const
A method for testing of a key exists.
const bool _vectorpostprocessors_as_reporters
static void addValidParams(InputParameters ¶ms, const MultiMooseEnum &types)
Method for defining the available parameters based on the types of outputs.
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
static InputParameters validParams()
virtual bool isArray() const
const std::string & type() const
Get the type of this class.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
A helper warehouse class for storing the "execute_on" settings for the various output types...
bool hasScalarOutput()
Returns true if there exists scalar variables for output.
MooseApp & _app
The MOOSE application this is associated with.
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
static InputParameters enableOutputTypes(const std::string &names=std::string())
A method for enabling individual output type control.
bool hasElementalVariableOutput()
Returns true if there exists elemental nonlinear variables for output.
std::set< std::string > hide
User-supplied list of outputs to hide.
std::set< ReporterName > getReporterNames() const
Return a list of all reporter names.
std::map< std::string, T >::iterator end()
const ReporterData & _reporter_data
Storage for Reporter values.
bool _is_advanced
Flag for advanced output testing.
bool wantOutput(const std::string &name, const ExecFlagType &type)
Handles logic for determining if a step should be output.
virtual void outputReporters()
Output Reporter values.
bool hasVectorPostprocessorByName(const VectorPostprocessorName &name, const std::string &vector_name) const
Determine if the VectorPostprocessor data exists by name.
virtual void initialSetup()
Call init() method on setup.
Class for containing MooseEnum item information.
virtual void outputPostprocessors()
Performs output of postprocessors The child class must define this method to output the postprocessor...
unsigned int spatial_dimension() const
libMesh::EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
const std::string & arrayVariableComponent(const unsigned int i) const
Returns the variable name of a component of an array variable.
const MeshBase & get_mesh() const
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
const std::set< std::string > & getElementalVariableOutput()
The list of elemental nonlinear variables names that are set for output.
static MultiMooseEnum getOutputTypes()
Get the supported types of output (e.g., postprocessors, etc.)
const InputParameters & parameters() const
Get the parameters of the object.
std::set< std::string > show
User-supplied list of outputs to display.
const std::set< std::string > & getNodalVariableOutput()
The list of nodal nonlinear variables names that are set for output.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
void buildInterfaceHideVariables(const std::string &output_name, std::set< std::string > &hide)
Return the list of hidden variables for the given output name.
bool hasReporterOutput()
Returns true if there exists Reporter for output.
static InputParameters validParams()
An outputter with filename support.
bool checkFilename()
Checks the filename for output Checks the output against the 'output_if_base_contians' list...
void initExecutionTypes(const std::string &name, ExecFlagEnum &input)
Initialize the possible execution types.
std::map< std::string, T >::iterator find(const std::string &name)
const ExecFlagType EXEC_FINAL
Real & _time
The current time for output purposes.
void clearSetValues()
Clear the MultiMooseEnum.
bool hasReporterValueByName(const ReporterName &reporter_name) const
The Reporter system is comprised of objects that can contain any number of data values.
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
virtual void init()
Populates the various data structures needed to control the output.
void setHasShowList(bool value)
Set the show list bool.