xref: /petsc/src/ksp/pc/impls/telescope/telescope.h (revision 2a22aa427fba2a1731631377d9475e4b679dc0e4)
11e07b27eSBarry Smith 
21e07b27eSBarry Smith #ifndef __PETSCPC_TELESCOPE_H
31e07b27eSBarry Smith #define __PETSCPC_TELESCOPE_H
41e07b27eSBarry Smith 
51e07b27eSBarry Smith /* Telescope */
61e07b27eSBarry Smith typedef enum { TELESCOPE_DEFAULT = 0, TELESCOPE_DMDA, TELESCOPE_DMPLEX } PCTelescopeType;
71e07b27eSBarry Smith 
81e07b27eSBarry Smith typedef struct _PC_Telescope *PC_Telescope;
91e07b27eSBarry Smith struct _PC_Telescope {
101e07b27eSBarry Smith   PetscSubcomm      psubcomm;
1148a10b22SPatrick Sanan   PetscSubcommType  subcommtype;
12*2a22aa42SDave May   MPI_Comm          subcomm;
131e07b27eSBarry Smith   PetscInt          redfactor; /* factor to reduce comm size by */
141e07b27eSBarry Smith   KSP               ksp;
151e07b27eSBarry Smith   IS                isin;
161e07b27eSBarry Smith   VecScatter        scatter;
171e07b27eSBarry Smith   Vec               xred,yred,xtmp;
181e07b27eSBarry Smith   Mat               Bred;
197c5279cbSDave May   PetscBool         ignore_dm,ignore_kspcomputeoperators;
201e07b27eSBarry Smith   PCTelescopeType   sr_type;
211e07b27eSBarry Smith   void              *dm_ctx;
221e07b27eSBarry Smith   PetscErrorCode    (*pctelescope_setup_type)(PC,PC_Telescope);
231e07b27eSBarry Smith   PetscErrorCode    (*pctelescope_matcreate_type)(PC,PC_Telescope,MatReuse,Mat*);
24392968a1SPatrick Sanan   PetscErrorCode    (*pctelescope_matnullspacecreate_type)(PC,PC_Telescope,Mat);
251e07b27eSBarry Smith   PetscErrorCode    (*pctelescope_reset_type)(PC);
26e3acf2f7SBarry Smith };
271e07b27eSBarry Smith 
28*2a22aa42SDave May  PetscBool isActiveRank(PC_Telescope);
291e07b27eSBarry Smith  DM private_PCTelescopeGetSubDM(PC_Telescope);
301e07b27eSBarry Smith 
311e07b27eSBarry Smith /* DMDA */
321e07b27eSBarry Smith typedef struct {
331e07b27eSBarry Smith   DM              dmrepart;
341e07b27eSBarry Smith   Mat             permutation;
351e07b27eSBarry Smith   Vec             xp;
361e07b27eSBarry Smith   PetscInt        Mp_re,Np_re,Pp_re;
371e07b27eSBarry Smith   PetscInt        *range_i_re,*range_j_re,*range_k_re;
381e07b27eSBarry Smith   PetscInt        *start_i_re,*start_j_re,*start_k_re;
391e07b27eSBarry Smith } PC_Telescope_DMDACtx;
401e07b27eSBarry Smith 
411e07b27eSBarry Smith  PetscErrorCode _DMDADetermineRankFromGlobalIJK(PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,
421e07b27eSBarry Smith                                                PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,
431e07b27eSBarry Smith                                                PetscMPIInt*,PetscMPIInt*,PetscMPIInt*,PetscMPIInt*);
441e07b27eSBarry Smith 
451e07b27eSBarry Smith  PetscErrorCode _DMDADetermineGlobalS0(PetscInt,PetscMPIInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
461e07b27eSBarry Smith 
471e07b27eSBarry Smith  PetscErrorCode PCTelescopeSetUp_dmda(PC,PC_Telescope);
481e07b27eSBarry Smith  PetscErrorCode PCTelescopeMatCreate_dmda(PC,PC_Telescope,MatReuse,Mat*);
49392968a1SPatrick Sanan  PetscErrorCode PCTelescopeMatNullSpaceCreate_dmda(PC,PC_Telescope,Mat);
501e07b27eSBarry Smith  PetscErrorCode PCApply_Telescope_dmda(PC,Vec,Vec);
51f650675bSDave May PetscErrorCode PCApplyRichardson_Telescope_dmda(PC pc,Vec x,Vec y,Vec w,PetscReal rtol,PetscReal abstol, PetscReal dtol,PetscInt its,PetscBool zeroguess,PetscInt *outits,PCRichardsonConvergedReason *reason);
521e07b27eSBarry Smith PetscErrorCode PCReset_Telescope_dmda(PC);
538ef9ca65SPatrick Sanan PetscErrorCode DMView_DA_Short(DM,PetscViewer);
541e07b27eSBarry Smith 
551e07b27eSBarry Smith #endif
56