[petsc-users] PETSC_VIEWER_DRAW_(Comm) Fortran interface missing?
Satish Balay
balay at mcs.anl.gov
Tue Mar 6 10:55:12 CST 2018
Hm - I do see the fortran interface code for PETSC_VIEWER_STDOUT_()
https://bitbucket.org/petsc/petsc/src/049452fa31a1384b9850ba16ebcec79c99e4198c/src/sys/classes/viewer/impls/ascii/ftn-custom/zvcreatef.c?at=master&fileviewer=file-view-default
and it does appear to work for me.
balay at asterix /home/balay/petsc/src/mat/examples/tests (master *=)
$ git diff
diff --git a/src/mat/examples/tests/ex16f90.F90 b/src/mat/examples/tests/ex16f90.F90
index 6bb83b4644..fee44aea95 100644
--- a/src/mat/examples/tests/ex16f90.F90
+++ b/src/mat/examples/tests/ex16f90.F90
@@ -15,6 +15,7 @@
PetscInt one
PetscScalar v(1)
PetscScalar, pointer :: array(:,:)
+ PetscViewer vw
call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
@@ -49,7 +50,8 @@
!
! Print the matrix to the screen
!
- call MatView(A,PETSC_VIEWER_STDOUT_WORLD,ierr);CHKERRA(ierr)
+ vw = PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
+ call MatView(A,vw,ierr);CHKERRA(ierr)
!
balay at asterix /home/balay/petsc/src/mat/examples/tests (master *=)
$ mpiexec -n 2 ./ex16f90
Mat Object: 2 MPI processes
type: mpidense
9.0000000000000000e+00 4.5000000000000000e+00
4.5000000000000000e+00 3.0000000000000000e+00
3.0000000000000000e+00 2.2500000000000000e+00
balay at asterix /home/balay/petsc/src/mat/examples/tests (master *=)
$
Satish
On Tue, 6 Mar 2018, Tim Steinhoff wrote:
> Hi Barry,
>
> thanks for your fast response. Yes, I'm fine with that.
> Indeed, my code with the routine PETSC_VIEWER_STDOUT_(comm) was
> compilable, but turned out it did not work properly at runtime
> (hangs).
> When using PETSC_VIEWER_DRAW_(comm), the compiler immediately gives an
> error and I was confused.
>
> Thanks,
>
> Volker
>
> By the way, the output parameter description of
> PetscViewerASCIIGetStdout is missing in the documentation:
> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerASCIIGetStdout.html
>
>
> 2018-03-06 16:26 GMT+01:00 Smith, Barry F. <bsmith at mcs.anl.gov>:
> >
> >
> > Tim,
> >
> > The PETSC_VIEWER_STDOUT_(comm) construct doesn't work in Fortran. Only the
> > PETSC_VIEWER_STDOUT_WORLD or PETSC_VIEWER_STDOUT_SELF work. This is also true for
> > draw see src/ksp/ksp/examples/tutorials/ex100f.F90
> >
> > Note that you can use PetscViewerDrawOpen() to get a draw to open on any communicator you like.
> >
> >
> > Does this answer your question or did I misunderstand?
> >
> > Barry
> >
> >
> >
> >
> >> On Mar 6, 2018, at 9:02 AM, Tim Steinhoff <kandanovian at gmail.com> wrote:
> >>
> >> Hi all,
> >>
> >> it seems like the routine PETSC_VIEWER_DRAW_(comm) is not available
> >> in Fortran, while PETSC_VIEWER_STDOUT_(comm) is.
> >> Is there anything I can do about it? (I am using the current maint
> >> branch of PETSc)
> >>
> >> Thank you very much and kind regards,
> >>
> >> Volker
> >
>
More information about the petsc-users
mailing list