20 #ifndef LIBMESH_DENSE_SUBMATRIX_H
21 #define LIBMESH_DENSE_SUBMATRIX_H
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/dense_matrix.h"
26 #include "libmesh/dense_subvector.h"
27 #include "libmesh/int_range.h"
58 const unsigned int ioff=0,
59 const unsigned int joff=0,
60 const unsigned int m=0,
61 const unsigned int n=0);
83 virtual void zero() override final;
92 T operator() (const
unsigned int i,
93 const
unsigned int j) const;
102 T & operator() (const
unsigned int i,
103 const
unsigned int j);
112 virtual T
el(const
unsigned int i,
113 const
unsigned int j) const override final
114 {
return (*
this)(i,j); }
123 virtual T &
el(
const unsigned int i,
124 const unsigned int j)
override final
125 {
return (*
this)(i,j); }
150 const unsigned int joff,
151 const unsigned int new_m,
152 const unsigned int new_n);
177 const unsigned int j,
211 const unsigned int ioff,
212 const unsigned int joff,
213 const unsigned int new_m,
214 const unsigned int new_n) :
216 _parent_matrix(new_parent)
225 const unsigned int joff,
226 const unsigned int new_m,
227 const unsigned int new_n)
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());
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.;
256 const unsigned int j)
const
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());
263 return _parent_matrix (i + this->i_off(),
271 const unsigned int j)
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());
278 return _parent_matrix (i + this->i_off(),
286 #endif // LIBMESH_DENSE_SUBMATRIX_H
unsigned int n() const
返回矩阵的列维度。
unsigned int _i_off
子矩阵在父矩阵中的行偏移。
DenseVector< T > & parent()
virtual void right_multiply(const DenseMatrixBase< T > &M3) overridefinal
覆盖基类的虚函数,右乘子矩阵。
定义了一个用于有限元计算的稠密子向量。 在将元素载荷向量累加到全局向量之前存储这些载荷向量时特别有用,尤其是在存在方程组的情况下。 所有重写的虚拟函数在 dense_vector_base.h 中有文档说明。
DenseMatrix< T > & parent()
返回对父矩阵的引用。
unsigned int _j_off
子矩阵在父矩阵中的列偏移。
unsigned int m() const
返回矩阵的行维度。
unsigned int i_off() const
返回子矩阵在父矩阵中的行偏移。
void condense(const unsigned int i, const unsigned int j, const T val, DenseSubVector< T > &rhs)
将矩阵的 (i,j) 元素压缩成值 val 对于施加边界条件在数值模拟中很有用。保持矩阵的对称性。
为有限元类型的计算定义密集子矩阵。 在将元素刚度矩阵相加到全局矩阵之前存储非常有用,特别是在存在方程组时。 所有重写的虚拟函数在 dense_matrix_base.h 中有文档。
DenseSubMatrix & operator=(const DenseSubMatrix &)=default
virtual T & el(const unsigned int i, const unsigned int j) overridefinal
覆盖基类的虚函数,返回子矩阵的 (i,j) 元素的可写引用。
virtual void zero() overridefinal
覆盖基类的虚拟函数,将子矩阵的所有元素设置为零。
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 的密集子矩阵。子矩阵的维度为 , 子矩阵的 元素位于父矩阵中的 位置。
T operator()(const unsigned int i, const unsigned int j) const
返回子矩阵的 (i,j) 元素。
void reposition(const unsigned int ioff, const unsigned int joff, const unsigned int new_m, const unsigned int new_n)
修改子矩阵在父矩阵中的位置。
virtual T el(const unsigned int i, const unsigned int j) const overridefinal
覆盖基类的虚函数,返回子矩阵的 (i,j) 元素。
为有限元类型的计算定义了一个抽象的稠密矩阵基类。例如 DenseSubMatrices 可以从这个类派生出来。
定义用于有限元类型计算的密集矩阵。 用于在求和成全局矩阵之前存储单元刚度矩阵。所有被覆盖的虚函数都记录在dense_matrix_base.h中。
unsigned int j_off() const
返回子矩阵在父矩阵中的列偏移。
virtual ~DenseSubMatrix()=default
virtual void left_multiply(const DenseMatrixBase< T > &M2) overridefinal
覆盖基类的虚函数,左乘子矩阵。
DenseMatrix< T > & _parent_matrix
包含该子矩阵的父矩阵。 引用父矩阵的对象,表示该子矩阵属于哪个父矩阵。