Error using VecRestoreArrayF90

Ben Tay zonexo at gmail.com
Tue Aug 28 10:12:27 CDT 2007


Ok, got it working. Thanks!

Satish Balay wrote:
> Perhaps the error is due to the missing include file?
>
> #include "include/finclude/petscvec.h90"
>
> Satish
>
>
> On Tue, 28 Aug 2007, Ben Tay wrote:
>
>   
>> Hi,
>>
>> I tried to use VecRestoreArrayF90. It works on 1 code but failed on the other.
>> The one which worked is a .F90 free format one while the one which failed is a
>> .F fixed format one. The failed one is
>>
>> #define PETSC_AVOID_DECLARATIONS
>> #include "include/finclude/petsc.h"
>> #include "include/finclude/petscvec.h"
>> #include "include/finclude/petscmat.h"
>> #include "include/finclude/petscksp.h"
>> #include "include/finclude/petscpc.h"
>> #undef PETSC_AVOID_DECLARATIONS
>>
>>    module petsc_sub
>>
>>    implicit none
>>
>>    contains
>>
>>    subroutine petsc_solver_pois
>>
>> #include "include/finclude/petsc.h"
>> #include "include/finclude/petscvec.h"
>> #include "include/finclude/petscmat.h"
>> #include "include/finclude/petscksp.h"
>> #include "include/finclude/petscpc.h"
>> #include "include/finclude/petscmat.h90"
>>
>> PetscScalar, pointer ::  xx_v(:)
>>
>> ...
>>
>> solve using KSPSolve to get xx
>>
>> ...
>>
>> call VecGetArrayF90(xx,xx_v,ierr)   !error at here
>>
>> pre=xx_v
>>
>> call VecRestoreArrayF90(xx,xx_v,ierr)   
>> The error msg is :
>>
>> [0]PETSC ERROR:
>> ----------------------------------------------------------------
>> --------
>> [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably
>> m
>> emory access out of range
>> [0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
>> [0]PETSC ERROR: or see
>> http://www.mcs.anl.gov/petsc/petsc-as/documentation/troub
>> leshooting.html#Signal[0]PETSC ERROR: or try http://valgrind.org on linux or
>> man
>> libgmalloc on Apple to find memory corruption errors
>> [0]PETSC ERROR: likely location of problem given in stack below
>> [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/d:\cygwin\codes\PET
>> SC-~1.3-P\src\sys\f90-src\f90_cwrap.c
>> [0]PETSC ERROR: --------------------- Error Message
>> ----------------------------
>> --------
>> [0]PETSC ERROR: Signal received!
>> [0]PETSC ERROR:
>> ----------------------------------------------------------------
>>
>> It works if I use "call VecRestoreArray(xx,ppv,i_vec,ierr)". So what did I do
>> wrong here?
>>
>> Thank you
>>
>>
>>     
>
>
>   




More information about the petsc-users mailing list