www.mooseframework.org
PolycrystalColoringICAction.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 #include "Factory.h"
9 #include "FEProblem.h"
10 #include "Conversion.h"
11 #include "PolycrystalICTools.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<Action>();
18  params.addClassDescription("Random Voronoi tesselation polycrystal action");
19  params.addRequiredParam<unsigned int>("op_num", "number of order parameters to create");
20  params.addRequiredParam<std::string>("var_name_base", "specifies the base name of the variables");
21  params.addRequiredParam<UserObjectName>("polycrystal_ic_uo", "Optional: TODO");
22 
23  return params;
24 }
25 
27  : Action(params),
28  _op_num(getParam<unsigned int>("op_num")),
29  _var_name_base(getParam<std::string>("var_name_base"))
30 {
31 }
32 
33 void
35 {
36  // Loop through the number of order parameters
37  for (unsigned int op = 0; op < _op_num; op++)
38  {
39  // Set parameters for BoundingBoxIC
40  InputParameters poly_params = _factory.getValidParams("PolycrystalColoringIC");
41  poly_params.set<VariableName>("variable") = _var_name_base + Moose::stringify(op);
42  poly_params.set<unsigned int>("op_index") = op;
43  poly_params.set<UserObjectName>("polycrystal_ic_uo") =
44  getParam<UserObjectName>("polycrystal_ic_uo");
45 
46  // Add initial condition
47  _problem->addInitialCondition(
48  "PolycrystalColoringIC", "PolycrystalColoringIC_" + Moose::stringify(op), poly_params);
49  }
50 }
InputParameters validParams< PolycrystalColoringICAction >()
PolycrystalColoringICAction(const InputParameters &params)