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/282167fa/attachment.htm>

Reply via email to