1 #if !defined(_SNES_FASIMPLS)
2 #define _SNES_FASIMPLS
3 
4 #include <petsc/private/snesimpl.h>
5 #include <petsc/private/linesearchimpl.h>
6 #include <petscdm.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   /* smoothing objects */
15   SNES smoothu;                                /* the SNES for presmoothing */
16   SNES smoothd;                                /* the SNES for postsmoothing */
17 
18   /* coarse grid correction objects */
19   SNES next;                                   /* the SNES instance for the next coarser level in the hierarchy */
20   SNES fine;                                   /* the finest SNES instance; used as a reference for prefixes */
21   SNES previous;                               /* the SNES instance for the next finer level in the hierarchy */
22   Mat  interpolate;                            /* interpolation */
23   Mat  inject;                                 /* injection operator (unscaled) */
24   Mat  restrct;                                /* restriction operator */
25   Vec  rscale;                                 /* the pointwise scaling of the restriction operator */
26 
27   /* method parameters */
28   PetscInt    n_cycles;                        /* number of cycles on this level */
29   SNESFASType fastype;                         /* FAS type */
30   PetscInt    max_up_it;                       /* number of pre-smooths */
31   PetscInt    max_down_it;                     /* number of post-smooth cycles */
32   PetscBool   usedmfornumberoflevels;          /* uses a DM to generate a number of the levels */
33   PetscBool   full_downsweep;                  /* smooth on the initial full downsweep */
34   PetscBool   continuation;                    /* sets the setup to default to continuation */
35   PetscInt    full_stage;                      /* stage of the full cycle -- 0 is the upswing, 1 is the downsweep and final V-cycle */
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 } SNES_FAS;
48 
49 PETSC_INTERN PetscErrorCode SNESFASCycleCreateSmoother_Private(SNES,SNES*);
50 
51 #endif
52