20 #ifndef LIBMESH_PETSC_MATRIX_H 21 #define LIBMESH_PETSC_MATRIX_H 25 #ifdef LIBMESH_HAVE_PETSC 39 #undef semiparallel_only 43 #define semiparallel_only() do { if (this->initialized()) { const char * mytype; \ 44 MatGetType(_mat,&mytype); \ 45 if (!strcmp(mytype, MATSEQAIJ)) \ 46 parallel_object_only(); } } while (0) 48 #define semiparallel_only() 61 template <
typename T>
class DenseMatrix;
78 class PetscMatrix final :
public SparseMatrix<T>
92 PetscMatrix (
const Parallel::Communicator & comm_in);
103 const Parallel::Communicator & comm_in);
141 const std::vector<numeric_index_type> & n_nz,
142 const std::vector<numeric_index_type> & n_oz,
145 virtual void init ()
override;
154 virtual void clear ()
override;
156 virtual void zero ()
override;
158 virtual void zero_rows (std::vector<numeric_index_type> & rows, T diag_value = 0.0)
override;
160 virtual void close ()
override;
162 virtual void flush ()
override;
174 const T
value)
override;
178 const T
value)
override;
180 virtual void add_matrix (
const DenseMatrix<T> & dm,
181 const std::vector<numeric_index_type> & rows,
182 const std::vector<numeric_index_type> & cols)
override;
184 virtual void add_matrix (
const DenseMatrix<T> & dm,
185 const std::vector<numeric_index_type> & dof_indices)
override;
188 const std::vector<numeric_index_type> & brows,
189 const std::vector<numeric_index_type> & bcols)
override;
192 const std::vector<numeric_index_type> & dof_indices)
override 217 virtual bool closed()
const override;
262 const std::vector<numeric_index_type> & rows,
263 const std::vector<numeric_index_type> & cols,
264 const bool reuse_submatrix)
const override;
284 #endif // #ifdef LIBMESH_HAVE_PETSC 285 #endif // LIBMESH_PETSC_MATRIX_H std::string name(const ElemQuality q)
virtual void add_block_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &dof_indices) override
virtual T operator()(const numeric_index_type i, const numeric_index_type j) const override
void set_matrix_type(PetscMatrixType mat_type)
virtual void print_matlab(const std::string &name="") const override
bool _destroy_mat_on_exit
virtual void zero() override
PetscMatrix(const Parallel::Communicator &comm_in)
virtual numeric_index_type n() const override
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
void update_preallocation_and_zero()
virtual void init() override
virtual void add_block_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &brows, const std::vector< numeric_index_type > &bcols) override
virtual void print_personal(std::ostream &os=libMesh::out) const override
void swap(PetscMatrix< T > &)
dof_id_type numeric_index_type
PetscMatrix & operator=(const PetscMatrix &)=delete
virtual numeric_index_type row_stop() const override
virtual numeric_index_type m() const override
virtual void add(const numeric_index_type i, const numeric_index_type j, const T value) override
PetscMatrixType _mat_type
virtual void get_diagonal(NumericVector< T > &dest) const override
virtual void clear() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual bool closed() const override
virtual numeric_index_type row_start() const override
virtual void get_transpose(SparseMatrix< T > &dest) const override
virtual Real l1_norm() const override
virtual void add_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols) override
SparseMatrix interface to PETSc Mat.
virtual void _get_submatrix(SparseMatrix< T > &submatrix, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols, const bool reuse_submatrix) const override
virtual void zero_rows(std::vector< numeric_index_type > &rows, T diag_value=0.0) override
A matrix object used for finite element assembly and numerics.
OStreamProxy out(std::cout)
virtual void flush() override
virtual void close() override
virtual Real linfty_norm() const override