[petsc-users] Printing parallel Vector in VTK format

Jed Brown jed at 59A2.org
Fri Nov 26 03:13:31 CST 2010


On Fri, Nov 26, 2010 at 06:36, khalid ashraf <khalid_eee at yahoo.com> wrote:

> Thanks Barry. I get the correct output when I use
> VecView(w,PETSC_VIEWER_STDOUT_WORLD)
>
> But if I use the VecView_VTK function from the file
> ksp/ksp/examples/tutorials/ex29.c
>
> then I get different results.
>

This is a crucial piece of information, if you stated this in the first
email, you would have gotten a good answer to your first email.

The problem is that this function and the copy in ex50.c, never worked in
parallel.  Clearly the person who wrote it misunderstood the VTK legacy
format because nothing similar can work in parallel.  See
src/snes/examples/tutorials/ex5.c for the correct way to do it:

    PetscViewer viewer;
    ierr = PetscViewerCreate(PETSC_COMM_WORLD, &viewer);CHKERRQ(ierr);
    ierr = PetscViewerSetType(viewer, PETSCVIEWERASCII);CHKERRQ(ierr);
    ierr = PetscViewerFileSetName(viewer, "ex5_sol.vtk");CHKERRQ(ierr);
    ierr = PetscViewerSetFormat(viewer,
PETSC_VIEWER_ASCII_VTK);CHKERRQ(ierr);
    ierr = DAView(user.da, viewer);CHKERRQ(ierr);
    ierr = VecView(x, viewer);CHKERRQ(ierr);
    ierr = PetscViewerDestroy(viewer);CHKERRQ(ierr);

Jed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101126/31c1b6cf/attachment.htm>


More information about the petsc-users mailing list