Actual source code: bddcstructs.h

petsc-3.7.3 2016-08-01
Report Typos and Errors
4: #include <petscksp.h> 5: #include <petscbt.h> 7: /* special marks for interface graph: they cannot be enums, since special marks should in principle range from -4 to -max_int */ 8: #define PCBDDCGRAPH_NEUMANN_MARK -1 9: #define PCBDDCGRAPH_DIRICHLET_MARK -2 10: #define PCBDDCGRAPH_LOCAL_PERIODIC_MARK -3 11: #define PCBDDCGRAPH_SPECIAL_MARK -4 13: /* Structure for local graph partitioning */ 14: struct _PCBDDCGraph { 15: /* graph information */ 16: ISLocalToGlobalMapping l2gmap; 17: PetscInt nvtxs; 18: PetscInt nvtxs_global; 19: PetscBT touched; 20: PetscInt *count; 21: PetscInt **neighbours_set; 22: PetscInt *subset; 23: PetscInt *which_dof; 24: PetscInt *special_dof; 25: PetscInt custom_minimal_size; 26: PetscBool twodim; 27: PetscBool has_dirichlet; 28: IS dirdofs; 29: IS dirdofsB; 30: /* data for connected components */ 31: PetscInt ncc; 32: PetscInt *cptr; 33: PetscInt *queue; 34: PetscBool queue_sorted; 35: /* data for interface subsets */ 36: PetscInt n_subsets; 37: PetscInt *subsets_size; 38: PetscInt **subsets; 39: PetscInt *subset_ncc; 40: PetscInt *subset_ref_node; 41: /* data for periodic dofs */ 42: PetscInt *mirrors; 43: PetscInt **mirrors_set; 44: /* placeholders for connectivity relation between dofs */ 45: PetscInt nvtxs_csr; 46: PetscInt *xadj; 47: PetscInt *adjncy; 48: }; 49: typedef struct _PCBDDCGraph *PCBDDCGraph; 51: /* Temporary wrap to MUMPS solver in Schur complement mode. Provides 52: - standalone solver for interior variables 53: - forward and backward substitutions for correction solver 54: */ 55: /* It assumes that interior variables are a contiguous set starting from 0 */ 56: struct _PCBDDCReuseMumps { 57: /* the factored matrix obtained from MatGetFactor(...,MAT_SOLVER_MUMPS...) */ 58: Mat F; 59: /* placeholders for the solution and rhs on the whole set of dofs of A (size local_dofs - local_vertices)*/ 60: Vec sol; 61: Vec rhs; 62: /* size of interior problem */ 63: PetscInt n_I; 64: /* shell PCs to handle MUMPS interior/correction solvers */ 65: PC interior_solver; 66: PC correction_solver; 67: IS is_R; 68: /* objects to hanlde Schur complement solution */ 69: Vec rhs_B; 70: Vec sol_B; 71: IS is_B; 72: VecScatter correction_scatter_B; 73: }; 74: typedef struct _PCBDDCReuseMumps *PCBDDCReuseMumps; 76: /* structure to handle Schur complements on subsets */ 77: struct _PCBDDCSubSchurs { 78: /* local Neumann matrix */ 79: Mat A; 80: /* local Schur complement */ 81: Mat S; 82: /* index sets */ 83: IS is_I; 84: IS is_B; 85: /* whether Schur complements are computed with MUMPS or not */ 86: PetscBool use_mumps; 87: /* matrices cointained explicit schur complements cat together */ 88: /* note that AIJ format is used but the values are inserted as in column major ordering */ 89: Mat S_Ej_all; 90: Mat sum_S_Ej_all; 91: Mat sum_S_Ej_inv_all; 92: Mat sum_S_Ej_tilda_all; 93: IS is_Ej_all; 94: IS is_vertices; 95: IS is_dir; 96: /* l2g maps */ 97: ISLocalToGlobalMapping l2gmap; 98: ISLocalToGlobalMapping BtoNmap; 99: /* number of local subproblems */ 100: PetscInt n_subs; 101: /* connected components */ 102: IS* is_subs; 103: PetscBT is_edge; 104: /* mat flags */ 105: PetscBool is_hermitian; 106: PetscBool is_posdef; 107: /* data structure to reuse MUMPS Schur solver */ 108: PCBDDCReuseMumps reuse_mumps; 109: }; 110: typedef struct _PCBDDCSubSchurs *PCBDDCSubSchurs; 112: /* Structure for deluxe scaling */ 113: struct _PCBDDCDeluxeScaling { 114: /* simple scaling on selected dofs (i.e. primal vertices and nodes on interface dirichlet boundaries) */ 115: PetscInt n_simple; 116: PetscInt* idx_simple_B; 117: /* handle deluxe problems */ 118: VecScatter seq_scctx; 119: Vec seq_work1; 120: Vec seq_work2; 121: Mat seq_mat; 122: KSP seq_ksp; 123: }; 124: typedef struct _PCBDDCDeluxeScaling *PCBDDCDeluxeScaling; 126: /* inexact solvers with nullspace correction */ 127: struct _NullSpaceCorrection_ctx { 128: Mat basis_mat; 129: Mat Kbasis_mat; 130: Mat Lbasis_mat; 131: PC local_pc; 132: Vec work_small_1; 133: Vec work_small_2; 134: Vec work_full_1; 135: Vec work_full_2; 136: }; 137: typedef struct _NullSpaceCorrection_ctx *NullSpaceCorrection_ctx; 139: /* change of basis */ 140: struct _PCBDDCChange_ctx { 141: Mat original_mat; 142: Mat global_change; 143: Vec *work; 144: }; 145: typedef struct _PCBDDCChange_ctx *PCBDDCChange_ctx; 147: /* feti-dp mat */ 148: struct _FETIDPMat_ctx { 149: PetscInt n_lambda; 150: Vec lambda_local; 151: Vec temp_solution_B; 152: Vec temp_solution_D; 153: Mat B_delta; 154: Mat B_Ddelta; 155: VecScatter l2g_lambda; 156: PC pc; 157: }; 158: typedef struct _FETIDPMat_ctx *FETIDPMat_ctx; 160: /* feti-dp dirichlet preconditioner */ 161: struct _FETIDPPC_ctx { 162: Mat S_j; 163: Vec lambda_local; 164: Mat B_Ddelta; 165: VecScatter l2g_lambda; 166: PC pc; 167: }; 168: typedef struct _FETIDPPC_ctx *FETIDPPC_ctx; 170: #endif