[petsc-users] How to view petsc array?
Matthew Knepley
knepley at gmail.com
Tue Jul 21 06:28:27 CDT 2015
On Tue, Jul 21, 2015 at 1:35 AM, TAY wee-beng <zonexo at gmail.com> wrote:
> Hi,
>
> I need to check the contents of the array which was declared using:
>
> PetscScalar,pointer ::
> u_array(:,:,:),v_array(:,:,:),w_array(:,:,:),p_array(:,:,:)
>
> I tried to use :
>
> call PetscViewerASCIIOpen(MPI_COMM_WORLD,"pres.txt",viewer,ierr)
>
> call VecView(p_array,viewer,ierr)
>
> or
>
> call MatView(p_array,viewer,ierr)
>
> call PetscViewerDestroy(viewer,ierr)
>
> but I got segmentation error. So is there a PETSc routine I can use?
No. Those routines work only for Vec objects. You could
a) Declare a DMDA of the same size
b) Use DMDAVecGetArrayF90() to get out the multidimensional array
c) Use that in your code
d) Use VecView() on the original vector
Matt
>
> --
> Thank you
>
> Yours sincerely,
>
> TAY wee-beng
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150721/21c473cf/attachment.html>
More information about the petsc-users
mailing list