[petsc-users] vtk format

Jed Brown jedbrown at mcs.anl.gov
Wed Dec 18 14:11:45 CST 2013


Please always use "reply-all" so that your messages go to the list.

Khai Pham <khaipham at utexas.edu> writes:

> Hello Jed,
>
> May I join this topic with one question about vtk? I followed the 
> discussion on 
> http://lists.mcs.anl.gov/pipermail/petsc-users/2013-February/016506.html 
> to set the non-uniform grid coordinates. Then try to print out the vtk 
> file using:
>    ierr = PetscViewerCreate(PETSC_COMM_WORLD, &viewer);CHKERRQ(ierr);
>    ierr = PetscViewerSetType(viewer, PETSCVIEWERASCII);CHKERRQ(ierr);
>    ierr = PetscViewerFileSetName(viewer, file_name);CHKERRQ(ierr);
>    ierr = PetscViewerSetFormat(viewer,PETSC_VIEWER_ASCII_VTK);CHKERRQ(ierr);
>
>    ierr = DMView(dm, viewer);CHKERRQ(ierr);
>    ierr = VecView(v, viewer);CHKERRQ(ierr);

I don't know where you got this sequence, but it has been discouraged
since we added proper VTK support.  Use this:

  PetscViewerVTKOpen(comm,file_name,FILE_MODE_WRITE,&viewer);
  VecView(v,viewer);
  PetscViewerDestroy(&viewer);


The file name should end in .vtr for "rectangular" or .vts for
"structured" (when using DMDA), or with .vtu for "unstructured" (with
DMPlex).
-------------- 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/20131218/ea60659b/attachment.pgp>


More information about the petsc-users mailing list