On Sat, Feb 28, 2009 at 6:19 PM, Yixun Liu <span dir="ltr"><<a href="mailto:enjoywm@cs.wm.edu">enjoywm@cs.wm.edu</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I use VecSetValue in a loop and if I add some codes such as IO before<br>
the VecSetValue the output of the vector is correct. However if I remove<br>
the IO the output is wrong. It seems that the values are cached and need<br>
some time to be set.<br><div class="Ih2E3d"></div></blockquote><div><br>1) It is unclear what the wrong behavior is.<br><br>2) This is also the a sign that memory might be corrupt somewhere else.<br><br>It is not possible to see what is wrong from your description, but I assure<br>
you that nothing is wrong with that method. It is used millions of times<br>every day. Send a sample code with known output and I will run it.<br><br> Matt<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">
Matthew Knepley wrote:<br>
> I cannot understand your question.<br>
><br>
> Matt<br>
><br>
> On Fri, Feb 27, 2009 at 6:45 PM, Yixun Liu <<a href="mailto:enjoywm@cs.wm.edu">enjoywm@cs.wm.edu</a><br>
</div><div><div></div><div class="Wj3C7c">> <mailto:<a href="mailto:enjoywm@cs.wm.edu">enjoywm@cs.wm.edu</a>>> wrote:<br>
><br>
> Hi,<br>
><br>
><br>
> VecCreate(PETSC_COMM_WORLD,&solutionDisplacementVector);<br>
><br>
> VecSetSizes(solutionDisplacementVector,<br>
> 3*numOfVerticesOfOneProcessor,<br>
> systemSize); //in this case 3*numOfVerticesOfOneProcessor==systemSize<br>
> VecSetFromOptions(solutionDisplacementVector);<br>
><br>
><br>
> VecDuplicate(solutionDisplacementVector,<br>
> &weightedDisplacementVector);<br>
><br>
><br>
> for(i = 0; i < systemSize; i++)<br>
> {<br>
> output weightedRealDisplacement[i] to file//with this code the<br>
> values in<br>
> weightedDisplacementVector are correct.<br>
><br>
> ...<br>
> VecSetValue(weightedDisplacementVector, i,<br>
> weightedRealDisplacement[i],<br>
> ADD_VALUES);<br>
> ...<br>
><br>
> }<br>
><br>
> VecAssemblyBegin(weightedDisplacementVector);<br>
> VecAssemblyEnd(weightedDisplacementVector);<br>
><br>
> output weightedDisplacementVector to file to see its values<br>
><br>
><br>
><br>
> For simplicity I only use one processor. As I examine the values in<br>
> weightedDisplacementVector and I found if I add the output code<br>
> in the<br>
> for loop the values in weightedDisplacementVector are correct. Without<br>
> it there is error.<br>
><br>
><br>
> Thanks.<br>
><br>
> Yixun<br>
><br>
><br>
><br>
><br>
> --<br>
> What most experimenters take for granted before they begin their<br>
> experiments is infinitely more interesting than any results to which<br>
> their experiments lead.<br>
> -- Norbert Wiener<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>