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