2010/4/15 陈乐平(Leping Chen) <span dir="ltr"><<a href="mailto:chenleping@yahoo.cn">chenleping@yahoo.cn</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="margin:10px;font-family:verdana;font-size:10pt">
<div><font color="#0000ff" size="3" face="Verdana">hello, petsc teams,</font></div>
<div><font color="#0000ff" size="3"></font> </div>
<div><font color="#0000ff" size="3">when I use FormFuncion(), I need use a value of
x;</font></div>
<div><font color="#0000ff" size="3"></font> </div>
<div><font color="#0000ff" size="3">but x is defined by Vec, I don't know how to
get a value of x, for example, the 3rd value.</font></div></div></blockquote><div><br></div><div>Exactly as Jed wrote, you can use VecGetArray() to access any local values</div><div>of x.</div><div><br></div><div> Matt</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="margin:10px;font-family:verdana;font-size:10pt"><div><font color="#0000ff" size="3"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-size: 13px; "> </span></font></div>
<div><font face="Verdana"></font><font color="#0000ff" size="3">thanks,</font></div>
<div><font color="#0000ff" size="3"></font> </div>
<div><font color="#0000ff" size="3">leping</font></div>
<div><font color="#0000ff" size="3" face="Verdana"> <span>
<div></div></span></font>
<hr color="#b5c4df" size="1">
</div></div>
<div><font size="2" face="Verdana"><strong>发件人:</strong> Jed Brown </font></div>
<div><font size="2" face="Verdana"><strong>发送时间:</strong> 2010-04-16 21:21:47
</font></div>
<div><font size="2" face="Verdana"><strong>收件人:</strong> chenleping; PETSc users
list </font></div>
<div><font size="2" face="Verdana"><strong>抄送:</strong> </font></div>
<div><font size="2" face="Verdana"><strong>主题:</strong> Re: [petsc-users] array and
vec </font></div>
<div><font size="2" face="Verdana"></font></div>
<div><font size="2" face="Verdana">
<div>On Thu, 15 Apr 2010 21:17:19 +0800, "=?gb2312?B?s8LA1sa9?=" <<a href="mailto:chenleping@yahoo.cn" target="_blank">chenleping@yahoo.cn</a>> wrote:</div>
<div>> petsc teams,</div>
<div>> </div>
<div>> for following definitions:</div>
<div>> </div>
<div>> double precision u(n)</div>
<div>> Vec v</div>
<div>> </div>
<div>> then, how can I actualize mutual updating between u(n) and v?</div>
<div></div>
<div>I'm not sure what you mean, if these are the same quantity then they</div>
<div>shouldn't be stored in separate locations. See VecGetArray:</div>
<div></div>
<div> <a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Vec/VecGetArray.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Vec/VecGetArray.html</a></div>
<div></div>
<div>Jed</div></font></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>