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