11 #include "FEProblem.h"
12 #include "Conversion.h"
13 #include "MooseMesh.h"
21 InputParameters params = validParams<AddAuxVariableAction>();
22 params.addClassDescription(
"Set up auxvariables for components of "
23 "MaterialProperty<std::vector<data_type> > for polycrystal sample.");
24 params.addRequiredParam<
unsigned int>(
25 "grain_num",
"Specifies the number of grains to create the aux variables for.");
26 params.addRequiredParam<std::vector<std::string>>(
27 "variable_base",
"Vector that specifies the base name of the variables.");
28 MultiMooseEnum data_type(
"Real RealGradient",
"Real");
29 params.addRequiredParam<MultiMooseEnum>(
32 "Specifying data type of the materials property, variables are created accordingly");
37 : AddAuxVariableAction(params),
38 _grain_num(getParam<unsigned int>(
"grain_num")),
39 _var_name_base(getParam<std::vector<std::string>>(
"variable_base")),
40 _num_var(_var_name_base.size()),
41 _data_type(getParam<MultiMooseEnum>(
"data_type")),
42 _data_size(_data_type.size())
52 mooseError(
"Data type not provided for all the AuxVariables in MultiAuxVariablesAction");
55 const unsigned int dim = _mesh->dimension();
56 const std::vector<char> suffix = {
'x',
'y',
'z'};
59 for (
unsigned int val = 0; val <
_num_var; ++val)
60 for (
unsigned int gr = 0; gr <
_grain_num; ++gr)
69 _problem->addAuxVariable(_type, var_name, _moose_object_pars);
73 for (
unsigned int x = 0; x < dim; ++x)
79 std::string var_name =
_var_name_base[val] + Moose::stringify(gr) +
"_" + suffix[x];
81 _problem->addAuxVariable(_type, var_name, _moose_object_pars);