[petsc-users] Providing matrix vector product yourself for matrix free in SNES

Jed Brown jedbrown at mcs.anl.gov
Wed Dec 21 13:31:27 CST 2011


On Wed, Dec 21, 2011 at 11:30, <E.T.A.vanderWeide at utwente.nl> wrote:

> ierr = MatShellSetContext(mat, this);
>

This is fine.


> CHKERRQ(ierr);
>
> Later on in the call to MatShellGetContext I get the following error
> [0]PETSC ERROR: MatShellGetContext() line 201 in
> src/mat/impls/shell/shell.c Null Pointer: Parameter # 2
>

You need to pass a valid address. Show us what this code looks like. It
should be something like

MyContext *ptr;
MatShellGetContext(mat,&ptr);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111221/43c871bb/attachment.htm>


More information about the petsc-users mailing list