[petsc-users] array and vec

Satish Balay balay at mcs.anl.gov
Fri Apr 16 12:00:22 CDT 2010


On Fri, 16 Apr 2010, Matthew Knepley wrote:

> 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.

> > > for following definitions:
> > >
> > > double precision u(n)
> > > Vec  v

Since you are uisng fortran check VecGetArrayF90(). for eg: check
src/vec/vec/examples/tutorials/ex4f90.F

Satish


More information about the petsc-users mailing list