<br><br><div class="gmail_quote">On Fri, Dec 2, 2011 at 08:04, Feng-Chao Wang <span dir="ltr"><<a href="mailto:wolfshow@gmail.com">wolfshow@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>
<div style="FONT-SIZE:10pt;MARGIN:10px;FONT-FAMILY:verdana">
<div><font face="Verdana" size="2">Dear all,</font></div>
<div> </div>
<div>I intend to postprocess the solution of a PDE (stored in a
parallel PETSc vector ) using tecplot. Thus I want to
output the values of the parallel vector as well as other data
(such as the grid information) to a ASCII file.</div>
<div> </div>
<div>When I deal this with </div>
<div> </div>
<div> </div>
<div>VecGetArray(U, &u);</div>
<div> </div>
<div>for (i=0; i<Mx*My; i++)</div>
<div>{</div>
<div>PetscViewerASCIIPrintf(viewer,"%F %F %F", x, y, u[i]);</div>
<div>}</div>
<div><font face="Verdana" size="2"></font> </div>
<div>If more than 1 processor are used, I found that only part of the value of u
was output correctly (that stored on the first processor).</div>
<div>I found in the manual page of "PetscViewerASCIIPrintf" that "<span style="DISPLAY:inline!important;FLOAT:none;WORD-SPACING:0px;FONT:medium Simsun;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);TEXT-INDENT:0px;WHITE-SPACE:normal;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255)">Not
Collective, but only first processor in set has any effect</span>"</div></div></blockquote><div><br></div><div>If you can afford the memory:</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Vec/VecScatterCreateToZero.html">http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Vec/VecScatterCreateToZero.html</a></div>
<div><br></div><div>Slower:</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscSynchronizedPrintf.html">http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscSynchronizedPrintf.html</a></div>
<div><br></div><div>Binary output can be written in parallel using</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Vec/VecView.html">http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Vec/VecView.html</a></div>
</div>