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

Creates AuxVariables and AuxKernels for automatic output of material properties. More...

#include <MaterialOutputAction.h>

Inheritance diagram for MaterialOutputAction:
[legend]

Public Member Functions

 MaterialOutputAction (InputParameters params)
 Class constructor. More...
 
virtual void act () override
 Method to add objects to the simulation or perform other setup tasks. More...
 
void timedAct ()
 The method called externally that causes the action to act() More...
 
virtual void addRelationshipManagers (Moose::RelationshipManagerType when_type)
 Method to add a relationship manager for the objects being added to the system. More...
 
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
 
template<typename 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. More...
 
bool isParamValid (const std::string &name) const
 
void appendTask (const std::string &task)
 
template<typename... Args>
void paramError (const std::string &param, Args... args)
 Emits an error prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message. More...
 
template<typename... Args>
void paramWarning (const std::string &param, Args... args)
 Emits a warning prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message. More...
 
template<typename... Args>
void paramInfo (const std::string &param, Args... args)
 Emits an informational message prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message. More...
 
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 Member Functions

PerfID registerTimedSection (const std::string &section_name, const unsigned int level)
 Call to register a named section for timing. 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...
 
PerfID _act_timer
 Timers. More...
 
const InputParameters_pg_params
 Params. More...
 
PerfGraph_perf_graph
 The performance graph to add to. More...
 
std::string _prefix
 A prefix to use for all sections. More...
 

Private Member Functions

template<typename T >
bool hasProperty (const std::string &property_name)
 Helper method for testing if the material exists as a block or boundary material. More...
 
template<typename T >
std::vector< std::string > materialOutputHelper (const std::string &property_name, const Material &material, bool get_names_only)
 Template method for creating the necessary objects for the various material property types. More...
 
InputParameters getParams (const std::string &type, const std::string &property_name, const std::string &variable_name, const Material &material)
 A method for retrieving and partially filling the InputParameters object for an AuxVariable. More...
 
template<>
std::vector< std::string > materialOutputHelper (const std::string &material_name, const Material &material, bool get_names_only)
 
template<>
std::vector< std::string > materialOutputHelper (const std::string &material_name, const Material &material, bool get_names_only)
 
template<>
std::vector< std::string > materialOutputHelper (const std::string &material_name, const Material &material, bool get_names_only)
 
template<>
std::vector< std::string > materialOutputHelper (const std::string &material_name, const Material &material, bool get_names_only)
 
template<>
std::vector< std::string > materialOutputHelper (const std::string &material_name, const Material &material, bool get_names_only)
 
template<>
std::vector< std::string > materialOutputHelper (const std::string &property_name, const Material &material, bool get_names_only)
 
template<>
std::vector< std::string > materialOutputHelper (const std::string &property_name, const Material &material, bool get_names_only)
 
template<>
std::vector< std::string > materialOutputHelper (const std::string &property_name, const Material &material, bool get_names_only)
 
template<>
std::vector< std::string > materialOutputHelper (const std::string &property_name, const Material &material, bool get_names_only)
 
template<>
std::vector< std::string > materialOutputHelper (const std::string &property_name, const Material &material, bool get_names_only)
 

Private Attributes

std::shared_ptr< MaterialData_block_material_data
 Pointer the MaterialData object storing the block restricted materials. More...
 
std::shared_ptr< MaterialData_boundary_material_data
 Pointer the MaterialData object storing the boundary restricted materials. More...
 
std::map< std::string, std::set< SubdomainID > > _block_variable_map
 Map of variable name that contains the blocks to which the variable should be restricted. More...
 
std::set< std::string > _material_variable_names
 List of variables for the current Material object. More...
 
std::map< OutputName, std::set< std::string > > _material_variable_names_map
 Map of output names and list of variables associated with the output. More...
 
OutputWarehouse_output_warehouse
 Reference to the OutputWarehouse. More...
 

Detailed Description

Creates AuxVariables and AuxKernels for automatic output of material properties.

Definition at line 28 of file MaterialOutputAction.h.

Constructor & Destructor Documentation

◆ MaterialOutputAction()

MaterialOutputAction::MaterialOutputAction ( InputParameters  params)

Class constructor.

Parameters
paramsInput parameters for this action object

Definition at line 54 of file MaterialOutputAction.C.

56 {
57 }
OutputWarehouse & _output_warehouse
Reference to the OutputWarehouse.
Action(InputParameters parameters)
Definition: Action.C:47
MooseApp & _app
The MOOSE application this is associated with.
Definition: Action.h:170
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
Definition: MooseApp.C:1056

Member Function Documentation

◆ act()

void MaterialOutputAction::act ( )
overridevirtual

Method to add objects to the simulation or perform other setup tasks.

Implements Action.

Definition at line 60 of file MaterialOutputAction.C.

61 {
62  mooseAssert(_problem,
63  "FEProblemBase pointer is nullptr, it is needed for auto material property output");
64 
65  // Do nothing if the application does not have output
66  if (!_app.actionWarehouse().hasActions("add_output"))
67  return;
68 
69  bool get_names_only = _current_task == "add_output_aux_variables" ? true : false;
70 
71  // Set the pointers to the MaterialData objects (Note, these pointers are not available at
72  // construction)
75 
76  // A complete list of all Material objects
77  const auto & material_ptrs = _problem->getMaterialWarehouse().getObjects();
78 
79  // Handle setting of material property output in [Outputs] sub-blocks
80  // Output objects can enable material property output, the following code examines the parameters
81  // for each Output object and sets a flag if any Output object has output set and also builds a
82  // list if the
83  // properties are limited via the 'show_material_properties' parameters
84  bool outputs_has_properties = false;
85  std::set<std::string> output_object_properties;
86 
87  const auto & output_actions = _app.actionWarehouse().getActionListByName("add_output");
88  for (const auto & act : output_actions)
89  {
90  // Extract the Output action
91  AddOutputAction * action = dynamic_cast<AddOutputAction *>(act);
92  if (!action)
93  continue;
94 
95  // Add the material property names from the output object parameters to the list of properties
96  // to output
97  InputParameters & params = action->getObjectParams();
98  if (params.isParamValid("output_material_properties") &&
99  params.get<bool>("output_material_properties"))
100  {
101  outputs_has_properties = true;
102  std::vector<std::string> prop_names =
103  params.get<std::vector<std::string>>("show_material_properties");
104  output_object_properties.insert(prop_names.begin(), prop_names.end());
105  }
106  }
107 
108  // Loop through each material object
109  std::set<std::string> material_names;
110  for (const auto & mat : material_ptrs)
111  {
112  // Extract the names of the output objects to which the material properties will be exported
113  std::set<OutputName> outputs = mat->getOutputs();
114 
115  // Extract the property names that will actually be output
116  std::vector<std::string> output_properties =
117  mat->getParam<std::vector<std::string>>("output_properties");
118 
119  // Append the properties listed in the Outputs block
120  if (outputs_has_properties)
121  output_properties.insert(output_properties.end(),
122  output_object_properties.begin(),
123  output_object_properties.end());
124 
125  // Clear the list of variable names for the current material object, this list will be populated
126  // with all the
127  // variables names for the current material object and is needed for purposes of controlling the
128  // which output objects
129  // show the material property data
130  _material_variable_names.clear();
131 
132  // Create necessary outputs for the properties if:
133  // (1) The Outputs block has material output enabled
134  // (2) If the Material object itself has set the 'outputs' parameter
135  if (outputs_has_properties || outputs.find("none") == outputs.end())
136  {
137  // Add the material property for output if the name is contained in the 'output_properties'
138  // list
139  // or if the list is empty (all properties)
140  const std::set<std::string> names = mat->getSuppliedItems();
141  std::vector<std::string> curr_material_names;
142  for (const auto & name : names)
143  {
144  // Add the material property for output
145  if (output_properties.empty() ||
146  std::find(output_properties.begin(), output_properties.end(), name) !=
147  output_properties.end())
148  {
149  if (hasProperty<Real>(name))
150  {
151  curr_material_names = materialOutputHelper<Real>(name, *mat, get_names_only);
152  material_names.insert(curr_material_names.begin(), curr_material_names.end());
153  }
154 
155  else if (hasProperty<RealVectorValue>(name))
156  {
157  curr_material_names = materialOutputHelper<RealVectorValue>(name, *mat, get_names_only);
158  material_names.insert(curr_material_names.begin(), curr_material_names.end());
159  }
160 
161  else if (hasProperty<RealTensorValue>(name))
162  {
163  curr_material_names = materialOutputHelper<RealTensorValue>(name, *mat, get_names_only);
164  material_names.insert(curr_material_names.begin(), curr_material_names.end());
165  }
166 
167  else if (hasProperty<RankTwoTensor>(name))
168  {
169  curr_material_names = materialOutputHelper<RankTwoTensor>(name, *mat, get_names_only);
170  material_names.insert(curr_material_names.begin(), curr_material_names.end());
171  }
172 
173  else if (hasProperty<RankFourTensor>(name))
174  {
175  curr_material_names = materialOutputHelper<RankFourTensor>(name, *mat, get_names_only);
176  material_names.insert(curr_material_names.begin(), curr_material_names.end());
177  }
178 
179  else
180  mooseWarning("The type for material property '",
181  name,
182  "' is not supported for automatic output.");
183  }
184 
185  // If the material object as limited outputs, store the variables associated with the output
186  // objects
187  if (!outputs.empty())
188  for (const auto & output_name : outputs)
189  _material_variable_names_map[output_name].insert(_material_variable_names.begin(),
191  }
192  }
193  }
194 
195  if (_current_task == "add_output_aux_variables")
196  {
197 
198  // Create the AuxVariables
199  FEType fe_type(
200  CONSTANT,
201  MONOMIAL); // currently only elemental variables are support for material property output
202  for (const auto & var_name : material_names)
203  _problem->addAuxVariable(var_name, fe_type);
204  }
205  else
206  {
207  // When a Material object has 'output_properties' defined all other properties not listed must
208  // be added to the hide list for the output objects so that properties that are not desired do
209  // not appear.
210  for (const auto & it : _material_variable_names_map)
211  {
212  std::set<std::string> hide;
213  std::set_difference(material_names.begin(),
214  material_names.end(),
215  it.second.begin(),
216  it.second.end(),
217  std::inserter(hide, hide.begin()));
218 
220  }
221  }
222 }
std::map< OutputName, std::set< std::string > > _material_variable_names_map
Map of output names and list of variables associated with the output.
OutputWarehouse & _output_warehouse
Reference to the OutputWarehouse.
const std::string & name() const
The name of the action.
Definition: Action.h:62
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:220
std::set< std::string > _material_variable_names
List of variables for the current Material object.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const std::list< Action * > & getActionListByName(const std::string &task) const
Retrieve a constant list of Action pointers associated with the passed in task.
std::shared_ptr< MaterialData > _boundary_material_data
Pointer the MaterialData object storing the boundary restricted materials.
std::shared_ptr< MaterialData > _block_material_data
Pointer the MaterialData object storing the block restricted materials.
Action for creating output objects.
InputParameters & getObjectParams()
Retreive the parameters of the object to be created by this action.
const std::string & _current_task
The current action (even though we have seperate instances for each action)
Definition: Action.h:197
ActionWarehouse & actionWarehouse()
Definition: MooseApp.h:139
bool hasActions(const std::string &task) const
Check if Actions associated with passed in task exist.
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:203
void addInterfaceHideVariables(const std::string &output_name, const std::set< std::string > &variable_names)
Insert variable names for hiding via the OutoutInterface.
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
MooseApp & _app
The MOOSE application this is associated with.
Definition: Action.h:170
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.

◆ addRelationshipManagers()

void Action::addRelationshipManagers ( Moose::RelationshipManagerType  when_type)
virtualinherited

Method to add a relationship manager for the objects being added to the system.

Relationship managers have to be added relatively early. In many cases before the Action::act() method is called.

Parameters
when_typeThe parameter indicating the normal time for adding either Geometric or Algebraic RelationshipManagers. It may not always be possible to add your RelationshipManager as early as you'd like. In these cases, your DistributedMesh may consume more memory during the problem setup.

Reimplemented in MooseADObjectAction, and MooseObjectAction.

Definition at line 89 of file Action.C.

89 {}

◆ appendTask()

void Action::appendTask ( const std::string &  task)
inlineinherited

Definition at line 103 of file Action.h.

103 { _all_tasks.insert(task); }
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:191

◆ getAllTasks()

const std::set<std::string>& Action::getAllTasks ( ) const
inlineinherited

Definition at line 79 of file Action.h.

Referenced by AddKernelAction::act().

79 { return _all_tasks; }
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:191

◆ getBaseName()

std::string Action::getBaseName ( ) const
inherited

Deprecated name methods, use name()

Definition at line 100 of file Action.C.

101 {
102  mooseDeprecated("getBaseName() is deprecated.");
103  return MooseUtils::baseName(_name);
104 }
std::string _name
The name of the action.
Definition: Action.h:164
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:237
std::string baseName(const std::string &name)
Function for string the information before the final / in a parser block.
Definition: MooseUtils.C:366

◆ getCheckedPointerParam()

template<typename T >
T Action::getCheckedPointerParam ( const std::string &  name,
const std::string &  error_string = "" 
) const
inlineinherited

Verifies that the requested parameter exists and is not NULL and returns it to the caller.

The template parameter must be a pointer or an error will be thrown.

Definition at line 96 of file Action.h.

97  {
98  return parameters().getCheckedPointerParam<T>(name, error_string);
99  }
const std::string & name() const
The name of the action.
Definition: Action.h:62
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...
InputParameters & parameters()
Definition: Action.h:74

◆ getParam()

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 211 of file Action.h.

Referenced by CreateDisplacedProblemAction::act(), AddPeriodicBCAction::act(), AddPeriodicBCAction::autoTranslationBoundaries(), DynamicObjectRegistrationAction::DynamicObjectRegistrationAction(), and MooseApp::getCheckpointDirectories().

212 {
213  return InputParameters::getParamHelper(name, _pars, static_cast<T *>(0));
214 }
static const T & getParamHelper(const std::string &name, const InputParameters &pars, const T *the_type)
const std::string & name() const
The name of the action.
Definition: Action.h:62
InputParameters _pars
Input parameters for the action.
Definition: Action.h:158

◆ getParams()

InputParameters MaterialOutputAction::getParams ( const std::string &  type,
const std::string &  property_name,
const std::string &  variable_name,
const Material material 
)
private

A method for retrieving and partially filling the InputParameters object for an AuxVariable.

Parameters
typeThe type of AuxVariable
property_nameThe property name to associated with that action
variable_nameThe AuxVariable name to create
materialA Material object containing the property of interest
Returns
An InputParameter object with common properties added.

Definition at line 225 of file MaterialOutputAction.C.

229 {
230  // Append the list of output variables for the current material
231  _material_variable_names.insert(variable_name);
232 
233  // Set the action parameters
235 
236  params.set<MaterialPropertyName>("property") = property_name;
237  params.set<AuxVariableName>("variable") = variable_name;
238  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
239 
240  if (material.boundaryRestricted())
241  params.set<std::vector<BoundaryName>>("boundary") = material.boundaryNames();
242  else
243  params.set<std::vector<SubdomainName>>("block") = material.blocks();
244 
245  return params;
246 }
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:25
virtual bool boundaryRestricted() const
Returns true if this object has been restricted to a boundary.
InputParameters getValidParams(const std::string &name)
Get valid parameters for the object.
Definition: Factory.C:67
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
std::set< std::string > _material_variable_names
List of variables for the current Material object.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Factory & _factory
The Factory associated with the MooseApp.
Definition: Action.h:173
const ExecFlagType EXEC_TIMESTEP_END
const std::vector< SubdomainName > & blocks() const
Return the block names for this object.
const std::string & type() const
Definition: Action.h:72
const std::vector< BoundaryName > & boundaryNames() const
Return the boundary names for this object.

◆ getShortName()

std::string Action::getShortName ( ) const
inherited

DEPRECATED METHODS.

Definition at line 93 of file Action.C.

94 {
95  mooseDeprecated("getShortName() is deprecated.");
97 }
std::string shortName(const std::string &name)
Function for stripping name after the file / in parser block.
Definition: MooseUtils.C:360
std::string _name
The name of the action.
Definition: Action.h:164
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:237

◆ hasProperty()

template<typename T >
bool MaterialOutputAction::hasProperty ( const std::string &  property_name)
private

Helper method for testing if the material exists as a block or boundary material.

Template Parameters
TThe property type (e.g., REAL)
Parameters
property_nameThe name of the property to test

Definition at line 109 of file MaterialOutputAction.h.

110 {
111  if (_block_material_data->haveProperty<T>(property_name) ||
112  _boundary_material_data->haveProperty<T>(property_name))
113  return true;
114  else
115  return false;
116 }
std::shared_ptr< MaterialData > _boundary_material_data
Pointer the MaterialData object storing the boundary restricted materials.
std::shared_ptr< MaterialData > _block_material_data
Pointer the MaterialData object storing the block restricted materials.

◆ isParamValid()

bool Action::isParamValid ( const std::string &  name) const
inlineinherited

Definition at line 101 of file Action.h.

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

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

◆ materialOutputHelper() [1/11]

template<typename T >
std::vector< std::string > MaterialOutputAction::materialOutputHelper ( const std::string &  property_name,
const Material material,
bool  get_names_only 
)
private

Template method for creating the necessary objects for the various material property types.

Template Parameters
TThe type of material property that automatic output is being performed
Parameters
property_nameThe name of the material property to output
materialA pointer to the Material object containing the property of interest
get_names_onlyA bool used to indicate that only the variable names should be returned
Returns
A vector of names that can be used as AuxVariable names

By default this function produces an mooseError, you must create a specialization for any type that you wish to have the automatic output capability. Also, you need to add a test for this type within the act() method.

Definition at line 100 of file MaterialOutputAction.h.

103 {
104  mooseError("Unknown type, you must create a specialization of materialOutputHelper");
105 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208

◆ materialOutputHelper() [2/11]

template<>
std::vector<std::string> MaterialOutputAction::materialOutputHelper ( const std::string &  material_name,
const Material material,
bool  get_names_only 
)
private

◆ materialOutputHelper() [3/11]

template<>
std::vector<std::string> MaterialOutputAction::materialOutputHelper ( const std::string &  material_name,
const Material material,
bool  get_names_only 
)
private

◆ materialOutputHelper() [4/11]

template<>
std::vector<std::string> MaterialOutputAction::materialOutputHelper ( const std::string &  material_name,
const Material material,
bool  get_names_only 
)
private

◆ materialOutputHelper() [5/11]

template<>
std::vector<std::string> MaterialOutputAction::materialOutputHelper ( const std::string &  material_name,
const Material material,
bool  get_names_only 
)
private

◆ materialOutputHelper() [6/11]

template<>
std::vector<std::string> MaterialOutputAction::materialOutputHelper ( const std::string &  material_name,
const Material material,
bool  get_names_only 
)
private

◆ materialOutputHelper() [7/11]

template<>
std::vector<std::string> MaterialOutputAction::materialOutputHelper ( const std::string &  property_name,
const Material material,
bool  get_names_only 
)
private

Definition at line 291 of file MaterialOutputAction.C.

294 {
295  std::vector<std::string> names(LIBMESH_DIM * LIBMESH_DIM);
296 
297  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
298  for (unsigned int j = 0; j < LIBMESH_DIM; ++j)
299  {
300  std::ostringstream oss;
301  oss << property_name << "_" << i << j;
302  names[i * LIBMESH_DIM + j] = oss.str();
303 
304  if (!get_names_only)
305  {
306  auto params = getParams("MaterialRealTensorValueAux", property_name, oss.str(), material);
307  params.set<unsigned int>("row") = i;
308  params.set<unsigned int>("column") = j;
309  _problem->addAuxKernel("MaterialRealTensorValueAux", material.name() + oss.str(), params);
310  }
311  }
312 
313  return names;
314 }
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
InputParameters getParams(const std::string &type, const std::string &property_name, const std::string &variable_name, const Material &material)
A method for retrieving and partially filling the InputParameters object for an AuxVariable.
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:51
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:203

◆ materialOutputHelper() [8/11]

template<>
std::vector<std::string> MaterialOutputAction::materialOutputHelper ( const std::string &  property_name,
const Material material,
bool  get_names_only 
)
private

Definition at line 250 of file MaterialOutputAction.C.

253 {
254  std::vector<std::string> names = {property_name};
255  if (!get_names_only)
256  {
257  auto params = getParams("MaterialRealAux", property_name, property_name, material);
258  _problem->addAuxKernel("MaterialRealAux", material.name() + property_name, params);
259  }
260 
261  return names;
262 }
InputParameters getParams(const std::string &type, const std::string &property_name, const std::string &variable_name, const Material &material)
A method for retrieving and partially filling the InputParameters object for an AuxVariable.
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:51
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:203

◆ materialOutputHelper() [9/11]

template<>
std::vector<std::string> MaterialOutputAction::materialOutputHelper ( const std::string &  property_name,
const Material material,
bool  get_names_only 
)
private

Definition at line 266 of file MaterialOutputAction.C.

269 {
270  std::array<char, 3> suffix = {{'x', 'y', 'z'}};
271  std::vector<std::string> names(3);
272  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
273  {
274  std::ostringstream oss;
275  oss << property_name << "_" << suffix[i];
276  names[i] = oss.str();
277 
278  if (!get_names_only)
279  {
280  auto params = getParams("MaterialRealVectorValueAux", property_name, oss.str(), material);
281  params.set<unsigned int>("component") = i;
282  _problem->addAuxKernel("MaterialRealVectorValueAux", material.name() + oss.str(), params);
283  }
284  }
285 
286  return names;
287 }
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
InputParameters getParams(const std::string &type, const std::string &property_name, const std::string &variable_name, const Material &material)
A method for retrieving and partially filling the InputParameters object for an AuxVariable.
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:51
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:203

◆ materialOutputHelper() [10/11]

template<>
std::vector<std::string> MaterialOutputAction::materialOutputHelper ( const std::string &  property_name,
const Material material,
bool  get_names_only 
)
private

Definition at line 318 of file MaterialOutputAction.C.

321 {
322  std::vector<std::string> names(LIBMESH_DIM * LIBMESH_DIM);
323 
324  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
325  for (unsigned int j = 0; j < LIBMESH_DIM; ++j)
326  {
327  std::ostringstream oss;
328  oss << property_name << "_" << i << j;
329  names[i * LIBMESH_DIM + j] = oss.str();
330 
331  if (!get_names_only)
332  {
333  auto params = getParams("MaterialRankTwoTensorAux", property_name, oss.str(), material);
334  params.set<unsigned int>("i") = i;
335  params.set<unsigned int>("j") = j;
336  _problem->addAuxKernel("MaterialRankTwoTensorAux", material.name() + oss.str(), params);
337  }
338  }
339 
340  return names;
341 }
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
InputParameters getParams(const std::string &type, const std::string &property_name, const std::string &variable_name, const Material &material)
A method for retrieving and partially filling the InputParameters object for an AuxVariable.
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:51
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:203

◆ materialOutputHelper() [11/11]

template<>
std::vector<std::string> MaterialOutputAction::materialOutputHelper ( const std::string &  property_name,
const Material material,
bool  get_names_only 
)
private

Definition at line 345 of file MaterialOutputAction.C.

348 {
349  std::vector<std::string> names(Utility::pow<4>(LIBMESH_DIM));
350 
351  unsigned int counter = 0;
352  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
353  for (unsigned int j = 0; j < LIBMESH_DIM; ++j)
354  for (unsigned int k = 0; k < LIBMESH_DIM; ++k)
355  for (unsigned int l = 0; l < LIBMESH_DIM; ++l)
356  {
357  std::ostringstream oss;
358  oss << property_name << "_" << i << j << k << l;
359  names[counter++] = oss.str();
360 
361  if (!get_names_only)
362  {
363  auto params =
364  getParams("MaterialRankFourTensorAux", property_name, oss.str(), material);
365  params.set<unsigned int>("i") = i;
366  params.set<unsigned int>("j") = j;
367  params.set<unsigned int>("k") = k;
368  params.set<unsigned int>("l") = l;
369  _problem->addAuxKernel(
370  "MaterialRankFourTensorAux", material.name() + oss.str(), params);
371  }
372  }
373 
374  return names;
375 }
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
InputParameters getParams(const std::string &type, const std::string &property_name, const std::string &variable_name, const Material &material)
A method for retrieving and partially filling the InputParameters object for an AuxVariable.
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:51
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:203

◆ name()

const std::string& Action::name ( ) const
inlineinherited

◆ paramError()

template<typename... Args>
void Action::paramError ( const std::string &  param,
Args...  args 
)
inlineinherited

Emits an error prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message.

If this object's parameters were not created directly by the Parser, then this function falls back to the normal behavior of mooseError - only printing a message using the given args.

Definition at line 112 of file Action.h.

113  {
114  auto prefix = param + ": ";
115  if (!_pars.inputLocation(param).empty())
116  prefix = _pars.inputLocation(param) + ": (" + _pars.paramFullpath(param) + "):\n";
117  mooseError(prefix, args...);
118  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
InputParameters _pars
Input parameters for the action.
Definition: Action.h:158
const std::string & inputLocation(const std::string &param) const
Get/set a string representing the location in the input text the parameter originated from (i...
const std::string & paramFullpath(const std::string &param) const
Get/set a string representing the full HIT parameter path from the input file (e.g.

◆ parameters() [1/2]

InputParameters& Action::parameters ( )
inlineinherited

Definition at line 74 of file Action.h.

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

74 { return _pars; }
InputParameters _pars
Input parameters for the action.
Definition: Action.h:158

◆ parameters() [2/2]

const InputParameters& Action::parameters ( ) const
inlineinherited

Definition at line 75 of file Action.h.

75 { return _pars; }
InputParameters _pars
Input parameters for the action.
Definition: Action.h:158

◆ paramInfo()

template<typename... Args>
void Action::paramInfo ( const std::string &  param,
Args...  args 
)
inlineinherited

Emits an informational message prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message.

If this object's parameters were not created directly by the Parser, then this function falls back to the normal behavior of mooseInfo - only printing a message using the given args.

Definition at line 143 of file Action.h.

144  {
145  auto prefix = param + ": ";
146  if (!_pars.inputLocation(param).empty())
147  prefix = _pars.inputLocation(param) + ": (" + _pars.paramFullpath(param) + "):\n";
148  mooseInfo(prefix, args...);
149  }
void mooseInfo(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
Definition: MooseError.h:253
InputParameters _pars
Input parameters for the action.
Definition: Action.h:158
const std::string & inputLocation(const std::string &param) const
Get/set a string representing the location in the input text the parameter originated from (i...
const std::string & paramFullpath(const std::string &param) const
Get/set a string representing the full HIT parameter path from the input file (e.g.

◆ paramWarning()

template<typename... Args>
void Action::paramWarning ( const std::string &  param,
Args...  args 
)
inlineinherited

Emits a warning prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message.

If this object's parameters were not created directly by the Parser, then this function falls back to the normal behavior of mooseWarning - only printing a message using the given args.

Definition at line 127 of file Action.h.

128  {
129  auto prefix = param + ": ";
130  if (!_pars.inputLocation(param).empty())
131  prefix = _pars.inputLocation(param) + ": (" + _pars.paramFullpath(param) + "):\n";
132  mooseWarning(prefix, args...);
133  }
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:220
InputParameters _pars
Input parameters for the action.
Definition: Action.h:158
const std::string & inputLocation(const std::string &param) const
Get/set a string representing the location in the input text the parameter originated from (i...
const std::string & paramFullpath(const std::string &param) const
Get/set a string representing the full HIT parameter path from the input file (e.g.

◆ registerTimedSection()

PerfID PerfGraphInterface::registerTimedSection ( const std::string &  section_name,
const unsigned int  level 
)
protectedinherited

Call to register a named section for timing.

Parameters
section_nameThe name of the code section to be timed
levelThe importance of the timer - lower is more important (0 will always come out)
Returns
The ID of the section - use when starting timing

Definition at line 50 of file PerfGraphInterface.C.

51 {
52  if (_prefix != "")
53  return _perf_graph.registerSection(_prefix + "::" + section_name, level);
54  else
55  return _perf_graph.registerSection(section_name, level);
56 }
PerfGraph & _perf_graph
The performance graph to add to.
std::string _prefix
A prefix to use for all sections.
PerfID registerSection(const std::string &section_name, unsigned int level)
Registers a named section of code.
Definition: PerfGraph.C:41

◆ specificTaskName()

const std::string& Action::specificTaskName ( ) const
inlineinherited

Definition at line 77 of file Action.h.

77 { 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:184

◆ timedAct()

void Action::timedAct ( )
inherited

The method called externally that causes the action to act()

Definition at line 83 of file Action.C.

84 {
85  TIME_SECTION(_act_timer);
86  act();
87 }
PerfID _act_timer
Timers.
Definition: Action.h:206
virtual void act()=0
Method to add objects to the simulation or perform other setup tasks.

◆ type()

const std::string& Action::type ( ) const
inlineinherited

Definition at line 72 of file Action.h.

Referenced by CreateProblemDefaultAction::act(), SetupDebugAction::act(), getParams(), and CommonOutputAction::hasConsole().

72 { return _action_type; }
std::string _action_type
Definition: Action.h:167

Member Data Documentation

◆ _act_timer

PerfID Action::_act_timer
protectedinherited

Timers.

Definition at line 206 of file Action.h.

Referenced by Action::timedAct().

◆ _action_factory

ActionFactory& Action::_action_factory
protectedinherited

◆ _action_type

std::string Action::_action_type
protectedinherited

Definition at line 167 of file Action.h.

Referenced by Action::type().

◆ _all_tasks

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 191 of file Action.h.

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

◆ _app

MooseApp& Action::_app
protectedinherited

◆ _awh

ActionWarehouse& Action::_awh
protectedinherited

◆ _block_material_data

std::shared_ptr<MaterialData> MaterialOutputAction::_block_material_data
private

Pointer the MaterialData object storing the block restricted materials.

Definition at line 80 of file MaterialOutputAction.h.

Referenced by act(), and hasProperty().

◆ _block_variable_map

std::map<std::string, std::set<SubdomainID> > MaterialOutputAction::_block_variable_map
private

Map of variable name that contains the blocks to which the variable should be restricted.

Definition at line 86 of file MaterialOutputAction.h.

◆ _boundary_material_data

std::shared_ptr<MaterialData> MaterialOutputAction::_boundary_material_data
private

Pointer the MaterialData object storing the boundary restricted materials.

Definition at line 83 of file MaterialOutputAction.h.

Referenced by act(), and hasProperty().

◆ _console

const ConsoleStream ConsoleStreamInterface::_console
inherited

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

Definition at line 32 of file ConsoleStreamInterface.h.

Referenced by IterationAdaptiveDT::acceptStep(), SetupRecoverFileBaseAction::act(), Adaptivity::adaptMesh(), FEProblemBase::adaptMesh(), SimplePredictor::apply(), FEProblemBase::backupMultiApps(), FEProblemBase::checkProblemIntegrity(), IterationAdaptiveDT::computeAdaptiveDT(), Transient::computeConstrainedDT(), NonlinearSystemBase::computeDamping(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInterpolationDT(), FEProblemBase::computeResidualTags(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), AB2PredictorCorrector::converged(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MultiAppPostprocessorTransfer::execute(), MultiAppPostprocessorInterpolationTransfer::execute(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), MultiAppNearestNodeTransfer::execute(), MultiAppPostprocessorToAuxScalarTransfer::execute(), MultiAppScalarToAuxScalarTransfer::execute(), MultiAppVariableValueSampleTransfer::execute(), MultiAppInterpolationTransfer::execute(), MultiAppMeshFunctionTransfer::execute(), MultiAppUserObjectTransfer::execute(), MultiAppProjectionTransfer::execute(), MultiAppVectorPostprocessorTransfer::execute(), MultiAppCopyTransfer::execute(), Steady::execute(), MultiAppDTKUserObjectTransfer::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), FEProblemBase::FEProblemBase(), ElementQualityChecker::finalize(), FEProblemBase::finishMultiAppStep(), 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(), PerfGraphOutput::output(), 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(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

◆ _current_task

const std::string& Action::_current_task
protectedinherited

◆ _displaced_mesh

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

◆ _factory

Factory& Action::_factory
protectedinherited

◆ _material_variable_names

std::set<std::string> MaterialOutputAction::_material_variable_names
private

List of variables for the current Material object.

Definition at line 89 of file MaterialOutputAction.h.

Referenced by act(), and getParams().

◆ _material_variable_names_map

std::map<OutputName, std::set<std::string> > MaterialOutputAction::_material_variable_names_map
private

Map of output names and list of variables associated with the output.

Definition at line 92 of file MaterialOutputAction.h.

Referenced by act().

◆ _mesh

std::shared_ptr<MooseMesh>& Action::_mesh
protectedinherited

◆ _name

std::string Action::_name
protectedinherited

◆ _output_warehouse

OutputWarehouse& MaterialOutputAction::_output_warehouse
private

Reference to the OutputWarehouse.

Definition at line 95 of file MaterialOutputAction.h.

Referenced by act().

◆ _pars

InputParameters Action::_pars
protectedinherited

◆ _perf_graph

PerfGraph& PerfGraphInterface::_perf_graph
protectedinherited

The performance graph to add to.

Definition at line 66 of file PerfGraphInterface.h.

Referenced by PerfGraphData::getValue(), and PerfGraphInterface::registerTimedSection().

◆ _pg_params

const InputParameters* PerfGraphInterface::_pg_params
protectedinherited

Params.

Definition at line 63 of file PerfGraphInterface.h.

◆ _prefix

std::string PerfGraphInterface::_prefix
protectedinherited

A prefix to use for all sections.

Definition at line 69 of file PerfGraphInterface.h.

Referenced by PerfGraphInterface::registerTimedSection().

◆ _problem

std::shared_ptr<FEProblemBase>& Action::_problem
protectedinherited

Convenience reference to a problem this action works on.

Definition at line 203 of file Action.h.

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

◆ _registered_identifier

std::string Action::_registered_identifier
protectedinherited

Definition at line 161 of file Action.h.

◆ _specific_task_name

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 184 of file Action.h.

Referenced by Action::specificTaskName().


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