VecGetArrayAligned#

FORTRAN only. Forces alignment of vector arrays so that arrays of derived types may be used.

Synopsis#

Not Collective

Notes#

Allows code such as

     type  :: Field
        PetscScalar :: p1
        PetscScalar :: p2
      end type Field

      type(Field)       :: lx_v(0:1)

      call VecGetArray(localX, lx_v, lx_i, ierr)
      call InitialGuessLocal(lx_v(lx_i/2), ierr)

      subroutine InitialGuessLocal(a,ierr)
      type(Field)     :: a(*)

If you have not called VecGetArrayAligned() the code may generate incorrect data or crash.

lx_i needs to be divided by the number of entries in Field (in this case 2)

You do NOT need VecGetArrayAligned() if lx_v and a are arrays of PetscScalar

See Also#

VecGetArray(), VecGetArrayF90()

Level#

advanced

Location#

src/vec/vec/interface/ftn-custom/zvectorf.c


Edit on GitLab

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