<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">On 21/7/2015 7:28 PM, Matthew Knepley
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAMYG4Gn9QHro7vymWcU16yAt3rKB1+nUXyCzFEt_MThbidJ+gQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Tue, Jul 21, 2015 at 1:35 AM, TAY
            wee-beng <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:zonexo@gmail.com" target="_blank">zonexo@gmail.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
              <br>
              I need to check the contents of the array which was
              declared using:<br>
              <br>
              PetscScalar,pointer ::
              u_array(:,:,:),v_array(:,:,:),w_array(:,:,:),p_array(:,:,:)<br>
              <br>
              I tried to use :<br>
              <br>
              call
              PetscViewerASCIIOpen(MPI_COMM_WORLD,"pres.txt",viewer,ierr)<br>
              <br>
              call VecView(p_array,viewer,ierr)<br>
              <br>
              or<br>
              <br>
              call MatView(p_array,viewer,ierr)<br>
              <br>
              call PetscViewerDestroy(viewer,ierr)<br>
              <br>
              but I got segmentation error. So is there a PETSc routine
              I can use?</blockquote>
            <div><br>
            </div>
            <div>No. Those routines work only for Vec objects. You could</div>
            <div><br>
            </div>
            <div> a) Declare a DMDA of the same size</div>
            <div><br>
            </div>
            <div> b) Use DMDAVecGetArrayF90() to get out the
              multidimensional array</div>
            <div><br>
            </div>
            <div> c) Use that in your code</div>
            <div><br>
            </div>
            <div> d) Use VecView() on the original vector</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Hi,<br>
    <br>
    Supposed I need to check the contents of the u_array which was
    declared using:<br>
    <br>
    PetscScalar,pointer :: u_array(:,:,:)<br>
    <br>
    call
DMDACreate3d(MPI_COMM_WORLD,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DMDA_STENCIL_STAR,size_x,size_y,&<br>
    <br>
size_z,1,PETSC_DECIDE,PETSC_DECIDE,1,stencil_width,lx,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,da_u,ierr)<br>
    <br>
    call DMDAVecGetArrayF90(da_u,u_local,u_array,ierr)<br>
    <br>
    call PetscViewerASCIIOpen(MPI_COMM_WORLD,"u.txt",viewer,ierr)<br>
            <br>
    call VecView(array,viewer,ierr)<br>
    <br>
    call PetscViewerDestroy(viewer,ierr)<br>
    <br>
    Is this the correct way?<br>
    <blockquote
cite="mid:CAMYG4Gn9QHro7vymWcU16yAt3rKB1+nUXyCzFEt_MThbidJ+gQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div>   Matt</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex"><span
                class="HOEnZb"><font color="#888888"><br>
                  -- <br>
                  Thank you<br>
                  <br>
                  Yours sincerely,<br>
                  <br>
                  TAY wee-beng<br>
                  <br>
                </font></span></blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div class="gmail_signature">What most experimenters take for
            granted before they begin their experiments is infinitely
            more interesting than any results to which their experiments
            lead.<br>
            -- Norbert Wiener</div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>