[petsc-users] Global DA index using DAGetCorners

khalid ashraf khalid_eee at yahoo.com
Thu Nov 25 19:50:21 CST 2010


It doesn't seem like the problem is with the natural ordering. Since in Fig.9 of 
the manual,
the highest number of the grid should be the same(30 in fig. 9) for natural and 
petsc ordering.
But I get a lower number when I print it. 

I also tried the petsc to natural conversion using the following code,   
   {
    ia[0]=(PetscInt)((k)*(my)*(mx)+(j)*(mx)+(i));
    AOPetscToApplication(ao,1,ia);
     w_localptr[k][j][i] = ia[0];
PetscPrintf(PETSC_COMM_WORLD,"%d\n",ia[0]);
}
But this gives even lower number for the highest index.

Anyway my goal is to be able to determine the global natural index of the 
grid within the for loops in the following way:
for (k=zs; k<zs+zm; k++) {
  for (j=ys; j<ys+ym; j++) {
  for (i=xs; i<xs+xm; i++) {
natural_global_coordinate(k',j',i')=f(k,j,i);
if natural_global_coord[k'][j'][i'] > half of the grid along x {Do something}
if natural_global_coord[k'][j'][i'] > half of the grid along y {Do something}
etc..
}}} 
Could you please suggest what would be the simplest way to achieve this. 
Thanks in advance.


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101125/ff463aaa/attachment.htm>


More information about the petsc-users mailing list