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" 39 # define LIBMESH_SAW_I 43 # undef I // Avoid complex.h contamination 52 template <
typename Obj>
63 template <
typename Obj>
99 virtual void clear ()
override;
101 virtual void init ()
override;
136 template <
typename T>
145 template <
typename T>
151 LibmeshPetscCall(MatGetSize(_mat, &m,
nullptr));
158 template <
typename T>
164 LibmeshPetscCall(MatGetSize(_mat,
nullptr, &n));
170 template <
typename T>
176 LibmeshPetscCall(MatGetLocalSize(_mat, &m,
nullptr));
183 template <
typename T>
189 LibmeshPetscCall(MatGetLocalSize(_mat,
nullptr, &n));
195 template <
typename T>
202 LibmeshPetscCall(MatGetDiagonal(_mat, petsc_dest.
vec()));
209 #endif // LIBMESH_HAVE_PETSC 210 #endif // LIBMESH_SPARSE_SHELL_MATRIX_H 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.
This class provides a nice interface to PETSc's Vec object.
Mat mat()
Returns a pointer to the underlying PETSc Mat object.
This class allows to use a PETSc shell matrix.
virtual void clear() override
virtual numeric_index_type local_n() const
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
Mat _mat
Petsc Shell Matrix.
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.
virtual numeric_index_type n() const override
virtual numeric_index_type m() 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.
virtual bool initialized() const
dof_id_type numeric_index_type
bool _is_initialized
Flag that tells if init() has been called.
virtual void get_diagonal(NumericVector< T > &dest) const override
Copies the diagonal part of the matrix into dest.
virtual numeric_index_type local_m() const
PetscShellMatrix(const Parallel::Communicator &comm_in)
virtual ~PetscShellMatrix()
Generic shell matrix, i.e.
virtual void init() override