通过解析数学表达式生成(通过 FParser)的函数。所有重写的虚拟函数在 function_base.h 中都有文档说明。 更多...
#include <parsed_function.h>
Public 成员函数 | |
| ParsedFunction (std::string expression, const std::vector< std::string > *additional_vars=nullptr, const std::vector< Output > *initial_vals=nullptr) | |
| 构造函数。使用给定的数学表达式创建一个 ParsedFunction。 更多... | |
| ParsedFunction (const ParsedFunction &) | |
| ParsedFunction & | operator= (const ParsedFunction &) |
| ParsedFunction (ParsedFunction &&)=default | |
| ParsedFunction & | operator= (ParsedFunction &&)=default |
| virtual | ~ParsedFunction ()=default |
| void | reparse (std::string expression) |
| 重新解析 ParsedFunction 的数学表达式。 更多... | |
| virtual Output | operator() (const Point &p, const Real time=0) override |
| 计算 ParsedFunction 在给定点上的值。 更多... | |
| virtual bool | has_derivatives () |
| 查询是否成功生成了自动导数。 更多... | |
| virtual Output | dot (const Point &p, const Real time=0) |
| 计算 ParsedFunction 在给定点上的点乘结果。 更多... | |
| virtual OutputGradient | gradient (const Point &p, const Real time=0) |
| 计算 ParsedFunction 在给定点上的梯度。 更多... | |
| virtual void | operator() (const Point &p, const Real time, DenseVector< Output > &output) override |
| 计算 ParsedFunction 在给定点上的输出并存储在输出向量中。 更多... | |
| virtual Output | component (unsigned int i, const Point &p, Real time) override |
| 计算 ParsedFunction 的特定分量在给定点上的值。 更多... | |
| const std::string & | expression () |
| 获取 ParsedFunction 的数学表达式。 更多... | |
| virtual Output & | getVarAddress (std::string_view variable_name) |
| 获取一个解析变量的地址,以便提供参数化的值。 更多... | |
| virtual std::unique_ptr < FunctionBase< Output > > | clone () const override |
| 克隆 ParsedFunction 对象。 更多... | |
| Output | get_inline_value (std::string_view inline_var_name) const |
| 获取内联变量的值。 更多... | |
| void | set_inline_value (std::string_view inline_var_name, Output newval) |
| Changes the value of an inline variable. 更多... | |
| ParsedFunction (std::string, const std::vector< std::string > *=nullptr, const std::vector< Output > *=nullptr) | |
| ParsedFunction (ParsedFunction &&)=delete | |
| LIBMESH_HAVE_FPARSER时,这个类没有实现, 所以让通过删除特殊函数来显式地实现它。 更多... | |
| ParsedFunction (const ParsedFunction &)=delete | |
| ParsedFunction & | operator= (const ParsedFunction &)=delete |
| ParsedFunction & | operator= (ParsedFunction &&)=delete |
| virtual | ~ParsedFunction ()=default |
| virtual Output | operator() (const Point &, const Real=0) |
| virtual void | operator() (const Point &, const Real, DenseVector< Output > &) |
用于时间无关的矢量值函数的评估函数。 将输出值设置在传入的 output DenseVector 中。 更多... | |
| virtual void | init () |
| 实际的初始化过程。 更多... | |
| virtual void | clear () |
| 清除函数。 更多... | |
| virtual Output & | getVarAddress (std::string_view) |
| virtual std::unique_ptr < FunctionBase< Output > > | clone () const |
| void | operator() (const Point &p, DenseVector< Output > &output) |
| Evaluation function for time-independent vector-valued functions. 更多... | |
| bool | initialized () const |
| void | set_is_time_dependent (bool is_time_dependent) |
| 设置函数是否依赖时间的函数。 这仅应该由无法本地确定时间依赖性的子类使用。 在这种情况下,应在构造之后立即使用这个函数。 更多... | |
| bool | is_time_dependent () const |
Protected 成员函数 | |
| void | partial_reparse (std::string expression) |
| 重新解析数学表达式,仅对表达式进行轻微更改。 更多... | |
| std::size_t | find_name (std::string_view varname, std::string_view expr) const |
| 解析出变量名的辅助函数。 更多... | |
| bool | expression_is_time_dependent (std::string_view expression) const |
| 检查表达式是否与时间有关。 更多... | |
Protected 属性 | |
| const FunctionBase * | _master |
指向我们的主函数对象的const指针,初始化为 nullptr。 可能存在需要多个函数的情况,但为了节省内存,一个主函数对象可以处理一些集中的数据。 更多... | |
| bool | _initialized |
当 init() 被调用以确保一切都准备好后,可以调用 operator() (...) 时为 true。 更多... | |
| bool | _is_time_dependent |
| 成员变量用于缓存函数是否真正依赖于时间。 更多... | |
Private 成员函数 | |
| void | set_spacetime (const Point &p, const Real time=0) |
| 设置 _spacetime 参数向量。 更多... | |
| Output | eval (FunctionParserADBase< Output > &parser, std::string_view libmesh_dbg_var(function_name), unsigned int libmesh_dbg_var(component_idx)) const |
| 评估第 i 个 FunctionParser 并检查结果。 更多... | |
Private 属性 | |
| std::string | _expression |
| 存储数学表达式的字符串表示。 更多... | |
| std::vector< std::string > | _subexpressions |
| 存储在数学表达式中找到的子表达式的字符串表示。 更多... | |
| std::vector< std::unique_ptr < FunctionParserADBase< Output > > > | parsers |
| 存储用于计算数学表达式的解析器的集合。 更多... | |
| std::vector< Output > | _spacetime |
| 存储空间-时间参数向量的值。 更多... | |
| std::vector< std::unique_ptr < FunctionParserADBase< Output > > > | dx_parsers |
| 存储用于计算导数的解析器的集合。 更多... | |
| std::vector< std::unique_ptr < FunctionParserADBase< Output > > > | dy_parsers |
| 存储用于计算二维场景中 y 方向导数的解析器的集合。 更多... | |
| std::vector< std::unique_ptr < FunctionParserADBase< Output > > > | dz_parsers |
| 存储用于计算三维场景中 z 方向导数的解析器的集合。 更多... | |
| std::vector< std::unique_ptr < FunctionParserADBase< Output > > > | dt_parsers |
| 存储用于计算时间导数的解析器的集合。 更多... | |
| bool | _valid_derivatives |
| 用于跟踪导数是否有效的标志。 更多... | |
| std::string | variables |
| 存储函数中可以解析和处理的变量名称和值。 更多... | |
| std::vector< std::string > | _additional_vars |
| 存储附加变量的名称,这些变量可以在函数中进行解析和处理。 更多... | |
| std::vector< Output > | _initial_vals |
| 存储函数中变量的初始值。 更多... | |
| Output | _dummy |
通过解析数学表达式生成(通过 FParser)的函数。所有重写的虚拟函数在 function_base.h 中都有文档说明。
在文件 parsed_function.h 第 58 行定义.
|
inlineexplicit |
构造函数。使用给定的数学表达式创建一个 ParsedFunction。
| expression | 数学表达式的字符串表示。 |
| additional_vars | 可选参数,附加的变量名(字符串向量),默认为空。 |
| initial_vals | 可选参数,初始值(输出向量),默认为空。 |
在文件 parsed_function.h 第 317 行定义.
参考 libMesh::FunctionBase< Output >::_initialized , 以及 libMesh::ParsedFunction< Output, OutputGradient >::reparse().
|
inline |
在文件 parsed_function.h 第 335 行定义.
参考 libMesh::ParsedFunction< Output, OutputGradient >::_expression, libMesh::FunctionBase< Output >::_initialized , 以及 libMesh::ParsedFunction< Output, OutputGradient >::reparse().
|
default |
|
virtualdefault |
|
inline |
在文件 parsed_function.h 第 845 行定义.
|
delete |
LIBMESH_HAVE_FPARSER时,这个类没有实现, 所以让通过删除特殊函数来显式地实现它。
|
delete |
|
virtualdefault |
|
inlinevirtual |
清除函数。
这个函数可以用来清除函数对象的状态,以备重新使用。
重载 libMesh::FunctionBase< Output > .
在文件 parsed_function.h 第 871 行定义.
|
inlineoverridevirtual |
克隆 ParsedFunction 对象。
实现了 libMesh::FunctionBase< Output >.
在文件 parsed_function.h 第 489 行定义.
|
inlinevirtual |
新副本应该足够“深”,以允许在不同线程中独立销毁和同时评估副本。
实现了 libMesh::FunctionBase< Output >.
在文件 parsed_function.h 第 873 行定义.
|
inlineoverridevirtual |
计算 ParsedFunction 的特定分量在给定点上的值。
| i | 要计算的分量的索引。 |
| p | 要计算分量值的点。 |
| time | 时间值。 |
i at coordinate p and time time. 重载 libMesh::FunctionBase< Output > .
在文件 parsed_function.h 第 455 行定义.
|
inlinevirtual |
计算 ParsedFunction 在给定点上的点乘结果。
| p | 要计算点乘结果的点。 |
| time | 时间值(可选,默认为0)。 |
在文件 parsed_function.h 第 404 行定义.
|
inlineprivate |
评估第 i 个 FunctionParser 并检查结果。
| parser | 要评估的 FunctionParser。 |
| function_name | 函数的名称。 |
| component_idx | 组件的索引。 |
在文件 parsed_function.h 第 779 行定义.
参考 libMesh::err.
|
inline |
获取 ParsedFunction 的数学表达式。
在文件 parsed_function.h 第 153 行定义.
|
inlineprotected |
检查表达式是否与时间有关。
| expression | 要检查的数学表达式的字符串表示。 |
在文件 parsed_function.h 第 745 行定义.
|
inlineprotected |
|
inline |
获取内联变量的值。
| inline_var_name | 内联变量的名称。 |
在文件 parsed_function.h 第 499 行定义.
参考 libMesh::Real.
参考自 libMesh::ParsedFunctionParameter< T >::get().
|
inlinevirtual |
获取一个解析变量的地址,以便提供参数化的值。
| variable_name | 要获取地址的变量名。 |
在文件 parsed_function.h 第 473 行定义.
|
inlinevirtual |
在文件 parsed_function.h 第 872 行定义.
|
inlinevirtual |
计算 ParsedFunction 在给定点上的梯度。
| p | 要计算梯度的点。 |
| time | 时间值(可选,默认为0)。 |
在文件 parsed_function.h 第 413 行定义.
|
inlinevirtual |
查询是否成功生成了自动导数。
在文件 parsed_function.h 第 103 行定义.
|
inlinevirtual |
实际的初始化过程。
这个函数可以用来进行函数对象的初始化工作。
重载 libMesh::FunctionBase< Output > .
在文件 parsed_function.h 第 870 行定义.
|
inlineinherited |
p 和时间 time 处的向量的分量 i。 子类可以选择重写这个函数以提高效率,因为默认实现基于向量评估,通常是不必要的低效率。
| i | 分量的索引。 |
| p | 坐标点。 |
| time | 时间。 |
i+1 的DenseVector的operator(),如果operator() 在该限制之外进行访问,将导致意外行为。 在文件 function_base.h 第 216 行定义.
|
inlineinherited |
true ,否则返回 false。 这个函数用于查询函数对象是否依赖于时间。有些函数对象的时间依赖性是从外部确定的,因此可以使用这个函数设置。
在文件 function_base.h 第 232 行定义.
参考自 libMesh::CompositeFunction< Output >::attach_subfunction().
|
inlineoverridevirtual |
计算 ParsedFunction 在给定点上的值。
| p | 要计算值的点。 |
| time | 时间值(可选,默认为0)。 |
实现了 libMesh::FunctionBase< Output >.
在文件 parsed_function.h 第 395 行定义.
|
inlineinherited |
Evaluation function for time-independent vector-valued functions.
Sets output values in the passed-in output DenseVector.
在文件 function_base.h 第 252 行定义.
|
inlineoverridevirtual |
计算 ParsedFunction 在给定点上的输出并存储在输出向量中。
| p | 要计算输出的点。 |
| time | 时间值。 |
| output | 存储计算结果的输出向量。 |
实现了 libMesh::FunctionBase< Output >.
在文件 parsed_function.h 第 433 行定义.
|
inlinevirtual |
p 和时间 time (默认为0)处的标量函数值。这是一个纯虚函数,因此必须重写它。
实现了 libMesh::FunctionBase< Output >.
在文件 parsed_function.h 第 862 行定义.
|
inlinevirtual |
用于时间无关的矢量值函数的评估函数。 将输出值设置在传入的 output DenseVector 中。
| p | 坐标点。 |
| output | 输出的向量。 |
实现了 libMesh::FunctionBase< Output >.
在文件 parsed_function.h 第 866 行定义.
|
inline |
在文件 parsed_function.h 第 355 行定义.
|
default |
|
delete |
|
delete |
|
inlineprotected |
重新解析数学表达式,仅对表达式进行轻微更改。
| expression | 新的数学表达式的字符串表示。 |
在文件 parsed_function.h 第 636 行定义.
参考 libMesh::Real.
|
inline |
重新解析 ParsedFunction 的数学表达式。
| expression | 新的数学表达式的字符串表示。 |
在文件 parsed_function.h 第 367 行定义.
参考自 libMesh::ParsedFunction< Output, OutputGradient >::ParsedFunction().
|
inline |
Changes the value of an inline variable.
| inline_var_name | 要更改的内联变量的名称。 |
| newval | 新的内联变量值。 |
在文件 parsed_function.h 第 572 行定义.
参考自 libMesh::ParsedFunctionParameter< T >::set().
|
inlineinherited |
设置函数是否依赖时间的函数。 这仅应该由无法本地确定时间依赖性的子类使用。 在这种情况下,应在构造之后立即使用这个函数。
在文件 function_base.h 第 224 行定义.
|
inlineprivate |
设置 _spacetime 参数向量。
| p | 要设置参数向量的点。 |
| time | 时间值(可选,默认为0)。 |
在文件 parsed_function.h 第 760 行定义.
|
private |
存储附加变量的名称,这些变量可以在函数中进行解析和处理。
在文件 parsed_function.h 第 304 行定义.
|
private |
在文件 parsed_function.h 第 878 行定义.
|
private |
存储数学表达式的字符串表示。
在文件 parsed_function.h 第 250 行定义.
参考自 libMesh::ParsedFunction< T >::expression() , 以及 libMesh::ParsedFunction< Output, OutputGradient >::ParsedFunction().
|
private |
存储函数中变量的初始值。
在文件 parsed_function.h 第 309 行定义.
|
protectedinherited |
当 init() 被调用以确保一切都准备好后,可以调用 operator() (...) 时为 true。
这个成员变量用于跟踪函数对象是否已经完成初始化,如果已经准备好进行评估,则为 true。
在文件 function_base.h 第 191 行定义.
参考自 libMesh::AnalyticFunction< Output >::AnalyticFunction(), libMesh::ConstFunction< Output >::ConstFunction(), libMesh::ParsedFunction< Output, OutputGradient >::ParsedFunction() , 以及 libMesh::WrappedFunction< Output >::WrappedFunction().
|
protectedinherited |
成员变量用于缓存函数是否真正依赖于时间。
在文件 function_base.h 第 197 行定义.
参考自 libMesh::CompositeFunction< Output >::attach_subfunction() , 以及 libMesh::ConstFunction< Output >::ConstFunction().
|
protectedinherited |
指向我们的主函数对象的const指针,初始化为 nullptr。 可能存在需要多个函数的情况,但为了节省内存,一个主函数对象可以处理一些集中的数据。
这个成员变量用于指向主函数对象的指针,有时候多个函数对象需要共享一些数据,可以通过主函数对象来管理。
在文件 function_base.h 第 184 行定义.
|
private |
存储空间-时间参数向量的值。
在文件 parsed_function.h 第 265 行定义.
|
private |
存储在数学表达式中找到的子表达式的字符串表示。
在文件 parsed_function.h 第 255 行定义.
|
private |
用于跟踪导数是否有效的标志。
在文件 parsed_function.h 第 294 行定义.
|
private |
存储用于计算时间导数的解析器的集合。
在文件 parsed_function.h 第 289 行定义.
|
private |
存储用于计算导数的解析器的集合。
在文件 parsed_function.h 第 270 行定义.
|
private |
存储用于计算二维场景中 y 方向导数的解析器的集合。
在文件 parsed_function.h 第 276 行定义.
|
private |
存储用于计算三维场景中 z 方向导数的解析器的集合。
在文件 parsed_function.h 第 283 行定义.
|
private |
存储用于计算数学表达式的解析器的集合。
在文件 parsed_function.h 第 260 行定义.
|
private |
存储函数中可以解析和处理的变量名称和值。
在文件 parsed_function.h 第 299 行定义.
1.8.5