The manual page that Jed pointed out to you has links to several  
examples that use VecGetArray() from Fortran. For example
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/vec/vec/examples/tutorials/ex4f.F.html
In particular you don't declare u(n) you just declare u(1)

> it seems don't work.

     This is the most useless type of email. If all you tell us is "it  
seems don't work", then we have NO idea of what happened, what didn't  
work, so cannot provide advice. Cut and paste all error messages and  
everything that that would help us see "what didn't work".

    Barry

On Apr 15, 2010, at 8:55 PM, ????Leping Chen? wrote:

> thanks,
>
> but I don't understand VecGetArray(), that is to say, I don't know  
> how to call VecGetArray()
>
> when I plan to get any local values of x,
>
> Maybe,
>
> double precision u(n)
>
> Vec x
>
> PetscOffset uu_i
>
> call VecGetArray(x,u,uu_i,ierr)
>
> is it right?
>
> it seems don't work. how can I call it?
>
> thanks,
>
> leping
> ???? Matthew Knepley
> ????? 2010-04-16  22:48:18
> ???? chenleping; PETSc users list
> ???
> ??? Re: [petsc-users] array and vec
> 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/6cc3fa1c/attachment.htm>

Reply via email to