Skip to main content
`Ctrl`+`K`

# SNESNewtonTRDCSetPreCheck

Sets a user function that is called before the search step has been determined. Allows the user a chance to change or override the trust region decision.

## Synopsis

    #include "petscsnes.h"
    PetscErrorCode SNESNewtonTRDCSetPreCheck(SNES snes, PetscErrorCode (*func)(SNES snes, Vec X, Vec Y, PetscBool *changed, PetscCtx ctx), PetscCtx ctx)

Logically Collective

## Input Parameters

- snes - the nonlinear solver object

- func - [optional] function evaluation routine, for the calling sequence see `SNESNewtonTRDCPreCheck()`

- ctx - [optional] application context for private data for the function evaluation routine (may be `NULL`)

## Calling sequence of `func`

- snes - the nonlinear solver object

- X - the current solution value

- Y - the tentative update step

- changed - output, flag indicating `Y` has been changed by the pre-check

- ctx - the optional application context

## Note

This function is called BEFORE the function evaluation within the `SNESNEWTONTRDC` solver.

## See Also

SNES: Nonlinear Solvers, `SNES`, `SNESNEWTONTRDC`, `SNESNewtonTRDCPreCheck()`, `SNESNewtonTRDCGetPreCheck()`, `SNESNewtonTRDCSetPostCheck()`, `SNESNewtonTRDCGetPostCheck()`, `SNESNewtonTRDCGetRhoFlag()`

## Level

intermediate

## Location

src/snes/impls/ntrdc/ntrdc.c

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