<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 19 August 2015 at 10:54, TAY wee-beng <span dir="ltr"><<a 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">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><span class="">
    <br>
    <div>On 21/7/2015 7:28 PM, Matthew Knepley
      wrote:<br>
    </div>
    <blockquote 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 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></span>
    Hi,<br>
    <br>
    Supposed I need to check the contents of the u_array which was
    declared using:<span class=""><br>
    <br>
    PetscScalar,pointer :: u_array(:,:,:)<br>
    <br></span>
    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></div></blockquote><div><br></div><div><br>The first argument of VecView must be of type Vec (as Matt noted).<br></div><div>It looks you are passing in an array of PetscScalar's.<br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
    <br>
    call PetscViewerDestroy(viewer,ierr)<br>
    <br>
    Is this the correct way?<span class=""><br>
    <blockquote 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><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>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>
  </span></div>

</blockquote></div><br></div></div>