xref: /petsc/src/ksp/pc/impls/telescope/telescope.h (revision 1e07b27e81e393854908e91a98c07414449fdbdc)
1*1e07b27eSBarry Smith 
2*1e07b27eSBarry Smith #ifndef __PETSCPC_TELESCOPE_H
3*1e07b27eSBarry Smith #define __PETSCPC_TELESCOPE_H
4*1e07b27eSBarry Smith 
5*1e07b27eSBarry Smith /* Telescope */
6*1e07b27eSBarry Smith typedef enum { TELESCOPE_DEFAULT = 0, TELESCOPE_DMDA, TELESCOPE_DMPLEX } PCTelescopeType;
7*1e07b27eSBarry Smith 
8*1e07b27eSBarry Smith typedef struct _PC_Telescope *PC_Telescope;
9*1e07b27eSBarry Smith struct _PC_Telescope {
10*1e07b27eSBarry Smith   PetscSubcomm      psubcomm;
11*1e07b27eSBarry Smith   PetscInt          redfactor; /* factor to reduce comm size by */
12*1e07b27eSBarry Smith   KSP               ksp;
13*1e07b27eSBarry Smith   IS                isin;
14*1e07b27eSBarry Smith   VecScatter        scatter;
15*1e07b27eSBarry Smith   Vec               xred,yred,xtmp;
16*1e07b27eSBarry Smith   Mat               Bred;
17*1e07b27eSBarry Smith   PetscBool         ignore_dm;
18*1e07b27eSBarry Smith   PCTelescopeType   sr_type;
19*1e07b27eSBarry Smith   void              *dm_ctx;
20*1e07b27eSBarry Smith   PetscErrorCode    (*pctelescope_setup_type)(PC,PC_Telescope);
21*1e07b27eSBarry Smith   PetscErrorCode    (*pctelescope_matcreate_type)(PC,PC_Telescope,MatReuse,Mat*);
22*1e07b27eSBarry Smith   PetscErrorCode    (*pctelescope_matnullspacecreate_type)(PC,PC_Telescope,Mat);
23*1e07b27eSBarry Smith   PetscErrorCode    (*pctelescope_reset_type)(PC);
24*1e07b27eSBarry Smith } P;
25*1e07b27eSBarry Smith 
26*1e07b27eSBarry Smith PetscBool isActiveRank(PetscSubcomm);
27*1e07b27eSBarry Smith DM private_PCTelescopeGetSubDM(PC_Telescope);
28*1e07b27eSBarry Smith 
29*1e07b27eSBarry Smith /* DMDA */
30*1e07b27eSBarry Smith typedef struct {
31*1e07b27eSBarry Smith   DM              dmrepart;
32*1e07b27eSBarry Smith   Mat             permutation;
33*1e07b27eSBarry Smith   Vec             xp;
34*1e07b27eSBarry Smith   PetscInt        Mp_re,Np_re,Pp_re;
35*1e07b27eSBarry Smith   PetscInt        *range_i_re,*range_j_re,*range_k_re;
36*1e07b27eSBarry Smith   PetscInt        *start_i_re,*start_j_re,*start_k_re;
37*1e07b27eSBarry Smith } PC_Telescope_DMDACtx;
38*1e07b27eSBarry Smith 
39*1e07b27eSBarry Smith PetscErrorCode _DMDADetermineRankFromGlobalIJK(PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,
40*1e07b27eSBarry Smith                                                PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,
41*1e07b27eSBarry Smith                                                PetscMPIInt*,PetscMPIInt*,PetscMPIInt*,PetscMPIInt*);
42*1e07b27eSBarry Smith 
43*1e07b27eSBarry Smith PetscErrorCode _DMDADetermineGlobalS0(PetscInt,PetscMPIInt,PetscInt,PetscInt,PetscInt,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
44*1e07b27eSBarry Smith 
45*1e07b27eSBarry Smith PetscErrorCode PCTelescopeSetUp_dmda(PC,PC_Telescope);
46*1e07b27eSBarry Smith PetscErrorCode PCTelescopeMatCreate_dmda(PC,PC_Telescope,MatReuse,Mat*);
47*1e07b27eSBarry Smith PetscErrorCode PCTelescopeMatNullSpaceCreate_dmda(PC,PC_Telescope,Mat);
48*1e07b27eSBarry Smith PetscErrorCode PCApply_Telescope_dmda(PC,Vec,Vec);
49*1e07b27eSBarry Smith PetscErrorCode PCReset_Telescope_dmda(PC);
50*1e07b27eSBarry Smith PetscErrorCode DMView_DMDAShort(DM,PetscViewer);
51*1e07b27eSBarry Smith 
52*1e07b27eSBarry Smith #endif
53