Actual source code: bddc.h

petsc-3.13.6 2020-09-29
Report Typos and Errors

  4:  #include <../src/ksp/pc/impls/is/pcis.h>
  5:  #include <../src/ksp/pc/impls/bddc/bddcstructs.h>

  7: #if !defined(PETSC_PCBDDC_MAXLEVELS)
  8: #define PETSC_PCBDDC_MAXLEVELS 8
  9: #endif

 11: PETSC_EXTERN PetscLogEvent PC_BDDC_Topology[PETSC_PCBDDC_MAXLEVELS];
 12: PETSC_EXTERN PetscLogEvent PC_BDDC_LocalSolvers[PETSC_PCBDDC_MAXLEVELS];
 13: PETSC_EXTERN PetscLogEvent PC_BDDC_LocalWork[PETSC_PCBDDC_MAXLEVELS];
 14: PETSC_EXTERN PetscLogEvent PC_BDDC_CorrectionSetUp[PETSC_PCBDDC_MAXLEVELS];
 15: PETSC_EXTERN PetscLogEvent PC_BDDC_CoarseSetUp[PETSC_PCBDDC_MAXLEVELS];
 16: PETSC_EXTERN PetscLogEvent PC_BDDC_ApproxSetUp[PETSC_PCBDDC_MAXLEVELS];
 17: PETSC_EXTERN PetscLogEvent PC_BDDC_ApproxApply[PETSC_PCBDDC_MAXLEVELS];
 18: PETSC_EXTERN PetscLogEvent PC_BDDC_CoarseSolver[PETSC_PCBDDC_MAXLEVELS];
 19: PETSC_EXTERN PetscLogEvent PC_BDDC_AdaptiveSetUp[PETSC_PCBDDC_MAXLEVELS];
 20: PETSC_EXTERN PetscLogEvent PC_BDDC_Scaling[PETSC_PCBDDC_MAXLEVELS];
 21: PETSC_EXTERN PetscLogEvent PC_BDDC_Schurs[PETSC_PCBDDC_MAXLEVELS];

 23: /* Private context (data structure) for the BDDC preconditioner.  */
 24: typedef struct {
 25:   /* First MUST come the folowing line, for the stuff that is common to FETI and Neumann-Neumann. */
 26:   PC_IS         pcis;
 27:   /* Coarse stuffs needed by BDDC Section 1.5 Writing Application Codes with PETSc in KSP */
 28:   Vec           coarse_vec;
 29:   KSP           coarse_ksp;
 30:   Mat           coarse_phi_B;
 31:   Mat           coarse_phi_D;
 32:   Mat           coarse_psi_B;
 33:   Mat           coarse_psi_D;
 34:   PetscInt      local_primal_size;
 35:   PetscInt      coarse_size;
 36:   PetscInt*     global_primal_indices;
 37:   VecScatter    coarse_loc_to_glob;
 38:   /* Local stuffs needed by BDDC Section 1.5 Writing Application Codes with PETSc in KSP */
 39:   Vec           vec1_P;
 40:   Vec           vec1_C;
 41:   Mat           local_auxmat1;
 42:   Mat           local_auxmat2;
 43:   Vec           vec1_R;
 44:   Vec           vec2_R;
 45:   IS            is_R_local;
 46:   VecScatter    R_to_B;
 47:   VecScatter    R_to_D;
 48:   KSP           ksp_R;
 49:   KSP           ksp_D;
 50:   /* Quantities defining constraining details (local) of the preconditioner */
 51:   /* These quantities define the preconditioner itself */
 52:   PetscInt      n_vertices;
 53:   Mat           ConstraintMatrix;
 54:   PetscBool     new_primal_space;
 55:   PetscBool     new_primal_space_local;
 56:   PetscInt      *primal_indices_local_idxs;
 57:   PetscInt      local_primal_size_cc;
 58:   PetscInt      *local_primal_ref_node;
 59:   PetscInt      *local_primal_ref_mult;
 60:   PetscBool     use_change_of_basis;
 61:   PetscBool     use_change_on_faces;
 62:   PetscBool     fake_change;
 63:   Mat           ChangeOfBasisMatrix;
 64:   Mat           user_ChangeOfBasisMatrix;
 65:   PetscBool     change_interior;
 66:   Mat           switch_static_change;
 67:   Vec           work_change;
 68:   Vec           original_rhs;
 69:   Vec           temp_solution;
 70:   Mat           local_mat;
 71:   PetscBool     use_exact_dirichlet_trick;
 72:   PetscBool     exact_dirichlet_trick_app;
 73:   PetscBool     ksp_guess_nonzero;
 74:   PetscBool     rhs_change;
 75:   PetscBool     temp_solution_used;
 76:   /* benign subspace trick */
 77:   PetscBool     benign_saddle_point;
 78:   PetscBool     benign_have_null;
 79:   PetscBool     benign_skip_correction;
 80:   PetscBool     benign_compute_correction;
 81:   Mat           benign_change;
 82:   Mat           benign_original_mat;
 83:   IS            *benign_zerodiag_subs;
 84:   Vec           benign_vec;
 85:   Mat           benign_B0;
 86:   PetscSF       benign_sf;
 87:   PetscScalar   *benign_p0;
 88:   PetscInt      benign_n;
 89:   PetscInt      *benign_p0_lidx;
 90:   PetscInt      *benign_p0_gidx;
 91:   PetscBool     benign_null;
 92:   PetscBool     benign_change_explicit;
 93:   PetscBool     benign_apply_coarse_only;

 95:   /* Some defaults on selecting vertices and constraints*/
 96:   PetscBool     use_local_adj;
 97:   PetscBool     use_vertices;
 98:   PetscBool     use_faces;
 99:   PetscBool     use_edges;

101:   /* Some customization is possible */
102:   PetscBool           corner_selection;
103:   PetscBool           corner_selected;
104:   PetscBool           recompute_topography;
105:   PetscBool           graphanalyzed;
106:   PCBDDCGraph         mat_graph;
107:   PetscInt            graphmaxcount;
108:   MatNullSpace        onearnullspace;
109:   PetscObjectState    *onearnullvecs_state;
110:   PetscBool           NullSpace_corr[4];
111:   IS                  user_primal_vertices;
112:   IS                  user_primal_vertices_local;
113:   PetscBool           use_nnsp;
114:   PetscBool           use_nnsp_true;
115:   PetscBool           use_qr_single;
116:   PetscBool           user_provided_isfordofs;
117:   PetscInt            n_ISForDofs;
118:   PetscInt            n_ISForDofsLocal;
119:   IS                  *ISForDofs;
120:   IS                  *ISForDofsLocal;
121:   IS                  NeumannBoundaries;
122:   IS                  NeumannBoundariesLocal;
123:   IS                  DirichletBoundaries;
124:   IS                  DirichletBoundariesLocal;
125:   PetscBool           eliminate_dirdofs;
126:   PetscBool           switch_static;
127:   PetscInt            coarsening_ratio;
128:   PetscInt            coarse_adj_red;
129:   PetscInt            current_level;
130:   PetscInt            max_levels;
131:   PetscInt            coarse_eqs_per_proc;
132:   PetscInt            coarse_eqs_limit;
133:   IS                  coarse_subassembling;
134:   PetscBool           use_coarse_estimates;
135:   PetscBool           symmetric_primal;
136:   PetscInt            vertex_size;
137:   PCBDDCInterfaceExtType interface_extension;

139:   /* no-net-flux */
140:   PetscBool compute_nonetflux;
141:   Mat       divudotp;
142:   PetscBool divudotp_trans;
143:   IS        divudotp_vl2l;

145:   /* nedelec */
146:   Mat       discretegradient;
147:   PetscInt  nedorder;
148:   PetscBool conforming;
149:   PetscInt  nedfield;
150:   PetscBool nedglobal;
151:   Mat       nedcG;
152:   IS        nedclocal;

154:   /* local disconnected subdomains */
155:   PetscBool detect_disconnected;
156:   PetscBool detect_disconnected_filter;
157:   PetscInt  n_local_subs;
158:   IS        *local_subs;

160:   /* scaling */
161:   Vec                 work_scaling;
162:   PetscBool           use_deluxe_scaling;
163:   PCBDDCDeluxeScaling deluxe_ctx;
164:   PetscBool           deluxe_zerorows;
165:   PetscBool           deluxe_singlemat;

167:   /* schur complements on interface's subsets */
168:   PCBDDCSubSchurs sub_schurs;
169:   PetscBool       sub_schurs_rebuild;
170:   PetscBool       sub_schurs_exact_schur;
171:   PetscInt        sub_schurs_layers;
172:   PetscBool       sub_schurs_use_useradj;
173:   PetscBool       computed_rowadj;

175:   /* adaptive selection of constraints */
176:   PetscBool    adaptive_selection;
177:   PetscBool    adaptive_userdefined;
178:   PetscReal    adaptive_threshold[2];
179:   PetscInt     adaptive_nmin;
180:   PetscInt     adaptive_nmax;
181:   PetscInt*    adaptive_constraints_n;
182:   PetscInt*    adaptive_constraints_idxs;
183:   PetscInt*    adaptive_constraints_idxs_ptr;
184:   PetscScalar* adaptive_constraints_data;
185:   PetscInt*    adaptive_constraints_data_ptr;

187:   /* For verbose output of some bddc data structures */
188:   PetscInt    dbg_flag;
189:   PetscViewer dbg_viewer;
190: } PC_BDDC;

192: #endif /* __pcbddc_h */