From: Wolfgang Bangerth Date: Wed, 25 Jan 2023 22:53:53 +0000 (-0700) Subject: Merge pull request #14602 from luca-heltai/petsc-petscmat-to-dealiimat X-Git-Tag: v9.5.0-rc1~611 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b026ce639090a89b253d327533e8d7ba27daef7;p=dealii.git Merge pull request #14602 from luca-heltai/petsc-petscmat-to-dealiimat PETScWrappers:BlockSparseMatrix: constructor from PETSc Mat --- 0b026ce639090a89b253d327533e8d7ba27daef7 diff --cc include/deal.II/lac/petsc_block_sparse_matrix.h index eb52c62072,15db6f4f31..5fdf6d4173 --- a/include/deal.II/lac/petsc_block_sparse_matrix.h +++ b/include/deal.II/lac/petsc_block_sparse_matrix.h @@@ -294,13 -294,18 +299,24 @@@ namespace PETScWrapper Mat & petsc_matrix(); + /** + * This method assigns the PETSc Mat to the instance of the class. + * + * Note that the matrix is not copied: instead, the instance of this class + * is initialized to use the given matrix. This is useful if you want to + * interpret a PETSc Mat object as a deal.II BlockMatrix, and you already + * have a BlockMatrix object that you want to use for this purpose. + */ + void + assign_petsc_matrix(Mat A); + private: + /** + * A PETSc Mat object that describes the entire block matrix. + * Internally, this is done by creating + * a "nested" matrix using Petsc's MatCreateNest object whose individual + * blocks are the blocks of this matrix. + */ Mat petsc_nest_matrix = nullptr; };