libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
numeric_vector.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_NUMERIC_VECTOR_H
21 #define LIBMESH_NUMERIC_VECTOR_H
22 
23 // Local includes
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/enum_parallel_type.h" // AUTOMATIC
26 #include "libmesh/id_types.h"
27 #include "libmesh/int_range.h"
28 #include "libmesh/reference_counted_object.h"
29 #include "libmesh/libmesh.h"
30 #include "libmesh/parallel_object.h"
31 #include "libmesh/dense_subvector.h"
32 #include "libmesh/dense_vector.h"
33 
34 // C++ includes
35 #include <cstddef>
36 #include <set>
37 #include <vector>
38 #include <memory>
39 #include <mutex>
40 
41 namespace libMesh
42 {
43 
44 
45 // forward declarations
46 template <typename T> class NumericVector;
47 template <typename T> class DenseVector;
48 template <typename T> class DenseSubVector;
49 template <typename T> class SparseMatrix;
50 template <typename T> class ShellMatrix;
51 enum SolverPackage : int;
52 
65 template <typename T>
66 class NumericVector : public ReferenceCountedObject<NumericVector<T>>,
67  public ParallelObject
68 {
69 public:
70 
77  explicit
78  NumericVector (const Parallel::Communicator & comm_in,
79  const ParallelType ptype = AUTOMATIC);
80 
88  explicit
89  NumericVector (const Parallel::Communicator & comm_in,
90  const numeric_index_type n,
91  const ParallelType ptype = AUTOMATIC);
92 
101  NumericVector (const Parallel::Communicator & comm_in,
102  const numeric_index_type n,
103  const numeric_index_type n_local,
104  const ParallelType ptype = AUTOMATIC);
105 
115  NumericVector (const Parallel::Communicator & comm_in,
116  const numeric_index_type N,
117  const numeric_index_type n_local,
118  const std::vector<numeric_index_type> & ghost,
119  const ParallelType ptype = AUTOMATIC);
120 
128  virtual NumericVector<T> & operator= (const NumericVector<T> & v) = 0;
129 
133  NumericVector (NumericVector &&) = default;
134  NumericVector (const NumericVector &) = default;
135  NumericVector & operator= (NumericVector &&) = default;
136 
140  virtual ~NumericVector() = default;
141 
150  static std::unique_ptr<NumericVector<T>>
151  build(const Parallel::Communicator & comm,
152  const SolverPackage solver_package = libMesh::default_solver_package());
153 
159  virtual bool initialized() const { return _is_initialized; }
160 
166  ParallelType type() const { return _type; }
167 
173  ParallelType & type() { return _type; }
174 
180  virtual bool closed() const { return _is_closed; }
181 
185  virtual void close () = 0;
186 
190  virtual void clear ();
191 
195  virtual void zero () = 0;
196 
204  virtual std::unique_ptr<NumericVector<T>> zero_clone () const = 0;
205 
213  virtual std::unique_ptr<NumericVector<T>> clone () const = 0;
214 
225  virtual void init (const numeric_index_type n,
226  const numeric_index_type n_local,
227  const bool fast = false,
228  const ParallelType ptype = AUTOMATIC) = 0;
229 
237  virtual void init (const numeric_index_type n,
238  const bool fast = false,
239  const ParallelType ptype = AUTOMATIC) = 0;
240 
250  virtual void init (const numeric_index_type n,
251  const numeric_index_type n_local,
252  const std::vector<numeric_index_type> & ghost,
253  const bool fast = false,
254  const ParallelType ptype = AUTOMATIC) = 0;
255 
262  virtual void init (const NumericVector<T> & other,
263  const bool fast = false) = 0;
264 
272  virtual NumericVector<T> & operator= (const T s) = 0;
273 
281  virtual NumericVector<T> & operator= (const std::vector<T> & v) = 0;
282 
288  virtual Real min () const = 0;
289 
295  virtual Real max () const = 0;
296 
302  virtual T sum() const = 0;
303 
309  virtual Real l1_norm () const = 0;
310 
316  virtual Real l2_norm () const = 0;
317 
323  virtual Real linfty_norm () const = 0;
324 
334  virtual Real subset_l1_norm (const std::set<numeric_index_type> & indices) const;
335 
345  virtual Real subset_l2_norm (const std::set<numeric_index_type> & indices) const;
346 
356  virtual Real subset_linfty_norm (const std::set<numeric_index_type> & indices) const;
357 
366  Real l2_norm_diff (const NumericVector<T> & other_vec) const;
367 
373  virtual numeric_index_type size () const = 0;
374 
380  virtual numeric_index_type local_size() const = 0;
381 
389  virtual numeric_index_type first_local_index() const = 0;
390 
398  virtual numeric_index_type last_local_index() const = 0;
399 
407  virtual T operator() (const numeric_index_type i) const = 0;
408 
416  virtual T el(const numeric_index_type i) const { return (*this)(i); }
417 
425  virtual void get(const std::vector<numeric_index_type> & index,
426  T * values) const;
427 
435  void get(const std::vector<numeric_index_type> & index,
436  std::vector<T> & values) const;
437 
445  virtual NumericVector<T> & operator += (const NumericVector<T> & v) = 0;
446 
454  virtual NumericVector<T> & operator -= (const NumericVector<T> & v) = 0;
455 
463  NumericVector<T> & operator *= (const T a) { this->scale(a); return *this; }
464 
472  virtual NumericVector<T> & operator *= (const NumericVector<T> & v) = 0;
473 
481  NumericVector<T> & operator /= (const T a) { this->scale(1./a); return *this; }
482 
490  virtual NumericVector<T> & operator /= (const NumericVector<T> & v) = 0;
491 
495  virtual void reciprocal() = 0;
496 
500  virtual void conjugate() = 0;
501 
510  virtual void set (const numeric_index_type i, const T value) = 0;
511 
520  virtual void add (const numeric_index_type i, const T value) = 0;
521 
528  virtual void add (const T s) = 0;
529 
537  virtual void add (const NumericVector<T> & v) = 0;
538 
547  virtual void add (const T a, const NumericVector<T> & v) = 0;
548 
557  virtual void add_vector (const T * v,
558  const std::vector<numeric_index_type> & dof_indices);
559 
569  void add_vector (const std::vector<T> & v,
570  const std::vector<numeric_index_type> & dof_indices);
571 
579  void add_vector (const NumericVector<T> & v,
580  const std::vector<numeric_index_type> & dof_indices);
581 
589  void add_vector (const DenseVector<T> & v,
590  const std::vector<numeric_index_type> & dof_indices);
591 
599  virtual void add_vector (const NumericVector<T> & v,
600  const SparseMatrix<T> & A) = 0;
601 
609  void add_vector (const NumericVector<T> & v,
610  const ShellMatrix<T> & A);
611 
619  virtual void add_vector_transpose (const NumericVector<T> & v,
620  const SparseMatrix<T> & A) = 0;
621 
628  virtual void insert (const T * v,
629  const std::vector<numeric_index_type> & dof_indices);
637  void insert (const NumericVector<T> & v,
638  const std::vector<numeric_index_type> & dof_indices);
639 
647  void insert (const DenseVector<T> & v,
648  const std::vector<numeric_index_type> & dof_indices);
649 
657  void insert (const DenseSubVector<T> & v,
658  const std::vector<numeric_index_type> & dof_indices);
659 
665  virtual void scale (const T factor) = 0;
666 
670  virtual void abs() = 0;
671 
681  virtual T dot(const NumericVector<T> & v) const = 0;
682 
688  virtual void localize (std::vector<T> & v_local) const = 0;
689 
695  virtual void localize (NumericVector<T> & v_local) const = 0;
696 
703  virtual void localize (NumericVector<T> & v_local,
704  const std::vector<numeric_index_type> & send_list) const = 0;
705 
738  virtual void localize (std::vector<T> & v_local,
739  const std::vector<numeric_index_type> & indices) const = 0;
740 
748  virtual void localize (const numeric_index_type first_local_idx,
749  const numeric_index_type last_local_idx,
750  const std::vector<numeric_index_type> & send_list) = 0;
751 
759  virtual void localize_to_one (std::vector<T> & v_local,
760  const processor_id_type proc_id=0) const = 0;
761 
778  virtual int compare (const NumericVector<T> & other_vector,
779  const Real threshold = TOLERANCE) const;
780 
781 
792  virtual int local_relative_compare (const NumericVector<T> & other_vector,
793  const Real threshold = TOLERANCE) const;
794 
815  virtual void pointwise_mult (const NumericVector<T> & vec1,
816  const NumericVector<T> & vec2) = 0;
817 
827  virtual void pointwise_divide (const NumericVector<T> & vec1,
828  const NumericVector<T> & vec2) = 0;
829 
835  virtual void print(std::ostream & os=libMesh::out) const;
836 
842  virtual void print_global(std::ostream & os=libMesh::out) const;
843 
847  friend std::ostream & operator << (std::ostream & os, const NumericVector<T> & v)
848  {
849  v.print_global(os);
850  return os;
851  }
852 
859  virtual void print_matlab(const std::string & /*name*/ = "") const
860  {
861  libmesh_not_implemented();
862  }
863 
871  virtual void create_subvector(NumericVector<T> & subvector,
872  const std::vector<numeric_index_type> & rows) const
873  {
874  libmesh_not_implemented();
875  }
876 
882  virtual void swap (NumericVector<T> & v);
883 
890  virtual std::size_t max_allowed_id() const = 0;
891 
897  bool readable() const;
898 
906  bool compatible(const NumericVector<T> & v) const;
907 
908 protected:
909 
914 
919 
923  ParallelType _type;
924 
929 };
930 
931 
932 /*----------------------- Inline functions ----------------------------------*/
933 
934 
935 
936 template <typename T>
937 inline
938 NumericVector<T>::NumericVector (const Parallel::Communicator & comm_in,
939  const ParallelType ptype) :
940  ParallelObject(comm_in),
941  _is_closed(false),
942  _is_initialized(false),
943  _type(ptype)
944 {
945 }
946 
947 
948 
949 template <typename T>
950 inline
951 NumericVector<T>::NumericVector (const Parallel::Communicator & comm_in,
952  const numeric_index_type /*n*/,
953  const ParallelType ptype) :
954  ParallelObject(comm_in),
955  _is_closed(false),
956  _is_initialized(false),
957  _type(ptype)
958 {
959  libmesh_not_implemented(); // Abstract base class!
960  // init(n, n, false, ptype);
961 }
962 
963 
964 
965 template <typename T>
966 inline
967 NumericVector<T>::NumericVector (const Parallel::Communicator & comm_in,
968  const numeric_index_type /*n*/,
969  const numeric_index_type /*n_local*/,
970  const ParallelType ptype) :
971  ParallelObject(comm_in),
972  _is_closed(false),
973  _is_initialized(false),
974  _type(ptype)
975 {
976  libmesh_not_implemented(); // Abstract base class!
977  // init(n, n_local, false, ptype);
978 }
979 
980 
981 
982 template <typename T>
983 inline
984 NumericVector<T>::NumericVector (const Parallel::Communicator & comm_in,
985  const numeric_index_type /*n*/,
986  const numeric_index_type /*n_local*/,
987  const std::vector<numeric_index_type> & /*ghost*/,
988  const ParallelType ptype) :
989  ParallelObject(comm_in),
990  _is_closed(false),
991  _is_initialized(false),
992  _type(ptype)
993 {
994  libmesh_not_implemented(); // 抽象基类!
995  // init(n, n_local, ghost, false, ptype);
996 }
997 
998 
999 
1000 template <typename T>
1001 inline
1003 {
1004  _is_closed = false;
1005  _is_initialized = false;
1006 }
1007 
1008 
1009 
1010 template <typename T>
1011 inline
1012 void NumericVector<T>::get(const std::vector<numeric_index_type> & index,
1013  T * values) const
1014 {
1015  const std::size_t num = index.size();
1016  for (std::size_t i=0; i<num; i++)
1017  {
1018  values[i] = (*this)(index[i]);
1019  }
1020 }
1021 
1022 
1023 
1024 template <typename T>
1025 inline
1026 void NumericVector<T>::get(const std::vector<numeric_index_type> & index,
1027  std::vector<T> & values) const
1028 {
1029  const std::size_t num = index.size();
1030  values.resize(num);
1031  if (!num)
1032  return;
1033 
1034  this->get(index, values.data());
1035 }
1036 
1037 
1038 
1039 template <typename T>
1040 inline
1041 void NumericVector<T>::add_vector(const std::vector<T> & v,
1042  const std::vector<numeric_index_type> & dof_indices)
1043 {
1044  libmesh_assert(v.size() == dof_indices.size());
1045  if (!v.empty())
1046  this->add_vector(v.data(), dof_indices);
1047 }
1048 
1049 
1050 
1051 template <typename T>
1052 inline
1054  const std::vector<numeric_index_type> & dof_indices)
1055 {
1056  libmesh_assert(v.size() == dof_indices.size());
1057  if (!v.empty())
1058  this->add_vector(&v(0), dof_indices);
1059 }
1060 
1061 
1062 
1063 template <typename T>
1064 inline
1065 void NumericVector<T>::insert(const std::vector<T> & v,
1066  const std::vector<numeric_index_type> & dof_indices)
1067 {
1068  libmesh_assert(v.size() == dof_indices.size());
1069  if (!v.empty())
1070  this->insert(v.data(), dof_indices);
1071 }
1072 
1073 
1074 
1075 template <typename T>
1076 inline
1078  const std::vector<numeric_index_type> & dof_indices)
1079 {
1080  libmesh_assert(v.size() == dof_indices.size());
1081  if (!v.empty())
1082  this->insert(&v(0), dof_indices);
1083 }
1084 
1085 
1086 
1087 template <typename T>
1088 inline
1090  const std::vector<numeric_index_type> & dof_indices)
1091 {
1092  libmesh_assert(v.size() == dof_indices.size());
1093  if (!v.empty())
1094  this->insert(&v(0), dof_indices);
1095 }
1096 
1097 
1098 
1099 // 复杂变量的print()成员的完全专门化。
1100 // 这必须先于非专门化版本,至少根据icc v7.1
1101 template <>
1102 inline
1103 void NumericVector<Complex>::print(std::ostream & os) const
1104 {
1105  libmesh_assert (this->initialized());
1106  os << "Size\tglobal = " << this->size()
1107  << "\t\tlocal = " << this->local_size() << std::endl;
1108 
1109  // std::complex<>::operator<<() is defined, but use this form
1110  os << "#\tReal part\t\tImaginary part" << std::endl;
1111  for (auto i : index_range(*this))
1112  os << i << "\t"
1113  << (*this)(i).real() << "\t\t"
1114  << (*this)(i).imag() << std::endl;
1115 }
1116 
1117 
1118 
1119 template <typename T>
1120 inline
1121 void NumericVector<T>::print(std::ostream & os) const
1122 {
1123  libmesh_assert (this->initialized());
1124  os << "Size\tglobal = " << this->size()
1125  << "\t\tlocal = " << this->local_size() << std::endl;
1126 
1127  os << "#\tValue" << std::endl;
1128  for (auto i : index_range(*this))
1129  os << i << "\t" << (*this)(i) << std::endl;
1130 }
1131 
1132 
1133 
1134 template <>
1135 inline
1136 void NumericVector<Complex>::print_global(std::ostream & os) const
1137 {
1138  libmesh_assert (this->initialized());
1139 
1140  std::vector<Complex> v(this->size());
1141  this->localize(v);
1142 
1143  // 现在我们只需要输出的一个副本
1144  if (this->processor_id())
1145  return;
1146 
1147  os << "Size\tglobal = " << this->size() << std::endl;
1148  os << "#\tReal part\t\tImaginary part" << std::endl;
1149  for (auto i : make_range(v.size()))
1150  os << i << "\t"
1151  << v[i].real() << "\t\t"
1152  << v[i].imag() << std::endl;
1153 }
1154 
1155 
1156 template <typename T>
1157 inline
1158 void NumericVector<T>::print_global(std::ostream & os) const
1159 {
1160  libmesh_assert (this->initialized());
1161 
1162  std::vector<T> v(this->size());
1163  this->localize(v);
1164 
1165  // 现在我们只需要输出的一个副本
1166  if (this->processor_id())
1167  return;
1168 
1169  os << "Size\tglobal = " << this->size() << std::endl;
1170  os << "#\tValue" << std::endl;
1171  for (auto i : make_range(v.size()))
1172  os << i << "\t" << v[i] << std::endl;
1173 }
1174 
1175 
1176 
1177 template <typename T>
1178 inline
1180 {
1181  std::swap(_is_closed, v._is_closed);
1182  std::swap(_is_initialized, v._is_initialized);
1183  std::swap(_type, v._type);
1184 }
1185 
1186 
1187 } // namespace libMesh
1188 
1189 
1190 // Workaround for weird boost/NumericVector interaction bug
1191 #ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION
1192 namespace boost { namespace multiprecision { namespace detail {
1193 template <typename T, typename To>
1194 struct is_lossy_conversion<libMesh::NumericVector<T>, To> {
1195  typedef boost::mpl::true_ type;
1196  static const bool value = type::value;
1197 };
1198 }}}
1199 #endif
1200 
1201 
1202 #endif // LIBMESH_NUMERIC_VECTOR_H
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
virtual void insert(const T *v, const std::vector< numeric_index_type > &dof_indices)
将 v 的条目插入到 *this 中,位置由 dof_indices 指定。请注意,此方法的库实现是线程安全的。
std::mutex _numeric_vector_mutex
用于执行线程安全操作的互斥锁。
virtual bool empty() const overridefinal
virtual int compare(const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const
比较 this 与 other_vector 的等效性,(在给定的 threshold 内) 如果等效则返回 -1 ,或者返回第一个索引,其中 abs(a[i]-b[i]) 超过阈值。 ...
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
virtual Real subset_linfty_norm(const std::set< numeric_index_type > &indices) const
获取指定条目的向量的最大绝对值,即指定条目的 -范数。
virtual void create_subvector(NumericVector< T > &subvector, const std::vector< numeric_index_type > &rows) const
使用 rows 中的索引从该向量中填充 subvector。类似于 SparseMatrix 类的 create_submatrix() 函数, 当前仅对 PetscVectors 实现了此功能。 ...
static constexpr Real TOLERANCE
virtual T sum() const =0
获取向量中所有值的总和。
virtual void add_vector_transpose(const NumericVector< T > &v, const SparseMatrix< T > &A)=0
计算 , 即将矩阵 A 的转置与 NumericVector v 的乘积添加到 this。
virtual numeric_index_type size() const =0
获取向量的大小。
virtual std::unique_ptr< NumericVector< T > > zero_clone() const =0
返回一个智能指针,指向具有相同类型、大小和分区的此向量的副本,但所有条目都为零。
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
计算 ,其中 v 是一个指针, 每个 dof_indices[i] 指定了要添加的值 v[i] 的位置。 这应该在子类中进行重写以提高效率。请注意,此方法的库实现是线程安全的。 ...
virtual T el(const numeric_index_type i) const
获取向量的第 i 个条目。
virtual NumericVector< T > & operator=(const NumericVector< T > &v)=0
一个复制赋值运算符
virtual bool empty() const overridefinal
Definition: dense_vector.h:116
ParallelType & type()
获取向量的类型。
提供了不同线性代数库的向量存储方案的统一接口。
Definition: dof_map.h:67
bool readable() const
检查该向量是否能够用于全局操作。
virtual std::unique_ptr< NumericVector< T > > clone() const =0
返回一个包装了此向量副本的智能指针。
bool _is_initialized
在调用 init() 后设置为 true。
virtual bool initialized() const
检查向量是否已经初始化。
virtual T dot(const NumericVector< T > &v) const =0
计算 ,即 (*this) 与向量 v 的点积。
virtual void init(const numeric_index_type n, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC)=0
更改向量的维度为 n 。如果可能的话 ,该向量的保留内存保持不变。 如果 n==0 ,所有内存都将被释放。因此,如果要调整向量的大小并释放不需要的内存, 必须首先调用 init(0) ,然后调用 ini...
uint8_t processor_id_type
Definition: id_types.h:104
virtual void zero()=0
将所有条目设置为零。等同于 v = 0,但更明显且更快。
定义了一个用于有限元计算的稠密子向量。 在将元素载荷向量累加到全局向量之前存储这些载荷向量时特别有用,尤其是在存在方程组的情况下。 所有重写的虚拟函数在 dense_vector_base.h 中有文档说明。
这是一个通用的稀疏矩阵类。该类包含了必须在派生类中覆盖的纯虚拟成员。 使用一个公共的基类允许从不同的求解器包中以不同的格式统一访问稀疏矩阵。
Definition: dof_map.h:66
SolverPackage default_solver_package()
Definition: libmesh.C:967
virtual void scale(const T factor)=0
缩放向量的每个元素。
virtual void localize_to_one(std::vector< T > &v_local, const processor_id_type proc_id=0) const =0
在处理器 proc_id 上创建全局向量的本地副本。 默认情况下,数据发送到处理器 0。此方法对于从一个处理器输出数据非常有用。
virtual Real l2_norm() const =0
获取向量的 -范数,即条目平方和的平方根。
virtual NumericVector< T > & operator+=(const NumericVector< T > &v)=0
将向量加上 v , 。等价于 u.add(1, v)。
virtual void print_matlab(const std::string &="") const
以Matlab的稀疏矩阵格式打印向量内容。可选择将向量打印到名为 name 的文件中。 如果未指定 name,则内容将被打印到屏幕上。
virtual ~NumericVector()=default
虽然这个类不管理任何内存,但派生类可能会管理内存,用户可能会通过指向这个基类的指针删除内存。
dof_id_type numeric_index_type
Definition: id_types.h:99
bool _is_initialized
Flag that tells if init() has been called.
Definition: libmesh.C:242
NumericVector(const Parallel::Communicator &comm_in, const ParallelType ptype=AUTOMATIC)
虚拟构造函数。维度=0。
NumericVector< T > & operator/=(const T a)
将向量缩放为 1/a , 。等价于 u.scale(1.
NumericVector< T > & operator*=(const T a)
将向量缩放为 a , 。等价于 u.scale(a)。
virtual Real subset_l1_norm(const std::set< numeric_index_type > &indices) const
获取指定条目的向量的 -范数,即指定条目的绝对值之和。
virtual int local_relative_compare(const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const
比较该向量与另一个向量的局部相对差异。
OStreamProxy out
virtual void print_global(std::ostream &os=libMesh::out) const
打印全局向量的内容,默认输出到 libMesh::out 流。
virtual Real max() const =0
获取向量中的最大值,或者在复数情况下获取最大的实部。
virtual Real min() const =0
获取向量中的最小值,或者在复数情况下获取最小的实部。
virtual Real l1_norm() const =0
获取向量的 -范数,即条目的绝对值之和。
virtual void close()=0
调用 NumericVector 的内部组装函数,确保值在处理器之间一致。
ParallelType _type
向量的类型。
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
构建一个 NumericVector 对象。
virtual unsigned int size() const overridefinal
virtual void pointwise_mult(const NumericVector< T > &vec1, const NumericVector< T > &vec2)=0
比较该向量与另一个向量的全局相对差异。
virtual void abs()=0
设置 ,对向量中的每个条目进行绝对值操作。
virtual numeric_index_type first_local_index() const =0
获取实际存储在该处理器上的第一个向量元素的索引。
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual NumericVector< T > & operator-=(const NumericVector< T > &v)=0
将 v 从 *this 减去, 。等价于 u.add(-1, v)。
virtual void swap(NumericVector< T > &v)
交换该向量的内容与向量 v 的内容。子类应提供足够的间接性以使此操作成为 O(1) 的头部交换操作。
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
一次访问多个组件。 values 将 *不会* 重新分配空间;它应该已经具有足够的空间。 默认实现对每个索引调用 operator() ,但某些实现可能在此处提供更快的方法。 ...
virtual numeric_index_type local_size() const =0
获取向量的本地大小,即 index_stop - index_start。
virtual std::size_t max_allowed_id() const =0
返回 NumericVector 可以包含的最大条目数(在所有处理器上)。
ParallelType type() const
获取向量的类型。
virtual void print(std::ostream &os=libMesh::out) const
打印本地向量的内容,默认输出到 libMesh::out 流。
bool initialized()
Checks that library initialization has been done.
Definition: libmesh.C:261
virtual void clear()
将 NumericVector&lt;T&gt; 恢复到原始状态。
virtual void set(const numeric_index_type i, const T value)=0
设置 v(i) = value 。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex 。
定义用于有限元计算的稠密向量类。该类基本上是为了补充 DenseMatrix 类而设计的。 它相对于 std::vector 具有额外的功能,使其在有限元中特别有用,特别是对于方程组。 所有重写的虚拟函...
Definition: dof_map.h:64
boost::multiprecision::float128 imag(const boost::multiprecision::float128)
virtual void reciprocal()=0
计算每个向量条目的分量倒数, 。
通用的Shell矩阵,即一个仅定义其对向量的作用的矩阵。此类包含必须在派生类中重写的纯虚拟成员。
virtual void add(const numeric_index_type i, const T value)=0
将 value 添加到由 i 指定的向量条目。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex 。
virtual T operator()(const numeric_index_type i) const =0
获取向量的第 i 个条目的副本。
virtual unsigned int size() const overridefinal
Definition: dense_vector.h:111
virtual numeric_index_type last_local_index() const =0
获取实际存储在该处理器上的最后一个向量元素的索引+1。
bool compatible(const NumericVector< T > &v) const
检查该向量和向量 v 是否能够一起用于全局操作。
virtual Real linfty_norm() const =0
获取向量的 -范数,即向量的最大绝对值。
virtual Real subset_l2_norm(const std::set< numeric_index_type > &indices) const
获取指定条目的向量的 -范数,即指定条目平方和的平方根。
virtual void pointwise_divide(const NumericVector< T > &vec1, const NumericVector< T > &vec2)=0
计算该向量与另一个向量的逐点除法。
bool _is_closed
用于跟踪向量的值在在一些或全部处理器上进行插入或添加值操作后是否在所有处理器上保持一致的标志。
virtual void conjugate()=0
反转向量中每个条目的虚部。
Real l2_norm_diff(const NumericVector< T > &other_vec) const
获取 -范数的向量差值 , 其中 是 this。
virtual void localize(std::vector< T > &v_local) const =0
创建全局向量的副本并存储在本地向量 v_local 中。