NEML2 2.0.0
|
The factory is responsible for:
#include <Factory.h>
Static Public Member Functions | |
static Factory & | get () |
Get the global Factory singleton. | |
template<class T > | |
static std::shared_ptr< T > | get_object_ptr (const std::string §ion, const std::string &name, const OptionSet &additional_options=OptionSet(), bool force_create=true) |
Retrive an object pointer under the given section with the given object name. | |
template<class T > | |
static T & | get_object (const std::string §ion, const std::string &name, const OptionSet &additional_options=OptionSet(), bool force_create=true) |
Retrive an object reference under the given section with the given object name. | |
static void | load_options (const OptionCollection &all_options) |
Provide all objects' options to the factory. The factory is ready to manufacture objects after this call, e.g., through either manufacture, get_object, or get_object_ptr. | |
static const OptionCollection & | loaded_options () |
Get the loaded options. | |
static void | clear () |
Destruct all the objects. | |
static void | print (std::ostream &os=std::cout) |
List all the manufactured objects. | |
Protected Member Functions | |
void | create_object (const std::string §ion, const OptionSet &options) |
Manufacture a single NEML2Object. | |
|
static |
Destruct all the objects.
Manufacture a single NEML2Object.
section | The section which the object to be manufactured belongs to. |
options | The options of the object. |
|
inlinestatic |
Retrive an object reference under the given section with the given object name.
An exception is thrown if
T | The type of the NEML2Object |
section | The section name under which the search happens. |
name | The name of the object to retrieve. |
additional_options | Additional input options to pass to the object constructor |
force_create | (Optional) Force the factory to create a new object even if the object has already been created. |
|
inlinestatic |
Retrive an object pointer under the given section with the given object name.
An exception is thrown if
T | The type of the NEML2Object |
section | The section name under which the search happens. |
name | The name of the object to retrieve. |
additional_options | Additional input options to pass to the object constructor |
force_create | (Optional) Force the factory to create a new object even if the object has already been created. |
|
static |
Provide all objects' options to the factory. The factory is ready to manufacture objects after this call, e.g., through either manufacture, get_object, or get_object_ptr.
all_options | The collection of all the options of the objects to be manufactured. |
|
static |
Get the loaded options.
|
static |
List all the manufactured objects.
os | The stream to write to. |