[petsc-users] error in calling VecGetArrayf90()
Satish Balay
balay at mcs.anl.gov
Tue Jan 4 17:50:11 CST 2011
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.
>
>
More information about the petsc-users
mailing list