www.mooseframework.org
AddICAction.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "AddICAction.h"
11 #include "FEProblem.h"
12 #include "MooseTypes.h"
13 #include "MooseUtils.h"
14 
15 registerMooseAction("MooseApp", AddICAction, "add_ic");
16 
17 template <>
20 {
22  return params;
23 }
24 
26 
27 void
29 {
30  std::vector<std::string> elements;
31  MooseUtils::tokenize<std::string>(_pars.blockFullpath(), elements);
32 
33  // The variable name will be the second to last element in the path name
34  std::string & var_name = elements[elements.size() - 2];
35  _moose_object_pars.set<VariableName>("variable") = var_name;
36  _problem->addInitialCondition(_type, var_name, _moose_object_pars);
37 }
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:25
InputParameters _pars
Input parameters for the action.
Definition: Action.h:171
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
Definition: AddICAction.C:28
InputParameters validParams< AddICAction >()
Definition: AddICAction.C:19
InputParameters validParams< MooseObjectAction >()
std::string _type
The Object type that is being created.
std::string & blockFullpath()
Get/set a string representing the full HIT parameter path from the input file (e.g.
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:216
registerMooseAction("MooseApp", AddICAction, "add_ic")