NEML2 2.0.0
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
ModelDriver Class Reference

A general-purpose driver that does something with a model. More...

Detailed Description

A general-purpose driver that does something with a model.

Derived classes define that "something".

#include <ModelDriver.h>

Inheritance diagram for ModelDriver:

Public Member Functions

 ModelDriver (const OptionSet &options)
 
void setup () override
 Setup this object.
 
void diagnose () const override
 Check for common problems.
 
const Modelmodel () const
 
- Public Member Functions inherited from Driver
 Driver (const OptionSet &options)
 Construct a new Driver object.
 
virtual bool run ()=0
 Let the driver run, return true upon successful completion, and return false otherwise.
 
- Public Member Functions inherited from NEML2Object
 NEML2Object ()=delete
 
 NEML2Object (NEML2Object &&)=delete
 
 NEML2Object (const NEML2Object &)=delete
 
NEML2Objectoperator= (NEML2Object &&)=delete
 
NEML2Objectoperator= (const NEML2Object &)=delete
 
virtual ~NEML2Object ()=default
 
 NEML2Object (const OptionSet &options)
 Construct a new NEML2Object object.
 
const OptionSetinput_options () const
 
const std::string & name () const
 A readonly reference to the object's name.
 
const std::string & type () const
 A readonly reference to the object's type.
 
const std::string & path () const
 A readonly reference to the object's path.
 
const std::string & doc () const
 A readonly reference to the object's docstring.
 
template<typename T = NEML2Object>
const T * host () const
 Get a readonly pointer to the host.
 
template<typename T = NEML2Object>
T * host ()
 Get a writable pointer to the host.
 
- Public Member Functions inherited from DiagnosticsInterface
 DiagnosticsInterface ()=delete
 
 DiagnosticsInterface (NEML2Object *object)
 
 DiagnosticsInterface (DiagnosticsInterface &&)=delete
 
 DiagnosticsInterface (const DiagnosticsInterface &)=delete
 
DiagnosticsInterfaceoperator= (const DiagnosticsInterface &)=delete
 
DiagnosticsInterfaceoperator= (DiagnosticsInterface &&)=delete
 
virtual ~DiagnosticsInterface ()=default
 
const NEML2Objectobject () const
 Get the object.
 

Static Public Member Functions

static OptionSet expected_options ()
 
- Static Public Member Functions inherited from Driver
static OptionSet expected_options ()
 
- Static Public Member Functions inherited from NEML2Object
static OptionSet expected_options ()
 

Protected Attributes

Model_model
 The model which the driver uses to perform constitutive updates.
 
const Device _device
 The device on which to evaluate the model.
 
const bool _show_params
 Set to true to list all the model parameters at the beginning.
 
const bool _show_input
 Set to true to show model's input axis at the beginning.
 
const bool _show_output
 Set to true to show model's output axis at the beginning.
 
- Protected Attributes inherited from Driver
bool _verbose
 Whether to print out additional (debugging) information during the execution.
 

Constructor & Destructor Documentation

◆ ModelDriver()

ModelDriver ( const OptionSet & options)

Member Function Documentation

◆ diagnose()

void diagnose ( ) const
overridevirtual

Check for common problems.

This method serves as the entry point for diagnosing common problems in object setup. The idea behind this method is that while some errors could be detected at construction time, i.e., when the object's constructor is called, it doesn't hinder other objects' creation. We therefore would like to defer the detection of errors until after all objects have been created, collect all errors at once, and present the user with a complete understanding of all errors encountered.

Note, however, if an error could interfere with other objects' creation, it should be raised right away inside the constructor, instead of inside this method.

Reimplemented from Driver.

Reimplemented in SolidMechanicsDriver, and TransientDriver.

◆ expected_options()

OptionSet expected_options ( )
static

◆ model()

const Model & model ( ) const
inline

◆ setup()

void setup ( )
overridevirtual

Setup this object.

This method is called automatically if you use the Factory method get_object or get_object_ptr, right after construction. This serves as the entry point for things that are not convenient/possible to do at construction time, but are necessary before this object can be used (by others).

Reimplemented from NEML2Object.

Reimplemented in SolidMechanicsDriver, and TransientDriver.

Member Data Documentation

◆ _device

const Device _device
protected

The device on which to evaluate the model.

◆ _model

Model& _model
protected

The model which the driver uses to perform constitutive updates.

◆ _show_input

const bool _show_input
protected

Set to true to show model's input axis at the beginning.

◆ _show_output

const bool _show_output
protected

Set to true to show model's output axis at the beginning.

◆ _show_params

const bool _show_params
protected

Set to true to list all the model parameters at the beginning.