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

Automatically generates all auxvariables given vectors telling it the names and how many to create. More...

#include <MultiAuxVariablesAction.h>

Inheritance diagram for MultiAuxVariablesAction:
[legend]

Public Member Functions

 MultiAuxVariablesAction (InputParameters params)
 
virtual void act ()
 

Protected Attributes

const unsigned int _grain_num
 number of grains to create More...
 
const std::vector< std::string > & _var_name_base
 base name for the auxvariables More...
 
const unsigned int _num_var
 number of auxvariables More...
 
const MultiMooseEnum & _data_type
 list of material properties to be used More...
 
const unsigned int _data_size
 number of properties More...
 

Detailed Description

Automatically generates all auxvariables given vectors telling it the names and how many to create.

Definition at line 18 of file MultiAuxVariablesAction.h.

Constructor & Destructor Documentation

◆ MultiAuxVariablesAction()

MultiAuxVariablesAction::MultiAuxVariablesAction ( InputParameters  params)

Definition at line 36 of file MultiAuxVariablesAction.C.

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())
43 {
44 }

Member Function Documentation

◆ act()

void MultiAuxVariablesAction::act ( )
virtual

for exatrcting data from MaterialProperty<std::vector<Real> >

for exatrcting data from MaterialProperty<std::vector<RealGradient> >

The name of the variable is the variable name base followed by the order parameter and a suffix mentioning dimension it applies to.

Definition at line 47 of file MultiAuxVariablesAction.C.

48 {
49  init();
50 
51  if (_num_var != _data_size)
52  mooseError("Data type not provided for all the AuxVariables in MultiAuxVariablesAction");
53 
54  // mesh dimension & components required for gradient variables
55  const unsigned int dim = _mesh->dimension();
56  const std::vector<char> suffix = {'x', 'y', 'z'};
57 
58  // Loop through the number of order parameters
59  for (unsigned int val = 0; val < _num_var; ++val)
60  for (unsigned int gr = 0; gr < _grain_num; ++gr)
61  {
63  if (_data_type[val] == "Real")
64  {
65  // Create variable names with variable name base followed by the order parameter it applies
66  // to.
67  std::string var_name = _var_name_base[val] + Moose::stringify(gr);
68 
69  _problem->addAuxVariable(_type, var_name, _moose_object_pars);
70  }
72  if (_data_type[val] == "RealGradient")
73  for (unsigned int x = 0; x < dim; ++x)
74  {
79  std::string var_name = _var_name_base[val] + Moose::stringify(gr) + "_" + suffix[x];
80 
81  _problem->addAuxVariable(_type, var_name, _moose_object_pars);
82  }
83  }
84 }

Member Data Documentation

◆ _data_size

const unsigned int MultiAuxVariablesAction::_data_size
protected

number of properties

Definition at line 39 of file MultiAuxVariablesAction.h.

Referenced by act().

◆ _data_type

const MultiMooseEnum& MultiAuxVariablesAction::_data_type
protected

list of material properties to be used

Definition at line 36 of file MultiAuxVariablesAction.h.

Referenced by act().

◆ _grain_num

const unsigned int MultiAuxVariablesAction::_grain_num
protected

number of grains to create

Definition at line 27 of file MultiAuxVariablesAction.h.

Referenced by act().

◆ _num_var

const unsigned int MultiAuxVariablesAction::_num_var
protected

number of auxvariables

Definition at line 33 of file MultiAuxVariablesAction.h.

Referenced by act().

◆ _var_name_base

const std::vector<std::string>& MultiAuxVariablesAction::_var_name_base
protected

base name for the auxvariables

Definition at line 30 of file MultiAuxVariablesAction.h.

Referenced by act().


The documentation for this class was generated from the following files:
MultiAuxVariablesAction::_data_size
const unsigned int _data_size
number of properties
Definition: MultiAuxVariablesAction.h:39
MultiAuxVariablesAction::_var_name_base
const std::vector< std::string > & _var_name_base
base name for the auxvariables
Definition: MultiAuxVariablesAction.h:30
MultiAuxVariablesAction::_grain_num
const unsigned int _grain_num
number of grains to create
Definition: MultiAuxVariablesAction.h:27
MultiAuxVariablesAction::_data_type
const MultiMooseEnum & _data_type
list of material properties to be used
Definition: MultiAuxVariablesAction.h:36
MultiAuxVariablesAction::_num_var
const unsigned int _num_var
number of auxvariables
Definition: MultiAuxVariablesAction.h:33