<br>My apologies, I want all values in all processor, following your indications I guess I need to use something like:<br><br> &nbsp; Vec natural,allonme;<br> &nbsp; VecScatter tozero;<br><br> &nbsp; DACreateNaturalVector(da,&amp;natural);<div>
/***********************************************************/<br> &nbsp; VecScatterCreateToAll(natural,&amp;tozero,&amp;allonme);<br>/***********************************************************/<br> &nbsp;/* now to get the values on the that 0th process */<br>
<br> &nbsp; DAGlobalToNaturalBegin(da,vec,INSERT_VALUES,natural);<br> &nbsp; DAGlobalToNaturalEnd(da,vec,INSERT_VALUES,natural);<br> &nbsp; VecScatterBegin(tozero,natural,allonme,INSERT_VALUES,SCATTER_FORWARD);<br> VecScatterEnd(tozero,natural,allonme,INSERT_VALUES,SCATTER_FORWARD);</div>
<div><br></div><div>And all process should have all data. Is this right?</div><div><br></div><div>Thank you very much,</div><div>Ignacio</div><div><br>2008/11/26 Barry Smith &lt;<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt;:<br>
&gt;<br>&gt; &nbsp; Your message is unclear.<br>&gt;<br>&gt; &nbsp; DAGlobalToNaturalAllCreate() will give you a scatter to get ALL the values<br>&gt; on EACH process in the &quot;natural ordering&quot;.<br>&gt;<br>&gt; &nbsp; Do you wish to get ALL the values onto a SINGLE process (and nothing<br>
&gt; on the rest)? If so, here is how you do it.<br>&gt;<br>&gt; &nbsp; &nbsp;Vec natural,allonme;<br>&gt; &nbsp; &nbsp;VecScatter tozero;<br>&gt;<br>&gt; &nbsp; &nbsp;DACreateNaturalVector(da,&amp;natural);<br>&gt; &nbsp; &nbsp;VecScatterCreateToZero(natural,&amp;tozero,&amp;allonme);<br>
&gt;<br>&gt; &nbsp; /* now to get the values on the that 0th process */<br>&gt;<br>&gt; &nbsp; &nbsp;DAGlobalToNaturalBegin(da,vec,INSERT_VALUES,natural);<br>&gt; &nbsp; &nbsp;DAGlobalToNaturalEnd(da,vec,INSERT_VALUES,natural);<br>&gt; &nbsp; &nbsp;VecScatterBegin(tozero,natural,allonme,INSERT_VALUES,SCATTER_FORWARD);<br>
&gt; &nbsp;VecScatterEnd(tozero,natural,allonme,INSERT_VALUES,SCATTER_FORWARD);<br>&gt;<br>&gt; &nbsp; Now process 0 will have a sequential vector that contains the entire<br>&gt; global vector.<br>&gt; All other processes will have a sequential vector of size 0. ALL processes,<br>
&gt; of course,<br>&gt; must call the DAGlobalToNatural.... and VecScatter... routines.<br>&gt;<br>&gt; &nbsp; It is possible to reverse this operation too, to get values from process 0<br>&gt; out to the other processes.<br>&gt;<br>
&gt; &nbsp; If this was not your question, then please clarify what you wish to do.<br>&gt;<br>&gt; &nbsp; Barry<br>&gt;<br>&gt;<br>&gt; On Nov 25, 2008, at 4:46 PM, Ignacio Martínez wrote:<br>&gt;<br>&gt;&gt; Hello,<br>&gt;&gt;<br>
&gt;&gt; I&#39;m a beginner user, and I have a problem:<br>&gt;&gt;<br>&gt;&gt; I have a routine in Fortran and I just want to parallelize few lines<br>&gt;&gt; with PETSc, I&#39;m using DA in order to gather the results, from local<br>
&gt;&gt; vectors to a global vector.<br>&gt;&gt; It works fine. But I need to return those values to the Fortran<br>&gt;&gt; routine, and I only get access to local process values.<br>&gt;&gt;<br>&gt;&gt; I try to create a sequential vectors with an scatter to get that<br>
&gt;&gt; values. But, PETSc returns an error, something like: &quot;Cannot create<br>&gt;&gt; VECSEQ on more than one process!&quot; (I try to create the vector only in<br>&gt;&gt; one process).<br>&gt;&gt;<br>&gt;&gt; Exactly in using DAGlobalToNaturalAllCreate and &nbsp;VecScatterBegin to<br>
&gt;&gt; get global values in to a process.<br>&gt;&gt;<br>&gt;&gt; And my question is if someone has tried to do something like this, and<br>&gt;&gt; how has done it. Or if could you give me some orientation?<br>&gt;&gt;<br>
&gt;&gt; Thank you in advance,<br>&gt;&gt; Ignacio<br>&gt;&gt;<br>&gt;<br>&gt;<br><br></div>