[petsc-users] error in calling VecGetArrayf90()
Peter Wang
pengxwang at hotmail.com
Tue Jan 4 20:43:28 CST 2011
Thanks a million. Yes, you are right, it works after included "finclude/petscvec.h90". The previouse code just with petscvec.h, but without petscvec.h90. Therefore, there is not a compiling error, but the runtime error. Thanks again. I had been stuck with this trouble the whole day. No, it is over !! :)
> Date: Tue, 4 Jan 2011 17:50:11 -0600
> From: balay at mcs.anl.gov
> To: petsc-users at mcs.anl.gov
> Subject: Re: [petsc-users] error in calling VecGetArrayf90()
>
> Did you included "finclude/petscvec.h90" in your code - as the example did?
>
> satish
>
> On Tue, 4 Jan 2011, Peter Wang wrote:
>
> >
> > I am trying to obtain the value of each element of a solution Vector by KSPsolve().
> >
> > The variables are defined according the example of ex4f90.F in \petsc-3.1-p5\src\snes\examples\tutorials\ as following,
> >
> > PetscScalar, pointer :: xx_v(:)
> >
> > ...
> > call KSPSolve(ksp,b,x,ierr)
> > call VecView(x,PETSC_VIEWER_STDOUT_WORLD,ierr)
> >
> > call VecGetArrayF90(x,xx_v,ierr)
> > call VecRestoreArrayF90(x,xx_v,ierr)
> >
> > ...
> >
> > But, the error keeps coming out when call VecGetArrayF90(x,xx_v,ierr) and call VecRestoreArrayF90(x,xx_v,ierr) are not commented off.
> >
> >
> > The error information shows:
> > Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
> >
> > [0]PETSC ERROR: --------------------- Stack Frames ------------------------------------
> > [0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,
> > [0]PETSC ERROR: INSTEAD the line number of the start of the function
> > [0]PETSC ERROR: is given.
> > [0]PETSC ERROR: [0] F90Array1dCreate line 52 src/sys/f90-src/f90_cwrap.c
> > [0]PETSC ERROR: --------------------- Error Message ------------------------------------
> >
> > I checked the code according the example, but cannot see any difference to that. Just don't know why the pointer array xx_v doesn't work here? Thanks.
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110104/d6916d1b/attachment.htm>
More information about the petsc-users
mailing list