PetscInitializeFortran — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# PetscInitializeFortran

Routine that should be called soon AFTER the call to `PetscInitialize()` if one is using a C main program that calls Fortran routines that in turn call PETSc routines.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscInitializeFortran(void)

Collective on `PETSC_COMM_WORLD`

## Notes

`PetscInitializeFortran()` initializes some of the default viewers, communicators, etc. for use in the Fortran if a user’s main program is written in C. `PetscInitializeFortran()` is NOT needed if a user’s main program is written in Fortran; in this case, just calling `PetscInitialize()` in the main (Fortran) program is sufficient.

This function exists and can be called even if PETSc has been configured with `--with-fortran-bindings=0` or `--with-fc=0`. It just does nothing in that case.

## See Also

`PetscInitialize()`

## Level

beginner

## Location

src/sys/objects/finit.c

## Examples

src/vec/vec/tutorials/ex7.c

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