18#ifndef LIBMESH_PETSC_SHELL_MATRIX_H
19#define LIBMESH_PETSC_SHELL_MATRIX_H
22#include "libmesh/libmesh_config.h"
24#ifdef LIBMESH_HAVE_PETSC
27#include "libmesh/libmesh_common.h"
28#include "libmesh/reference_counted_object.h"
29#include "libmesh/libmesh.h"
30#include "libmesh/shell_matrix.h"
31#include "libmesh/petsc_macro.h"
32#include "libmesh/petsc_solver_exception.h"
33#include "libmesh/petsc_vector.h"
34#include "libmesh/libmesh_common.h"
35#include "libmesh/wrapped_petsc.h"
52template <
typename Obj>
63template <
typename Obj>
99 virtual void clear ()
override;
101 virtual void init ()
override;
140 _is_initialized(false)
151 LibmeshPetscCall(MatGetSize(_mat, &m,
nullptr));
164 LibmeshPetscCall(MatGetSize(_mat,
nullptr, &n));
176 LibmeshPetscCall(MatGetLocalSize(_mat, &m,
nullptr));
189 LibmeshPetscCall(MatGetLocalSize(_mat,
nullptr, &n));
202 LibmeshPetscCall(MatGetDiagonal(_mat, petsc_dest.
vec()));
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
This class allows to use a PETSc shell matrix.
virtual numeric_index_type m() const override
virtual ~PetscShellMatrix()
virtual void init() override
PetscShellMatrix(const Parallel::Communicator &comm_in)
virtual void vector_mult_add(NumericVector< T > &dest, const NumericVector< T > &arg) const override
Multiplies the matrix with arg and adds the result to dest.
virtual bool initialized() const
Mat mat()
Returns a pointer to the underlying PETSc Mat object.
virtual numeric_index_type local_m() const
Mat _mat
Petsc Shell Matrix.
virtual void clear() override
virtual numeric_index_type local_n() const
virtual void get_diagonal(NumericVector< T > &dest) const override
Copies the diagonal part of the matrix into dest.
virtual numeric_index_type n() const override
virtual void vector_mult(NumericVector< T > &dest, const NumericVector< T > &arg) const override
Multiplies the matrix with arg and stores the result in dest.
This class provides a nice interface to PETSc's Vec object.
Generic shell matrix, i.e.
The libMesh namespace provides an interface to certain functionality in the library.
void init_shell_mat(Obj &obj, 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 blocksize_in)
Initialize a shell matrix object.
dof_id_type numeric_index_type