17 #ifdef MOOSE_UNIT_TEST 18 #include "gtest/gtest.h" 27 #define registerApp(name) AppFactory::instance().reg<name>(#name) 45 return std::make_unique<T>(params);
76 static std::unique_ptr<MooseApp>
create(
const std::string & app_type,
77 const std::vector<std::string> & cli_args = {});
82 static std::unique_ptr<MooseApp>
create(std::unique_ptr<Parser> parser,
83 std::unique_ptr<CommandLine> command_line);
96 std::unique_ptr<MooseApp>
create(
const std::string & app_type,
98 const std::string & name,
100 MPI_Comm COMM_WORLD_IN);
101 std::shared_ptr<MooseApp>
createShared(
const std::string & app_type,
102 const std::string & name,
104 MPI_Comm COMM_WORLD_IN);
111 static std::shared_ptr<MooseApp>
createAppShared(
const std::string & default_app_type,
114 MPI_Comm comm_word = MPI_COMM_WORLD);
120 template <
typename T>
121 void reg(
const std::string & name);
147 #ifdef MOOSE_UNIT_TEST 220 #ifdef MOOSE_UNIT_TEST 222 FRIEND_TEST(::AppFactoryTest, appCopyConstructParams);
223 FRIEND_TEST(::AppFactoryTest, createNotRegistered);
230 template <
typename T>
239 name,
true,
"MOOSE application " +
name +
" is available.");
bool isRegistered(const std::string &app_name) const
Returns a Boolean indicating whether an application type has been registered.
std::shared_ptr< MooseApp > createShared(const std::string &app_type, const std::string &name, InputParameters parameters, MPI_Comm COMM_WORLD_IN)
static const std::string main_app_name
The name for the "main" moose application.
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 Bui...
const InputParameters & storeAppParams(InputParameters ¶ms)
Stores the given parameters within _input_parameters for app construction.
const InputParameters & getAppParams(const InputParameters ¶ms) const
class GTEST_TEST_CLASS_NAME_(AppFactoryTest, manageAppParams)
Base class for MOOSE-based applications.
virtual std::unique_ptr< MooseApp > build(const InputParameters ¶ms) override
InputParameters validParams()
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.
const std::string & name() const
Get the name of the class.
const auto & registeredObjects() const
Returns a reference to the map from names to AppFactoryBuildInfo pointers.
virtual std::unique_ptr< MooseApp > build(const InputParameters ¶ms)=0
Generic AppFactory class for building Application objects.
void clearAppParams(const InputParameters ¶ms, const ClearAppParamsKey)
Clears the stored parameters for the given application parameteres.
AppFactoryBuildInfoMap _name_to_build_info
virtual InputParameters buildParameters()=0
ClearAppParamsKey(const ClearAppParamsKey &)
std::size_t createdAppCount(const std::string &app_type) const
FRIEND_TEST(::AppFactoryTest, manageAppParams)
std::size_t _app_creation_count
std::map< std::size_t, std::unique_ptr< InputParameters > > _input_parameters
Storage of input parameters used in applications (ID (from getAppParamsID()) -> params) ...
FRIEND_TEST(::AppFactoryTest, manageAppParams)
void reg(const std::string &name)
Register a new object.
AppFactory()
Private constructor for singleton pattern.
static AppFactory & instance()
Get the instance of the AppFactory.
static Capabilities & getCapabilityRegistry()
std::size_t getAppParamsID(const InputParameters ¶ms) const
Get the ID for the InputParameters associated with an application, used in storing them in _input_par...
virtual InputParameters buildParameters() override
const AppFactoryBuildInfoMap & registeredObjectBuildInfos() const
Returns the map of object name to a function pointer for building said object's input parameters...
Registry & operator=(AppFactory const &)=delete
Class that is used as a parameter to clearAppParams() that allows only MooseApp to call clearAppParam...
InputParameters getValidParams(const std::string &name)
Get valid parameters for the object.
std::map< std::string, std::unique_ptr< AppFactoryBuildInfoBase > > AppFactoryBuildInfoMap
The registry is used as a global singleton to collect information on all available MooseObject and Ac...
Polymorphic data structure with parameter and object build access.
void add(const std::string &capability, CapabilityUtils::Type value, const std::string &doc)
register a new capability
virtual ~AppFactoryBuildInfoBase()=default