[petsc-users] A global vector reading from the binary file.
    (Rebecca) Xuefei YUAN 
    xy2102 at columbia.edu
       
    Fri Mar 12 09:33:58 CST 2010
    
    
  
Dear Barry,
I was trying to read from a binary file and make the vector be global  
at each processor, but if the following routine applies,
ierr = DACreate2d(PETSC_COMM_WORLD,DA_NONPERIODIC,DA_STENCIL_BOX,  
(info1.mx-1-parameters->abandonNumber),  
(info1.my-1-parameters->abandonNumber), PETSC_DECIDE, PETSC_DECIDE, 4,  
1, PETSC_NULL, PETSC_NULL, &da2_4);CHKERRQ(ierr);
ierr = DACreateGlobalVector(da2_4,&FIELD);CHKERRQ(ierr);
sprintf(fileName,"solution");
ierr =  
PetscViewerBinaryOpen(PETSC_COMM_WORLD,fileName,FILE_MODE_READ,&viewer);CHKERRQ(ierr);
ierr = VecLoadIntoVector(viewer,FIELD);CHKERRQ(ierr);
ierr = DAVecGetArray(da2_4,FIELD, &field);CHKERRQ(ierr);
I expect to let field[][] in each processor are the same at each grid  
point, i.e., for np=2,
at the first processor, field[][] =
0   1  2  3  4  5
6   7  8  9 10 11
12 13 14 15 16 17
18 19 20 21 22 23
24 25 26 27 28 29
and at the second processor, field[][] =
0   1  2  3  4  5
6   7  8  9 10 11
12 13 14 15 16 17
18 19 20 21 22 23
24 25 26 27 28 29
However, this routine gives me at the first processor, field[][] =
(xs=0,x=3,ys=0,y=5)
0   1  2  3  4  5
3   4  5  6  7  8
6   7  8  9 10 11
9  10 11 12 13 14
12 13 14  X  X  X
and at the second processor, field[][] =
(xs=3,x=3,ys=0,y=5)
  X   X  X 15 16 17
  15 16 17 18 19 20
  18 19 20 21 22 23
  21 22 23 24 25 26
  24 25 26 27 28 29
I know in each subdomain, the values are right, but how could I have  
this array be exact the same as a 'global' one?
Thanks very much!
Rebecca
    
    
More information about the petsc-users
mailing list