www.mooseframework.org
CreateExecutionerAction.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 
11 #include "Factory.h"
12 #include "PetscSupport.h"
13 #include "MooseApp.h"
14 #include "Executioner.h"
15 #include "Eigenvalue.h"
16 #include "FEProblem.h"
17 #include "EigenProblem.h"
18 
19 registerMooseAction("MooseApp", CreateExecutionerAction, "setup_executioner");
20 
21 template <>
24 {
26 
27  return params;
28 }
29 
31 {
32 }
33 
34 void
36 {
37  std::shared_ptr<EigenProblem> eigen_problem = std::dynamic_pointer_cast<EigenProblem>(_problem);
38  if (eigen_problem)
39  _moose_object_pars.set<EigenProblem *>("_eigen_problem") = eigen_problem.get();
40 
41  std::shared_ptr<Executioner> executioner =
43 
44  std::shared_ptr<Eigenvalue> eigen_executioner =
46 
47  if ((eigen_problem == nullptr) != (eigen_executioner == nullptr))
48  mooseError("Executioner is not consistent with each other; EigenExecutioner needs an "
49  "EigenProblem, and Steady and Transient need a FEProblem");
50 
51  _app.setExecutioner(std::move(executioner));
52 }
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, InputParameters parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>()) ...
Definition: Factory.C:87
void setExecutioner(std::shared_ptr< Executioner > &&executioner)
Set the Executioner for this App.
Definition: MooseApp.h:271
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:207
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< CreateExecutionerAction >()
Factory & _factory
The Factory associated with the MooseApp.
Definition: Action.h:186
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
CreateExecutionerAction(InputParameters params)
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:32
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.
registerMooseAction("MooseApp", CreateExecutionerAction, "setup_executioner")
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:216
Problem for solving eigenvalue problems.
Definition: EigenProblem.h:25
MooseApp & _app
The MOOSE application this is associated with.
Definition: Action.h:183