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... | |
MooseAppPtr | createShared (const std::string &app_type, const std::string &name, InputParameters parameters, MPI_Comm COMM_WORLD_IN) |
Build an application object (must be registered) 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... | |
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 MooseAppPtr | createAppShared (int argc, char **argv, std::unique_ptr< Parser > parser) |
Helper function for creating a MooseApp from command-line arguments and a Parser. More... | |
static MooseAppPtr | 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... | |
Protected Attributes | |
AppFactoryBuildInfoMap | _name_to_build_info |
Private Member Functions | |
AppFactory () | |
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... | |
FRIEND_TEST (::AppFactoryTest, manageAppParams) | |
FRIEND_TEST (::AppFactoryTest, appCopyConstructParams) | |
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 62 of file AppFactory.h.
|
virtual |
Definition at line 28 of file AppFactory.C.
|
delete |
Don't allow creation through copy/move construction or assignment.
|
delete |
|
inlineprivate |
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 49 of file AppFactory.C.
Referenced by MooseApp::~MooseApp().
|
static |
Helper function for creating a MooseApp from command-line arguments and a Parser.
The parser must be set and have an app type set.
Definition at line 60 of file AppFactory.C.
Referenced by Moose::createMooseApp().
|
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 79 of file AppFactory.C.
std::size_t AppFactory::createdAppCount | ( | const std::string & | app_type | ) | const |
Definition at line 168 of file AppFactory.C.
MooseAppPtr AppFactory::createShared | ( | const std::string & | app_type, |
const std::string & | name, | ||
InputParameters | parameters, | ||
MPI_Comm | COMM_WORLD_IN | ||
) |
Build an application object (must be registered)
app_type | Type of the application being constructed |
name | Name for the object |
parameters | Parameters this object should have |
Definition at line 127 of file AppFactory.C.
Referenced by MultiApp::createApp(), createAppShared(), and MooseServer::parseDocumentForDiagnostics().
|
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 40 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 193 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 31 of file AppFactory.C.
Referenced by MultiApp::createApp(), and createAppShared().
|
static |
Get the instance of the AppFactory.
Definition at line 18 of file AppFactory.C.
Referenced by JsonSyntaxTree::addGlobal(), MultiApp::createApp(), MultiApp::createApps(), createAppShared(), Moose::createMooseApp(), MooseApp::dynamicAppRegistration(), MooseServer::parseDocumentForDiagnostics(), MultiApp::validParams(), and MooseApp::~MooseApp().
|
inline |
Returns a Boolean indicating whether an application type has been registered.
Definition at line 155 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 217 of file AppFactory.h.
|
inline |
Returns the map of object name to a function pointer for building said object's input parameters.
Definition at line 169 of file AppFactory.h.
|
inline |
Returns a reference to the map from names to AppFactoryBuildInfo pointers.
Definition at line 150 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 179 of file AppFactory.C.
Referenced by createShared().
|
static |
|
private |
Storage of input parameters used in applications (ID (from getAppParamsID()) -> params)
Definition at line 212 of file AppFactory.h.
Referenced by clearAppParams(), getAppParams(), and storeAppParams().
|
protected |
Definition at line 180 of file AppFactory.h.
Referenced by createdAppCount(), createShared(), getValidParams(), isRegistered(), reg(), registeredObjectBuildInfos(), and registeredObjects().