[petsc-users] [Fortran] VTK viewer error

Jed Brown jedbrown at mcs.anl.gov
Thu Apr 18 11:37:50 CDT 2013


Matthew Knepley <knepley at gmail.com> writes:

> On Thu, Apr 18, 2013 at 9:25 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
>> Dharmendar Reddy <dharmareddy84 at gmail.com> writes:
>>
>> > ! This line gives a compile error, as PETSCVIEWERVTK is not defined for
>> > FORTRAN
>> > !  !call PetscViewerSetType(viewer, PETSCVIEWERVTK)
>>
>
> I have pushed a Fortran example of this now:
>
>   src/dm/impls/plex/example/tutorials/ex1f90

Relative to Matt's example, you can use the following for
binary-appended XML, which is fast and works in parallel.

diff --git i/src/dm/impls/plex/examples/tutorials/ex1f90.F w/src/dm/impls/plex/examples/tutorials/ex1f90.F
index d6954e6..570ad9f 100644
--- i/src/dm/impls/plex/examples/tutorials/ex1f90.F
+++ w/src/dm/impls/plex/examples/tutorials/ex1f90.F
@@ -82,9 +82,7 @@
       CHKERRQ(ierr)
       call PetscViewerSetType(viewer, PETSCVIEWERVTK, ierr)
       CHKERRQ(ierr)
-      call PetscViewerSetFormat(viewer, PETSC_VIEWER_ASCII_VTK, ierr)
-      CHKERRQ(ierr)
-      call PetscViewerFileSetName(viewer, 'sol.vtk', ierr)
+      call PetscViewerFileSetName(viewer, 'sol.vtu', ierr)
       CHKERRQ(ierr)
       call VecView(u, viewer, ierr)
       CHKERRQ(ierr)


The example also leaks memory.  (Matt is fixing that.)


More information about the petsc-users mailing list