20 #ifndef LIBMESH_TRILINOS_EPETRA_MATRIX_H
21 #define LIBMESH_TRILINOS_EPETRA_MATRIX_H
23 #include "libmesh/libmesh_common.h"
25 #ifdef LIBMESH_TRILINOS_HAVE_EPETRA
28 #include "libmesh/ignore_warnings.h"
29 #include <Epetra_FECrsMatrix.h>
30 #include <Epetra_Map.h>
31 #include <Epetra_MpiComm.h>
34 #ifdef LIBMESH_TRILINOS_HAVE_EPETRAEXT
35 # include <EpetraExt_MatrixMatrix.h>
37 #include "libmesh/restore_warnings.h"
40 #include "libmesh/sparse_matrix.h"
50 template <
typename T>
class DenseMatrix;
83 const Parallel::Communicator & comm);
136 virtual void init (ParallelType parallelType = PARALLEL)
override;
141 virtual void clear () noexcept override;
146 virtual
void zero () override;
165 virtual
void close () override;
204 const T value) override;
215 const T value) override;
277 virtual
bool closed() const override;
315 Epetra_FECrsMatrix *
mat () { libmesh_assert(
_mat);
return _mat; }
325 const Epetra_FECrsMatrix *
mat ()
const { libmesh_assert(
_mat);
return _mat; }
356 #endif // LIBMESH_TRILINOS_HAVE_EPETRA
357 #endif // LIBMESH_TRILINOS_EPETRA_MATRIX_H
virtual ~EpetraMatrix()
析构函数
virtual std::unique_ptr< SparseMatrix< T > > clone() const override
创建矩阵克隆。
virtual numeric_index_type row_stop() const override
获取本地行索引的结束位置。
const Epetra_FECrsMatrix * mat() const
获取原始Epetra_FECrsMatrix指针(const版本)。
virtual void get_transpose(SparseMatrix< T > &dest) const override
获取矩阵的转置。
bool _destroy_mat_on_exit
在接口函数中是否销毁_mat。
virtual void update_sparsity_pattern(const SparsityPattern::Graph &graph) override
更新矩阵的稀疏性模式。这将告诉底层矩阵存储方案如何映射(i,j)元素。
bool _use_transpose
手动跟踪是否手动进行了转置。
virtual std::unique_ptr< SparseMatrix< T > > zero_clone() const override
创建零克隆矩阵。
virtual void init(const numeric_index_type m, const numeric_index_type n, const numeric_index_type m_l, const numeric_index_type n_l, const numeric_index_type nnz=30, const numeric_index_type noz=10, const numeric_index_type blocksize=1) override
初始化矩阵。
virtual void add_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols) override
添加稀疏矩阵的元素值。
virtual numeric_index_type n() const override
获取全局列数。
virtual void set(const numeric_index_type i, const numeric_index_type j, const T value) override
设置矩阵元素值。
这是一个通用的稀疏矩阵类。该类包含了必须在派生类中覆盖的纯虚拟成员。 使用一个公共的基类允许从不同的求解器包中以不同的格式统一访问稀疏矩阵。
dof_id_type numeric_index_type
Epetra_CrsGraph * _graph
稀疏性模式
virtual numeric_index_type m() const override
获取全局行数。
void swap(EpetraMatrix< T > &other)
交换内部数据指针,不交换实际值。
EpetraMatrix & operator=(const EpetraMatrix &)=delete
virtual numeric_index_type row_start() const override
获取本地行索引的起始位置。
virtual void close() override
关闭矩阵,使其无法再次修改。
virtual void print_personal(std::ostream &os=libMesh::out) const override
打印矩阵的个性化信息。
EpetraMatrix(const Parallel::Communicator &comm)
构造函数; 初始化矩阵为空,没有任何结构。矩阵不可用。仅用于成员类的矩阵。 所有其他矩阵应在所有必要信息都可用的数据流的某个点创建。
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real l1_norm() const override
获取矩阵的L1范数。
virtual Real linfty_norm() const override
获取矩阵的L∞范数。
virtual void get_diagonal(NumericVector< T > &dest) const override
获取矩阵的对角线元素。
virtual bool closed() const override
检查矩阵是否已关闭。
virtual void zero() override
将矩阵元素设置为零。
virtual void clear() noexceptoverride
清除矩阵。
Epetra_FECrsMatrix * _mat
实际Epetra数据类型来保存矩阵条目。
virtual void add(const numeric_index_type i, const numeric_index_type j, const T value) override
添加矩阵元素值。
Epetra_FECrsMatrix * mat()
获取原始Epetra_FECrsMatrix指针。
定义用于有限元类型计算的密集矩阵。 用于在求和成全局矩阵之前存储单元刚度矩阵。所有被覆盖的虚函数都记录在dense_matrix_base.h中。
此类提供了对Epetra数据结构的并行、稀疏矩阵的友好接口。所有重写的虚拟函数在sparse_matrix.h中都有文档。
virtual bool need_full_sparsity_pattern() const override
EpetraMatrix需要完整的稀疏性模式。