1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/UsingFortran.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>UsingFortran</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<div id="version" align=right><b>petsc-3.14.5 2021-03-03</b></div>
<div id="bugreport" align=right><a href="mailto:petsc-maint@mcs.anl.gov?subject=Typo or Error in Documentation &body=Please describe the typo or error in the documentation: petsc-3.14.5 v3.14.5 docs/manualpages/Sys/UsingFortran.html "><small>Report Typos and Errors</small></a></div>
<A NAME="UsingFortran"><H1>UsingFortran</H1></A>
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
<pre>
</pre>
<pre>
#include "petsc/finclude/petscXXX.h"
</pre>
<pre>
use petscXXX
</pre>
<P>
You can declare PETSc variables using either of the following.
<P>
<pre>
XXX variablename
</pre>
<pre>
type(tXXX) variablename
</pre>
<P>
For example,
<P>
<pre>
#include "petsc/finclude/petscvec.h"
</pre>
<pre>
use petscvec
</pre>
<pre>
</pre>
<pre>
<A HREF="../Vec/Vec.html#Vec">Vec</A> b
</pre>
<pre>
type(tVec) x
</pre>
<P>
<P>
<P><B></B><H3><FONT COLOR="#CC3333">Level</FONT></H3>beginner<BR>
<H3><FONT COLOR="#CC3333">Location</FONT></H3>
</B><A HREF="../../../include/petscsys.h.html#UsingFortran">include/petscsys.h</A>
<P><H3><FONT COLOR="#CC3333">Examples</FONT></H3>
<A HREF="../../../src/vec/vec/tutorials/ex20f90.F90.html">src/vec/vec/tutorials/ex20f90.F90.html</A><BR>
<BR><A HREF="./index.html">Index of all Sys routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
</BODY></HTML>
|