petsc-3.14.5 2021-03-03
Report Typos and Errors

# UsingFortran

To use PETSc with Fortran you must use both PETSc include files and modules. At the beginning of every function and module definition you need something like

    #include "petsc/finclude/petscXXX.h"

            use petscXXX

You can declare PETSc variables using either of the following.

       XXX variablename

       type(tXXX) variablename

For example,

    #include "petsc/finclude/petscvec.h"

            use petscvec

       Vec b

       type(tVec) x

### Level

beginner

### Location

include/petscsys.h

### Examples

src/vec/vec/tutorials/ex20f90.F90.html
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages