Date: 2025-03-29T05:58:39+00:00

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:   /* method parameters */
     26:   PetscInt    n_cycles;               /* number of cycles on this level */
     27:   SNESFASType fastype;                /* FAS type */
     28:   PetscInt    max_up_it;              /* number of pre-smooths */
     29:   PetscInt    max_down_it;            /* number of post-smooth cycles */
     30:   PetscBool   usedmfornumberoflevels; /* uses a DM to generate a number of the levels */
     31:   PetscBool   full_downsweep;         /* smooth on the initial full downsweep */
     32:   PetscBool   full_total;             /* use total residual restriction and total solution interpolation on the initial downsweep and upsweep */
     33:   PetscBool   continuation;           /* sets the setup to default to continuation */
     34:   PetscInt    full_stage;             /* stage of the full cycle -- 0 is the upswing, 1 is the downsweep and final V-cycle */

     36:   /* Galerkin FAS state */
     37:   PetscBool galerkin; /* use Galerkin formation of the coarse problem */
     38:   Vec       Xg;       /* Galerkin solution projection */
     39:   Vec       Fg;       /* Galerkin function projection */

     41:   /* if logging times for each level */
     42:   PetscLogEvent eventsmoothsetup;    /* level setup */
     43:   PetscLogEvent eventsmoothsolve;    /* level smoother solves */
     44:   PetscLogEvent eventresidual;       /* level residual evaluation */
     45:   PetscLogEvent eventinterprestrict; /* level interpolation and restriction */
     46: } SNES_FAS;

     48: PETSC_INTERN PetscErrorCode SNESFASCycleCreateSmoother_Private(SNES, SNES *);