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