Skip to main content
`Ctrl`+`K`

# MatSNESMFSetReuseBase

Causes the base vector to be used for differencing even if the function provided to `SNESSetFunction()` is not the same as that provided to `MatMFFDSetFunction()`.

## Synopsis

    #include "petscsnes.h"
    #include "petscdm.h"
    PetscErrorCode MatSNESMFSetReuseBase(Mat J, PetscBool use)

Logically Collective

## Input Parameters

- J - the `MATMFFD` matrix

- use - if true always reuse the base vector instead of recomputing f(u) even if the function in the `MATMFFD` is not `SNESComputeFunction()`

## Note

Care must be taken when using this routine to insure that the function provided to `MatMFFDSetFunction()`, call it F_MF() is compatible with with that provided to `SNESSetFunction()`, call it F_SNES(). That is, (F_MF(u + h*d) - F_SNES(u))/h has to approximate the derivative

## Developer Notes

This was provided for the MOOSE team who desired to have a `SNESSetFunction()` function that could change configurations (similar to variable switching) to contacts while the function provided to `MatMFFDSetFunction()` cannot. Except for the possibility of changing the configuration both functions compute the same mathematical function so the differencing makes sense.

## See Also

SNES: Nonlinear Solvers, `SNES`, `MATMFFD`, `MatMFFDSetFunction()`, `SNESSetFunction()`, `MatCreateSNESMF()`, `MatSNESMFGetReuseBase()`

## Level

advanced

## Location

src/snes/mf/snesmfj.c

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