libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
fem_function_base.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_FEM_FUNCTION_BASE_H
21 #define LIBMESH_FEM_FUNCTION_BASE_H
22 
23 // Local Includes
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/dense_vector.h" // required to instantiate a DenseVector<> below
26 #include "libmesh/fem_context.h"
27 
28 // C++ includes
29 #include <memory>
30 
31 namespace libMesh
32 {
33 
42 template <typename Output=Number>
43 class FEMFunctionBase
44 {
45 protected:
46 
50  FEMFunctionBase () = default;
51 
52 public:
53 
57  FEMFunctionBase (FEMFunctionBase &&) = default;
58  FEMFunctionBase (const FEMFunctionBase &) = default;
59  FEMFunctionBase & operator= (const FEMFunctionBase &) = default;
61  virtual ~FEMFunctionBase () = default;
62 
70  virtual void init_context (const FEMContext &) {}
71 
79  virtual std::unique_ptr<FEMFunctionBase<Output>> clone () const = 0;
80 
91  virtual Output operator() (const FEMContext &,
92  const Point & p,
93  const Real time = 0.) = 0;
94 
102  void operator() (const FEMContext &,
103  const Point & p,
104  DenseVector<Output> & output);
105 
116  virtual void operator() (const FEMContext &,
117  const Point & p,
118  const Real time,
119  DenseVector<Output> & output) = 0;
120 
133  virtual Output component(const FEMContext &,
134  unsigned int i,
135  const Point & p,
136  Real time=0.);
137 };
138 
139 template <typename Output>
140 inline
141 Output FEMFunctionBase<Output>::component (const FEMContext & context,
142  unsigned int i,
143  const Point & p,
144  Real time)
145 {
146  DenseVector<Output> outvec(i+1);
147  (*this)(context, p, time, outvec);
148  return outvec(i);
149 }
150 
151 template <typename Output>
152 inline
153 void FEMFunctionBase<Output>::operator() (const FEMContext & context,
154  const Point & p,
155  DenseVector<Output> & output)
156 {
157  // 调用时间相关的函数,t=0。
158  this->operator()(context, p, 0., output);
159 }
160 
161 } // namespace libMesh
162 #endif // LIBMESH_FEM_FUNCTION_BASE_H
FEMFunctionBase & operator=(const FEMFunctionBase &)=default
virtual void init_context(const FEMContext &)
准备上下文对象以供使用。
FEMFunctionBase()=default
默认构造函数。
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual ~FEMFunctionBase()=default
virtual Output operator()(const FEMContext &, const Point &p, const Real time=0.)=0
计算坐标p和时间time(默认为0)处的标量函数值。
virtual Output component(const FEMContext &, unsigned int i, const Point &p, Real time=0.)
返回坐标p和时间time的向量分量i。
virtual std::unique_ptr< FEMFunctionBase< Output > > clone() const =0
创建并返回函数的新副本。