# VecGetArrayAligned
FORTRAN only. Forces alignment of vector arrays so that arrays of derived types may be used. 
## Synopsis
```
VecGetArrayAligned(PetscErrorCode ierr)
```
Not Collective




## Notes
Allows code such as

```none
type  :: Field
```
```none
PetscScalar :: p1
```
```none
PetscScalar :: p2
```
```none
end type Field
```
```none
```
```none
type(Field)       :: lx_v(0:1)
```
```none
```
```none
call VecGetArray(localX, lx_v, lx_i, ierr)
```
```none
call InitialGuessLocal(lx_v(lx_i/2),ierr)
```
```none
```
```none
subroutine InitialGuessLocal(a,ierr)
```
```none
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
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/interface/ftn-custom/zvectorf.c.html#VecGetArrayAligned">src/vec/vec/interface/ftn-custom/zvectorf.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/interface/ftn-custom/zvectorf.c)


[Index of all Vec routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
