VecGetArrayF90#

Accesses a vector array from Fortran. For default PETSc vectors, VecGetArrayF90() returns a pointer to the local data array. Otherwise, this routine is implementation dependent. You MUST call VecRestoreArrayF90() when you no longer need access to the array.

Synopsis#

VecGetArrayF90(Vec x,{Scalar, pointer :: xx_v(:)},integer ierr)

Logically Collective

Input Parameter#

  • x - vector

Output Parameters#

  • xx_v - the Fortran pointer to the array

  • ierr - error code

Example of Usage#

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

    PetscScalar, pointer :: xx_v(:)
    ....
    call VecGetArrayF90(x,xx_v,ierr)
    xx_v(3) = a
    call VecRestoreArrayF90(x,xx_v,ierr)

Note#

If you ONLY intend to read entries from the array and not change any entries you should use VecGetArrayReadF90().

See Also#

Vectors and Parallel Data, Vec, VecRestoreArrayF90(), VecGetArray(), VecRestoreArray(), VecGetArrayReadF90()

Level#

beginner

Location#

src/vec/vec/interface/rvector.c

Examples#

src/ksp/ksp/tutorials/ex14f.F90
src/snes/tutorials/ex1f.F90
src/snes/tutorials/ex5f.F90
src/snes/tutorials/ex5f90.F90
src/snes/tutorials/ex5f90t.F90
src/snes/tutorials/ex73f90t.F90
src/tao/bound/tutorials/plate2f.F90
src/tao/leastsquares/tutorials/chwirut1f.F90
src/tao/leastsquares/tutorials/chwirut2f.F90
src/tao/unconstrained/tutorials/rosenbrock1f.F90
src/ts/tutorials/ex1f.F90


Edit on GitLab

Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages