Hi Jed,
I am using petsc/3.1 and the include file "petscdmda.h" is not working. I am
using the "petscda.h"
and DACreate3D.?
unew_localptr[][][] is from a global vector using VecGetArray
u_localptr[][][] is from a local vector communicated from a global vector.
I tried?
unew_localptr[k][j][i]=u_localptr[k-1][j-1][i-1]
but it gives Segmentation Violation error.?
I also tried?unew_localptr[k][j][i]=u_localptr[k][j+1][i+1] which works but?
unew_localptr[k][j][i]=u_localptr[k+1][j+1][i+1]
or?unew_localptr[k][j][i]=u_localptr[k][j-1][i-1]
does not work. I am running the program on4 processors.
Thanks.
??ierr =
DACreate3d(PETSC_COMM_WORLD,DA_YPERIODIC,DA_STENCIL_BOX,appctx.l,appctx.m,appctx.n,
?? ? ? ? ? ? ? ? ?
?PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,
?? ? ? ? ? ? ? ? ? ?&appctx.da);CHKERRQ(ierr);
?for (k=zs; k<zs+zm; k++) {
??for (j=ys; j<ys+ym; j++) {
??for (i=xs; i<xs+xm; i++) {
??if(i!=0 || j!=0 || k!=0|| i!=mx-1 || j!=my-1 || k!=mz-1)
??unew_localptr[k][j][i]=u_localptr[k+1][j+1][i+1];
}}}
________________________________
From: Jed Brown <jedbrown at mcs.anl.gov>
To: khalid ashraf <khalid_eee at yahoo.com>; PETSc users list <petsc-users at
mcs.anl.gov>
Sent: Sunday, April 1, 2012 10:07 PM
Subject: Re: [petsc-users] transfer vector data diagonally on DA
On Sun, Apr 1, 2012 at 22:01, khalid ashraf <khalid_eee at yahoo.com> wrote:
I want to transfer vector data diagonally in the DA grid like?
>?for (k=zs; k<zs+zm; k++) {
>??for (j=ys; j<ys+ym; j++) {
>??for (i=xs; i<xs+xm; i++) {
>if(i!=mx-1 || j!=my-1 || k!=mz-1){
>u_new[k+1][j+1][i+1]=u[k][j][i];}
>}}}
>
>
>Could you please suggest the best way to do it minimizing interprocessor
>assignments.
Both are on the same DMDA?
Communicate U to Ulocal (DMGlobalToLocalBegin/End) using a BOX stencil with
width at least 1, get the global array u_new[][][] from UGlobalNew and the
local arrays u[][][] from Ulocal, then assign u_new[k][j][i] = u[k-1][j-1][i-1].
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120402/b9318138/attachment-0001.htm>