xref: /petsc/src/snes/impls/fas/fasimpls.h (revision 87f44e3fb7de2ff439013de3578ccf3ef7b2b1b5)
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 */
36928e959bSPeter Brune   PetscBool   full_downsweep;                  /* smooth on the initial full downsweep */
37*87f44e3fSPeter Brune   PetscBool   continuation;                    /* sets the setup to default to continuation */
388c94862eSPeter Brune   PetscInt    full_stage;                      /* stage of the full cycle -- 0 is the upswing, 1 is the downsweep and final V-cycle */
396273346dSPeter Brune 
406273346dSPeter Brune   /* Galerkin FAS state */
416273346dSPeter Brune   PetscBool galerkin;                          /* use Galerkin formation of the coarse problem */
426273346dSPeter Brune   Vec       Xg;                                /* Galerkin solution projection */
436273346dSPeter Brune   Vec       Fg;                                /* Galerkin function projection */
446273346dSPeter Brune 
450dd27c6cSPeter Brune   /* if logging times for each level */
460dd27c6cSPeter Brune   PetscLogEvent eventsmoothsetup;              /* level setup */
470dd27c6cSPeter Brune   PetscLogEvent eventsmoothsolve;              /* level smoother solves */
480dd27c6cSPeter Brune   PetscLogEvent eventresidual;                 /* level residual evaluation */
490dd27c6cSPeter Brune   PetscLogEvent eventinterprestrict;           /* level interpolation and restriction */
500dd27c6cSPeter Brune 
518c94862eSPeter Brune 
52421d9b32SPeter Brune } SNES_FAS;
53421d9b32SPeter Brune 
54421d9b32SPeter Brune #endif
55