[petsc-users] Printing parallel Vector in VTK format

Barry Smith bsmith at mcs.anl.gov
Fri Nov 26 10:42:04 CST 2010


  Jed,

    Can you please remove that bad code from those two examples if you haven't yet.

    Thanks

   Barry

On Nov 26, 2010, at 3:13 AM, Jed Brown wrote:

> 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



More information about the petsc-users mailing list