[petsc-users] Fortran Example problem with MPI_COMM_WORLD
Jed Brown
jedbrown at mcs.anl.gov
Wed Jul 24 09:11:49 CDT 2013
Inge Gutheil <i.gutheil at fz-juelich.de> writes:
> Hello,
> in
>
> petsc-3.4.2/src/snes/examples/tests/ex12f.F it says
> 8 ! In this example the application context is a Fortran integer array:
> 9 ! ctx(1) = da - distributed array
> 10 ! 2 = F - global vector where the function is stored
> 11 ! 3 = xl - local work vector
> 12 ! 4 = comm - MPI communictor
> 13 ! 5 = unused
> 14 ! 6 = N - system size
>
> This array is declared as
> 34 PetscFortranAddr ctx(6)
True, this is not portable. F77 is terrible, but we can fix this
example by getting rid of the last three fields, instead opting for
MPI_Comm comm
call PetscObjectGetComm(da,comm,ierr)
call VecGetSize(F,N,ierr)
Also, this is totally bogus:
! Write results if first processor
if (ctx(4) .eq. 0) then
write(6,100) its
endif
Thanks for finding this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130724/b0fe78a5/attachment.pgp>
More information about the petsc-users
mailing list