93 Mat system_matrix, dummy;
94#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>=5)
95 KSPGetOperators(rKspObject, &system_matrix, &dummy);
98 KSPGetOperators(rKspObject, &system_matrix, &dummy, &flag);
102 MatGetSize(system_matrix, &num_rows, &num_columns);
103 assert(num_rows==num_columns);
105 PetscInt num_local_rows, num_local_columns;
106 MatGetLocalSize(system_matrix, &num_local_rows, &num_local_columns);
110 if ((num_rows%2 != 0) || (num_local_rows%2 != 0))
112 TERMINATE(
"Wrong matrix parallel layout detected in PCBlockDiagonal.");
116 unsigned subvector_num_rows = num_rows/2;
117 unsigned subvector_local_rows = num_local_rows/2;
139 assert(global_size == num_rows/2);
143 ISCreateStride(PETSC_COMM_WORLD, high-low, 2*low, 2, &A11_local_rows);
144 ISCreateStride(PETSC_COMM_WORLD, global_size, 0, 2, &A11_columns);
146#if (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 8)
147 MatCreateSubMatrix(system_matrix, A11_local_rows, A11_local_rows,
150 MatGetSubMatrix(system_matrix, A11_local_rows, A11_local_rows,
165 assert(global_size == num_rows/2);
169 ISCreateStride(PETSC_COMM_WORLD, high-low, 2*low+1, 2, &A22_local_rows);
170 ISCreateStride(PETSC_COMM_WORLD, global_size, 1, 2, &A22_columns);
172#if (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 8)
173 MatCreateSubMatrix(system_matrix, A22_local_rows, A22_local_rows,
176 MatGetSubMatrix(system_matrix, A22_local_rows, A22_local_rows,
186#if (PETSC_VERSION_MAJOR == 2 && PETSC_VERSION_MINOR == 2)
212 PetscPushErrorHandler(PetscIgnoreErrorHandler,
nullptr);
214 if (pc_set_error != 0)
216 WARNING(
"PETSc hypre preconditioning library is not installed");
219 PetscPopErrorHandler();
221#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR<=5)
232#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>=5)
246 PetscPushErrorHandler(PetscIgnoreErrorHandler,
nullptr);
249 PetscPopErrorHandler();
292#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>=5)
VecScatter A11_scatter_ctx
VecScatter A22_scatter_ctx