Actual source code: fasimpls.h
1: #pragma once
3: #include <petsc/private/snesimpl.h>
4: #include <petsc/private/linesearchimpl.h>
5: #include <petscdm.h>
7: typedef struct {
8: /* flags for knowing the global place of this FAS object */
9: PetscInt level; /* level = 0 coarsest level */
10: PetscInt levels; /* if level + 1 = levels; we're the last turtle */
12: /* smoothing objects */
13: SNES smoothu; /* the SNES for presmoothing */
14: SNES smoothd; /* the SNES for postsmoothing */
16: /* coarse grid correction objects */
17: SNES next; /* the SNES instance for the next coarser level in the hierarchy */
18: SNES fine; /* the finest SNES instance; used as a reference for prefixes */
19: SNES previous; /* the SNES instance for the next finer level in the hierarchy */
20: Mat interpolate; /* interpolation */
21: Mat inject; /* injection operator (unscaled) */
22: Mat restrct; /* restriction operator */
23: Vec rscale; /* the pointwise scaling of the restriction operator */
25: PetscBool useCoarseCorrectionLineSearch;
26: SNESLineSearch coarseCorrectionLineSearch; /* optional line search for X += lambda*I(x^c - Rx); NONE (unit step) by default */
28: PetscBool monitorCorrection; /* monitor the coarse correction step */
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: PetscBool full_downsweep; /* smooth on the initial full downsweep */
37: PetscBool full_total; /* use total residual restriction and total solution interpolation on the initial downsweep and upsweep */
38: PetscBool continuation; /* sets the setup to default to continuation */
39: PetscInt full_stage; /* stage of the full cycle -- 0 is the upswing, 1 is the downsweep and final V-cycle */
41: /* Galerkin FAS state */
42: PetscBool galerkin; /* use Galerkin formation of the coarse problem */
43: Vec Xg; /* Galerkin solution projection */
44: Vec Fg; /* Galerkin function projection */
46: /* if logging times for each level */
47: PetscLogEvent eventsmoothsetup; /* level setup */
48: PetscLogEvent eventsmoothsolve; /* level smoother solves */
49: PetscLogEvent eventresidual; /* level residual evaluation */
50: PetscLogEvent eventinterprestrict; /* level interpolation and restriction */
51: } SNES_FAS;
53: PETSC_INTERN PetscErrorCode SNESFASCycleCreateSmoother_Private(SNES, SNES *);