xref: /petsc/src/snes/tutorials/ex55.h (revision 3ea99036a5fedea4d39e7e77471d0ab500c249d7)
1 #ifndef EX55_H
2 #define EX55_H
3 #include <petscdmda.h>
4 
5 /*
6    User-defined application context - contains data needed by the
7    application-provided call-back routines, FormJacobianLocal() and
8    FormFunctionLocal().
9 */
10 typedef struct AppCtx AppCtx;
11 struct AppCtx {
12   PetscReal  param; /* test problem parameter */
13   PetscInt   m, n;  /* MMS3 parameters */
14   PetscCount ncoo;  /* support for coo setvalues only */
15   PetscErrorCode (*mms_solution)(AppCtx *, const DMDACoor2d *, PetscScalar *);
16   PetscErrorCode (*mms_forcing)(AppCtx *, const DMDACoor2d *, PetscScalar *);
17 };
18 
19 PETSC_EXTERN PetscErrorCode FormFunctionLocalVec(DMDALocalInfo *info, Vec x, Vec f, AppCtx *user);
20 PETSC_EXTERN PetscErrorCode FormObjectiveLocalVec(DMDALocalInfo *info, Vec x, PetscReal *obj, AppCtx *user);
21 PETSC_EXTERN PetscErrorCode FormJacobianLocalVec(DMDALocalInfo *info, Vec x, Mat jac, Mat jacpre, AppCtx *user);
22 #endif
23