xref: /petsc/src/ksp/pc/impls/telescope/telescope.h (revision 48a10b22724dcb2133e337caacd0d29403d7be99)
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;
11*48a10b22SPatrick Sanan   PetscSubcommType  subcommtype;
121e07b27eSBarry Smith   PetscInt          redfactor; /* factor to reduce comm size by */
131e07b27eSBarry Smith   KSP               ksp;
141e07b27eSBarry Smith   IS                isin;
151e07b27eSBarry Smith   VecScatter        scatter;
161e07b27eSBarry Smith   Vec               xred,yred,xtmp;
171e07b27eSBarry Smith   Mat               Bred;
187c5279cbSDave May   PetscBool         ignore_dm,ignore_kspcomputeoperators;
191e07b27eSBarry Smith   PCTelescopeType   sr_type;
201e07b27eSBarry Smith   void              *dm_ctx;
211e07b27eSBarry Smith   PetscErrorCode    (*pctelescope_setup_type)(PC,PC_Telescope);
221e07b27eSBarry Smith   PetscErrorCode    (*pctelescope_matcreate_type)(PC,PC_Telescope,MatReuse,Mat*);
231e07b27eSBarry Smith   PetscErrorCode    (*pctelescope_matnullspacecreate_type)(PC,PC_Telescope,Mat);
241e07b27eSBarry Smith   PetscErrorCode    (*pctelescope_reset_type)(PC);
25e3acf2f7SBarry Smith };
261e07b27eSBarry Smith 
271e07b27eSBarry Smith PetscBool isActiveRank(PetscSubcomm);
281e07b27eSBarry Smith DM private_PCTelescopeGetSubDM(PC_Telescope);
291e07b27eSBarry Smith 
301e07b27eSBarry Smith /* DMDA */
311e07b27eSBarry Smith typedef struct {
321e07b27eSBarry Smith   DM              dmrepart;
331e07b27eSBarry Smith   Mat             permutation;
341e07b27eSBarry Smith   Vec             xp;
351e07b27eSBarry Smith   PetscInt        Mp_re,Np_re,Pp_re;
361e07b27eSBarry Smith   PetscInt        *range_i_re,*range_j_re,*range_k_re;
371e07b27eSBarry Smith   PetscInt        *start_i_re,*start_j_re,*start_k_re;
381e07b27eSBarry Smith } PC_Telescope_DMDACtx;
391e07b27eSBarry Smith 
401e07b27eSBarry Smith PetscErrorCode _DMDADetermineRankFromGlobalIJK(PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,
411e07b27eSBarry Smith                                                PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,
421e07b27eSBarry Smith                                                PetscMPIInt*,PetscMPIInt*,PetscMPIInt*,PetscMPIInt*);
431e07b27eSBarry Smith 
441e07b27eSBarry Smith PetscErrorCode _DMDADetermineGlobalS0(PetscInt,PetscMPIInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
451e07b27eSBarry Smith 
461e07b27eSBarry Smith PetscErrorCode PCTelescopeSetUp_dmda(PC,PC_Telescope);
471e07b27eSBarry Smith PetscErrorCode PCTelescopeMatCreate_dmda(PC,PC_Telescope,MatReuse,Mat*);
481e07b27eSBarry Smith PetscErrorCode PCTelescopeMatNullSpaceCreate_dmda(PC,PC_Telescope,Mat);
491e07b27eSBarry Smith PetscErrorCode PCApply_Telescope_dmda(PC,Vec,Vec);
50f650675bSDave 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);
511e07b27eSBarry Smith PetscErrorCode PCReset_Telescope_dmda(PC);
521e07b27eSBarry Smith PetscErrorCode DMView_DMDAShort(DM,PetscViewer);
531e07b27eSBarry Smith 
541e07b27eSBarry Smith #endif
55