The factory is responsible for:
- retriving a NEML2Object given the object name as a std::string
- creating a NEML2Object given the type of the NEML2Object as a std::string.
#include <Factory.h>
|
| | Factory (InputFile) |
| |
| InputFile & | input_file () |
| | Get the input file.
|
| |
| const InputFile & | input_file () const |
| | Get the input file.
|
| |
| const std::shared_ptr< Settings > & | settings () const |
| | Global settings.
|
| |
| bool | has_object (const std::string §ion, const std::string &name) |
| | Check if an object with the given name exists under the given section.
|
| |
| template<class T > |
| std::shared_ptr< T > | get_object (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 = Solver> |
| std::shared_ptr< T > | get_solver (const std::string &name) |
| | Get a solver by its name.
|
| |
| template<class T = Data> |
| std::shared_ptr< T > | get_data (const std::string &name) |
| | Get a data by its name.
|
| |
| template<class T = Model> |
| std::shared_ptr< T > | get_model (const std::string &name) |
| | Get a model by its name.
|
| |
| template<class T = Driver> |
| std::shared_ptr< T > | get_driver (const std::string &name) |
| | Get a driver by its name.
|
| |
| template<class T = WorkScheduler> |
| std::shared_ptr< T > | get_scheduler (const std::string &name) |
| | Get a scheduler by its name.
|
| |
| void | clear () |
| | Delete all factories and destruct all the objects.
|
| |
| void | print (std::ostream &os=std::cout) |
| | List all the manufactured objects.
|
| |
◆ Factory()
◆ clear()
Delete all factories and destruct all the objects.
◆ create_object()
| void create_object |
( |
const std::string & | section, |
|
|
const OptionSet & | options ) |
|
protected |
Manufacture a single NEML2Object.
- Parameters
-
| section | The section which the object to be manufactured belongs to. |
| options | The options of the object. |
◆ get_data()
template<class T >
| std::shared_ptr< T > get_data |
( |
const std::string & | name | ) |
|
◆ get_driver()
template<class T >
| std::shared_ptr< T > get_driver |
( |
const std::string & | name | ) |
|
Get a driver by its name.
◆ get_model()
template<class T >
| std::shared_ptr< T > get_model |
( |
const std::string & | name | ) |
|
◆ get_object()
template<class T >
| std::shared_ptr< T > get_object |
( |
const std::string & | section, |
|
|
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.
An exception is thrown if
- the object with the given name does not exist, or
- the object with the given name exists but does not have the correct type (e.g., dynamic case fails).
- Template Parameters
-
- Parameters
-
| 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. |
- Returns
- std::shared_ptr<T> The object pointer.
◆ get_scheduler()
template<class T >
| std::shared_ptr< T > get_scheduler |
( |
const std::string & | name | ) |
|
Get a scheduler by its name.
◆ get_solver()
template<class T >
| std::shared_ptr< T > get_solver |
( |
const std::string & | name | ) |
|
Get a solver by its name.
◆ has_object()
| bool has_object |
( |
const std::string & | section, |
|
|
const std::string & | name ) |
Check if an object with the given name exists under the given section.
◆ input_file() [1/2]
◆ input_file() [2/2]
◆ print()
| void print |
( |
std::ostream & | os = std::cout | ) |
|
List all the manufactured objects.
- Parameters
-
| os | The stream to write to. |
◆ settings()
| const std::shared_ptr< Settings > & settings |
( |
| ) |
const |
|
inline |