[petsc-users] MatCreateShell, MatShellGetContext, MatShellSetContext in fortran
Samuel Lanthaler
s.lanthaler at gmail.com
Mon Dec 11 12:41:57 CST 2017
Dear petsc-/slepc-users,
I have been trying to understand matrix-free/shell matrices in PETSc for
eventual use in solving a non-linear eigenvalue problem using SLEPC. But
I seem to be having trouble with calls to MatShellGetContext. As far as
I understand, this function should initialize a pointer (second
argument) so that the subroutine output will point to the context
associated with my shell-matrix (let's say of TYPE(MatCtx))? When
calling that subroutine, I get the following error message:
[0]PETSC ERROR: --------------------- Error Message
--------------------------------------------------------------
[0]PETSC ERROR: Null argument, when expecting valid pointer
[0]PETSC ERROR: Null Pointer: Parameter # 2
In my code, the second input argument to the routine is a null-pointer
of TYPE(MatCtx),POINTER :: arg2. Which the error message appears to be
unhappy with. I noticed that there is no error message if I instead pass
an object TYPE(MatCtx) :: arg2 to the routine... which doesn't really
make sense to me? Could someone maybe explain to me what is going on, here?
Just in case, let me also attach my concrete example code (it is
supposed to be a Fortran version of the slepc-example in
slepc-3.8.1/src/nep/examples/tutorials/ex21.c). I have added an extra
call to MatShellGetContext on line 138, after the function and jacobian
should supposedly have been set up.
Thanks a lot for your help!
Cheers,
Samuel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.f90
Type: text/x-fortran
Size: 11400 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20171211/d98db493/attachment.bin>
More information about the petsc-users
mailing list