1 #include <petscdmda.h> 2 3 /* 4 User-defined application context - contains data needed by the 5 application-provided call-back routines, FormJacobianLocal() and 6 FormFunctionLocal(). 7 */ 8 typedef struct AppCtx AppCtx; 9 struct AppCtx { 10 PetscReal param; /* test problem parameter */ 11 PetscInt m, n; /* MMS3 parameters */ 12 PetscErrorCode (*mms_solution)(AppCtx *, const DMDACoor2d *, PetscScalar *); 13 PetscErrorCode (*mms_forcing)(AppCtx *, const DMDACoor2d *, PetscScalar *); 14 }; 15 16 PETSC_EXTERN PetscErrorCode FormFunctionLocalVec(DMDALocalInfo *info, Vec x, Vec f, AppCtx *user); 17 PETSC_EXTERN PetscErrorCode FormObjectiveLocalVec(DMDALocalInfo *info, Vec x, PetscReal *obj, AppCtx *user); 18 PETSC_EXTERN PetscErrorCode FormJacobianLocalVec(DMDALocalInfo *info, Vec x, Mat jac, Mat jacpre, AppCtx *user); 19