[petsc-users] VecGetArrayF90 in PETSc/3.10 (Fortran)

Balay, Satish balay at mcs.anl.gov
Sun Jan 6 16:45:42 CST 2019


This code is missing:

#include <petsc/finclude/petscvec.h>
      use petscvec

Check:

https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/UsingFortran.html

Satish

On Sun, 6 Jan 2019, Chang Liu via petsc-users wrote:

> Hi All,
> Recently, when I am upgrading our code from 3.8 to 3.10, it always runs
> into error during VecGetArrayF90 call (it is Fortran90-based code). The
> reason we use is to access the array for our user-defined matrix-vector
> multiplication subroutine, for example:
> 
> *  subroutine mymult(A,x,y,loco_ierr) *
> *   !!!!!!!!!!!!!!! matrix-vector multiplication  y=A.x
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*
> *    use mat_vec_mult,only:matvec*
> *    implicit none*
> *    Mat,intent(in)::A ! required by PETSc*
> *    Vec,intent(in)::x*
> *    Vec,intent(out)::y*
> *    PetscErrorCode,intent(out)::loco_ierr*
> *    PetscScalar,pointer::xx(:),yy(:)*
> 
> *    call VecGetArrayReadF90(x,xx,loco_ierr)*
> *    call VecGetArrayF90(y,yy,loco_ierr)*
> *    call matvec(xx,yy)*
> *    call VecRestoreArrayReadF90(x,xx,loco_ierr)*
> *    call VecRestoreArrayF90(y,yy,loco_ierr)*
> *    return*
> * end subroutine mymult*
> 
> I checked the change log on the website and saw a statement:
> TAO:
> 
>    - Added VecLock{Push|Pop} calls around user callbacks; use of
>    VecGetArray in user callbacks is now prohibited.
> 
> Is there any relation to my issue? All the online PETSc examples and
> description for VecGetArray/VecGetArrayF90 are the same as PETSc/3.8.  I
> tried to add/use VecLockPop/Push, but still doesn't work.
> 
> I am confused and not sure what is the problem?
> Could I get some help?
> Thanks,
> 



More information about the petsc-users mailing list