[petsc-users] array and vec

Matthew Knepley knepley at gmail.com
Fri Apr 16 09:48:17 CDT 2010


2010/4/15 陈乐平(Leping Chen) <chenleping at yahoo.cn>

>  hello, petsc teams,
>
> when I use FormFuncion(), I need use a value of x;
>
> but x is defined by Vec, I don't know how to get  a value of x, for
> example, the 3rd value.
>

Exactly as Jed wrote, you can use VecGetArray() to access any local values
of x.

   Matt


>
> thanks,
>
> leping
>
> ------------------------------
>  *发件人:* Jed Brown
> *发送时间:* 2010-04-16  21:21:47
> *收件人:* chenleping; PETSc users list
> *抄送:*
> *主题:* Re: [petsc-users] array and vec
>  On Thu, 15 Apr 2010 21:17:19 +0800, "=?gb2312?B?s8LA1sa9?=" <
> chenleping at yahoo.cn> wrote:
> > petsc teams,
> >
> > for following definitions:
> >
> > double precision u(n)
> > Vec  v
> >
> > then, how can I actualize mutual updating between u(n) and v?
>  I'm not sure what you mean, if these are the same quantity then they
> shouldn't be stored in separate locations.  See VecGetArray:
>
> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Vec/VecGetArray.html
>  Jed
>



-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100416/f4fbb181/attachment.htm>


More information about the petsc-users mailing list