Generic AppFactory class for building Application objects. More...
#include <AppFactory.h>
Classes | |
| class | ClearAppParamsKey |
| Class that is used as a parameter to clearAppParams() that allows only MooseApp to call clearAppParams(). More... | |
Public Member Functions | |
| virtual | ~AppFactory () |
| template<typename T > | |
| void | reg (const std::string &name) |
| Register a new object. More... | |
| InputParameters | getValidParams (const std::string &name) |
| Get valid parameters for the object. More... | |
| const InputParameters & | getAppParams (const InputParameters ¶ms) const |
| void | clearAppParams (const InputParameters ¶ms, const ClearAppParamsKey) |
| Clears the stored parameters for the given application parameteres. More... | |
| const auto & | registeredObjects () const |
| Returns a reference to the map from names to AppFactoryBuildInfo pointers. More... | |
| bool | isRegistered (const std::string &app_name) const |
| Returns a Boolean indicating whether an application type has been registered. More... | |
| std::size_t | createdAppCount (const std::string &app_type) const |
| const AppFactoryBuildInfoMap & | registeredObjectBuildInfos () const |
| Returns the map of object name to a function pointer for building said object's input parameters. More... | |
| std::unique_ptr< MooseApp > | create (const std::string &app_type, const std::string &name, InputParameters parameters, MPI_Comm COMM_WORLD_IN) |
| Create a MooseApp given a set of parameters. More... | |
| std::shared_ptr< MooseApp > | createShared (const std::string &app_type, const std::string &name, InputParameters parameters, MPI_Comm COMM_WORLD_IN) |
| AppFactory (AppFactory const &)=delete | |
| Don't allow creation through copy/move construction or assignment. More... | |
| Registry & | operator= (AppFactory const &)=delete |
| AppFactory (AppFactory &&)=delete | |
| Registry & | operator= (AppFactory &&)=delete |
Static Public Member Functions | |
| static AppFactory & | instance () |
| Get the instance of the AppFactory. More... | |
| static InputParameters | validParams () |
| static std::unique_ptr< MooseApp > | create (const std::string &app_type, const std::vector< std::string > &cli_args={}) |
| Create an app with no input and command line arguments. More... | |
| static std::unique_ptr< MooseApp > | create (std::unique_ptr< Parser > parser, std::unique_ptr< CommandLine > command_line) |
| Create a MooseApp from a Parser and CommandLine, both of which should have parsed. More... | |
| static std::shared_ptr< MooseApp > | createAppShared (const std::string &default_app_type, int argc, char **argv, MPI_Comm comm_word=MPI_COMM_WORLD) |
| Deprecated helper function for creating a MooseApp for Apps haven't adapted to the new Parser and Builder changes. More... | |
Static Public Attributes | |
| static const std::string | main_app_name = "main" |
| The name for the "main" moose application. More... | |
Protected Attributes | |
| AppFactoryBuildInfoMap | _name_to_build_info |
Private Member Functions | |
| const InputParameters & | storeAppParams (InputParameters ¶ms) |
| Stores the given parameters within _input_parameters for app construction. More... | |
| std::size_t | getAppParamsID (const InputParameters ¶ms) const |
| Get the ID for the InputParameters associated with an application, used in storing them in _input_parameters. More... | |
| void | registerAppCapability (const std::string &app_name) |
| Register an application name as a capability. More... | |
| AppFactory () | |
| Private constructor for singleton pattern. More... | |
| FRIEND_TEST (::AppFactoryTest, manageAppParams) | |
| FRIEND_TEST (::AppFactoryTest, appCopyConstructParams) | |
| FRIEND_TEST (::AppFactoryTest, createNotRegistered) | |
Private Attributes | |
| std::map< std::size_t, std::unique_ptr< InputParameters > > | _input_parameters |
| Storage of input parameters used in applications (ID (from getAppParamsID()) -> params) More... | |
Generic AppFactory class for building Application objects.
Definition at line 54 of file AppFactory.h.
|
virtual |
Definition at line 30 of file AppFactory.C.
|
delete |
Don't allow creation through copy/move construction or assignment.
|
delete |
|
inlineprivate |
Private constructor for singleton pattern.
Definition at line 222 of file AppFactory.h.
Referenced by instance().
| void AppFactory::clearAppParams | ( | const InputParameters & | params, |
| const ClearAppParamsKey | |||
| ) |
Clears the stored parameters for the given application parameteres.
See getAppParams() for why this is needed.
Definition at line 53 of file AppFactory.C.
|
static |
Create an app with no input and command line arguments.
Useful for unit testing.
Definition at line 64 of file AppFactory.C.
Referenced by create(), MultiApp::createApp(), createAppShared(), Moose::createMooseApp(), createShared(), and MooseServer::parseDocumentForDiagnostics().
|
static |
Create a MooseApp from a Parser and CommandLine, both of which should have parsed.
Definition at line 79 of file AppFactory.C.
| std::unique_ptr< MooseApp > AppFactory::create | ( | const std::string & | app_type, |
| const std::string & | name, | ||
| InputParameters | parameters, | ||
| MPI_Comm | COMM_WORLD_IN | ||
| ) |
Create a MooseApp given a set of parameters.
The Parser must be set in the _parser param and the CommandLine must be set in the _command_line param, both of which must have been parsed.
| app_type | Type of the application being constructed |
| name | Name for the object |
| parameters | Parameters this object should have |
Definition at line 140 of file AppFactory.C.
|
static |
Deprecated helper function for creating a MooseApp for Apps haven't adapted to the new Parser and Builder changes.
This function needed to be removed after the new Parser and Builder merged
Definition at line 97 of file AppFactory.C.
| std::size_t AppFactory::createdAppCount | ( | const std::string & | app_type | ) | const |
Definition at line 191 of file AppFactory.C.
| std::shared_ptr< MooseApp > AppFactory::createShared | ( | const std::string & | app_type, |
| const std::string & | name, | ||
| InputParameters | parameters, | ||
| MPI_Comm | COMM_WORLD_IN | ||
| ) |
Definition at line 182 of file AppFactory.C.
|
private |
|
private |
|
private |
| const InputParameters & AppFactory::getAppParams | ( | const InputParameters & | params | ) | const |
name This is needed because we poorly decided to not pass references of the InputParameters in all derived MooseApp objects. This enables the MooseApp to get the copy of the parameters that it was actually built with using this factory.
Definition at line 44 of file AppFactory.C.
|
private |
Get the ID for the InputParameters associated with an application, used in storing them in _input_parameters.
This is needed until app constructors do not copy construct parameters. See getAppParams() for more information.
The parameters passed in here (from the app) could be copy-constructed parameters, but will contain a "_app_params_id" parameter that allows us to get the actual parameters (owned by this factory).
Definition at line 216 of file AppFactory.C.
Referenced by clearAppParams(), and getAppParams().
| InputParameters AppFactory::getValidParams | ( | const std::string & | name | ) |
Get valid parameters for the object.
| name | Name of the object whose parameter we are requesting |
Definition at line 35 of file AppFactory.C.
Referenced by create(), MultiApp::createApp(), and createAppShared().
|
static |
Get the instance of the AppFactory.
Definition at line 20 of file AppFactory.C.
Referenced by JsonSyntaxTree::addGlobal(), create(), MultiApp::createApp(), MultiApp::createApps(), createAppShared(), Moose::createMooseApp(), createShared(), MooseApp::dynamicAppRegistration(), MooseServer::parseDocumentForDiagnostics(), and MultiApp::validParams().
|
inline |
Returns a Boolean indicating whether an application type has been registered.
Definition at line 168 of file AppFactory.h.
Referenced by MultiApp::createApp(), and reg().
|
delete |
|
delete |
| void AppFactory::reg | ( | const std::string & | name | ) |
Register a new object.
| name | Name of the object to register |
Definition at line 236 of file AppFactory.h.
|
private |
Register an application name as a capability.
Definition at line 225 of file AppFactory.C.
Referenced by reg().
|
inline |
Returns the map of object name to a function pointer for building said object's input parameters.
Definition at line 182 of file AppFactory.h.
|
inline |
Returns a reference to the map from names to AppFactoryBuildInfo pointers.
Definition at line 163 of file AppFactory.h.
Referenced by MultiApp::validParams().
|
private |
Stores the given parameters within _input_parameters for app construction.
Also calls finalize() on the parameters
Definition at line 202 of file AppFactory.C.
Referenced by create().
|
static |
|
private |
Storage of input parameters used in applications (ID (from getAppParamsID()) -> params)
Definition at line 231 of file AppFactory.h.
Referenced by clearAppParams(), getAppParams(), and storeAppParams().
|
protected |
Definition at line 193 of file AppFactory.h.
Referenced by create(), createdAppCount(), getValidParams(), isRegistered(), reg(), registeredObjectBuildInfos(), and registeredObjects().
|
static |
The name for the "main" moose application.
Definition at line 68 of file AppFactory.h.
Referenced by create(), MooseBase::messagePrefix(), and MooseServer::parseDocumentForDiagnostics().
1.8.14