11e07b27eSBarry Smith 21e07b27eSBarry Smith #ifndef __PETSCPC_TELESCOPE_H 31e07b27eSBarry Smith #define __PETSCPC_TELESCOPE_H 41e07b27eSBarry Smith 51e07b27eSBarry Smith /* Telescope */ 6*8d9f7141SDave May typedef enum { TELESCOPE_DEFAULT = 0, TELESCOPE_DMDA, TELESCOPE_DMPLEX, TELESCOPE_COARSEDM } PCTelescopeType; 71e07b27eSBarry Smith 81e07b27eSBarry Smith typedef struct _PC_Telescope *PC_Telescope; 91e07b27eSBarry Smith struct _PC_Telescope { 101e07b27eSBarry Smith PetscSubcomm psubcomm; 1148a10b22SPatrick Sanan PetscSubcommType subcommtype; 122a22aa42SDave 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; 19*8d9f7141SDave May PetscBool ignore_dm,ignore_kspcomputeoperators,use_coarse_dm; 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 282a22aa42SDave 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); 51*8d9f7141SDave May PetscErrorCode PCApplyRichardson_Telescope_dmda(PC,Vec,Vec,Vec,PetscReal,PetscReal,PetscReal,PetscInt,PetscBool,PetscInt*,PCRichardsonConvergedReason*); 521e07b27eSBarry Smith PetscErrorCode PCReset_Telescope_dmda(PC); 53*8d9f7141SDave May PetscErrorCode PCTelescopeSetUp_CoarseDM(PC,PC_Telescope); 54*8d9f7141SDave May PetscErrorCode PCApply_Telescope_CoarseDM(PC,Vec,Vec); 55*8d9f7141SDave May PetscErrorCode PCTelescopeMatNullSpaceCreate_CoarseDM(PC,PC_Telescope,Mat); 56*8d9f7141SDave May PetscErrorCode PCReset_Telescope_CoarseDM(PC); 57*8d9f7141SDave May PetscErrorCode PCApplyRichardson_Telescope_CoarseDM(PC,Vec,Vec,Vec,PetscReal,PetscReal,PetscReal,PetscInt,PetscBool,PetscInt*,PCRichardsonConvergedReason*); 588ef9ca65SPatrick Sanan PetscErrorCode DMView_DA_Short(DM,PetscViewer); 591e07b27eSBarry Smith 601e07b27eSBarry Smith #endif 61