xref: /petsc/src/snes/impls/fas/fasimpls.h (revision 0dd27c6cfae9dc1af950b720382efbc5314fd943)
1519f805aSKarl Rupp #if !defined(_SNES_FASIMPLS)
2421d9b32SPeter Brune #define _SNES_FASIMPLS
3421d9b32SPeter Brune 
4b45d2f2cSJed Brown #include <petsc-private/snesimpl.h>
5b45d2f2cSJed Brown #include <petsc-private/linesearchimpl.h>
6b45d2f2cSJed Brown #include <petsc-private/dmimpl.h>
707144faaSPeter Brune #include <petscsnesfas.h>
8421d9b32SPeter Brune 
9421d9b32SPeter Brune typedef struct {
10421d9b32SPeter Brune 
11421d9b32SPeter Brune   /* flags for knowing the global place of this FAS object */
12421d9b32SPeter Brune   PetscInt       level;                        /* level = 0 coarsest level */
13421d9b32SPeter Brune   PetscInt       levels;                       /* if level + 1 = levels; we're the last turtle */
14421d9b32SPeter Brune 
15646217ecSPeter Brune   PetscViewer    monitor;                      /* debuggging output for FAS */
16421d9b32SPeter Brune 
17421d9b32SPeter Brune   /* smoothing objects */
18ab8d36c9SPeter Brune   SNES           smoothu;                      /* the SNES for presmoothing */
19ab8d36c9SPeter Brune   SNES           smoothd;                      /* the SNES for postsmoothing */
2022c1e704SPeter Brune 
21421d9b32SPeter Brune   /* coarse grid correction objects */
226273346dSPeter Brune   SNES           next;                         /* the SNES instance for the next coarser level in the hierarchy */
23ab8d36c9SPeter Brune   SNES           fine;                         /* the finest SNES instance; used as a reference for prefixes */
246273346dSPeter Brune   SNES           previous;                     /* the SNES instance for the next finer level in the hierarchy */
25421d9b32SPeter Brune   Mat            interpolate;                  /* interpolation */
26efe1f98aSPeter Brune   Mat            inject;                       /* injection operator (unscaled) */
27421d9b32SPeter Brune   Mat            restrct;                      /* restriction operator */
28421d9b32SPeter Brune   Vec            rscale;                       /* the pointwise scaling of the restriction operator */
29421d9b32SPeter Brune 
30ee78dd50SPeter Brune   /* method parameters */
31ee78dd50SPeter Brune   PetscInt       n_cycles;                     /* number of cycles on this level */
3207144faaSPeter Brune   SNESFASType    fastype;                      /* FAS type */
33ee78dd50SPeter Brune   PetscInt       max_up_it;                    /* number of pre-smooths */
34ee78dd50SPeter Brune   PetscInt       max_down_it;                  /* number of post-smooth cycles */
35d1adcc6fSPeter Brune   PetscBool      usedmfornumberoflevels;       /* uses a DM to generate a number of the levels */
366273346dSPeter Brune 
376273346dSPeter Brune   /* Galerkin FAS state */
386273346dSPeter Brune   PetscBool      galerkin;                     /* use Galerkin formation of the coarse problem */
396273346dSPeter Brune   Vec            Xg;                           /* Galerkin solution projection */
406273346dSPeter Brune   Vec            Fg;                           /* Galerkin function projection */
416273346dSPeter Brune 
42*0dd27c6cSPeter Brune   /* if logging times for each level */
43*0dd27c6cSPeter Brune   PetscLogEvent  eventsmoothsetup;             /* level setup */
44*0dd27c6cSPeter Brune   PetscLogEvent  eventsmoothsolve;             /* level smoother solves */
45*0dd27c6cSPeter Brune   PetscLogEvent  eventresidual;                /* level residual evaluation */
46*0dd27c6cSPeter Brune   PetscLogEvent  eventinterprestrict;          /* level interpolation and restriction */
47*0dd27c6cSPeter Brune 
48421d9b32SPeter Brune } SNES_FAS;
49421d9b32SPeter Brune 
50421d9b32SPeter Brune #endif
51