libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
parsed_fem_function_parameter.h
浏览该文件的文档.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2023 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_PARSED_FEM_FUNCTION_PARAMETER_H
21 #define LIBMESH_PARSED_FEM_FUNCTION_PARAMETER_H
22 
23 
24 // Local Includes
25 #include "libmesh/libmesh_common.h"
26 #include "libmesh/parameter_accessor.h"
27 
28 // C++ Includes
29 #include <memory>
30 
31 namespace libMesh
32 {
33 
34 // 前向声明
35 template <typename T> class ParsedFEMFunction;
36 
46 template <typename T=Number>
47 class ParsedFEMFunctionParameter : public ParameterAccessor<T>
48 {
49 public:
61  std::string param_name) :
62  _func(func_ref), _name(std::move(param_name)) {}
63 
67  virtual ParameterAccessor<T> &
68  operator= (T * /* new_ptr */) { libmesh_error(); return *this; }
69 
75  virtual void set (const T & new_value) override {
76  _func.set_inline_value(_name, new_value);
77  }
78 
86  virtual const T & get () const override {
88  return _current_val;
89  }
90 
98  virtual std::unique_ptr<ParameterAccessor<T>> clone() const override {
99  return std::make_unique<ParsedFEMFunctionParameter<T>>(_func, _name);
100  }
101 
102 private:
104  std::string _name;
105 
106  // 我们需要从 get() 返回一个引用。这对于 libMesh::Number 来说是毫无意义的,但在处理字段参数时可能会变得有意义。
108 };
109 
110 } // namespace libMesh
111 
112 #endif // LIBMESH_PARSED_FEM_FUNCTION_PARAMETER_H
Output get_inline_value(std::string_view inline_var_name) const
获取内联变量的值。
virtual ParameterAccessor< T > & operator=(T *)
简单的重置器对解析函数无效。
ParsedFEMFunctionParameter(ParsedFEMFunction< T > &func_ref, std::string param_name)
构造函数:获取要修改的函数和表示我们的参数的内联变量的名称。
virtual std::unique_ptr< ParameterAccessor< T > > clone() const override
返回访问器的新副本。
void set_inline_value(std::string_view inline_var_name, Output newval)
更改内联变量的值。
virtual void set(const T &new_value) override
设置:更改我们访问的参数的值。
访问器对象,允许读取和修改参数灵敏度计算中的独立变量。