18 #include "libmesh/lumped_mass_matrix.h" 19 #include "libmesh/numeric_vector.h" 35 std::unique_ptr<SparseMatrix<T>>
39 auto mat_copy = std::make_unique<LumpedMassMatrix<T>>(this->comm());
43 mat_copy->init(*
this,
false);
49 std::unique_ptr<SparseMatrix<T>>
53 auto mat_copy = std::make_unique<LumpedMassMatrix<T>>(this->comm());
56 auto diag_copy = this->_diagonal->clone();
59 *mat_copy = std::move(*diag_copy);
70 libmesh_assert_msg(i == j,
"Set in a lumped mass matrix really only makes sense for i == j");
71 this->_diagonal->set(i, std::abs(
value));
78 this->_diagonal->add(i, std::abs(
value));
87 auto x_diagonal = this->_diagonal->zero_clone();
89 this->_diagonal->add(a, *x_diagonal);
92 libmesh_error_msg(
"Unsupported matrix type passed to LumpedMassMatrix::add");
99 *this->_diagonal = vec;
103 template <
typename T>
107 this->_diagonal->swap(vec);
virtual void set(const numeric_index_type i, const numeric_index_type j, const T value) override
Set the element (i,j) to value.
LumpedMassMatrix(const Parallel::Communicator &comm)
Constructor; initializes the matrix to be empty, without any structure, i.e.
virtual void add(const numeric_index_type i, const numeric_index_type j, const T value) override
Add value to the element (i,j).
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
The libMesh namespace provides an interface to certain functionality in the library.
dof_id_type numeric_index_type
virtual void get_diagonal(NumericVector< T > &dest) const =0
Copies the diagonal part of the matrix into dest.
Diagonal matrix class whose underlying storage is a vector.
virtual std::unique_ptr< SparseMatrix< T > > clone() const override
LumpedMassMatrix & operator=(LumpedMassMatrix &&)=default
Template class used to construct a lumped mass matrix.
virtual std::unique_ptr< SparseMatrix< T > > zero_clone() const override