Actual source code: ex55.h

      1: #pragma once
      2: #include <petscdmda.h>

      4: /*
      5:    User-defined application context - contains data needed by the
      6:    application-provided call-back routines, FormJacobianLocal() and
      7:    FormFunctionLocal().
      8: */
      9: typedef struct AppCtx AppCtx;
     10: struct AppCtx {
     11:   PetscReal  param; /* test problem parameter */
     12:   PetscInt   m, n;  /* MMS3 parameters */
     13:   PetscCount ncoo;  /* support for coo setvalues only */
     14:   PetscErrorCode (*mms_solution)(AppCtx *, const DMDACoor2d *, PetscScalar *);
     15:   PetscErrorCode (*mms_forcing)(AppCtx *, const DMDACoor2d *, PetscScalar *);
     16: };

     18: PETSC_EXTERN PetscErrorCode FormFunctionLocalVec(DMDALocalInfo *info, Vec x, Vec f, AppCtx *user);
     19: PETSC_EXTERN PetscErrorCode FormObjectiveLocalVec(DMDALocalInfo *info, Vec x, PetscReal *obj, AppCtx *user);
     20: PETSC_EXTERN PetscErrorCode FormJacobianLocalVec(DMDALocalInfo *info, Vec x, Mat jac, Mat jacpre, AppCtx *user);