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