https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MaterialOutputAction.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "Action.h"
13#include "MaterialData.h"
14#include "FEProblemBase.h"
15
17class MaterialBase;
18
23{
24public:
26
28
29 virtual void act() override;
30
33 {
34 std::string _aux_kernel_name;
35 std::string _index_symbols;
36 std::vector<std::string> _param_names;
37 };
38
39protected:
43 virtual std::vector<std::string> materialOutput(const std::string & property_name,
44 const MaterialBase & material,
45 bool get_names_only);
46
48 std::vector<std::string> outputHelper(const OutputMetaData & metadata,
49 const std::string & property_name,
50 const std::string & var_name_base,
51 const MaterialBase & material,
52 bool get_names_only);
53
59 template <typename T>
60 bool hasProperty(const std::string & property_name);
61
67 template <typename T>
68 bool hasADProperty(const std::string & property_name);
69
75 template <typename T>
76 bool hasFunctorProperty(const std::string & property_name);
77
87 InputParameters getParams(const std::string & type,
88 const std::string & property_name,
89 const std::string & variable_name,
90 const MaterialBase & material);
91
92private:
95
98
100 std::map<std::string, std::set<SubdomainID>> _block_variable_map;
101
103 std::set<std::string> _material_variable_names;
104
106 std::map<OutputName, std::set<std::string>> _material_variable_names_map;
107
110
113};
114
115template <typename T>
116bool
117MaterialOutputAction::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
126template <typename T>
127bool
128MaterialOutputAction::hasADProperty(const std::string & property_name)
129{
130 if (_block_material_data->haveADProperty<T>(property_name) ||
131 _boundary_material_data->haveADProperty<T>(property_name))
132 return true;
133 else
134 return false;
135}
136
137template <typename T>
138bool
139MaterialOutputAction::hasFunctorProperty(const std::string & property_name)
140{
141 return _problem->hasFunctorWithType<T>(property_name, 0);
142}
Base class for actions.
Definition Action.h:38
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition Action.h:178
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
MaterialBases compute MaterialProperties.
Proxy for accessing MaterialPropertyStorage.
bool haveProperty(const std::string &prop_name) const
Returns true if the regular material property exists - defined by any material.
bool haveADProperty(const std::string &prop_name) const
Returns true if the AD material property exists - defined by any material.
Creates AuxVariables and AuxKernels for automatic output of material properties.
bool hasADProperty(const std::string &property_name)
Helper method for testing if the material exists as a block or boundary material.
virtual std::vector< std::string > materialOutput(const std::string &property_name, const MaterialBase &material, bool get_names_only)
A function to be overriden by derived actions to handle a set of material property types.
bool hasProperty(const std::string &property_name)
Helper method for testing if the material exists as a block or boundary material.
const MaterialData * _block_material_data
Pointer the MaterialData object storing the block restricted materials.
std::set< std::string > _material_variable_names
variables for the current MaterialBase object
std::map< OutputName, std::set< std::string > > _material_variable_names_map
Map of output names and list of variables associated with the output.
const bool _output_only_on_timestep_end
Output only on TIMESTEP_END, not on INITIAL?
InputParameters getParams(const std::string &type, const std::string &property_name, const std::string &variable_name, const MaterialBase &material)
A method for retrieving and partially filling the InputParameters object for an AuxVariable.
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
static InputParameters validParams()
OutputWarehouse & _output_warehouse
Reference to the OutputWarehouse.
std::vector< std::string > outputHelper(const OutputMetaData &metadata, const std::string &property_name, const std::string &var_name_base, const MaterialBase &material, bool get_names_only)
Universal output object setup function.
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.
bool hasFunctorProperty(const std::string &property_name)
Helper method for testing if the functor material property exists.
const MaterialData * _boundary_material_data
Pointer the MaterialData object storing the boundary restricted materials.
const std::string & type() const
Get the type of this class.
Definition MooseBase.h:93
Class for storing and utilizing output objects.
Meta data describing the setup of an output object.
std::vector< std::string > _param_names