www.mooseframework.org
MaterialOutputAction.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef MATERIALOUTPUTACTION_H
16 #define MATERIALOUTPUTACTION_H
17 
18 // MOOSE includes
19 #include "Action.h"
20 #include "MaterialData.h"
21 
22 // Forward declarations
24 class MooseObjectAction;
25 class Material;
26 
27 template <>
29 
34 {
35 public:
41 
42  virtual void act() override;
43 
47  void buildMaterialOutputObjects(FEProblemBase * problem_ptr);
48 
49 private:
55  template <typename T>
56  bool hasProperty(const std::string & property_name);
57 
70  template <typename T>
71  void materialOutputHelper(const std::string & property_name, std::shared_ptr<Material> material);
72 
80  std::shared_ptr<MooseObjectAction> createAction(const std::string & type,
81  const std::string & property_name,
82  const std::string & variable_name,
83  std::shared_ptr<Material> material);
84 
86  std::shared_ptr<MaterialData> _block_material_data;
87 
89  std::shared_ptr<MaterialData> _boundary_material_data;
90 
92  std::map<std::string, std::set<SubdomainID>> _block_variable_map;
93 
95  std::set<std::string> _variable_names;
96 
98  std::set<std::string> _material_variable_names;
99 
101  std::map<OutputName, std::set<std::string>> _material_variable_names_map;
102 
105 };
106 
107 template <typename T>
108 void
109 MaterialOutputAction::materialOutputHelper(const std::string & /*property_name*/,
110  std::shared_ptr<Material> /*material*/)
111 {
112  mooseError("Unknown type, you must create a specialization of materialOutputHelper");
113 }
114 
115 template <typename T>
116 bool
117 MaterialOutputAction::hasProperty(const std::string & property_name)
118 {
119  if (_block_material_data->haveProperty<T>(property_name) ||
120  _boundary_material_data->haveProperty<T>(property_name))
121  return true;
122  else
123  return false;
124 }
125 
126 #endif // MATERIALOUTPUTACTION_H
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.
void materialOutputHelper(const std::string &property_name, std::shared_ptr< Material > material)
Template method for creating the necessary objects for the various material property types...
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
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.
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...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Base class for actions.
Definition: Action.h:39
std::shared_ptr< MaterialData > _boundary_material_data
Pointer the MaterialData object storing the boundary restricted materials.
Creates AuxVariables and AuxKernels for automatic output of material properties.
std::shared_ptr< MaterialData > _block_material_data
Pointer the MaterialData object storing the block restricted materials.
const std::string & type() const
Definition: Action.h:61
bool hasProperty(const std::string &property_name)
Helper method for testing if the material exists as a block or boundary material. ...
Class for storing and utilizing output objects.
Materials compute MaterialProperties.
Definition: Material.h:53
std::shared_ptr< MooseObjectAction > createAction(const std::string &type, const std::string &property_name, const std::string &variable_name, std::shared_ptr< Material > material)
A method for creating an AuxVariable and associated action.
InputParameters validParams< MaterialOutputAction >()
MaterialOutputAction(InputParameters params)
Class constructor.
void buildMaterialOutputObjects(FEProblemBase *problem_ptr)
Builds the objects necessary for material property output.
virtual void act() override
std::set< std::string > _variable_names
Set of variable names for boundary.