![]() |
OGS
|
|
Symbol table storage and compiled expressions for one OpenMP thread. Each thread receives its own instance so that concurrent evaluations do not race on the exprtk symbol table or the VariableArray scratch space. The symbol table has to point to some fixed addresses. Therefore, it cannot directly use a user-provided VariableArray during evaluation. Instead, a user-provided VariableArray will be copied to this object before expression evaluation.
Definition at line 160 of file Function.cpp.
Public Member Functions | |
| template<int D> | |
| PerThreadData (std::integral_constant< int, D >, std::vector< std::string > const &expression_symbol_names, bool spatial_position_is_required, std::vector< std::string > const &used_curve_names, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves, std::vector< Variable > const &variables_enum, std::vector< Variable > *non_scalar_out, std::vector< std::string > const &value_string_expressions, std::vector< std::pair< std::string, std::vector< std::string > > > const &dvalue_string_expressions, std::vector< D2ValueConfig > const &d2value_string_expressions) | |
| PerThreadData (PerThreadData &&) | |
| PerThreadData & | operator= (PerThreadData &&other) noexcept=delete |
| PerThreadData (PerThreadData const &)=delete | |
| PerThreadData & | operator= (PerThreadData const &)=delete |
| void | updateNonScalarVariables (std::vector< Variable > const &non_scalar_variables, VariableArray const &new_variable_array) |
| PropertyDataType | evaluate (std::vector< Variable > const &non_scalar_variables, VariableArray const &new_variable_array, ParameterLib::SpatialPosition const &pos, double t, std::vector< exprtk::expression< double > > const &expressions) |
| void | buildCopyOps (std::vector< Variable > const &variables_enum, std::vector< Variable > *non_scalar_out) |
| void | compileExpressions (std::vector< std::string > const &value_string_expressions, std::vector< std::pair< std::string, std::vector< std::string > > > const &dvalue_string_expressions, std::vector< D2ValueConfig > const &d2value_string_expressions) |
Public Attributes | |
| std::map< std::string, ParameterLib::CurveWrapper > | curve_wrappers |
| Curve wrappers owned by this thread; must outlive the symbol table. | |
| VariableArray | variable_array |
| exprtk::symbol_table< double > | symbol_table |
| std::vector< exprtk::expression< double > > | value_expressions |
| std::vector< std::pair< Variable, std::vector< exprtk::expression< double > > > > | dvalue_expressions |
| std::vector< D2ValueExpression > | d2value_expressions |
| ParameterLib::SymbolTableCache | symbol_table_cache |
| Cached pointers to symbol table variables (t, x, y, z). | |
| std::vector< ScalarCopyOp > | scalar_copy_ops |
| Scalar copy operations into this thread's symbol table. | |
|
inline |
Definition at line 163 of file Function.cpp.
References buildCopyOps(), compileExpressions(), MaterialPropertyLib::createSymbolTable(), curve_wrappers, symbol_table, symbol_table_cache, and variable_array.
Referenced by PerThreadData(), PerThreadData(), operator=(), and operator=().
|
inline |
Definition at line 187 of file Function.cpp.
References PerThreadData(), and OGS_FATAL.
|
delete |
References PerThreadData().
|
inline |
Build scalar_copy_ops for this thread.
| variables_enum | All variables to visit. |
| non_scalar_out | If non-null, non-scalar variables are appended here (pass only for thread 0). |
Definition at line 281 of file Function.cpp.
References scalar_copy_ops, and variable_array.
Referenced by PerThreadData().
|
inline |
Compile value, dValue, and d2Value expressions for this thread.
| value_string_expressions | Raw value expression strings. |
| dvalue_string_expressions | Variable name paired with its derivative expression strings. |
| d2value_string_expressions | Two variable names and second- derivative expression strings. |
Definition at line 314 of file Function.cpp.
References ParameterLib::compileExpressions(), MaterialPropertyLib::convertStringToVariable(), d2value_expressions, dvalue_expressions, OGS_FATAL, symbol_table, and value_expressions.
Referenced by PerThreadData().
| PropertyDataType MaterialPropertyLib::PerThreadData::evaluate | ( | std::vector< Variable > const & | non_scalar_variables, |
| VariableArray const & | new_variable_array, | ||
| ParameterLib::SpatialPosition const & | pos, | ||
| double | t, | ||
| std::vector< exprtk::expression< double > > const & | expressions ) |
Evaluate expressions against the given variable array and position, returning the result as a PropertyDataType.
| non_scalar_variables | Non-scalar variables from Implementation (shared read-only). |
| new_variable_array | Input variable array for this evaluation. |
| pos | Spatial position (coordinates required when spatial variables x, y, z are used). |
| t | Current time. |
| expressions | Compiled exprtk expressions to evaluate. |
Definition at line 519 of file Function.cpp.
References MaterialPropertyLib::evaluateToArray(), MaterialPropertyLib::fromArray(), OGS_FATAL, scalar_copy_ops, symbol_table_cache, and updateNonScalarVariables().
|
deletenoexcept |
References PerThreadData().
|
delete |
References PerThreadData().
| void MaterialPropertyLib::PerThreadData::updateNonScalarVariables | ( | std::vector< Variable > const & | non_scalar_variables, |
| VariableArray const & | new_variable_array ) |
Update non-scalar (KelvinVector / DeformationGradient) variables in this thread's variable_array from new_variable_array.
Definition at line 417 of file Function.cpp.
References MaterialPropertyLib::VariableArray::address_of(), MathLib::KelvinVector::kelvinVectorToSymmetricTensor(), OGS_FATAL, variable_array, and MaterialPropertyLib::variable_enum_to_string.
Referenced by evaluate().
| std::map<std::string, ParameterLib::CurveWrapper> MaterialPropertyLib::PerThreadData::curve_wrappers |
Curve wrappers owned by this thread; must outlive the symbol table.
Definition at line 198 of file Function.cpp.
Referenced by PerThreadData().
| std::vector<D2ValueExpression> MaterialPropertyLib::PerThreadData::d2value_expressions |
Second-derivative expressions w.r.t. an unordered pair of variables. Each entry stores the VariablePair - where (v1, v2) and (v2, v1) are treated as identical - together with multi-component expressions corresponding one-to-one with the value expressions. Specified in the project file as:
Definition at line 248 of file Function.cpp.
Referenced by compileExpressions().
| std::vector<std::pair<Variable, std::vector<exprtk::expression<double> > > > MaterialPropertyLib::PerThreadData::dvalue_expressions |
Derivative expressions w.r.t. a differentiation variable. Outer vector is an unordered set of (Variable, expressions) pairs. Each pair's second element holds multi-component expressions, corresponding one-to-one with the input XML entries, e.g.:
Definition at line 233 of file Function.cpp.
Referenced by compileExpressions().
| std::vector<ScalarCopyOp> MaterialPropertyLib::PerThreadData::scalar_copy_ops |
Scalar copy operations into this thread's symbol table.
Definition at line 254 of file Function.cpp.
Referenced by buildCopyOps(), and evaluate().
| exprtk::symbol_table<double> MaterialPropertyLib::PerThreadData::symbol_table |
Symbol table holding variable storage. Must be destroyed after expressions (exprtk requirement) and after curve_wrappers and variable_array.
Definition at line 208 of file Function.cpp.
Referenced by PerThreadData(), and compileExpressions().
| ParameterLib::SymbolTableCache MaterialPropertyLib::PerThreadData::symbol_table_cache |
Cached pointers to symbol table variables (t, x, y, z).
Definition at line 251 of file Function.cpp.
Referenced by PerThreadData(), and evaluate().
| std::vector<exprtk::expression<double> > MaterialPropertyLib::PerThreadData::value_expressions |
Value expressions evaluating the property value. Multi-component expressions corresponding one-to-one with the input XML entries, e.g.:
Definition at line 219 of file Function.cpp.
Referenced by compileExpressions().
| VariableArray MaterialPropertyLib::PerThreadData::variable_array |
Storage for vectorial variables (KelvinVector / DeformationGradient). Must be declared before symbol_table so it is initialized first (symbol_table stores pointers into variable_array).
Definition at line 203 of file Function.cpp.
Referenced by PerThreadData(), buildCopyOps(), and updateNonScalarVariables().