www.mooseframework.org
AddICAction.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "AddICAction.h"
16 #include "FEProblem.h"
17 #include "MooseTypes.h"
18 #include "MooseUtils.h"
19 
20 template <>
23 {
25  return params;
26 }
27 
29 
30 void
32 {
33  std::vector<std::string> elements;
34  MooseUtils::tokenize<std::string>(getParam<std::string>("parser_syntax"), elements);
35 
36  // The variable name will be the second to last element in the path name
37  std::string & var_name = elements[elements.size() - 2];
38  _moose_object_pars.set<VariableName>("variable") = var_name;
39  _problem->addInitialCondition(_type, var_name, _moose_object_pars);
40 }
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
AddICAction(InputParameters params)
Definition: AddICAction.C:28
virtual void act() override
Definition: AddICAction.C:31
InputParameters validParams< AddICAction >()
Definition: AddICAction.C:22
InputParameters validParams< MooseObjectAction >()
std::string _type
The Object type that is being created.
InputParameters _moose_object_pars
The parameters for the object to be created.
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:131