petsc-3.7.1 2016-05-15
Report Typos and Errors

# DMRefineHookAdd

adds a callback to be run when interpolating a nonlinear problem to a finer grid

### Synopsis

    #include "petscdm.h"
    #include "petscdmlabel.h"
    PetscErrorCode DMRefineHookAdd(DM coarse,PetscErrorCode (*refinehook)(DM,DM,void*),PetscErrorCode (*interphook)(DM,Mat,DM,void*),void *ctx)

Logically Collective Many br

### Input Arguments

| coarse | - nonlinear solver context on which to run a hook when restricting to a coarser level Many br
| refinehook | - function to run when setting up a coarser level Many br
| interphook | - function to run to update data on finer levels (once per SNESSolve()) Many br
| ctx | - [optional] user-defined context for provide data for the hooks (may be NULL) Many br

### Calling sequence of refinehook

       refinehook(DM coarse,DM fine,void *ctx);

| coarse | - coarse level DM Many br
| fine | - fine level DM to interpolate problem to Many br
| ctx | - optional user-defined function context Many br

### Calling sequence for interphook

       interphook(DM coarse,Mat interp,DM fine,void *ctx)

| coarse | - coarse level DM Many br
| interp | - matrix interpolating a coarse-level solution to the finer grid Many br
| fine | - fine level DM to update Many br
| ctx | - optional user-defined function context Many br

Many br

### Notes

This function is only needed if auxiliary data needs to be passed to fine grids while grid sequencing Many br

If this function is called multiple times, the hooks will be run in the order they are added. Many br

This function is currently not available from Fortran. Many br

### See Also

DMCoarsenHookAdd(), SNESFASGetInterpolation(), SNESFASGetInjection(), PetscObjectCompose(), PetscContainerCreate()

Level:advanced
Location:src/dm/interface/dm.c
Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/snes/examples/tutorials/ex48.c.html