www.mooseframework.org
CreateExecutionerAction.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 
16 #include "Factory.h"
17 #include "PetscSupport.h"
18 #include "MooseApp.h"
19 #include "Executioner.h"
20 #include "Eigenvalue.h"
21 #include "FEProblem.h"
22 #include "EigenProblem.h"
23 
24 template <>
27 {
29 
30  return params;
31 }
32 
34 {
35 }
36 
37 void
39 {
40  _moose_object_pars.set<FEProblemBase *>("_fe_problem_base") = _problem.get();
41 
42  std::shared_ptr<FEProblem> fe_problem = std::dynamic_pointer_cast<FEProblem>(_problem);
43  if (fe_problem)
44  _moose_object_pars.set<FEProblem *>("_fe_problem") = fe_problem.get();
45 
46  std::shared_ptr<EigenProblem> eigen_problem = std::dynamic_pointer_cast<EigenProblem>(_problem);
47  if (eigen_problem)
48  _moose_object_pars.set<EigenProblem *>("_eigen_problem") = eigen_problem.get();
49 
50  std::shared_ptr<Executioner> executioner =
52 
53  std::shared_ptr<Eigenvalue> eigen_executioner =
54  std::dynamic_pointer_cast<Eigenvalue>(executioner);
55 
56  if ((eigen_problem == nullptr) != (eigen_executioner == nullptr))
57  mooseError("Executioner is not consistent with each other; EigenExecutioner needs an "
58  "EigenProblem, and Steady and Transient need a FEProblem");
59 
60  _app.executioner() = executioner;
61 }
std::shared_ptr< Executioner > & executioner()
Retrieve the Executioner shared pointer for this App.
Definition: MooseApp.h:238
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:46
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Definition: FEProblem.h:30
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
virtual void act() override
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:101
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
CreateExecutionerAction(InputParameters params)
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:41
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
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Definition: EigenProblem.h:32
MooseApp & _app
The MOOSE application this is associated with.
Definition: Action.h:98