#include "petscdm.h" #include "petscdmlabel.h" #include "petscds.h" PetscErrorCode DMCoarsenHookAdd(DM fine,PetscErrorCode (*coarsenhook)(DM,DM,void*),PetscErrorCode (*restricthook)(DM,Mat,Vec,Mat,DM,void*),void *ctx)Logically Collective
fine | - nonlinear solver context on which to run a hook when restricting to a coarser level | |
coarsenhook | - function to run when setting up a coarser level | |
restricthook | - function to run to update data on coarser levels (once per SNESSolve()) | |
ctx | - [optional] user-defined context for provide data for the hooks (may be NULL) |
coarsenhook(DM fine,DM coarse,void *ctx);
fine | - fine level DM | |
coarse | - coarse level DM to restrict problem to | |
ctx | - optional user-defined function context |
restricthook(DM fine,Mat mrestrict,Vec rscale,Mat inject,DM coarse,void *ctx)
fine | - fine level DM | |
mrestrict | - matrix restricting a fine-level solution to the coarse grid | |
rscale | - scaling vector for restriction | |
inject | - matrix restricting by injection | |
coarse | - coarse level DM to update | |
ctx | - optional user-defined function context |
If this function is called multiple times, the hooks will be run in the order they are added.
In order to compose with nonlinear preconditioning without duplicating storage, the hook should be implemented to extract the finest level information from its context (instead of from the SNES).
This function is currently not available from Fortran.