Lines Matching refs:osm

18   PC_ASM           *osm = (PC_ASM *)pc->data;  in PCView_ASM()  local
31 …if (osm->overlap >= 0) PetscCall(PetscSNPrintf(overlaps, sizeof(overlaps), "amount of overlap = %"… in PCView_ASM()
32 …if (osm->n > 0) PetscCall(PetscSNPrintf(blocks, sizeof(blocks), "total subdomain blocks = %" Petsc… in PCView_ASM()
34 …(PetscViewerASCIIPrintf(viewer, " restriction/interpolation type - %s\n", PCASMTypes[osm->type])); in PCView_ASM()
35 …if (osm->dm_subdomains) PetscCall(PetscViewerASCIIPrintf(viewer, " Additive Schwarz: using DM to … in PCView_ASM()
36osm->loctype != PC_COMPOSITE_ADDITIVE) PetscCall(PetscViewerASCIIPrintf(viewer, " Additive Schwar… in PCView_ASM()
40 if (osm->ksp) { in PCView_ASM()
47 PetscCall(KSPView(osm->ksp[0], sviewer)); in PCView_ASM()
54 …zedPrintf(viewer, " [%d] number of local blocks = %" PetscInt_FMT "\n", rank, osm->n_local_true)); in PCView_ASM()
60 for (i = 0; i < osm->n_local_true; i++) { in PCView_ASM()
61 PetscCall(ISGetLocalSize(osm->is[i], &bsz)); in PCView_ASM()
63 PetscCall(KSPView(osm->ksp[i], sviewer)); in PCView_ASM()
71 …s=%" PetscInt_FMT ", overlap=%" PetscInt_FMT ", type=%s", osm->n, osm->overlap, PCASMTypes[osm->ty… in PCView_ASM()
73 if (osm->ksp) PetscCall(KSPView(osm->ksp[0], sviewer)); in PCView_ASM()
81 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMPrintSubdomains() local
97 for (i = 0; i < osm->n_local; i++) { in PCASMPrintSubdomains()
98 if (i < osm->n_local_true) { in PCASMPrintSubdomains()
99 PetscCall(ISGetLocalSize(osm->is[i], &nidx)); in PCASMPrintSubdomains()
100 PetscCall(ISGetIndices(osm->is[i], &idx)); in PCASMPrintSubdomains()
108 PetscCall(ISRestoreIndices(osm->is[i], &idx)); in PCASMPrintSubdomains()
116 if (osm->is_local) { in PCASMPrintSubdomains()
123 PetscCall(ISGetLocalSize(osm->is_local[i], &nidx)); in PCASMPrintSubdomains()
124 PetscCall(ISGetIndices(osm->is_local[i], &idx)); in PCASMPrintSubdomains()
126 PetscCall(ISRestoreIndices(osm->is_local[i], &idx)); in PCASMPrintSubdomains()
141 if (osm->is_local) { in PCASMPrintSubdomains()
155 PC_ASM *osm = (PC_ASM *)pc->data; in PCSetUp_ASM() local
172 if (osm->n_local_true == PETSC_DECIDE) { in PCSetUp_ASM()
175 if (osm->dm_subdomains && pc->dm) { in PCSetUp_ASM()
180 osm->overlap = -1; /* We do not want to increase the overlap of the IS. in PCSetUp_ASM()
194 if (osm->n_local_true == PETSC_DECIDE) { in PCSetUp_ASM()
196 osm->n_local_true = 1; in PCSetUp_ASM()
205 inwork.max = osm->n_local_true; in PCSetUp_ASM()
206 inwork.sum = osm->n_local_true; in PCSetUp_ASM()
208 osm->n_local = outwork.max; in PCSetUp_ASM()
209 osm->n = outwork.sum; in PCSetUp_ASM()
217 if (!osm->is) { /* create the index sets */ in PCSetUp_ASM()
218 PetscCall(PCASMCreateSubdomains(pc->pmat, osm->n_local_true, &osm->is)); in PCSetUp_ASM()
220 if (osm->n_local_true > 1 && !osm->is_local) { in PCSetUp_ASM()
221 PetscCall(PetscMalloc1(osm->n_local_true, &osm->is_local)); in PCSetUp_ASM()
222 for (i = 0; i < osm->n_local_true; i++) { in PCSetUp_ASM()
223 if (osm->overlap > 0) { /* With positive overlap, osm->is[i] will be modified */ in PCSetUp_ASM()
224 PetscCall(ISDuplicate(osm->is[i], &osm->is_local[i])); in PCSetUp_ASM()
225 PetscCall(ISCopy(osm->is[i], osm->is_local[i])); in PCSetUp_ASM()
227 PetscCall(PetscObjectReference((PetscObject)osm->is[i])); in PCSetUp_ASM()
228 osm->is_local[i] = osm->is[i]; in PCSetUp_ASM()
233 if (osm->overlap > 0) { in PCSetUp_ASM()
235 PetscCall(MatIncreaseOverlap(pc->pmat, osm->n_local_true, osm->is, osm->overlap)); in PCSetUp_ASM()
237 if (osm->sort_indices) { in PCSetUp_ASM()
238 for (i = 0; i < osm->n_local_true; i++) { in PCSetUp_ASM()
239 PetscCall(ISSort(osm->is[i])); in PCSetUp_ASM()
240 if (osm->is_local) PetscCall(ISSort(osm->is_local[i])); in PCSetUp_ASM()
246 if (!osm->ksp) { in PCSetUp_ASM()
248 PetscCall(PetscMalloc1(osm->n_local_true, &osm->ksp)); in PCSetUp_ASM()
250 for (i = 0; i < osm->n_local_true; i++) { in PCSetUp_ASM()
265 osm->ksp[i] = ksp; in PCSetUp_ASM()
270 PetscCall(ISConcatenate(PETSC_COMM_SELF, osm->n_local_true, osm->is, &osm->lis)); in PCSetUp_ASM()
271 PetscCall(ISSortRemoveDups(osm->lis)); in PCSetUp_ASM()
272 PetscCall(ISGetLocalSize(osm->lis, &m)); in PCSetUp_ASM()
280 PetscCall(MatGetNullSpaces(osm->n_local_true, osm->pmat, &nullsp)); in PCSetUp_ASM()
281 PetscCall(MatDestroyMatrices(osm->n_local_true, &osm->pmat)); in PCSetUp_ASM()
287 if (scall == MAT_REUSE_MATRIX && osm->sub_mat_type) { in PCSetUp_ASM()
288 PetscCall(MatGetNullSpaces(osm->n_local_true, osm->pmat, &nullsp)); in PCSetUp_ASM()
289 if (osm->n_local_true > 0) PetscCall(MatDestroySubMatrices(osm->n_local_true, &osm->pmat)); in PCSetUp_ASM()
296 PetscCall(MatCreateSubMatrices(pc->pmat, osm->n_local_true, osm->is, osm->is, scall, &osm->pmat)); in PCSetUp_ASM()
299 …for (i = 0; i < osm->n_local_true; i++) PetscCall(PetscObjectSetOptionsPrefix((PetscObject)osm->pm… in PCSetUp_ASM()
300 if (nullsp) PetscCall(MatRestoreNullSpaces(osm->n_local_true, osm->pmat, &nullsp)); in PCSetUp_ASM()
304 if (osm->sub_mat_type) { in PCSetUp_ASM()
305 …for (i = 0; i < osm->n_local_true; i++) PetscCall(MatConvert(osm->pmat[i], osm->sub_mat_type, MAT_… in PCSetUp_ASM()
314 …PetscCheck(!osm->is_local || osm->n_local_true == 1 || (osm->type != PC_ASM_INTERPOLATE && osm->ty… in PCSetUp_ASM()
315 …if (osm->is_local && osm->type != PC_ASM_BASIC && osm->loctype == PC_COMPOSITE_ADDITIVE) PetscCall… in PCSetUp_ASM()
316 PetscCall(PetscMalloc1(osm->n_local_true, &osm->lrestriction)); in PCSetUp_ASM()
317 PetscCall(PetscMalloc1(osm->n_local_true, &osm->x)); in PCSetUp_ASM()
318 PetscCall(PetscMalloc1(osm->n_local_true, &osm->y)); in PCSetUp_ASM()
320 PetscCall(ISGetLocalSize(osm->lis, &m)); in PCSetUp_ASM()
322 PetscCall(MatGetVecType(osm->pmat[0], &vtype)); in PCSetUp_ASM()
323 PetscCall(VecCreate(PETSC_COMM_SELF, &osm->lx)); in PCSetUp_ASM()
324 PetscCall(VecSetSizes(osm->lx, m, m)); in PCSetUp_ASM()
325 PetscCall(VecSetType(osm->lx, vtype)); in PCSetUp_ASM()
326 PetscCall(VecDuplicate(osm->lx, &osm->ly)); in PCSetUp_ASM()
327 PetscCall(VecScatterCreate(vec, osm->lis, osm->lx, isl, &osm->restriction)); in PCSetUp_ASM()
330 for (i = 0; i < osm->n_local_true; ++i) { in PCSetUp_ASM()
336 PetscCall(ISGetLocalSize(osm->is[i], &m)); in PCSetUp_ASM()
337 PetscCall(MatCreateVecs(osm->pmat[i], &osm->x[i], NULL)); in PCSetUp_ASM()
338 PetscCall(VecDuplicate(osm->x[i], &osm->y[i])); in PCSetUp_ASM()
341 PetscCall(ISLocalToGlobalMappingCreateIS(osm->lis, &ltog)); in PCSetUp_ASM()
342 PetscCall(ISGetLocalSize(osm->is[i], &m)); in PCSetUp_ASM()
343 PetscCall(ISGetIndices(osm->is[i], &idx_is)); in PCSetUp_ASM()
347 PetscCall(ISRestoreIndices(osm->is[i], &idx_is)); in PCSetUp_ASM()
351 PetscCall(VecScatterCreate(osm->ly, isll, osm->y[i], isl, &osm->lrestriction[i])); in PCSetUp_ASM()
354 …if (osm->lprolongation) { /* generate a scatter from y[i] to ly picking only the non-overlapping i… in PCSetUp_ASM()
360 PetscCall(ISGetLocalSize(osm->is_local[i], &m_local)); in PCSetUp_ASM()
361 PetscCall(ISGetIndices(osm->is_local[i], &idx_local)); in PCSetUp_ASM()
363 PetscCall(ISLocalToGlobalMappingCreateIS(osm->is[i], &ltog)); in PCSetUp_ASM()
370 PetscCall(ISLocalToGlobalMappingCreateIS(osm->lis, &ltog)); in PCSetUp_ASM()
377 PetscCall(ISRestoreIndices(osm->is_local[i], &idx_local)); in PCSetUp_ASM()
378 PetscCall(VecScatterCreate(osm->y[i], isll, osm->ly, isll_local, &osm->lprolongation[i])); in PCSetUp_ASM()
387 if (osm->loctype == PC_COMPOSITE_MULTIPLICATIVE) { in PCSetUp_ASM()
391 PetscCall(PetscMalloc1(osm->n_local_true, &cis)); in PCSetUp_ASM()
392 for (c = 0; c < osm->n_local_true; ++c) cis[c] = osm->lis; in PCSetUp_ASM()
393 PetscCall(MatCreateSubMatrices(pc->pmat, osm->n_local_true, osm->is, cis, scall, &osm->lmats)); in PCSetUp_ASM()
399 …PetscCall(PCModifySubMatrices(pc, osm->n_local_true, osm->is, osm->is, osm->pmat, pc->modifysubmat… in PCSetUp_ASM()
404 PetscCall(KSPGetOptionsPrefix(osm->ksp[0], &prefix)); in PCSetUp_ASM()
405 for (i = 0; i < osm->n_local_true; i++) { in PCSetUp_ASM()
406 PetscCall(KSPSetOperators(osm->ksp[i], osm->pmat[i], osm->pmat[i])); in PCSetUp_ASM()
407 PetscCall(MatSetOptionsPrefix(osm->pmat[i], prefix)); in PCSetUp_ASM()
408 if (!pc->setupcalled) PetscCall(KSPSetFromOptions(osm->ksp[i])); in PCSetUp_ASM()
415 PC_ASM *osm = (PC_ASM *)pc->data; in PCSetUpOnBlocks_ASM() local
420 for (i = 0; i < osm->n_local_true; i++) { in PCSetUpOnBlocks_ASM()
421 PetscCall(KSPSetUp(osm->ksp[i])); in PCSetUpOnBlocks_ASM()
422 PetscCall(KSPGetConvergedReason(osm->ksp[i], &reason)); in PCSetUpOnBlocks_ASM()
430 PC_ASM *osm = (PC_ASM *)pc->data; in PCApply_ASM() local
431 PetscInt i, n_local_true = osm->n_local_true; in PCApply_ASM()
439 if (!(osm->type & PC_ASM_RESTRICT)) { in PCApply_ASM()
442 PetscCall(VecSet(osm->lx, 0.0)); in PCApply_ASM()
444 if (!(osm->type & PC_ASM_INTERPOLATE)) reverse = SCATTER_REVERSE_LOCAL; in PCApply_ASM()
446osm->loctype == PC_COMPOSITE_MULTIPLICATIVE || osm->loctype == PC_COMPOSITE_ADDITIVE, PetscObjectC… in PCApply_ASM()
449 PetscCall(VecSet(osm->ly, 0.0)); in PCApply_ASM()
452 PetscCall(VecScatterBegin(osm->restriction, x, osm->lx, INSERT_VALUES, forward)); in PCApply_ASM()
453 PetscCall(VecScatterEnd(osm->restriction, x, osm->lx, INSERT_VALUES, forward)); in PCApply_ASM()
456 PetscCall(VecScatterBegin(osm->lrestriction[0], osm->lx, osm->x[0], INSERT_VALUES, forward)); in PCApply_ASM()
457 PetscCall(VecScatterEnd(osm->lrestriction[0], osm->lx, osm->x[0], INSERT_VALUES, forward)); in PCApply_ASM()
462 PetscCall(PetscLogEventBegin(PC_ApplyOnBlocks, osm->ksp[i], osm->x[i], osm->y[i], 0)); in PCApply_ASM()
463 PetscCall(KSPSolve(osm->ksp[i], osm->x[i], osm->y[i])); in PCApply_ASM()
464 PetscCall(KSPCheckSolve(osm->ksp[i], pc, osm->y[i])); in PCApply_ASM()
465 PetscCall(PetscLogEventEnd(PC_ApplyOnBlocks, osm->ksp[i], osm->x[i], osm->y[i], 0)); in PCApply_ASM()
467 …if (osm->lprolongation && osm->type != PC_ASM_INTERPOLATE) { /* interpolate the non-overlapping i-… in PCApply_ASM()
468 PetscCall(VecScatterBegin(osm->lprolongation[i], osm->y[i], osm->ly, ADD_VALUES, forward)); in PCApply_ASM()
469 PetscCall(VecScatterEnd(osm->lprolongation[i], osm->y[i], osm->ly, ADD_VALUES, forward)); in PCApply_ASM()
471 PetscCall(VecScatterBegin(osm->lrestriction[i], osm->y[i], osm->ly, ADD_VALUES, reverse)); in PCApply_ASM()
472 PetscCall(VecScatterEnd(osm->lrestriction[i], osm->y[i], osm->ly, ADD_VALUES, reverse)); in PCApply_ASM()
477 …PetscCall(VecScatterBegin(osm->lrestriction[i + 1], osm->lx, osm->x[i + 1], INSERT_VALUES, forward… in PCApply_ASM()
478 …PetscCall(VecScatterEnd(osm->lrestriction[i + 1], osm->lx, osm->x[i + 1], INSERT_VALUES, forward)); in PCApply_ASM()
480 if (osm->loctype == PC_COMPOSITE_MULTIPLICATIVE) { in PCApply_ASM()
482 PetscCall(MatMult(osm->lmats[i + 1], osm->ly, osm->y[i + 1])); in PCApply_ASM()
483 PetscCall(VecAXPBY(osm->x[i + 1], -1., 1., osm->y[i + 1])); in PCApply_ASM()
488 PetscCall(VecScatterBegin(osm->restriction, osm->ly, y, ADD_VALUES, reverse)); in PCApply_ASM()
489 PetscCall(VecScatterEnd(osm->restriction, osm->ly, y, ADD_VALUES, reverse)); in PCApply_ASM()
495 PC_ASM *osm = (PC_ASM *)pc->data; in PCMatApply_ASM_Private() local
502 …PetscCheck(osm->n_local_true <= 1, PetscObjectComm((PetscObject)pc), PETSC_ERR_SUP, "Not yet imple… in PCMatApply_ASM_Private()
507 …if ((!transpose && !(osm->type & PC_ASM_RESTRICT)) || (transpose && !(osm->type & PC_ASM_INTERPOLA… in PCMatApply_ASM_Private()
510 PetscCall(VecSet(osm->lx, 0.0)); in PCMatApply_ASM_Private()
512 …if ((!transpose && !(osm->type & PC_ASM_INTERPOLATE)) || (transpose && !(osm->type & PC_ASM_RESTRI… in PCMatApply_ASM_Private()
513 PetscCall(VecGetLocalSize(osm->x[0], &m)); in PCMatApply_ASM_Private()
517osm->loctype == PC_COMPOSITE_MULTIPLICATIVE || osm->loctype == PC_COMPOSITE_ADDITIVE, PetscObjectC… in PCMatApply_ASM_Private()
520 PetscCall(VecSet(osm->ly, 0.0)); in PCMatApply_ASM_Private()
525 PetscCall(VecScatterBegin(osm->restriction, x, osm->lx, INSERT_VALUES, forward)); in PCMatApply_ASM_Private()
526 PetscCall(VecScatterEnd(osm->restriction, x, osm->lx, INSERT_VALUES, forward)); in PCMatApply_ASM_Private()
531 PetscCall(VecScatterBegin(osm->lrestriction[0], osm->lx, x, INSERT_VALUES, forward)); in PCMatApply_ASM_Private()
532 PetscCall(VecScatterEnd(osm->lrestriction[0], osm->lx, x, INSERT_VALUES, forward)); in PCMatApply_ASM_Private()
538 PetscCall(PetscLogEventBegin(PC_ApplyOnBlocks, osm->ksp[0], Z, W, 0)); in PCMatApply_ASM_Private()
539 PetscCall(KSPMatSolve(osm->ksp[0], Z, W)); in PCMatApply_ASM_Private()
540 PetscCall(PetscLogEventEnd(PC_ApplyOnBlocks, osm->ksp[0], Z, W, 0)); in PCMatApply_ASM_Private()
542 PetscCall(PetscLogEventBegin(PC_ApplyTransposeOnBlocks, osm->ksp[0], Z, W, 0)); in PCMatApply_ASM_Private()
543 PetscCall(KSPMatSolveTranspose(osm->ksp[0], Z, W)); in PCMatApply_ASM_Private()
544 PetscCall(PetscLogEventEnd(PC_ApplyTransposeOnBlocks, osm->ksp[0], Z, W, 0)); in PCMatApply_ASM_Private()
546 PetscCall(KSPCheckSolve(osm->ksp[0], pc, NULL)); in PCMatApply_ASM_Private()
550 PetscCall(VecSet(osm->ly, 0.0)); in PCMatApply_ASM_Private()
552 …if (osm->lprolongation && ((!transpose && osm->type != PC_ASM_INTERPOLATE) || (transpose && osm->t… in PCMatApply_ASM_Private()
553 PetscCall(VecScatterBegin(osm->lprolongation[0], x, osm->ly, ADD_VALUES, forward)); in PCMatApply_ASM_Private()
554 PetscCall(VecScatterEnd(osm->lprolongation[0], x, osm->ly, ADD_VALUES, forward)); in PCMatApply_ASM_Private()
556 PetscCall(VecScatterBegin(osm->lrestriction[0], x, osm->ly, ADD_VALUES, reverse)); in PCMatApply_ASM_Private()
557 PetscCall(VecScatterEnd(osm->lrestriction[0], x, osm->ly, ADD_VALUES, reverse)); in PCMatApply_ASM_Private()
563 PetscCall(VecScatterBegin(osm->restriction, osm->ly, x, ADD_VALUES, reverse)); in PCMatApply_ASM_Private()
564 PetscCall(VecScatterEnd(osm->restriction, osm->ly, x, ADD_VALUES, reverse)); in PCMatApply_ASM_Private()
587 PC_ASM *osm = (PC_ASM *)pc->data; in PCApplyTranspose_ASM() local
588 PetscInt i, n_local_true = osm->n_local_true; in PCApplyTranspose_ASM()
592 …PetscCheck(osm->n_local_true <= 1 || osm->loctype == PC_COMPOSITE_ADDITIVE, PetscObjectComm((Petsc… in PCApplyTranspose_ASM()
601 if (!(osm->type & PC_ASM_INTERPOLATE)) { in PCApplyTranspose_ASM()
604 PetscCall(VecSet(osm->lx, 0.0)); in PCApplyTranspose_ASM()
606 if (!(osm->type & PC_ASM_RESTRICT)) reverse = SCATTER_REVERSE_LOCAL; in PCApplyTranspose_ASM()
610 PetscCall(VecSet(osm->ly, 0.0)); in PCApplyTranspose_ASM()
613 PetscCall(VecScatterBegin(osm->restriction, x, osm->lx, INSERT_VALUES, forward)); in PCApplyTranspose_ASM()
614 PetscCall(VecScatterEnd(osm->restriction, x, osm->lx, INSERT_VALUES, forward)); in PCApplyTranspose_ASM()
617 PetscCall(VecScatterBegin(osm->lrestriction[0], osm->lx, osm->x[0], INSERT_VALUES, forward)); in PCApplyTranspose_ASM()
618 PetscCall(VecScatterEnd(osm->lrestriction[0], osm->lx, osm->x[0], INSERT_VALUES, forward)); in PCApplyTranspose_ASM()
623 PetscCall(PetscLogEventBegin(PC_ApplyTransposeOnBlocks, osm->ksp[i], osm->x[i], osm->y[i], 0)); in PCApplyTranspose_ASM()
624 PetscCall(KSPSolveTranspose(osm->ksp[i], osm->x[i], osm->y[i])); in PCApplyTranspose_ASM()
625 PetscCall(KSPCheckSolve(osm->ksp[i], pc, osm->y[i])); in PCApplyTranspose_ASM()
626 PetscCall(PetscLogEventEnd(PC_ApplyTransposeOnBlocks, osm->ksp[i], osm->x[i], osm->y[i], 0)); in PCApplyTranspose_ASM()
628 …if (osm->lprolongation && osm->type != PC_ASM_RESTRICT) { /* interpolate the non-overlapping i-blo… in PCApplyTranspose_ASM()
629 PetscCall(VecScatterBegin(osm->lprolongation[i], osm->y[i], osm->ly, ADD_VALUES, forward)); in PCApplyTranspose_ASM()
630 PetscCall(VecScatterEnd(osm->lprolongation[i], osm->y[i], osm->ly, ADD_VALUES, forward)); in PCApplyTranspose_ASM()
632 PetscCall(VecScatterBegin(osm->lrestriction[i], osm->y[i], osm->ly, ADD_VALUES, reverse)); in PCApplyTranspose_ASM()
633 PetscCall(VecScatterEnd(osm->lrestriction[i], osm->y[i], osm->ly, ADD_VALUES, reverse)); in PCApplyTranspose_ASM()
638 …PetscCall(VecScatterBegin(osm->lrestriction[i + 1], osm->lx, osm->x[i + 1], INSERT_VALUES, forward… in PCApplyTranspose_ASM()
639 …PetscCall(VecScatterEnd(osm->lrestriction[i + 1], osm->lx, osm->x[i + 1], INSERT_VALUES, forward)); in PCApplyTranspose_ASM()
643 PetscCall(VecScatterBegin(osm->restriction, osm->ly, y, ADD_VALUES, reverse)); in PCApplyTranspose_ASM()
644 PetscCall(VecScatterEnd(osm->restriction, osm->ly, y, ADD_VALUES, reverse)); in PCApplyTranspose_ASM()
650 PC_ASM *osm = (PC_ASM *)pc->data; in PCReset_ASM() local
654 if (osm->ksp) { in PCReset_ASM()
655 for (i = 0; i < osm->n_local_true; i++) PetscCall(KSPReset(osm->ksp[i])); in PCReset_ASM()
657 if (osm->pmat) { in PCReset_ASM()
658 if (osm->n_local_true > 0) PetscCall(MatDestroySubMatrices(osm->n_local_true, &osm->pmat)); in PCReset_ASM()
660 if (osm->lrestriction) { in PCReset_ASM()
661 PetscCall(VecScatterDestroy(&osm->restriction)); in PCReset_ASM()
662 for (i = 0; i < osm->n_local_true; i++) { in PCReset_ASM()
663 PetscCall(VecScatterDestroy(&osm->lrestriction[i])); in PCReset_ASM()
664 if (osm->lprolongation) PetscCall(VecScatterDestroy(&osm->lprolongation[i])); in PCReset_ASM()
665 PetscCall(VecDestroy(&osm->x[i])); in PCReset_ASM()
666 PetscCall(VecDestroy(&osm->y[i])); in PCReset_ASM()
668 PetscCall(PetscFree(osm->lrestriction)); in PCReset_ASM()
669 if (osm->lprolongation) PetscCall(PetscFree(osm->lprolongation)); in PCReset_ASM()
670 PetscCall(PetscFree(osm->x)); in PCReset_ASM()
671 PetscCall(PetscFree(osm->y)); in PCReset_ASM()
673 PetscCall(PCASMDestroySubdomains(osm->n_local_true, &osm->is, &osm->is_local)); in PCReset_ASM()
674 PetscCall(ISDestroy(&osm->lis)); in PCReset_ASM()
675 PetscCall(VecDestroy(&osm->lx)); in PCReset_ASM()
676 PetscCall(VecDestroy(&osm->ly)); in PCReset_ASM()
677 …if (osm->loctype == PC_COMPOSITE_MULTIPLICATIVE) PetscCall(MatDestroyMatrices(osm->n_local_true, & in PCReset_ASM()
679 PetscCall(PetscFree(osm->sub_mat_type)); in PCReset_ASM()
681 osm->is = NULL; in PCReset_ASM()
682 osm->is_local = NULL; in PCReset_ASM()
688 PC_ASM *osm = (PC_ASM *)pc->data; in PCDestroy_ASM() local
693 if (osm->ksp) { in PCDestroy_ASM()
694 for (i = 0; i < osm->n_local_true; i++) PetscCall(KSPDestroy(&osm->ksp[i])); in PCDestroy_ASM()
695 PetscCall(PetscFree(osm->ksp)); in PCDestroy_ASM()
715 PC_ASM *osm = (PC_ASM *)pc->data; in PCSetFromOptions_ASM() local
724 …nDecomposition() to define subdomains", "PCASMSetDMSubdomains", osm->dm_subdomains, &osm->dm_subdo… in PCSetFromOptions_ASM()
725 …nsInt("-pc_asm_blocks", "Number of subdomains", "PCASMSetTotalSubdomains", osm->n, &blocks, &flg)); in PCSetFromOptions_ASM()
728 osm->dm_subdomains = PETSC_FALSE; in PCSetFromOptions_ASM()
730 …sm_local_blocks", "Number of local subdomains", "PCASMSetLocalSubdomains", osm->n_local_true, &blo… in PCSetFromOptions_ASM()
733 osm->dm_subdomains = PETSC_FALSE; in PCSetFromOptions_ASM()
735 …Int("-pc_asm_overlap", "Number of grid points overlap", "PCASMSetOverlap", osm->overlap, &ovl, &fl… in PCSetFromOptions_ASM()
738 osm->dm_subdomains = PETSC_FALSE; in PCSetFromOptions_ASM()
741 …", "Type of restriction/extension", "PCASMSetType", PCASMTypes, (PetscEnum)osm->type, (PetscEnum *… in PCSetFromOptions_ASM()
744 …cal solver composition", "PCASMSetLocalType", PCCompositeTypes, (PetscEnum)osm->loctype, (PetscEnu… in PCSetFromOptions_ASM()
754 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMSetLocalSubdomains_ASM() local
759 …PetscCheck(!pc->setupcalled || (n == osm->n_local_true && !is), PetscObjectComm((PetscObject)pc), … in PCASMSetLocalSubdomains_ASM()
768 PetscCall(PCASMDestroySubdomains(osm->n_local_true, &osm->is, &osm->is_local)); in PCASMSetLocalSubdomains_ASM()
770 if (osm->ksp && osm->n_local_true != n) { in PCASMSetLocalSubdomains_ASM()
771 for (i = 0; i < osm->n_local_true; i++) PetscCall(KSPDestroy(&osm->ksp[i])); in PCASMSetLocalSubdomains_ASM()
772 PetscCall(PetscFree(osm->ksp)); in PCASMSetLocalSubdomains_ASM()
775 osm->n_local_true = n; in PCASMSetLocalSubdomains_ASM()
776 osm->is = NULL; in PCASMSetLocalSubdomains_ASM()
777 osm->is_local = NULL; in PCASMSetLocalSubdomains_ASM()
779 PetscCall(PetscMalloc1(n, &osm->is)); in PCASMSetLocalSubdomains_ASM()
780 for (i = 0; i < n; i++) osm->is[i] = is[i]; in PCASMSetLocalSubdomains_ASM()
782 osm->overlap = -1; in PCASMSetLocalSubdomains_ASM()
785 PetscCall(PetscMalloc1(n, &osm->is_local)); in PCASMSetLocalSubdomains_ASM()
786 for (i = 0; i < n; i++) osm->is_local[i] = is_local[i]; in PCASMSetLocalSubdomains_ASM()
788 PetscCall(PetscMalloc1(osm->n_local_true, &osm->is)); in PCASMSetLocalSubdomains_ASM()
789 for (i = 0; i < osm->n_local_true; i++) { in PCASMSetLocalSubdomains_ASM()
790 if (osm->overlap > 0) { /* With positive overlap, osm->is[i] will be modified */ in PCASMSetLocalSubdomains_ASM()
791 PetscCall(ISDuplicate(osm->is_local[i], &osm->is[i])); in PCASMSetLocalSubdomains_ASM()
792 PetscCall(ISCopy(osm->is_local[i], osm->is[i])); in PCASMSetLocalSubdomains_ASM()
794 PetscCall(PetscObjectReference((PetscObject)osm->is_local[i])); in PCASMSetLocalSubdomains_ASM()
795 osm->is[i] = osm->is_local[i]; in PCASMSetLocalSubdomains_ASM()
806 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMSetTotalSubdomains_ASM() local
821 …PetscCheck(!pc->setupcalled || n == osm->n_local_true, PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, … in PCASMSetTotalSubdomains_ASM()
823 PetscCall(PCASMDestroySubdomains(osm->n_local_true, &osm->is, &osm->is_local)); in PCASMSetTotalSubdomains_ASM()
825 osm->n_local_true = n; in PCASMSetTotalSubdomains_ASM()
826 osm->is = NULL; in PCASMSetTotalSubdomains_ASM()
827 osm->is_local = NULL; in PCASMSetTotalSubdomains_ASM()
834 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMSetOverlap_ASM() local
838 …PetscCheck(!pc->setupcalled || ovl == osm->overlap, PetscObjectComm((PetscObject)pc), PETSC_ERR_AR… in PCASMSetOverlap_ASM()
839 if (!pc->setupcalled) osm->overlap = ovl; in PCASMSetOverlap_ASM()
845 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMSetType_ASM() local
848 osm->type = type; in PCASMSetType_ASM()
849 osm->type_set = PETSC_TRUE; in PCASMSetType_ASM()
855 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMGetType_ASM() local
858 *type = osm->type; in PCASMGetType_ASM()
864 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMSetLocalType_ASM() local
868 osm->loctype = type; in PCASMSetLocalType_ASM()
874 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMGetLocalType_ASM() local
877 *type = osm->loctype; in PCASMGetLocalType_ASM()
883 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMSetSortIndices_ASM() local
886 osm->sort_indices = doSort; in PCASMSetSortIndices_ASM()
892 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMGetSubKSP_ASM() local
895 …PetscCheck(osm->n_local_true >= 1, PetscObjectComm((PetscObject)pc), PETSC_ERR_ORDER, "Need to cal… in PCASMGetSubKSP_ASM()
897 if (n_local) *n_local = osm->n_local_true; in PCASMGetSubKSP_ASM()
899 …PetscCallMPI(MPI_Scan(&osm->n_local_true, first_local, 1, MPIU_INT, MPI_SUM, PetscObjectComm((Pets… in PCASMGetSubKSP_ASM()
900 *first_local -= osm->n_local_true; in PCASMGetSubKSP_ASM()
902 if (ksp) *ksp = osm->ksp; in PCASMGetSubKSP_ASM()
908 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMGetSubMatType_ASM() local
913 *sub_mat_type = osm->sub_mat_type; in PCASMGetSubMatType_ASM()
919 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMSetSubMatType_ASM() local
923 PetscCall(PetscFree(osm->sub_mat_type)); in PCASMSetSubMatType_ASM()
924 PetscCall(PetscStrallocpy(sub_mat_type, (char **)&osm->sub_mat_type)); in PCASMSetSubMatType_ASM()
1286 PC_ASM *osm; in PCCreate_ASM() local
1289 PetscCall(PetscNew(&osm)); in PCCreate_ASM()
1291 osm->n = PETSC_DECIDE; in PCCreate_ASM()
1292 osm->n_local = 0; in PCCreate_ASM()
1293 osm->n_local_true = PETSC_DECIDE; in PCCreate_ASM()
1294 osm->overlap = 1; in PCCreate_ASM()
1295 osm->ksp = NULL; in PCCreate_ASM()
1296 osm->restriction = NULL; in PCCreate_ASM()
1297 osm->lprolongation = NULL; in PCCreate_ASM()
1298 osm->lrestriction = NULL; in PCCreate_ASM()
1299 osm->x = NULL; in PCCreate_ASM()
1300 osm->y = NULL; in PCCreate_ASM()
1301 osm->is = NULL; in PCCreate_ASM()
1302 osm->is_local = NULL; in PCCreate_ASM()
1303 osm->mat = NULL; in PCCreate_ASM()
1304 osm->pmat = NULL; in PCCreate_ASM()
1305 osm->type = PC_ASM_RESTRICT; in PCCreate_ASM()
1306 osm->loctype = PC_COMPOSITE_ADDITIVE; in PCCreate_ASM()
1307 osm->sort_indices = PETSC_TRUE; in PCCreate_ASM()
1308 osm->dm_subdomains = PETSC_FALSE; in PCCreate_ASM()
1309 osm->sub_mat_type = NULL; in PCCreate_ASM()
1311 pc->data = (void *)osm; in PCCreate_ASM()
1652 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMGetLocalSubdomains() local
1662 if (n) *n = osm->n_local_true; in PCASMGetLocalSubdomains()
1663 if (is) *is = osm->is; in PCASMGetLocalSubdomains()
1664 if (is_local) *is_local = osm->is_local; in PCASMGetLocalSubdomains()
1693 PC_ASM *osm; in PCASMGetLocalSubmatrices() local
1706 osm = (PC_ASM *)pc->data; in PCASMGetLocalSubmatrices()
1707 if (n) *n = osm->n_local_true; in PCASMGetLocalSubmatrices()
1708 if (mat) *mat = osm->pmat; in PCASMGetLocalSubmatrices()
1739 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMSetDMSubdomains() local
1747 if (match) osm->dm_subdomains = flg; in PCASMSetDMSubdomains()
1772 PC_ASM *osm = (PC_ASM *)pc->data; in PCASMGetDMSubdomains() local
1779 if (match) *flg = osm->dm_subdomains; in PCASMGetDMSubdomains()