[petsc-users] ksp_monitor_true_residual_norm

Jed Brown jedbrown at mcs.anl.gov
Thu Apr 19 14:00:03 CDT 2012


On Thu, Apr 19, 2012 at 11:32, Randall Mackie <rlmackie862 at gmail.com> wrote:

> I still get the same error message. Can you try
> /src/ksp/ksp/examples/tutorials/ex2f.F, but replace the
> call to KSPBuildSolution line 348 to
>
>         call KSPMonitorTrueResidualNorm(ksp,n,rnorm,dummy,ierr)
>
> That will reproduce the error.
>

Okay, this is much more clear. I do not know a way to pass
PETSC_NULL_OBJECT through Fortran without interaction from the Fortran
side. The reason is that (dummy .eq. PETSC_NULL_OBJECT) compares by value,
but the reference is actually passed. So

dummy = PETSC_NULL_OBJECT
call Anything(dummy)

is different from

call Anything(PETSC_NULL_OBJECT)


The current code is dangerous because (in the NULL case), the address of
"dummy" comes into the Fortran routine as 0x0, so anything that uses its
value will dereference that bad pointer. We can pass
mctx?mctx:PETSC_NULL_OBJECT_Fortran so that we never pass raw 0x0, but the
Fortran side would still have to test for equality to PETSC_NULL_OBJECT and
make the call differently. Can anyone think of a better way?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120419/30ab3266/attachment.htm>


More information about the petsc-users mailing list