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 16 of file MultiAuxVariablesAction.h.

Constructor & Destructor Documentation

MultiAuxVariablesAction::MultiAuxVariablesAction ( InputParameters  params)

Definition at line 31 of file MultiAuxVariablesAction.C.

32  : AddAuxVariableAction(params),
33  _grain_num(getParam<unsigned int>("grain_num")),
34  _var_name_base(getParam<std::vector<std::string>>("variable_base")),
35  _num_var(_var_name_base.size()),
36  _data_type(getParam<MultiMooseEnum>("data_type")),
37  _data_size(_data_type.size())
38 {
39 }
const MultiMooseEnum & _data_type
list of material properties to be used
const std::vector< std::string > & _var_name_base
base name for the auxvariables
const unsigned int _num_var
number of auxvariables
const unsigned int _grain_num
number of grains to create
const unsigned int _data_size
number of properties

Member Function Documentation

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 42 of file MultiAuxVariablesAction.C.

43 {
44  if (_num_var != _data_size)
45  mooseError("Data type not provided for all the AuxVariables in MultiAuxVariablesAction");
46 
47  // Blocks from the input
48  std::set<SubdomainID> blocks = getSubdomainIDs();
49 
50  // mesh dimension & components required for gradient variables
51  const unsigned int dim = _mesh->dimension();
52  const std::vector<char> suffix = {'x', 'y', 'z'};
53 
54  // Loop through the number of order parameters
55  for (unsigned int val = 0; val < _num_var; ++val)
56  for (unsigned int gr = 0; gr < _grain_num; ++gr)
57  {
59  if (_data_type[val] == "Real")
60  {
61  // Create variable names with variable name base followed by the order parameter it applies
62  // to.
63  std::string var_name = _var_name_base[val] + Moose::stringify(gr);
64 
65  if (blocks.empty())
66  _problem->addAuxVariable(var_name, _fe_type);
67  else
68  _problem->addAuxVariable(var_name, _fe_type, &blocks);
69  }
71  if (_data_type[val] == "RealGradient")
72  for (unsigned int x = 0; x < dim; ++x)
73  {
78  std::string var_name = _var_name_base[val] + Moose::stringify(gr) + "_" + suffix[x];
79 
80  if (blocks.empty())
81  _problem->addAuxVariable(var_name, _fe_type);
82  else
83  _problem->addAuxVariable(var_name, _fe_type, &blocks);
84  }
85  }
86 }
const MultiMooseEnum & _data_type
list of material properties to be used
const std::vector< std::string > & _var_name_base
base name for the auxvariables
const unsigned int _num_var
number of auxvariables
const unsigned int _grain_num
number of grains to create
const unsigned int _data_size
number of properties

Member Data Documentation

const unsigned int MultiAuxVariablesAction::_data_size
protected

number of properties

Definition at line 37 of file MultiAuxVariablesAction.h.

Referenced by act().

const MultiMooseEnum& MultiAuxVariablesAction::_data_type
protected

list of material properties to be used

Definition at line 34 of file MultiAuxVariablesAction.h.

Referenced by act().

const unsigned int MultiAuxVariablesAction::_grain_num
protected

number of grains to create

Definition at line 25 of file MultiAuxVariablesAction.h.

Referenced by act().

const unsigned int MultiAuxVariablesAction::_num_var
protected

number of auxvariables

Definition at line 31 of file MultiAuxVariablesAction.h.

Referenced by act().

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

base name for the auxvariables

Definition at line 28 of file MultiAuxVariablesAction.h.

Referenced by act().


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