[petsc-users] output
Barry Smith
bsmith at mcs.anl.gov
Wed Jan 23 14:53:13 CST 2013
Sanjay,
Since you are wanting ASCII output you don't need to worry about absolute scalability. Thus what I would do is in your parallel PETSc application code save the vectors with VecView() to binary format. Then write a stand-alone sequential program in C, Matlab, Python that reads in the binary vectors with VecLoad() and outputs them in any way you want. Trying to do fancy ASCII output in parallel is not worth spending time.
Barry
On Jan 23, 2013, at 2:18 PM, "Kharche, Sanjay" <Sanjay.Kharche at liverpool.ac.uk> wrote:
>
> Dear All
>
> I am an absolute beginner to PetSc. I am trying to output PetSc vectors in a specific format. This may have been discussed before, but I have so far not found a solution.
>
> For 2 or 3 vectors, I do this:
>
> /*
> now write it to file.
> I would like row 1 to be u, row 2 to be b, and row 3 to be u. that way I can use
> gnuplots surf, and also all my existin matlab code for plotting/analysis.
> */
> PetscViewer viewer; // a Petsc file pointer.
> PetscViewerASCIIOpen(PETSC_COMM_WORLD,"ubx.dat",&viewer);
> VecView(u,viewer); // this comes out with information that I dont want, and in a column - I need to put it as a row.
> VecView(b,viewer);
> VecView(x,viewer);
> PetscViewerDestroy( &viewer );
>
> However, I have not been able to get rid of the information about procs, and also the vectors u, b, and u need to be in row format as:
> 1 2 1 1 1
> 0 0 0 1 0
> -1 2 -1 0
>
> rather than what I have now:
>
> Vector Object: 1 MPI processes
> type: seq
> 1
> 2
> 1
> 1
> 1
> etc....
>
>
> Any suggestions on how to do this will be appreciated.
>
> thanks
> Sanjay
More information about the petsc-users
mailing list