libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
Public 成员函数 | Protected 成员函数 | 静态 Protected 成员函数 | Protected 属性 | Private 属性 | 所有成员列表
libMesh::DenseSubMatrix< T > 模板类 参考

为有限元类型的计算定义密集子矩阵。 在将元素刚度矩阵相加到全局矩阵之前存储非常有用,特别是在存在方程组时。 所有重写的虚拟函数在 dense_matrix_base.h 中有文档。 更多...

#include <dense_submatrix.h>

类 libMesh::DenseSubMatrix< T > 继承关系图:
[图例]

Public 成员函数

 DenseSubMatrix (DenseMatrix< T > &new_parent, const unsigned int ioff=0, const unsigned int joff=0, const unsigned int m=0, const unsigned int n=0)
 构造函数。创建矩阵 parent 的密集子矩阵。子矩阵的维度为 $(m \times n)$, 子矩阵的 $(0,0)$ 元素位于父矩阵中的 $(ioff,joff)$ 位置。 更多...
 
 DenseSubMatrix (DenseSubMatrix &&)=default
 The 5 special functions can be defaulted for this class, as it does not manage any memory itself. 更多...
 
 DenseSubMatrix (const DenseSubMatrix &)=default
 
DenseSubMatrixoperator= (const DenseSubMatrix &)=default
 
DenseSubMatrixoperator= (DenseSubMatrix &&)=default
 
virtual ~DenseSubMatrix ()=default
 
DenseMatrix< T > & parent ()
 返回对父矩阵的引用。 更多...
 
virtual void zero () overridefinal
 覆盖基类的虚拟函数,将子矩阵的所有元素设置为零。 更多...
 
operator() (const unsigned int i, const unsigned int j) const
 返回子矩阵的 (i,j) 元素。 更多...
 
T & operator() (const unsigned int i, const unsigned int j)
 返回子矩阵的 (i,j) 元素的可写引用。 更多...
 
virtual T el (const unsigned int i, const unsigned int j) const overridefinal
 覆盖基类的虚函数,返回子矩阵的 (i,j) 元素。 更多...
 
virtual T & el (const unsigned int i, const unsigned int j) overridefinal
 覆盖基类的虚函数,返回子矩阵的 (i,j) 元素的可写引用。 更多...
 
virtual void left_multiply (const DenseMatrixBase< T > &M2) overridefinal
 覆盖基类的虚函数,左乘子矩阵。 更多...
 
virtual void right_multiply (const DenseMatrixBase< T > &M3) overridefinal
 覆盖基类的虚函数,右乘子矩阵。 更多...
 
void reposition (const unsigned int ioff, const unsigned int joff, const unsigned int new_m, const unsigned int new_n)
 修改子矩阵在父矩阵中的位置。 更多...
 
unsigned int i_off () const
 返回子矩阵在父矩阵中的行偏移。 更多...
 
unsigned int j_off () const
 返回子矩阵在父矩阵中的列偏移。 更多...
 
void condense (const unsigned int i, const unsigned int j, const T val, DenseSubVector< T > &rhs)
 将矩阵的 (i,j) 元素压缩成值 val 对于施加边界条件在数值模拟中很有用。保持矩阵的对称性。 更多...
 
unsigned int m () const
 返回矩阵的行维度。 更多...
 
unsigned int n () const
 返回矩阵的列维度。 更多...
 
void print (std::ostream &os=libMesh::out) const
 漂亮地打印矩阵,默认为 libMesh::out。 更多...
 
void print_scientific (std::ostream &os, unsigned precision=8) const
 以科学计数法格式打印矩阵。 更多...
 
template<typename T2 , typename T3 >
boostcopy::enable_if_c
< ScalarTraits< T2 >::value,
void >::type 
add (const T2 factor, const DenseMatrixBase< T3 > &mat)
 factor 添加到矩阵的每个元素。 这应该仅在 T += T2 * T3 是有效的 C++,且 T2 是标量的情况下工作。返回类型是 void。 更多...
 
DenseVector< T > diagonal () const
 返回矩阵的对角线。 更多...
 

Protected 成员函数

void condense (const unsigned int i, const unsigned int j, const T val, DenseVectorBase< T > &rhs)
 将矩阵的 (i,j) 条目压缩出来,强制它取值为 val。这对于在数值模拟中应用边界条件很有用。 保留矩阵的对称性。 更多...
 

静态 Protected 成员函数

static void multiply (DenseMatrixBase< T > &M1, const DenseMatrixBase< T > &M2, const DenseMatrixBase< T > &M3)
 辅助函数 - 执行计算 M1 = M2 * M3 其中: M1 = (m x n) M2 = (m x p) M3 = (p x n) 更多...
 

Protected 属性

unsigned int _m
 行维度。 更多...
 
unsigned int _n
 列维度。 更多...
 

Private 属性

DenseMatrix< T > & _parent_matrix
 包含该子矩阵的父矩阵。 引用父矩阵的对象,表示该子矩阵属于哪个父矩阵。 更多...
 
unsigned int _i_off
 子矩阵在父矩阵中的行偏移。 更多...
 
unsigned int _j_off
 子矩阵在父矩阵中的列偏移。 更多...
 

详细描述

template<typename T>
class libMesh::DenseSubMatrix< T >

为有限元类型的计算定义密集子矩阵。 在将元素刚度矩阵相加到全局矩阵之前存储非常有用,特别是在存在方程组时。 所有重写的虚拟函数在 dense_matrix_base.h 中有文档。

作者
Benjamin S. Kirk
日期
2003

在文件 dense_submatrix.h43 行定义.

构造及析构函数说明

template<typename T >
libMesh::DenseSubMatrix< T >::DenseSubMatrix ( DenseMatrix< T > &  new_parent,
const unsigned int  ioff = 0,
const unsigned int  joff = 0,
const unsigned int  m = 0,
const unsigned int  n = 0 
)
inline

构造函数。创建矩阵 parent 的密集子矩阵。子矩阵的维度为 $(m \times n)$, 子矩阵的 $(0,0)$ 元素位于父矩阵中的 $(ioff,joff)$ 位置。

参数
new_parent父矩阵的引用。
ioff子矩阵在父矩阵中的行偏移。
joff子矩阵在父矩阵中的列偏移。
m子矩阵的行数。
n子矩阵的列数。

在文件 dense_submatrix.h210 行定义.

参考 libMesh::DenseSubMatrix< T >::reposition().

214  :
215  DenseMatrixBase<T>(new_m,new_n),
216  _parent_matrix(new_parent)
217 {
218  this->reposition (ioff, joff, new_m, new_n);
219 }
void reposition(const unsigned int ioff, const unsigned int joff, const unsigned int new_m, const unsigned int new_n)
修改子矩阵在父矩阵中的位置。
DenseMatrix< T > & _parent_matrix
包含该子矩阵的父矩阵。 引用父矩阵的对象,表示该子矩阵属于哪个父矩阵。
template<typename T>
libMesh::DenseSubMatrix< T >::DenseSubMatrix ( DenseSubMatrix< T > &&  )
default

The 5 special functions can be defaulted for this class, as it does not manage any memory itself.

template<typename T>
libMesh::DenseSubMatrix< T >::DenseSubMatrix ( const DenseSubMatrix< T > &  )
default
template<typename T>
virtual libMesh::DenseSubMatrix< T >::~DenseSubMatrix ( )
virtualdefault

成员函数说明

template<typename T >
template<typename T2 , typename T3 >
boostcopy::enable_if_c< ScalarTraits< T2 >::value, void >::type libMesh::DenseMatrixBase< T >::add ( const T2  factor,
const DenseMatrixBase< T3 > &  mat 
)
inlineinherited

factor 添加到矩阵的每个元素。 这应该仅在 T += T2 * T3 是有效的 C++,且 T2 是标量的情况下工作。返回类型是 void。

参数
factor要添加的标量因子。
mat乘法的右操作数矩阵。

在文件 dense_matrix_base.h217 行定义.

参考 libMesh::DenseMatrixBase< T >::el(), libMesh::DenseMatrixBase< T >::m() , 以及 libMesh::DenseMatrixBase< T >::n().

219 {
220  libmesh_assert_equal_to (this->m(), mat.m());
221  libmesh_assert_equal_to (this->n(), mat.n());
222 
223  for (auto j : make_range(this->n()))
224  for (auto i : make_range(this->m()))
225  this->el(i,j) += factor*mat.el(i,j);
226 }
unsigned int n() const
返回矩阵的列维度。
virtual T el(const unsigned int i, const unsigned int j) const =0
返回矩阵的 (i,j) 元素。 由于内部数据表示可能不同,必须重新定义此函数。
unsigned int m() const
返回矩阵的行维度。
template<typename T>
void libMesh::DenseSubMatrix< T >::condense ( const unsigned int  i,
const unsigned int  j,
const T  val,
DenseSubVector< T > &  rhs 
)
inline

将矩阵的 (i,j) 元素压缩成值 val 对于施加边界条件在数值模拟中很有用。保持矩阵的对称性。

参数
i元素的行索引。
j元素的列索引。
val要施加的值。
rhs子矩阵的右侧向量。

在文件 dense_submatrix.h176 行定义.

参考 libMesh::DenseSubMatrix< T >::i_off(), libMesh::DenseSubMatrix< T >::j_off(), libMesh::DenseSubVector< T >::parent() , 以及 libMesh::DenseSubMatrix< T >::parent().

180  {
181  this->parent().condense(this->i_off()+i,
182  this->j_off()+j,
183  val, rhs.parent());
184  }
DenseMatrix< T > & parent()
返回对父矩阵的引用。
unsigned int i_off() const
返回子矩阵在父矩阵中的行偏移。
unsigned int j_off() const
返回子矩阵在父矩阵中的列偏移。
template<typename T >
void libMesh::DenseMatrixBase< T >::condense ( const unsigned int  iv,
const unsigned int  jv,
const T  val,
DenseVectorBase< T > &  rhs 
)
protectedinherited

将矩阵的 (i,j) 条目压缩出来,强制它取值为 val。这对于在数值模拟中应用边界条件很有用。 保留矩阵的对称性。

将矩阵列约减为已知值。

参数
i要压缩的行索引。
j要压缩的列索引。
val压缩出的值。
rhs与压缩操作相关联的右侧向量。
模板参数
T矩阵元素类型。
参数
iv列索引。
jv列索引。
val已知值。
rhs包含右侧向量的 DenseVectorBase 对象。

在文件 dense_matrix_base_impl.h94 行定义.

参考 libMesh::DenseVectorBase< T >::el() , 以及 libMesh::DenseVectorBase< T >::size().

参考自 libMesh::DenseMatrix< T >::condense().

98 {
99  libmesh_assert_equal_to(this->_m, rhs.size());
100  libmesh_assert_equal_to(iv, jv);
101 
102  // 将已知值移入 RHS,并将列置零
103  for (auto i : make_range(this->m()))
104  {
105  rhs.el(i) -= this->el(i, jv) * val;
106  this->el(i, jv) = 0.;
107  }
108 
109  // 将行置零
110  for (auto j : make_range(this->n()))
111  this->el(iv, j) = 0.;
112 
113  this->el(iv, jv) = 1.;
114  rhs.el(iv) = val;
115 }
unsigned int n() const
返回矩阵的列维度。
virtual T el(const unsigned int i, const unsigned int j) const =0
返回矩阵的 (i,j) 元素。 由于内部数据表示可能不同,必须重新定义此函数。
unsigned int m() const
返回矩阵的行维度。
unsigned int _m
行维度。
template<typename T >
DenseVector< T > libMesh::DenseMatrixBase< T >::diagonal ( ) const
inherited

返回矩阵的对角线。

返回稠密矩阵的对角线。

返回
矩阵对角线的 DenseVector。
模板参数
T矩阵元素类型。
返回
返回包含对角线元素的 DenseVector 对象。

在文件 dense_matrix_base_impl.h43 行定义.

参考自 libMesh::DiagonalMatrix< T >::add_matrix().

44 {
45  DenseVector<T> ret(_m);
46  for (decltype(_m) i = 0; i < _m; ++i)
47  ret(i) = el(i, i);
48  return ret;
49 }
virtual T el(const unsigned int i, const unsigned int j) const =0
返回矩阵的 (i,j) 元素。 由于内部数据表示可能不同,必须重新定义此函数。
unsigned int _m
行维度。
template<typename T>
virtual T libMesh::DenseSubMatrix< T >::el ( const unsigned int  i,
const unsigned int  j 
) const
inlinefinaloverridevirtual

覆盖基类的虚函数,返回子矩阵的 (i,j) 元素。

参数
i元素的行索引。
j元素的列索引。
返回
子矩阵的 (i,j) 元素。

实现了 libMesh::DenseMatrixBase< T >.

在文件 dense_submatrix.h112 行定义.

114  { return (*this)(i,j); }
template<typename T>
virtual T& libMesh::DenseSubMatrix< T >::el ( const unsigned int  i,
const unsigned int  j 
)
inlinefinaloverridevirtual

覆盖基类的虚函数,返回子矩阵的 (i,j) 元素的可写引用。

参数
i元素的行索引。
j元素的列索引。
返回
子矩阵的 (i,j) 元素的可写引用。

实现了 libMesh::DenseMatrixBase< T >.

在文件 dense_submatrix.h123 行定义.

125  { return (*this)(i,j); }
template<typename T>
unsigned int libMesh::DenseSubMatrix< T >::i_off ( ) const
inline

返回子矩阵在父矩阵中的行偏移。

返回
子矩阵在父矩阵中的行偏移。

在文件 dense_submatrix.h159 行定义.

参考 libMesh::DenseSubMatrix< T >::_i_off.

参考自 libMesh::DenseSubMatrix< T >::condense().

159 { return _i_off; }
unsigned int _i_off
子矩阵在父矩阵中的行偏移。
template<typename T>
unsigned int libMesh::DenseSubMatrix< T >::j_off ( ) const
inline

返回子矩阵在父矩阵中的列偏移。

返回
子矩阵在父矩阵中的列偏移。

在文件 dense_submatrix.h166 行定义.

参考 libMesh::DenseSubMatrix< T >::_j_off.

参考自 libMesh::DenseSubMatrix< T >::condense().

166 { return _j_off; }
unsigned int _j_off
子矩阵在父矩阵中的列偏移。
template<typename T >
void libMesh::DenseSubMatrix< T >::left_multiply ( const DenseMatrixBase< T > &  M2)
finaloverridevirtual

覆盖基类的虚函数,左乘子矩阵。

参数
M2另一个矩阵,用于左乘子矩阵。

实现了 libMesh::DenseMatrixBase< T >.

在文件 dense_submatrix.C31 行定义.

32 {
33  // (*this) <- M2 * M3
34  // Where:
35  // (*this) = (m x n),
36  // M2 = (m x p),
37  // M3 = (p x n)
38 
39  // M3 is a simply a copy of *this
40  DenseSubMatrix<T> M3(*this);
41 
42  // Call the multiply function in the base class
43  this->multiply(*this, M2, M3);
44 }
static void multiply(DenseMatrixBase< T > &M1, const DenseMatrixBase< T > &M2, const DenseMatrixBase< T > &M3)
辅助函数 - 执行计算 M1 = M2 * M3 其中: M1 = (m x n) M2 = (m x p) M3 = (p x n)
template<typename T>
unsigned int libMesh::DenseMatrixBase< T >::m ( ) const
inlineinherited

返回矩阵的行维度。

返回
矩阵的行维度。

在文件 dense_matrix_base.h115 行定义.

参考 libMesh::DenseMatrixBase< T >::_m.

参考自 libMesh::DenseMatrix< T >::_left_multiply_transpose(), libMesh::DenseMatrix< T >::_multiply_blas(), libMesh::DenseMatrix< T >::_right_multiply_transpose(), libMesh::DenseMatrix< T >::_svd_solve_lapack(), libMesh::DenseMatrixBase< T >::add(), libMesh::SparseMatrix< T >::add_block_matrix(), libMesh::PetscMatrix< T >::add_block_matrix(), libMesh::EigenSparseMatrix< T >::add_matrix(), libMesh::DiagonalMatrix< T >::add_matrix(), libMesh::LaspackMatrix< T >::add_matrix(), libMesh::EpetraMatrix< T >::add_matrix(), libMesh::PetscMatrix< T >::add_matrix(), libMesh::DofMap::build_constraint_matrix(), libMesh::DofMap::build_constraint_matrix_and_vector(), libMesh::DofMap::constrain_element_dyad_matrix(), libMesh::DofMap::constrain_element_matrix(), libMesh::DofMap::constrain_element_matrix_and_vector(), libMesh::DofMap::constrain_element_vector(), libMesh::DofMap::extract_local_vector(), libMesh::DenseMatrix< T >::get_transpose(), libMesh::DofMap::heterogeneously_constrain_element_jacobian_and_residual(), libMesh::DofMap::heterogeneously_constrain_element_matrix_and_vector(), libMesh::DofMap::heterogeneously_constrain_element_residual(), libMesh::DofMap::heterogeneously_constrain_element_vector(), libMesh::DenseMatrix< T >::left_multiply(), libMesh::DofMap::max_constraint_error(), libMesh::DenseMatrixBase< T >::multiply(), libMesh::DenseMatrix< T >::right_multiply() , 以及 MetaPhysicL::RawType< libMesh::DenseMatrix< T > >::value().

115 { return _m; }
unsigned int _m
行维度。
template<typename T >
void libMesh::DenseMatrixBase< T >::multiply ( DenseMatrixBase< T > &  M1,
const DenseMatrixBase< T > &  M2,
const DenseMatrixBase< T > &  M3 
)
staticprotectedinherited

辅助函数 - 执行计算 M1 = M2 * M3 其中: M1 = (m x n) M2 = (m x p) M3 = (p x n)

将两个矩阵相乘。

参数
M1乘法的结果矩阵。
M2乘法的左操作数矩阵。
M3乘法的右操作数矩阵。
模板参数
T矩阵元素类型。
参数
M1存储结果的矩阵。
M2第一个矩阵。
M3第二个矩阵。

在文件 dense_matrix_base_impl.h61 行定义.

参考 libMesh::DenseMatrixBase< T >::el(), libMesh::DenseMatrixBase< T >::m() , 以及 libMesh::DenseMatrixBase< T >::n().

64 {
65  // 断言确保我们传递了正确维度的矩阵
66  libmesh_assert_equal_to(M1.m(), M2.m());
67  libmesh_assert_equal_to(M1.n(), M3.n());
68  libmesh_assert_equal_to(M2.n(), M3.m());
69 
70  const unsigned int m_s = M2.m();
71  const unsigned int p_s = M2.n();
72  const unsigned int n_s = M1.n();
73 
74  // 通过这种方式执行是因为有很大的机会(至少对于约束矩阵来说)
75  // 在右乘时 M3(k,j) = 0.
76  for (unsigned int k = 0; k < p_s; k++)
77  for (unsigned int j = 0; j < n_s; j++)
78  if (M3.el(k, j) != 0.)
79  for (unsigned int i = 0; i < m_s; i++)
80  M1.el(i, j) += M2.el(i, k) * M3.el(k, j);
81 }
template<typename T>
unsigned int libMesh::DenseMatrixBase< T >::n ( ) const
inlineinherited

返回矩阵的列维度。

返回
矩阵的列维度。

在文件 dense_matrix_base.h122 行定义.

参考 libMesh::DenseMatrixBase< T >::_n.

参考自 libMesh::DenseMatrix< T >::_left_multiply_transpose(), libMesh::DenseMatrix< T >::_multiply_blas(), libMesh::DenseMatrix< T >::_right_multiply_transpose(), libMesh::DenseMatrix< T >::_svd_solve_lapack(), libMesh::DenseMatrixBase< T >::add(), libMesh::SparseMatrix< T >::add_block_matrix(), libMesh::PetscMatrix< T >::add_block_matrix(), libMesh::EigenSparseMatrix< T >::add_matrix(), libMesh::DiagonalMatrix< T >::add_matrix(), libMesh::LaspackMatrix< T >::add_matrix(), libMesh::EpetraMatrix< T >::add_matrix(), libMesh::PetscMatrix< T >::add_matrix(), libMesh::DofMap::build_constraint_matrix(), libMesh::DofMap::build_constraint_matrix_and_vector(), libMesh::DofMap::constrain_element_dyad_matrix(), libMesh::DofMap::constrain_element_matrix(), libMesh::DofMap::constrain_element_matrix_and_vector(), libMesh::DofMap::constrain_element_residual(), libMesh::DofMap::constrain_element_vector(), libMesh::DofMap::extract_local_vector(), libMesh::DenseMatrix< T >::get_transpose(), libMesh::DofMap::heterogeneously_constrain_element_jacobian_and_residual(), libMesh::DofMap::heterogeneously_constrain_element_matrix_and_vector(), libMesh::DofMap::heterogeneously_constrain_element_residual(), libMesh::DofMap::heterogeneously_constrain_element_vector(), libMesh::DenseMatrix< T >::left_multiply(), libMesh::DofMap::max_constraint_error(), libMesh::DenseMatrixBase< T >::multiply(), libMesh::DenseMatrix< T >::right_multiply() , 以及 MetaPhysicL::RawType< libMesh::DenseMatrix< T > >::value().

122 { return _n; }
unsigned int _n
列维度。
template<typename T >
T libMesh::DenseSubMatrix< T >::operator() ( const unsigned int  i,
const unsigned int  j 
) const
inline

返回子矩阵的 (i,j) 元素。

参数
i元素的行索引。
j元素的列索引。
返回
子矩阵的 (i,j) 元素。

在文件 dense_submatrix.h255 行定义.

257 {
258  libmesh_assert_less (i, this->m());
259  libmesh_assert_less (j, this->n());
260  libmesh_assert_less (i + this->i_off(), _parent_matrix.m());
261  libmesh_assert_less (j + this->j_off(), _parent_matrix.n());
262 
263  return _parent_matrix (i + this->i_off(),
264  j + this->j_off());
265 }
unsigned int n() const
返回矩阵的列维度。
unsigned int m() const
返回矩阵的行维度。
unsigned int i_off() const
返回子矩阵在父矩阵中的行偏移。
unsigned int j_off() const
返回子矩阵在父矩阵中的列偏移。
DenseMatrix< T > & _parent_matrix
包含该子矩阵的父矩阵。 引用父矩阵的对象,表示该子矩阵属于哪个父矩阵。
template<typename T >
T & libMesh::DenseSubMatrix< T >::operator() ( const unsigned int  i,
const unsigned int  j 
)
inline

返回子矩阵的 (i,j) 元素的可写引用。

参数
i元素的行索引。
j元素的列索引。
返回
子矩阵的 (i,j) 元素的可写引用。

在文件 dense_submatrix.h270 行定义.

272 {
273  libmesh_assert_less (i, this->m());
274  libmesh_assert_less (j, this->n());
275  libmesh_assert_less (i + this->i_off(), _parent_matrix.m());
276  libmesh_assert_less (j + this->j_off(), _parent_matrix.n());
277 
278  return _parent_matrix (i + this->i_off(),
279  j + this->j_off());
280 }
unsigned int n() const
返回矩阵的列维度。
unsigned int m() const
返回矩阵的行维度。
unsigned int i_off() const
返回子矩阵在父矩阵中的行偏移。
unsigned int j_off() const
返回子矩阵在父矩阵中的列偏移。
DenseMatrix< T > & _parent_matrix
包含该子矩阵的父矩阵。 引用父矩阵的对象,表示该子矩阵属于哪个父矩阵。
template<typename T>
DenseSubMatrix& libMesh::DenseSubMatrix< T >::operator= ( const DenseSubMatrix< T > &  )
default
template<typename T>
DenseSubMatrix& libMesh::DenseSubMatrix< T >::operator= ( DenseSubMatrix< T > &&  )
default
template<typename T>
DenseMatrix<T>& libMesh::DenseSubMatrix< T >::parent ( )
inline

返回对父矩阵的引用。

返回
对父矩阵的引用。

在文件 dense_submatrix.h78 行定义.

参考 libMesh::DenseSubMatrix< T >::_parent_matrix.

参考自 libMesh::DenseSubMatrix< T >::condense().

78 { return _parent_matrix; }
DenseMatrix< T > & _parent_matrix
包含该子矩阵的父矩阵。 引用父矩阵的对象,表示该子矩阵属于哪个父矩阵。
template<typename T >
void libMesh::DenseMatrixBase< T >::print ( std::ostream &  os = libMesh::out) const
inherited

漂亮地打印矩阵,默认为 libMesh::out。

以普通格式打印矩阵。

参数
os输出流,默认为 libMesh::out。
模板参数
T矩阵元素类型。
参数
os输出流。

在文件 dense_matrix_base_impl.h155 行定义.

156 {
157  for (auto i : make_range(this->m()))
158  {
159  for (auto j : make_range(this->n()))
160  os << std::setw(8)
161  << this->el(i, j) << " ";
162 
163  os << std::endl;
164  }
165 
166  return;
167 }
unsigned int n() const
返回矩阵的列维度。
virtual T el(const unsigned int i, const unsigned int j) const =0
返回矩阵的 (i,j) 元素。 由于内部数据表示可能不同,必须重新定义此函数。
unsigned int m() const
返回矩阵的行维度。
template<typename T >
void libMesh::DenseMatrixBase< T >::print_scientific ( std::ostream &  os,
unsigned  precision = 8 
) const
inherited

以科学计数法格式打印矩阵。

参数
os输出流。
precision打印的精度。
模板参数
T矩阵元素类型。
参数
os输出流。
precision打印的精度。

在文件 dense_matrix_base_impl.h126 行定义.

127 {
128  // 保存初始格式标志
129  std::ios_base::fmtflags os_flags = os.flags();
130 
131  // 打印矩阵元素
132  for (auto i : make_range(this->m()))
133  {
134  for (auto j : make_range(this->n()))
135  os << std::setw(15)
136  << std::scientific
137  << std::setprecision(precision)
138  << this->el(i, j) << " ";
139 
140  os << std::endl;
141  }
142 
143  // 恢复原始格式标志
144  os.flags(os_flags);
145 }
unsigned int n() const
返回矩阵的列维度。
virtual T el(const unsigned int i, const unsigned int j) const =0
返回矩阵的 (i,j) 元素。 由于内部数据表示可能不同,必须重新定义此函数。
unsigned int m() const
返回矩阵的行维度。
template<typename T >
void libMesh::DenseSubMatrix< T >::reposition ( const unsigned int  ioff,
const unsigned int  joff,
const unsigned int  new_m,
const unsigned int  new_n 
)
inline

修改子矩阵在父矩阵中的位置。

参数
ioff子矩阵在父矩阵中的新行偏移。
joff子矩阵在父矩阵中的新列偏移。
new_m子矩阵的新行数。
new_n子矩阵的新列数。

在文件 dense_submatrix.h224 行定义.

参考自 libMesh::DenseSubMatrix< T >::DenseSubMatrix().

228 {
229  _i_off = ioff;
230  _j_off = joff;
231  this->_m = new_m;
232  this->_n = new_n;
233 
234  // Make sure we still fit in the parent matrix.
235  libmesh_assert_less_equal ((this->i_off() + this->m()), _parent_matrix.m());
236  libmesh_assert_less_equal ((this->j_off() + this->n()), _parent_matrix.n());
237 }
unsigned int n() const
返回矩阵的列维度。
unsigned int _i_off
子矩阵在父矩阵中的行偏移。
unsigned int _j_off
子矩阵在父矩阵中的列偏移。
unsigned int m() const
返回矩阵的行维度。
unsigned int i_off() const
返回子矩阵在父矩阵中的行偏移。
unsigned int _n
列维度。
unsigned int j_off() const
返回子矩阵在父矩阵中的列偏移。
unsigned int _m
行维度。
DenseMatrix< T > & _parent_matrix
包含该子矩阵的父矩阵。 引用父矩阵的对象,表示该子矩阵属于哪个父矩阵。
template<typename T >
void libMesh::DenseSubMatrix< T >::right_multiply ( const DenseMatrixBase< T > &  M3)
finaloverridevirtual

覆盖基类的虚函数,右乘子矩阵。

参数
M3另一个矩阵,用于右乘子矩阵。

实现了 libMesh::DenseMatrixBase< T >.

在文件 dense_submatrix.C49 行定义.

50 {
51  // (*this) <- M2 * M3
52  // Where:
53  // (*this) = (m x n),
54  // M2 = (m x p),
55  // M3 = (p x n)
56 
57  // M2 is simply a copy of *this
58  DenseSubMatrix<T> M2(*this);
59 
60  // Call the multiply function in the base class
61  this->multiply(*this, M2, M3);
62 }
static void multiply(DenseMatrixBase< T > &M1, const DenseMatrixBase< T > &M2, const DenseMatrixBase< T > &M3)
辅助函数 - 执行计算 M1 = M2 * M3 其中: M1 = (m x n) M2 = (m x p) M3 = (p x n)
template<typename T >
void libMesh::DenseSubMatrix< T >::zero ( )
inlinefinaloverridevirtual

覆盖基类的虚拟函数,将子矩阵的所有元素设置为零。

实现了 libMesh::DenseMatrixBase< T >.

在文件 dense_submatrix.h243 行定义.

244 {
245  for (auto i : make_range(this->m()))
246  for (auto j : make_range(this->n()))
247  _parent_matrix(i + this->i_off(),
248  j + this->j_off()) = 0.;
249 }
unsigned int n() const
返回矩阵的列维度。
unsigned int m() const
返回矩阵的行维度。
unsigned int i_off() const
返回子矩阵在父矩阵中的行偏移。
unsigned int j_off() const
返回子矩阵在父矩阵中的列偏移。
DenseMatrix< T > & _parent_matrix
包含该子矩阵的父矩阵。 引用父矩阵的对象,表示该子矩阵属于哪个父矩阵。

类成员变量说明

template<typename T>
unsigned int libMesh::DenseSubMatrix< T >::_i_off
private

子矩阵在父矩阵中的行偏移。

在文件 dense_submatrix.h197 行定义.

参考自 libMesh::DenseSubMatrix< T >::i_off().

template<typename T>
unsigned int libMesh::DenseSubMatrix< T >::_j_off
private

子矩阵在父矩阵中的列偏移。

在文件 dense_submatrix.h202 行定义.

参考自 libMesh::DenseSubMatrix< T >::j_off().

template<typename T>
unsigned int libMesh::DenseMatrixBase< T >::_m
protectedinherited

行维度。

在文件 dense_matrix_base.h204 行定义.

参考自 libMesh::DenseMatrixBase< T >::m().

template<typename T>
unsigned int libMesh::DenseMatrixBase< T >::_n
protectedinherited

列维度。

在文件 dense_matrix_base.h209 行定义.

参考自 libMesh::DenseMatrixBase< T >::n().

template<typename T>
DenseMatrix<T>& libMesh::DenseSubMatrix< T >::_parent_matrix
private

包含该子矩阵的父矩阵。 引用父矩阵的对象,表示该子矩阵属于哪个父矩阵。

在文件 dense_submatrix.h192 行定义.

参考自 libMesh::DenseSubMatrix< T >::parent().


该类的文档由以下文件生成: