xref: /petsc/src/snes/impls/fas/fasimpls.h (revision 009bbdc485cd9ad46be9940d3549e2dde9cdc322)
1 #if !defined(_SNES_FASIMPLS)
2 #define _SNES_FASIMPLS
3 
4 #include <petsc-private/snesimpl.h>
5 #include <petsc-private/linesearchimpl.h>
6 #include <petsc-private/dmimpl.h>
7 #include <petscsnesfas.h>
8 
9 typedef struct {
10 
11   /* flags for knowing the global place of this FAS object */
12   PetscInt       level;                        /* level = 0 coarsest level */
13   PetscInt       levels;                       /* if level + 1 = levels; we're the last turtle */
14 
15   PetscViewer    monitor;                      /* debuggging output for FAS */
16 
17   /* smoothing objects */
18   SNES           smoothu;                      /* the SNES for presmoothing */
19   SNES           smoothd;                      /* the SNES for postsmoothing */
20 
21   /* coarse grid correction objects */
22   SNES           next;                         /* the SNES instance for the next coarser level in the hierarchy */
23   SNES           fine;                         /* the finest SNES instance; used as a reference for prefixes */
24   SNES           previous;                     /* the SNES instance for the next finer level in the hierarchy */
25   Mat            interpolate;                  /* interpolation */
26   Mat            inject;                       /* injection operator (unscaled) */
27   Mat            restrct;                      /* restriction operator */
28   Vec            rscale;                       /* the pointwise scaling of the restriction operator */
29 
30   /* method parameters */
31   PetscInt       n_cycles;                     /* number of cycles on this level */
32   SNESFASType    fastype;                      /* FAS type */
33   PetscInt       max_up_it;                    /* number of pre-smooths */
34   PetscInt       max_down_it;                  /* number of post-smooth cycles */
35   PetscBool      usedmfornumberoflevels;       /* uses a DM to generate a number of the levels */
36 
37   /* Galerkin FAS state */
38   PetscBool      galerkin;                     /* use Galerkin formation of the coarse problem */
39   Vec            Xg;                           /* Galerkin solution projection */
40   Vec            Fg;                           /* Galerkin function projection */
41 
42   /* if logging times for each level */
43   PetscLogEvent  eventsmoothsetup;             /* level setup */
44   PetscLogEvent  eventsmoothsolve;             /* level smoother solves */
45   PetscLogEvent  eventresidual;                /* level residual evaluation */
46   PetscLogEvent  eventinterprestrict;          /* level interpolation and restriction */
47 
48 } SNES_FAS;
49 
50 #endif
51