<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Thanks to everyone which helped to fix
the bug.<br>
<br>
Let me restate my problem.<br>
<br>
I have used DMDACreate2d (dof = 2) for my code and solve the
equation. Using<br>
<br>
<i>call KSPSolve(ksp_semi,b_rhs_semi_global,velocity_global,ierr)<br>
<br>
call
DMGlobalToLocalBegin(da,velocity_global,INSERT_VALUES,velocity_local,ierr)<br>
call
DMGlobalToLocalEnd(da,velocity_global,INSERT_VALUES,velocity_local,ierr)<br>
<br>
call VecGetArrayF90(velocity_local,p_velocity,ierr)<br>
<br>
do j = start_ij(2),end_ij(2)<br>
<br>
do i = start_ij(1),end_ij(1)<br>
<br>
du(i,j)=p_velocity(ij)<br>
<br>
dv(i,j)=p_velocity(ij+1)<br>
<br>
ij=ij+2<br>
<br>
end do<br>
<br>
end do</i><br>
<br>
<i>call VecRestoreArrayF90(velocity_local,p_velocity,ierr)</i><br>
<br>
The above du,dv correspond to the region without the ghost cell.
I would like to have the ghost cell values as well. I tried using:<br>
<br>
<i>PetscScalar,pointer :: velocity_array(:,:,:)<br>
<br>
call DMDAVecGetArrayF90(da,velocity_local,velocity_array,ierr)<br>
call
DMDAVecRestoreArrayF90(da,velocity_local,velocity_array,ierr)<br>
</i><br>
I checked by looking at the values at :<br>
<br>
velocity_array(0,34-1,47-1:48-1) -> 0 is for 1st dof, -1
becos array starts from 0, 47-48 is where the grid divides<br>
<br>
the But the values obtained is wrong. So how should I do it?<br>
<br>
<pre class="moz-signature" cols="72">Yours sincerely,
TAY wee-beng</pre>
On 6/7/2012 1:24 PM, Blaise Bourdin wrote:<br>
</div>
<blockquote cite="mid:24B6C15D-EAB7-4105-A8BC-F30C79389CFC@lsu.edu"
type="cite">
<pre wrap="">On Jul 6, 2012, at 6:02 PM, TAY wee-beng wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On 3/7/2012 1:23 PM, Satish Balay wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Tue, 3 Jul 2012, Barry Smith wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Jul 3, 2012, at 3:08 AM, Blaise Bourdin wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Jul 3, 2012, at 4:10 AM, Barry Smith wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Blaise,
I don't understand why the patch does anything:
- *ierr = VecRestoreArray(*v,0);if (*ierr) return;
+ PetscScalar *fa;
+ *ierr = F90Array1dAccess(a,PETSC_SCALAR,(void**)&fa PETSC_F90_2PTR_PARAM(ptrd));
+ *ierr = VecRestoreArray(*v,&fa);if (*ierr) return;
*ierr = F90Array1dDestroy(&a,PETSC_SCALAR PETSC_F90_2PTR_PARAM(ptrd));
All that passing &fa into VecRestoreArray() does is cause fa to be zeroed. Why would that have any affect on anything?
</pre>
</blockquote>
<pre wrap="">Not sure either, I quite don't understand this code, but I noticed that the logic of VecRestoreArrayF90 was different from that of DMDAVecRestoreArrayF90
src/vec/vec/interface/f90-custom/zvectorf90.c:33
PetscScalar *fa;
*__ierr = F90Array1dAccess(ptr,PETSC_SCALAR,(void**)&fa PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
*__ierr = F90Array1dDestroy(ptr,PETSC_SCALAR PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
</pre>
</blockquote>
<pre wrap=""> It could be the above line is important; but the Accesser and restore array are not.
I'll have Satish apply the patch.
</pre>
</blockquote>
<pre wrap="">pushed to petsc-3.3 [petsc-dev will get this update]
Satish
</pre>
</blockquote>
<pre wrap="">Hi,
I just tested with the latest petsc-dev but it doesn't work in intel linux for ex11f90. Has the patch been applied?
</pre>
</blockquote>
<pre wrap="">Try to clone petsc-3.3 from the mercurial repository <a class="moz-txt-link-freetext" href="http://petsc.cs.iit.edu/petsc/releases/petsc-3.3/">http://petsc.cs.iit.edu/petsc/releases/petsc-3.3/</a> It looks like the first patch has not made its way to the tarball or petsc-dev yet.
You can also apply the patch manually:
cd $PETSC_DIR
patch -p1 < DMDAVecGetArrayF90.patch
</pre>
<blockquote type="cite">
<pre wrap="">Also, is there any chance of it working under 3d with multiple dof since that's what I'm using and I have other problems with gfortran. Lastly, if the patch is applied, it works with 3d da with 1 dof? Is that right?
</pre>
</blockquote>
<pre wrap="">I am sending another patch that should take care of the 3d case with >1 dof to the developers list.
Blaise
</pre>
</blockquote>
<br>
<br>
</body>
</html>