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

Meta-action for creating common output object parameters This action serves two purpose, first it adds common output object parameters. More...

#include <CommonOutputAction.h>

Inheritance diagram for CommonOutputAction:
[legend]

Public Member Functions

 CommonOutputAction (InputParameters params)
 Class constructor. More...
 
virtual void act () override
 
const std::string & name () const
 The name of the action. More...
 
const std::string & type () const
 
InputParametersparameters ()
 
const InputParametersparameters () const
 
const std::string & specificTaskName () const
 
const std::set< std::string > & getAllTasks () const
 
bool isParamValid (const std::string &name) const
 
void appendTask (const std::string &task)
 
std::string getBaseName () const
 Deprecated name methods, use name() More...
 
std::string getShortName () const
 DEPRECATED METHODS. More...
 
template<typename T >
const T & getParam (const std::string &name) const
 Retrieve a parameter for the object. More...
 

Public Attributes

const ConsoleStream _console
 An instance of helper class to write streams to the Console objects. More...
 

Protected Attributes

InputParameters _pars
 Input parameters for the action. More...
 
std::string _registered_identifier
 
std::string _name
 The name of the action. More...
 
std::string _action_type
 
MooseApp_app
 The MOOSE application this is associated with. More...
 
Factory_factory
 The Factory associated with the MooseApp. More...
 
ActionFactory_action_factory
 Builds Actions. More...
 
std::string _specific_task_name
 This member will only be populated if this Action instance is only designed to handle one task. More...
 
std::set< std::string > _all_tasks
 A list of all the tasks that this Action will satisfy. More...
 
ActionWarehouse_awh
 Reference to ActionWarehouse where we store object build by actions. More...
 
const std::string & _current_task
 The current action (even though we have seperate instances for each action) More...
 
std::shared_ptr< MooseMesh > & _mesh
 
std::shared_ptr< MooseMesh > & _displaced_mesh
 
std::shared_ptr< FEProblemBase > & _problem
 Convenience reference to a problem this action works on. More...
 
std::shared_ptr< Executioner > & _executioner
 Convenience reference to an executioner. More...
 

Private Member Functions

void create (std::string object_type)
 Helper method for creating the short-cut actions. More...
 
bool hasConsole ()
 Check if a Console object that outputs to the screen has been defined. More...
 

Private Attributes

InputParameters _action_params
 Parameters from the action being created (AddOutputAction) More...
 

Detailed Description

Meta-action for creating common output object parameters This action serves two purpose, first it adds common output object parameters.

Second, it creates the action (AddOutputAction) short-cuts such as 'exodus=true' that result in the default output object of that type to be created.

Definition at line 34 of file CommonOutputAction.h.

Constructor & Destructor Documentation

CommonOutputAction::CommonOutputAction ( InputParameters  params)

Class constructor.

Definition at line 122 of file CommonOutputAction.C.

123  : Action(params), _action_params(_action_factory.getValidParams("AddOutputAction"))
124 {
125 }
InputParameters _action_params
Parameters from the action being created (AddOutputAction)
ActionFactory & _action_factory
Builds Actions.
Definition: Action.h:104
InputParameters getValidParams(const std::string &name)
Definition: ActionFactory.C:74
Action(InputParameters parameters)
Definition: Action.C:51

Member Function Documentation

void CommonOutputAction::act ( )
overridevirtual

Implements Action.

Definition at line 128 of file CommonOutputAction.C.

129 {
130  // Store the common output parameters in the OutputWarehouse
132 
133 // Create the actions for the short-cut methods
134 #ifdef LIBMESH_HAVE_EXODUS_API
135  if (getParam<bool>("exodus"))
136  create("Exodus");
137 #else
138  if (getParam<bool>("exodus"))
139  mooseWarning("Exodus output requested but not enabled through libMesh");
140 #endif
141 
142 #ifdef LIBMESH_HAVE_NEMESIS_API
143  if (getParam<bool>("nemesis"))
144  create("Nemesis");
145 #else
146  if (getParam<bool>("nemesis"))
147  mooseWarning("Nemesis output requested but not enabled through libMesh");
148 #endif
149 
150  // Only create a Console if screen output was not created
151  if (getParam<bool>("console") && !hasConsole())
152  create("Console");
153  else
154  _pars.set<bool>("console") = false;
155 
156  if (getParam<bool>("csv"))
157  create("CSV");
158 
159 #ifdef LIBMESH_HAVE_VTK
160  if (getParam<bool>("vtk"))
161  create("VTK");
162 #else
163  if (getParam<bool>("vtk"))
164  mooseWarning("VTK output requested but not enabled through libMesh");
165 #endif
166 
167  if (getParam<bool>("xda"))
168  create("XDA");
169 
170  if (getParam<bool>("xdr"))
171  create("XDR");
172 
173  if (getParam<bool>("checkpoint"))
174  create("Checkpoint");
175 
176  if (getParam<bool>("gmv"))
177  create("GMV");
178 
179  if (getParam<bool>("tecplot"))
180  create("Tecplot");
181 
182  if (getParam<bool>("gnuplot"))
183  create("Gnuplot");
184 
185  if (getParam<bool>("solution_history"))
186  create("SolutionHistory");
187 
188  if (getParam<bool>("dofmap"))
189  create("DOFMap");
190 
191  if (getParam<bool>("controls") || _app.getParam<bool>("show_controls"))
192  create("ControlOutput");
193 
194  if (!getParam<bool>("color"))
195  Moose::setColorConsole(false);
196 }
void create(std::string object_type)
Helper method for creating the short-cut actions.
bool hasConsole()
Check if a Console object that outputs to the screen has been defined.
void setCommonParameters(InputParameters *params_ptr)
Stores the common InputParameters object.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
InputParameters _pars
Input parameters for the action.
Definition: Action.h:86
const T & getParam(const std::string &name)
Retrieve a parameter for the object.
Definition: MooseApp.h:738
bool setColorConsole(bool use_color, bool force=false)
Turns color escape sequences on/off for info written to stdout.
Definition: Moose.C:1276
MooseApp & _app
The MOOSE application this is associated with.
Definition: Action.h:98
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
Definition: MooseApp.C:841
void mooseWarning(Args &&...args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:194
void Action::appendTask ( const std::string &  task)
inlineinherited

Definition at line 82 of file Action.h.

82 { _all_tasks.insert(task); }
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:119
void CommonOutputAction::create ( std::string  object_type)
private

Helper method for creating the short-cut actions.

Parameters
object_typeString of the object type, i.e., the value of 'type=' in the input file

Definition at line 199 of file CommonOutputAction.C.

Referenced by act().

200 {
201  // Set the 'type =' parameters for the desired object
202  _action_params.set<std::string>("type") = object_type;
203 
204  // Create the complete object name (uses lower case of type)
205  std::transform(object_type.begin(), object_type.end(), object_type.begin(), ::tolower);
206 
207  // Create the action
208  std::shared_ptr<MooseObjectAction> action = std::static_pointer_cast<MooseObjectAction>(
209  _action_factory.create("AddOutputAction", object_type, _action_params));
210 
211  // Set flag indicating that the object to be created was created with short-cut syntax
212  action->getObjectParams().set<bool>("_built_by_moose") = true;
213 
214  // Add the action to the warehouse
215  _awh.addActionBlock(action);
216 }
InputParameters _action_params
Parameters from the action being created (AddOutputAction)
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
Definition: Action.h:122
ActionFactory & _action_factory
Builds Actions.
Definition: Action.h:104
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
void addActionBlock(std::shared_ptr< Action > blk)
This method add an Action instance to the warehouse.
InputParameters & getObjectParams()
Retreive the parameters of the object to be created by this action.
std::shared_ptr< Action > create(const std::string &action, const std::string &action_name, InputParameters parameters)
Definition: ActionFactory.C:26
const std::set<std::string>& Action::getAllTasks ( ) const
inlineinherited

Definition at line 68 of file Action.h.

Referenced by AddKernelAction::act().

68 { return _all_tasks; }
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:119
std::string Action::getBaseName ( ) const
inherited

Deprecated name methods, use name()

Definition at line 82 of file Action.C.

Referenced by Action::name().

83 {
84  mooseDeprecated("getBaseName() is deprecated.");
86 }
void mooseDeprecated(Args &&...args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:202
std::string _name
The name of the action.
Definition: Action.h:92
std::string baseName(const std::string &name)
Function for string the information before the final / in a parser block.
Definition: MooseUtils.C:331
template<typename T >
const T & Action::getParam ( const std::string &  name) const
inherited

Retrieve a parameter for the object.

Parameters
nameThe name of the parameter
Returns
The value of the parameter

Definition at line 139 of file Action.h.

Referenced by CreateDisplacedProblemAction::act(), AddPeriodicBCAction::act(), AddPeriodicBCAction::autoTranslationBoundaries(), DynamicObjectRegistrationAction::DynamicObjectRegistrationAction(), Action::getAllTasks(), and MooseApp::getCheckpointFiles().

140 {
141  return InputParameters::getParamHelper(name, _pars, static_cast<T *>(0));
142 }
static const T & getParamHelper(const std::string &name, const InputParameters &pars, const T *the_type)
InputParameters _pars
Input parameters for the action.
Definition: Action.h:86
const std::string & name() const
The name of the action.
Definition: Action.h:51
std::string Action::getShortName ( ) const
inherited

DEPRECATED METHODS.

Definition at line 75 of file Action.C.

Referenced by Action::name().

76 {
77  mooseDeprecated("getShortName() is deprecated.");
79 }
void mooseDeprecated(Args &&...args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:202
std::string shortName(const std::string &name)
Function for stripping name after the file / in parser block.
Definition: MooseUtils.C:325
std::string _name
The name of the action.
Definition: Action.h:92
bool CommonOutputAction::hasConsole ( )
private

Check if a Console object that outputs to the screen has been defined.

Returns
True if the a screen outputting Console objects

Definition at line 219 of file CommonOutputAction.C.

Referenced by act().

220 {
221 
222  // Loop through all of the actions for adding output objects
223  for (ActionIterator it = _awh.actionBlocksWithActionBegin("add_output");
224  it != _awh.actionBlocksWithActionEnd("add_output");
225  it++)
226  {
227  MooseObjectAction * moa = static_cast<MooseObjectAction *>(*it);
228  const std::string & type = moa->getMooseObjectType();
229  InputParameters & params = moa->getObjectParams();
230  if (type.compare("Console") == 0 && params.get<bool>("output_screen"))
231  return true;
232  }
233 
234  return false;
235 }
std::list< Action * >::iterator ActionIterator
alias to hide implementation details
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
Definition: Action.h:122
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const std::string & getMooseObjectType() const
Return the object type to be created.
const std::string & type() const
Definition: Action.h:61
InputParameters & getObjectParams()
Retreive the parameters of the object to be created by this action.
ActionIterator actionBlocksWithActionEnd(const std::string &task)
ActionIterator actionBlocksWithActionBegin(const std::string &task)
Iterators to the Actions in the warehouse.
bool Action::isParamValid ( const std::string &  name) const
inlineinherited

Definition at line 80 of file Action.h.

Referenced by CopyNodalVarsAction::act(), SetAdaptivityOptionsAction::act(), CreateProblemAction::act(), SetupMeshAction::act(), CreateDisplacedProblemAction::act(), AddAuxVariableAction::act(), AddVariableAction::act(), AddVariableAction::addVariable(), AddPeriodicBCAction::autoTranslationBoundaries(), DynamicObjectRegistrationAction::DynamicObjectRegistrationAction(), and SetupMeshAction::setupMesh().

80 { return _pars.isParamValid(name); }
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.
InputParameters _pars
Input parameters for the action.
Definition: Action.h:86
const std::string & name() const
The name of the action.
Definition: Action.h:51
const std::string& Action::name ( ) const
inlineinherited
InputParameters& Action::parameters ( )
inlineinherited

Definition at line 63 of file Action.h.

Referenced by GlobalParamsAction::remove(), GlobalParamsAction::setDoubleIndexParam(), GlobalParamsAction::setScalarParam(), and GlobalParamsAction::setVectorParam().

63 { return _pars; }
InputParameters _pars
Input parameters for the action.
Definition: Action.h:86
const InputParameters& Action::parameters ( ) const
inlineinherited

Definition at line 64 of file Action.h.

64 { return _pars; }
InputParameters _pars
Input parameters for the action.
Definition: Action.h:86
const std::string& Action::specificTaskName ( ) const
inlineinherited

Definition at line 66 of file Action.h.

66 { return _specific_task_name; }
std::string _specific_task_name
This member will only be populated if this Action instance is only designed to handle one task...
Definition: Action.h:112
const std::string& Action::type ( ) const
inlineinherited

Definition at line 61 of file Action.h.

Referenced by hasConsole().

61 { return _action_type; }
std::string _action_type
Definition: Action.h:95

Member Data Documentation

ActionFactory& Action::_action_factory
protectedinherited
InputParameters CommonOutputAction::_action_params
private

Parameters from the action being created (AddOutputAction)

Definition at line 58 of file CommonOutputAction.h.

Referenced by create().

std::string Action::_action_type
protectedinherited

Definition at line 95 of file Action.h.

Referenced by Action::type().

std::set<std::string> Action::_all_tasks
protectedinherited

A list of all the tasks that this Action will satisfy.

Note: That this is not populated at construction time. However, all tasks will be added prior to act().

Definition at line 119 of file Action.h.

Referenced by Action::appendTask(), and Action::getAllTasks().

MooseApp& Action::_app
protectedinherited
ActionWarehouse& Action::_awh
protectedinherited
const ConsoleStream ConsoleStreamInterface::_console
inherited

An instance of helper class to write streams to the Console objects.

Definition at line 37 of file ConsoleStreamInterface.h.

Referenced by IterationAdaptiveDT::acceptStep(), CreateProblemAction::act(), SetupRecoverFileBaseAction::act(), Adaptivity::adaptMesh(), FEProblemBase::adaptMesh(), FEProblemBase::advanceMultiApps(), SimplePredictor::apply(), FEProblemBase::backupMultiApps(), FEProblemBase::checkProblemIntegrity(), IterationAdaptiveDT::computeAdaptiveDT(), Transient::computeConstrainedDT(), NonlinearSystemBase::computeDamping(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInterpolationDT(), FEProblemBase::computeResidualType(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), AB2PredictorCorrector::converged(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MultiAppPostprocessorTransfer::execute(), MultiAppPostprocessorInterpolationTransfer::execute(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), MultiAppNearestNodeTransfer::execute(), MultiAppPostprocessorToAuxScalarTransfer::execute(), MultiAppScalarToAuxScalarTransfer::execute(), MultiAppVariableValueSampleTransfer::execute(), MultiAppUserObjectTransfer::execute(), MultiAppInterpolationTransfer::execute(), MultiAppMeshFunctionTransfer::execute(), MultiAppProjectionTransfer::execute(), MultiAppCopyTransfer::execute(), Steady::execute(), MultiAppDTKUserObjectTransfer::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), MultiApp::globalAppToLocal(), InversePowerMethod::init(), NonlinearEigen::init(), Steady::init(), FEProblemBase::initialAdaptMesh(), FEProblemBase::initialSetup(), EigenExecutionerBase::inversePowerIteration(), Transient::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseObject::mooseDeprecated(), MooseObject::mooseInfo(), MooseObject::mooseWarning(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), Console::outputPostprocessors(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), ActionWarehouse::printActionDependencySets(), EigenExecutionerBase::printEigenvalue(), MaterialPropertyDebugOutput::printMaterialMap(), SolutionTimeAdaptiveDT::rejectStep(), DT2::rejectStep(), FEProblemBase::restoreMultiApps(), SimplePredictor::shouldApply(), NonlinearSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), AStableDirk4::solve(), LStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), Transient::solveStep(), DT2::step(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), FEProblemBase::useFECache(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

const std::string& Action::_current_task
protectedinherited

The current action (even though we have seperate instances for each action)

Definition at line 125 of file Action.h.

Referenced by AddKernelAction::act(), CopyNodalVarsAction::act(), AddScalarKernelAction::act(), SetupMeshAction::act(), SetupMeshCompleteAction::act(), MaterialDerivativeTestAction::act(), and AddNodalNormalsAction::act().

std::shared_ptr<MooseMesh>& Action::_displaced_mesh
protectedinherited
std::shared_ptr<Executioner>& Action::_executioner
protectedinherited

Convenience reference to an executioner.

Definition at line 134 of file Action.h.

Referenced by SetupPredictorAction::act(), and SetupTimeStepperAction::act().

Factory& Action::_factory
protectedinherited
std::shared_ptr<MooseMesh>& Action::_mesh
protectedinherited
std::string Action::_name
protectedinherited
InputParameters Action::_pars
protectedinherited
std::shared_ptr<FEProblemBase>& Action::_problem
protectedinherited

Convenience reference to a problem this action works on.

Definition at line 131 of file Action.h.

Referenced by AddBCAction::act(), AddBoundsVectorsAction::act(), AddInitialConditionAction::act(), AddDiracKernelAction::act(), AddICAction::act(), CreateExecutionerAction::act(), AddKernelAction::act(), AddMultiAppAction::act(), AddElementalFieldAction::act(), AddMaterialAction::act(), AddUserObjectAction::act(), AddNodalKernelAction::act(), SetupDampersAction::act(), SetAdaptivityOptionsAction::act(), AddDamperAction::act(), AddIndicatorAction::act(), AddDGKernelAction::act(), AddInterfaceKernelAction::act(), AddMarkerAction::act(), AddTransferAction::act(), AddPostprocessorAction::act(), InitProblemAction::act(), CopyNodalVarsAction::act(), AddScalarKernelAction::act(), AddVectorPostprocessorAction::act(), CheckIntegrityAction::act(), AddConstraintAction::act(), AddFieldSplitAction::act(), CreateProblemAction::act(), AdaptivityAction::act(), CreateDisplacedProblemAction::act(), AddDistributionAction::act(), SetupPreconditionerAction::act(), SetupPredictorAction::act(), AddFunctionAction::act(), SetupTimeIntegratorAction::act(), SetupTimeStepperAction::act(), SetupResidualDebugAction::act(), MaterialDerivativeTestAction::act(), SetupQuadratureAction::act(), AddSamplerAction::act(), AddAuxVariableAction::act(), AddOutputAction::act(), AddPeriodicBCAction::act(), AddControlAction::act(), MaterialOutputAction::act(), SetupPostprocessorDataAction::act(), AddNodalNormalsAction::act(), AddVariableAction::addVariable(), AddPeriodicBCAction::autoTranslationBoundaries(), CheckOutputAction::checkMaterialOutput(), AddVariableAction::getSubdomainIDs(), and AddPeriodicBCAction::setPeriodicVars().

std::string Action::_registered_identifier
protectedinherited

Definition at line 89 of file Action.h.

std::string Action::_specific_task_name
protectedinherited

This member will only be populated if this Action instance is only designed to handle one task.

This happens when an Action is registered with several pieces of syntax in which case separate instances are built to handle the different incoming parameter values.

Definition at line 112 of file Action.h.

Referenced by Action::specificTaskName().


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