[petsc-users] MatShell & PCShell

Jed Brown jed at 59A2.org
Thu Jun 24 06:00:54 CDT 2010


On Thu, 24 Jun 2010 08:08:37 +0000, "Klaij, Christiaan" <C.Klaij at marin.nl> wrote:
> Thanks!  I modified ex15f so that it uses a new MatShell AA with
> associated multiplication Ax. Only problem is that MatCreateShell
> expects the local matrix dimensions which is somewhat contrary to the
> spirit of ex15f, but at least I got it working for one proc.

How is this contrary to the spirit?  It needs to be determined for
compatibility with the vector you will multiply against.  Perhaps it
should determine this automatically, but it's easy to provide, and
allows PETSc to check for this compatibility before calling your
function.  If it was determined automatically, then you would have to
check what PETSc decided so you can set up your internal data structures
(which you usually need in your implementation of MatMult)
appropriately.  I think it's more common to create these structures
first, then call MatCreateShell, in which case you know the local sizes.

Jed


More information about the petsc-users mailing list