www.mooseframework.org
MooseObject.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 // MOOSE includes
11 #include "MooseObject.h"
12 #include "MooseApp.h"
13 #include "MooseUtils.h"
14 
15 class FEProblem;
16 class FEProblemBase;
17 class EigenProblem;
18 class SubProblem;
19 class SystemBase;
20 class AuxiliarySystem;
21 class Transient;
22 
23 template <>
26 {
28  params.addParam<bool>("enable", true, "Set the enabled status of the MooseObject.");
29  params.addParam<std::vector<std::string>>(
30  "control_tags",
31  "Adds user-defined labels for accessing object parameters via control logic.");
32  params.addParamNamesToGroup("enable control_tags", "Advanced");
33  params.addPrivateParam<std::string>("_type"); // The name of the class being built
34  params.addPrivateParam<std::string>("_object_name"); // The name passed to Factory::create
35  params.addPrivateParam<std::string>("_unique_name"); // The unique name generated in the warehouse
36  params.addPrivateParam<FEProblem *>("_fe_problem");
37  params.addPrivateParam<FEProblemBase *>("_fe_problem_base");
38  params.addPrivateParam<EigenProblem *>("_eigen_problem");
39  params.addPrivateParam<SubProblem *>("_subproblem");
40  params.addPrivateParam<SystemBase *>("_sys");
41  params.addPrivateParam<SystemBase *>("_nl_sys");
42  params.addPrivateParam<AuxiliarySystem *>("_aux_sys");
43  params.addPrivateParam<Transient *>("_executioner");
44  params.addPrivateParam<THREAD_ID>("_tid");
45  return params;
46 }
47 
50  ParallelObject(*parameters.getCheckedPointerParam<MooseApp *>("_moose_app")),
52  _app(*getCheckedPointerParam<MooseApp *>("_moose_app")),
53  _type(getParam<std::string>("_type")),
54  _name(getParam<std::string>("_object_name")),
55  _enabled(getParam<bool>("enable")){}
56 
57  [[noreturn]] void callMooseErrorRaw(std::string & msg, MooseApp * app)
58 {
60  std::string prefix;
61  if (!app->isUltimateMaster())
62  prefix = app->name();
63  moose::internal::mooseErrorRaw(msg, prefix);
64 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:73
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
Definition: MooseObject.h:80
Transient executioners usually loop through a number of timesteps...
Definition: Transient.h:30
void addPrivateParam(const std::string &name, const T &value)
These method add a parameter to the InputParameters object which can be retrieved like any other para...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Definition: FEProblem.h:24
MooseObject(const InputParameters &parameters)
Definition: MooseObject.C:48
Base class for MOOSE-based applications.
Definition: MooseApp.h:59
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Base class for a system (of equations)
Definition: SystemBase.h:92
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: MooseObject.h:191
InputParameters emptyInputParameters()
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
InputParameters validParams< MooseObject >()
Definition: MooseObject.C:25
const bool & _enabled
Reference to the "enable" InputParaemters, used by Controls for toggling on/off MooseObjects.
Definition: MooseObject.h:186
An inteface for the _console for outputting to the Console object.
void mooseErrorRaw(std::string msg, const std::string prefix="")
Definition: MooseError.C:43
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
Definition: MooseObject.h:174
const std::string & _name
The name of this object, reference to value stored in InputParameters.
Definition: MooseObject.h:183
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:59
MooseApp & _app
The MooseApp this object is associated with.
Definition: MooseObject.h:177
void mooseConsole()
Send current output buffer to Console output objects.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
Problem for solving eigenvalue problems.
Definition: EigenProblem.h:25
bool isUltimateMaster()
Whether or not this app is the ultimate master app.
Definition: MooseApp.h:528
A system that holds auxiliary variables.
void callMooseErrorRaw(std::string &msg, MooseApp *app)
Definition: MooseObject.C:57
const std::string & _type
The type of this object (the Class name)
Definition: MooseObject.h:180
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
Definition: MooseApp.C:1055
unsigned int THREAD_ID
Definition: MooseTypes.h:161
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...