libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
dense_vector_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_DENSE_VECTOR_BASE_H
21 #define LIBMESH_DENSE_VECTOR_BASE_H
22 
23 
24 // Local Includes
25 #include "libmesh/libmesh_common.h"
26 
27 // C++ includes
28 
29 namespace libMesh
30 {
31 
39 template<typename T>
40 class DenseVectorBase
41 {
42 public:
46  DenseVectorBase() = default;
47 
51  DenseVectorBase (DenseVectorBase &&) = default;
52  DenseVectorBase (const DenseVectorBase &) = default;
53  DenseVectorBase & operator= (const DenseVectorBase &) = default;
55  virtual ~DenseVectorBase() = default;
56 
62  virtual void zero() = 0;
63 
69  virtual T el(const unsigned int i) const = 0;
70 
76  virtual T & el(const unsigned int i) = 0;
77 
81  virtual unsigned int size() const = 0;
82 
86  virtual bool empty() const { return (this->size() == 0); }
87 
93  void print(std::ostream & os) const;
94 
102  friend std::ostream & operator << (std::ostream & os, const DenseVectorBase<T> & v)
103  {
104  v.print(os);
105  return os;
106  }
107 
114  void print_scientific(std::ostream & os, unsigned precision=8) const;
115 };
116 
117 } // namespace libMesh
118 
119 
120 
121 #endif // LIBMESH_DENSE_VECTOR_BASE_H
void print_scientific(std::ostream &os, unsigned precision=8) const
以科学计数法在额外的小数位数下打印向量的条目。
virtual void zero()=0
将向量中的每个元素设置为0。由于派生类中的存储方法可能不同,需要将其声明为纯虚函数。
DenseVectorBase & operator=(const DenseVectorBase &)=default
virtual unsigned int size() const =0
void print(std::ostream &os) const
将向量漂亮地打印到 stdout。
virtual bool empty() const
virtual ~DenseVectorBase()=default
DenseVectorBase()=default
构造函数。
virtual T el(const unsigned int i) const =0