libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
sparse_shell_matrix.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_SPARSE_SHELL_MATRIX_H
21 #define LIBMESH_SPARSE_SHELL_MATRIX_H
22 
23 
24 // Local includes
25 #include "libmesh/libmesh_common.h"
26 #include "libmesh/reference_counted_object.h"
27 #include "libmesh/libmesh.h"
28 #include "libmesh/shell_matrix.h"
29 #include "libmesh/sparse_matrix.h"
30 
31 namespace libMesh
32 {
33 
39 template <typename T>
40 class SparseShellMatrix : public ShellMatrix<T>
41 {
42 public:
48  explicit
49  SparseShellMatrix (const SparseMatrix<T> & new_m);
50 
54  virtual ~SparseShellMatrix ();
55 
61  virtual numeric_index_type m () const override;
62 
68  virtual numeric_index_type n () const override;
69 
76  virtual void vector_mult (NumericVector<T> & dest,
77  const NumericVector<T> & arg) const override;
78 
85  virtual void vector_mult_add (NumericVector<T> & dest,
86  const NumericVector<T> & arg) const override;
87 
93  virtual void get_diagonal (NumericVector<T> & dest) const override;
94 
95 protected:
100 };
101 
102 
103 
104 //-----------------------------------------------------------------------
105 // SparseShellMatrix inline members
106 template <typename T>
107 inline
109  ShellMatrix<T>(new_m.comm()),
110  _m(new_m)
111 {}
112 
113 
114 
115 template <typename T>
116 inline
118 {}
119 
120 
121 
122 template <typename T>
123 inline
125 {
126  return _m.m();
127 }
128 
129 
130 
131 template <typename T>
132 inline
134 {
135  return _m.n();
136 }
137 
138 
139 
140 template <typename T>
141 inline
143 {
144  _m.get_diagonal(dest);
145 }
146 
147 
148 } // namespace libMesh
149 
150 
151 #endif // LIBMESH_SPARSE_SHELL_MATRIX_H
virtual void vector_mult(NumericVector< T > &dest, const NumericVector< T > &arg) const override
将矩阵与参数arg相乘,并将结果存储在dest中。
virtual numeric_index_type n() const override
获取矩阵的列维度。
提供了不同线性代数库的向量存储方案的统一接口。
Definition: dof_map.h:67
这是一个通用的稀疏矩阵类。该类包含了必须在派生类中覆盖的纯虚拟成员。 使用一个公共的基类允许从不同的求解器包中以不同的格式统一访问稀疏矩阵。
Definition: dof_map.h:66
dof_id_type numeric_index_type
Definition: id_types.h:99
const SparseMatrix< T > & _m
稀疏矩阵。
virtual void vector_mult_add(NumericVector< T > &dest, const NumericVector< T > &arg) const override
将矩阵与参数arg相乘,然后将结果添加到dest中。
SparseShellMatrix(const SparseMatrix< T > &new_m)
Constructor; 接受稀疏矩阵的引用。稀疏矩阵本身必须在其他地方存储。
允许将任何SparseMatrix对象用作壳矩阵的类。
virtual ~SparseShellMatrix()
Destructor(析构函数)。
通用的Shell矩阵,即一个仅定义其对向量的作用的矩阵。此类包含必须在派生类中重写的纯虚拟成员。
virtual numeric_index_type m() const override
获取矩阵的行维度。
virtual void get_diagonal(NumericVector< T > &dest) const override
将矩阵的对角部分复制到dest中。