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 58 59 60 61 62 63
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/MatCreateSNESMF.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MatCreateSNESMF</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<div id="version" align=right><b>petsc-3.7.5 2017-01-01</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.7.5 v3.7.5 docs/manualpages/SNES/MatCreateSNESMF.html "><small>Report Typos and Errors</small></a></div>
<A NAME="MatCreateSNESMF"><H1>MatCreateSNESMF</H1></A>
Creates a matrix-free matrix context for use with a <A HREF="../SNES/SNES.html#SNES">SNES</A> solver. This matrix can be used as the Jacobian argument for the routine <A HREF="../SNES/SNESSetJacobian.html#SNESSetJacobian">SNESSetJacobian</A>(). See <A HREF="../Mat/MatCreateMFFD.html#MatCreateMFFD">MatCreateMFFD</A>() for details on how the finite difference computation is done.
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petscsnes.h"
#include "petscdm.h"
PetscErrorCode MatCreateSNESMF(SNES snes,Mat *J)
</PRE>
Collective on <A HREF="../SNES/SNES.html#SNES">SNES</A> and <A HREF="../Vec/Vec.html#Vec">Vec</A>
<P>
<H3><FONT COLOR="#CC3333">Input Parameters</FONT></H3>
<DT><B>snes </B> -the <A HREF="../SNES/SNES.html#SNES">SNES</A> context
<br>
<P>
<H3><FONT COLOR="#CC3333">Output Parameter</FONT></H3>
<DT><B>J </B> -the matrix-free matrix
<br>
<P>
<P>
<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
You can call <A HREF="../SNES/SNESSetJacobian.html#SNESSetJacobian">SNESSetJacobian</A>() with <A HREF="../SNES/MatMFFDComputeJacobian.html#MatMFFDComputeJacobian">MatMFFDComputeJacobian</A>() if you are using matrix and not a different
preconditioner matrix
<P>
If you wish to provide a different function to do differencing on to compute the matrix-free operator than
that provided to <A HREF="../SNES/SNESSetFunction.html#SNESSetFunction">SNESSetFunction</A>() then call <A HREF="../Mat/MatMFFDSetFunction.html#MatMFFDSetFunction">MatMFFDSetFunction</A>() with your function after this call.
<P>
The difference between this routine and <A HREF="../Mat/MatCreateMFFD.html#MatCreateMFFD">MatCreateMFFD</A>() is that this matrix
automatically gets the current base vector from the <A HREF="../SNES/SNES.html#SNES">SNES</A> object and not from an
explicit call to <A HREF="../Mat/MatMFFDSetBase.html#MatMFFDSetBase">MatMFFDSetBase</A>().
<P>
<H3><FONT COLOR="#CC3333">Warning</FONT></H3>
If <A HREF="../Mat/MatMFFDSetBase.html#MatMFFDSetBase">MatMFFDSetBase</A>() is ever called on jac then this routine will NO longer get
the x from the <A HREF="../SNES/SNES.html#SNES">SNES</A> object and <A HREF="../Mat/MatMFFDSetBase.html#MatMFFDSetBase">MatMFFDSetBase</A>() must from that point on be used to
change the base vector x.
<P>
<H3><FONT COLOR="#CC3333">Warning</FONT></H3>
Using a different function for the differencing will not work if you are using non-linear left preconditioning.
<P>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
<A HREF="../Mat/MatDestroy.html#MatDestroy">MatDestroy</A>(), <A HREF="../Mat/MatMFFDSetFunction.html#MatMFFDSetFunction">MatMFFDSetFunction</A>(), <A HREF="../Mat/MatMFFDSetFunctionError.html#MatMFFDSetFunctionError">MatMFFDSetFunctionError</A>(), <A HREF="../Mat/MatMFFDDSSetUmin.html#MatMFFDDSSetUmin">MatMFFDDSSetUmin</A>()
<BR><A HREF="../Mat/MatMFFDSetHHistory.html#MatMFFDSetHHistory">MatMFFDSetHHistory</A>(), <A HREF="../Mat/MatMFFDResetHHistory.html#MatMFFDResetHHistory">MatMFFDResetHHistory</A>(), <A HREF="../Mat/MatCreateMFFD.html#MatCreateMFFD">MatCreateMFFD</A>(),
<A HREF="../Mat/MatMFFDGetH.html#MatMFFDGetH">MatMFFDGetH</A>(), <A HREF="../Mat/MatMFFDRegister.html#MatMFFDRegister">MatMFFDRegister</A>(), <A HREF="../SNES/MatMFFDComputeJacobian.html#MatMFFDComputeJacobian">MatMFFDComputeJacobian</A>()
<P>
<P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>advanced
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/snes/mf/snesmfj.c.html#MatCreateSNESMF">src/snes/mf/snesmfj.c</A>
<BR><A HREF="./index.html">Index of all SNES 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>
<P><H3><FONT COLOR="#CC3333">Examples</FONT></H3>
<A HREF="../../../src/ts/examples/tutorials/ex15.c.html">src/ts/examples/tutorials/ex15.c.html</A><BR>
</BODY></HTML>
|