https://mooseframework.inl.gov
SubChannelCreateProblemAction.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 
11 #include "ActionFactory.h"
12 #include "SubChannelApp.h"
13 #include "FEProblemBase.h"
14 
15 registerMooseAction("SubChannelApp", SubChannelCreateProblemAction, "create_problem");
16 
19 {
21  params.addClassDescription("Creates the input block that encopasses all the problem parameters");
22  params.addRequiredParam<std::string>("type", "Problem type");
23  params.addParam<std::string>("name", "SubChannel Problem", "The name of the problem");
24  return params;
25 }
26 
28  : MooseObjectAction(parameters)
29 {
30 }
31 
32 void
34 {
35  // build the problem only if we have mesh
36  if (_mesh.get() != NULL)
37  {
38  // when this action is built by parser with Problem input block, this action
39  // must act i.e. create a problem. Thus if a problem has been created, it will error out.
40  if (_problem)
41  mooseError("Trying to build a problem but problem has already existed");
42 
43  _moose_object_pars.set<MooseMesh *>("mesh") = _mesh.get();
44  _moose_object_pars.set<bool>("use_nonlinear") = _app.useNonlinear();
45 
46  _problem =
47  _factory.create<FEProblemBase>(_type, getParam<std::string>("name"), _moose_object_pars);
48  }
49 }
SubChannelCreateProblemAction(const InputParameters &parameters)
bool & useNonlinear()
Action that creates SubChannel problem.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
T & set(const std::string &name, bool quiet_mode=false)
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
void addRequiredParam(const std::string &name, const std::string &doc_string)
Factory & _factory
std::shared_ptr< MooseMesh > & _mesh
std::string _type
InputParameters _moose_object_pars
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
std::shared_ptr< FEProblemBase > & _problem
registerMooseAction("SubChannelApp", SubChannelCreateProblemAction, "create_problem")