NEML2 2.0.0
|
The name of a tensor object that can be referenced in the input files. More...
The name of a tensor object that can be referenced in the input files.
All tokens in the input files are essentially strings, and it is not always possible to represent all quantities as strings. This class enables cross-referencing tensor or model output variable (by name) defined in the input file. The object name is used as the label, and the object value is not resolved at parse time. The method TensorName::resolve() is used to explicitly resolve the name to a tensor object or a model's output variable. Note that the resolution takes place upon the first call to TensorName::resolve(), and subsequent calls simply return the cached value.
#include <TensorName.h>
Public Member Functions | |
TensorName ()=default | |
TensorName (std::string raw) | |
TensorName & | operator= (const std::string &other) |
Assignment operator. | |
const T & | resolve () const |
Resolve the TensorName to a Tensor object. | |
const T & | resolve (Model *caller, const std::string &pname) const |
bool | operator== (const TensorName &other) const |
Test equality. | |
std::string & | raw () |
Get the raw string literal. | |
const std::string & | raw () const |
|
default |
|
inline |
|
inline |
Assignment operator.
This simply assigns the string without parsing and resolving the cross-reference
|
inline |
Test equality.
|
inline |
Get the raw string literal.
|
inline |
const T & resolve | ( | ) | const |
Resolve the TensorName to a Tensor object.
The underlying string is parsed and used to resolve the cross-reference. It is assumed that the cross-referenced tensor object has already been manufactured at this point.
const T & resolve | ( | Model * | caller, |
const std::string & | pname ) const |