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"
56 const unsigned int ioff=0,
57 const unsigned int joff=0,
58 const unsigned int m=0,
59 const unsigned int n=0);
76 virtual void zero() override final;
81 T operator() (const
unsigned int i,
82 const
unsigned int j) const;
87 T & operator() (const
unsigned int i,
88 const
unsigned int j);
90 virtual T
el(const
unsigned int i,
91 const
unsigned int j) const override final
92 {
return (*
this)(i,j); }
94 virtual T &
el(
const unsigned int i,
95 const unsigned int j)
override final
96 {
return (*
this)(i,j); }
106 const unsigned int joff,
107 const unsigned int new_m,
108 const unsigned int new_n);
127 const unsigned int j,
160 const unsigned int ioff,
161 const unsigned int joff,
162 const unsigned int new_m,
163 const unsigned int new_n) :
165 _parent_matrix(new_parent)
174 const unsigned int joff,
175 const unsigned int new_m,
176 const unsigned int new_n)
184 libmesh_assert_less_equal ((this->i_off() + this->m()), _parent_matrix.m());
185 libmesh_assert_less_equal ((this->j_off() + this->n()), _parent_matrix.n());
196 _parent_matrix(i + this->i_off(),
197 j + this->j_off()) = 0.;
205 const unsigned int j)
const
207 libmesh_assert_less (i, this->m());
208 libmesh_assert_less (j, this->n());
209 libmesh_assert_less (i + this->i_off(), _parent_matrix.m());
210 libmesh_assert_less (j + this->j_off(), _parent_matrix.n());
212 return _parent_matrix (i + this->i_off(),
220 const unsigned int j)
222 libmesh_assert_less (i, this->m());
223 libmesh_assert_less (j, this->n());
224 libmesh_assert_less (i + this->i_off(), _parent_matrix.m());
225 libmesh_assert_less (j + this->j_off(), _parent_matrix.n());
227 return _parent_matrix (i + this->i_off(),
238 const auto m = var.
m(), n = var.
n();
261 const auto m = var.
m(), n = var.
n();
262 bool has_inf =
false;
269 has_inf = has_inf ||
isinf(var(i,j));
287 const auto m = var.
m(), n = var.
n();
Defines an abstract dense matrix base class for use in Finite Element-type computations.
Defines a dense matrix for use in Finite Element-type computations.
Defines a dense submatrix for use in Finite Element-type computations.
virtual T el(const unsigned int i, const unsigned int j) const override final
void reposition(const unsigned int ioff, const unsigned int joff, const unsigned int new_m, const unsigned int new_n)
Changes the location of the submatrix in the parent matrix.
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)
Constructor.
DenseSubMatrix & operator=(const DenseSubMatrix &)=default
virtual ~DenseSubMatrix()=default
unsigned int _j_off
The column offset into the parent matrix.
unsigned int _i_off
The row offset into the parent matrix.
T operator()(const unsigned int i, const unsigned int j) const
unsigned int i_off() const
void condense(const unsigned int i, const unsigned int j, const T val, DenseSubVector< T > &rhs)
Condense-out the (i,j) entry of the matrix, forcing it to take on the value val.
virtual void left_multiply(const DenseMatrixBase< T > &M2) override final
Performs the operation: (*this) <- M2 * (*this)
virtual T & el(const unsigned int i, const unsigned int j) override final
DenseMatrix< T > & parent()
unsigned int j_off() const
DenseSubMatrix(DenseSubMatrix &&)=default
The 5 special functions can be defaulted for this class, as it does not manage any memory itself.
virtual void zero() override final
Set every element in the matrix to 0.
DenseMatrix< T > & _parent_matrix
The parent matrix that contains this submatrix.
DenseSubMatrix(const DenseSubMatrix &)=default
virtual void right_multiply(const DenseMatrixBase< T > &M3) override final
Performs the operation: (*this) <- (*this) * M3.
Defines a dense subvector for use in finite element computations.
DenseVector< T > & parent()
The libMesh namespace provides an interface to certain functionality in the library.
bool isfinite(std::complex< T > a)
bool isnan(std::complex< T > a)
bool isinf(std::complex< T > a)
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...