27#include "neml2/base/OptionSet.h"
28#include "neml2/base/Factory.h"
32#include "neml2/base/Registry.h"
83 const std::string &
name()
const {
return _input_options.name(); }
85 const std::string &
type()
const {
return _input_options.type(); }
87 const std::string &
path()
const {
return _input_options.path(); }
89 const std::string &
doc()
const {
return _input_options.doc(); }
98 template <
typename T = NEML2Object>
99 const T *
host()
const;
102 template <
typename T = NEML2Object>
106 template <
typename T>
112 std::shared_ptr<T>
get_object(
const std::string & section,
const std::string &
name);
114 template <
class T = Solver>
117 template <
class T = Data>
120 template <
class T = Model>
123 template <
class T = Driver>
126 template <
class T = WorkScheduler>
142 const std::shared_ptr<Settings> _settings;
152 auto host_ptr =
dynamic_cast<const T *
>(_host ? _host :
this);
154 throw NEMLException(
"Internal error: Failed to retrieve host of object " +
name());
162 auto host_ptr =
dynamic_cast<T *
>(_host ? _host :
this);
164 throw NEMLException(
"Internal error: Failed to retrieve host of object " +
name());
172 auto obj_name = _input_options.contains(
name) ? _input_options.get<std::string>(
name) :
name;
174 throw NEMLException(
"Internal error: factory is nullptr for object " + this->
name());
175 return _factory->get_object<T>(section, obj_name);
The Driver drives the execution of a NEML2 Model.
Definition Driver.h:44
The base class for all constitutive models.
Definition Model.h:74
The base class of all "manufacturable" objects in the NEML2 library.
Definition NEML2Object.h:51
NEML2Object(const NEML2Object &)=delete
std::shared_ptr< T > get_driver(const std::string &name)
Get a driver from the factory.
Definition NEML2Object.h:201
const T & resolve_tensor(const std::string &name)
Resolve a TensorName to a Tensor.
Definition NEML2Object.cxx:59
const std::string & name() const
A readonly reference to the object's name.
Definition NEML2Object.h:83
const T * host() const
Get a readonly pointer to the host.
Definition NEML2Object.h:150
std::shared_ptr< T > get_data(const std::string &name)
Get a data from the factory.
Definition NEML2Object.h:187
Factory * factory() const
Get the factory that created this object.
Definition NEML2Object.h:92
virtual void setup()
Setup this object.
Definition NEML2Object.h:80
const OptionSet & input_options() const
Definition NEML2Object.h:69
const std::string & type() const
A readonly reference to the object's type.
Definition NEML2Object.h:85
std::shared_ptr< T > get_object(const std::string §ion, const std::string &name)
Definition NEML2Object.h:170
NEML2Object(NEML2Object &&)=delete
NEML2Object & operator=(const NEML2Object &)=delete
const std::string & doc() const
A readonly reference to the object's docstring.
Definition NEML2Object.h:89
NEML2Object & operator=(NEML2Object &&)=delete
std::shared_ptr< T > get_model(const std::string &name)
Get a model from the factory.
Definition NEML2Object.h:194
std::shared_ptr< T > get_scheduler(const std::string &name)
Get a scheduler from the factory.
Definition NEML2Object.h:208
const std::string & path() const
A readonly reference to the object's path.
Definition NEML2Object.h:87
const Settings & settings() const
Settings.
Definition NEML2Object.h:95
static OptionSet expected_options()
Definition NEML2Object.cxx:33
virtual ~NEML2Object()=default
std::shared_ptr< T > get_solver(const std::string &name)
Get a solver from the factory.
Definition NEML2Object.h:180
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:51
The solver solves a system of equations.
Definition Solver.h:42
Scheduler for work dispatching.
Definition WorkScheduler.h:48
Definition DiagnosticsInterface.cxx:29
std::string name(ElasticConstant p)
Definition ElasticityConverter.cxx:30