<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><div>Hi, </div><div>I am trying to load a vector that I saved as PetscBinary file. </div><div>On a single processor, I have to put an initial PetscBinaryRead command & put the subsequent reads in the loop. Then I get the correct answer. I don't understand why an initial PetscBinaryRead is required. Anyway, with this, the code works fine on single processor.</div><div><br></div><div>However, on multiple processors, the input file and the vector after reading are not in the same order. I think that somehow I have to pass the information to each processor as to which part of the binary file to read. Please tell me how to do this.</div><div><br></div><div>Thanks.</div><div><br></div><div>Khalid</div><div><br></div><div><br></div><div>Here is the
code:</div><div><br></div><div><div>PetscViewerBinaryOpen(appctx->comm,"Pxbin_10.out",FILE_MODE_READ,&viewer);</div><div>PetscViewerBinaryGetDescriptor(viewer,&fd);</div><div>PetscBinaryRead(fd,header,1,PETSC_SCALAR);</div><div><br></div></div><div> for (k=zs; k<zs+zm; k++) {</div><div> for (j=ys; j<ys+ym; j++) {</div><div> for (i=xs; i<xs+xm; i++) {</div><div>PetscBinaryRead(fd,header,1,PETSC_SCALAR);<br></div><div> u_localptr[k][j][i] = header[0];<br></div><div> }<br></div><div> }</div><div> }</div><div><br></div></div></div></body></html>