Lines Matching refs:osm
41 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMComputeGlobalSubdomainNumbering_Private() local
46 PetscCall(PetscMalloc2(osm->n, numbering, osm->n, permutation)); in PCGASMComputeGlobalSubdomainNumbering_Private()
47 …bjectsListGetGlobalNumbering(PetscObjectComm((PetscObject)pc), osm->n, (PetscObject *)osm->iis, NU… in PCGASMComputeGlobalSubdomainNumbering_Private()
48 for (i = 0; i < osm->n; ++i) (*permutation)[i] = i; in PCGASMComputeGlobalSubdomainNumbering_Private()
49 PetscCall(PetscSortIntWithPermutation(osm->n, *numbering, *permutation)); in PCGASMComputeGlobalSubdomainNumbering_Private()
55 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMSubdomainView_Private() local
62 …osm->n, PetscObjectComm((PetscObject)viewer), PETSC_ERR_ARG_WRONG, "Invalid subdomain %" PetscInt_… in PCGASMSubdomainView_Private()
75 PetscCall(ISGetLocalSize(osm->iis[i], &nidx)); in PCGASMSubdomainView_Private()
78 PetscCall(ISGetIndices(osm->iis[i], &idx)); in PCGASMSubdomainView_Private()
80 PetscCall(ISRestoreIndices(osm->iis[i], &idx)); in PCGASMSubdomainView_Private()
101 PetscCall(ISGetLocalSize(osm->ois[i], &nidx)); in PCGASMSubdomainView_Private()
104 PetscCall(ISGetIndices(osm->ois[i], &idx)); in PCGASMSubdomainView_Private()
107 PetscCall(ISRestoreIndices(osm->ois[i], &idx)); in PCGASMSubdomainView_Private()
120 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMPrintSubdomains() local
142 for (count = 0; count < osm->N; ++count) { in PCGASMPrintSubdomains()
144 if (l < osm->n) { in PCGASMPrintSubdomains()
158 PC_GASM *osm = (PC_GASM *)pc->data; in PCView_GASM() local
174 …if (osm->overlap >= 0) PetscCall(PetscSNPrintf(overlap, sizeof(overlap), "requested amount of over… in PCView_GASM()
175 …if (osm->N != PETSC_DETERMINE) PetscCall(PetscSNPrintf(gsubdomains, sizeof(gsubdomains), "total nu… in PCView_GASM()
176 …if (osm->nmax != PETSC_DETERMINE) PetscCall(PetscSNPrintf(msubdomains, sizeof(msubdomains), "max n… in PCView_GASM()
189 …(PetscViewerASCIIPrintf(viewer, " Restriction/interpolation type: %s\n", PCGASMTypes[osm->type])); in PCView_GASM()
194 …er, " [%d|%d] number of locally-supported subdomains = %" PetscInt_FMT "\n", rank, size, osm->n)); in PCView_GASM()
204 for (count = 0; count < osm->N; ++count) { in PCView_GASM()
206 if (l < osm->n) { in PCView_GASM()
209 PetscCallMPI(MPI_Comm_size(((PetscObject)osm->ois[d])->comm, &ssize)); in PCView_GASM()
210 PetscCallMPI(MPI_Comm_rank(((PetscObject)osm->ois[d])->comm, &srank)); in PCView_GASM()
211 PetscCall(PetscViewerGetSubViewer(viewer, ((PetscObject)osm->ois[d])->comm, &sviewer)); in PCView_GASM()
212 PetscCall(ISGetLocalSize(osm->ois[d], &bsz)); in PCView_GASM()
220 PetscCall(KSPView(osm->ksp[d], sviewer)); in PCView_GASM()
225 … PetscCall(PetscViewerRestoreSubViewer(viewer, ((PetscObject)osm->ois[d])->comm, &sviewer)); in PCView_GASM()
249 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMSetHierarchicalPartitioning() local
265 …if (osm->N == PETSC_DETERMINE || osm->N >= size || osm->N == 1) PetscFunctionReturn(PETSC_SUCCESS); in PCGASMSetHierarchicalPartitioning()
266 …osm->N == 0, PETSC_COMM_WORLD, PETSC_ERR_ARG_INCOMP, "have to specify the total number of subdomai… in PCGASMSetHierarchicalPartitioning()
267 nlocalsubdomains = size / osm->N; in PCGASMSetHierarchicalPartitioning()
268 osm->n = 1; in PCGASMSetHierarchicalPartitioning()
272 PetscCall(MatPartitioningHierarchicalSetNcoarseparts(part, osm->N)); in PCGASMSetHierarchicalPartitioning()
283 PetscCall(VecCreateMPI(comm, fromrows_localsize, PETSC_DETERMINE, &osm->pcx)); in PCGASMSetHierarchicalPartitioning()
284 PetscCall(VecDuplicate(osm->pcx, &osm->pcy)); in PCGASMSetHierarchicalPartitioning()
285 PetscCall(VecScatterCreate(osm->pcx, NULL, outervec, fromrows, &osm->pctoouter)); in PCGASMSetHierarchicalPartitioning()
286 …PetscCall(MatCreateSubMatrix(pc->pmat, fromrows, fromrows, MAT_INITIAL_MATRIX, &osm->permutationP)… in PCGASMSetHierarchicalPartitioning()
288 osm->permutationIS = fromrows; in PCGASMSetHierarchicalPartitioning()
289 osm->pcmat = pc->pmat; in PCGASMSetHierarchicalPartitioning()
290 PetscCall(PetscObjectReference((PetscObject)osm->permutationP)); in PCGASMSetHierarchicalPartitioning()
291 pc->pmat = osm->permutationP; in PCGASMSetHierarchicalPartitioning()
295 osm->n = PETSC_DETERMINE; in PCGASMSetHierarchicalPartitioning()
301 PC_GASM *osm = (PC_GASM *)pc->data; in PCSetUp_GASM() local
327 if (osm->hierarchicalpartitioning) PetscCall(PCGASMSetHierarchicalPartitioning(pc)); in PCSetUp_GASM()
328 if (osm->n == PETSC_DETERMINE) { in PCSetUp_GASM()
329 if (osm->N != PETSC_DETERMINE) { in PCSetUp_GASM()
331 PetscCall(PCGASMCreateSubdomains(pc->pmat, osm->N, &osm->n, &osm->iis)); in PCSetUp_GASM()
332 } else if (osm->dm_subdomains && pc->dm) { in PCSetUp_GASM()
346 osm->nmax = osm->n = 1; in PCSetUp_GASM()
348 osm->N = size; in PCSetUp_GASM()
349 PetscCall(PCGASMCreateLocalSubdomains(pc->pmat, osm->n, &osm->iis)); in PCSetUp_GASM()
352 if (!osm->iis) { in PCSetUp_GASM()
358 PetscCall(PCGASMCreateLocalSubdomains(pc->pmat, osm->n, &osm->iis)); in PCSetUp_GASM()
360 if (!osm->ois) { in PCSetUp_GASM()
365 PetscCall(PetscMalloc1(osm->n, &osm->ois)); in PCSetUp_GASM()
366 for (i = 0; i < osm->n; ++i) { in PCSetUp_GASM()
367 … if (osm->overlap > 0 && osm->N > 1) { /* With positive overlap, osm->iis[i] will be modified */ in PCSetUp_GASM()
368 PetscCall(ISDuplicate(osm->iis[i], (osm->ois) + i)); in PCSetUp_GASM()
369 PetscCall(ISCopy(osm->iis[i], osm->ois[i])); in PCSetUp_GASM()
371 PetscCall(PetscObjectReference((PetscObject)osm->iis[i])); in PCSetUp_GASM()
372 osm->ois[i] = osm->iis[i]; in PCSetUp_GASM()
375 if (osm->overlap > 0 && osm->N > 1) { in PCSetUp_GASM()
377 PetscCall(MatIncreaseOverlapSplit(pc->pmat, osm->n, osm->ois, osm->overlap)); in PCSetUp_GASM()
382 if (osm->nmax == PETSC_DETERMINE) { in PCSetUp_GASM()
385 inwork = osm->n; in PCSetUp_GASM()
387 osm->nmax = outwork; in PCSetUp_GASM()
389 if (osm->N == PETSC_DETERMINE) { in PCSetUp_GASM()
391 …sListGetGlobalNumbering(PetscObjectComm((PetscObject)pc), osm->n, (PetscObject *)osm->ois, &osm->N… in PCSetUp_GASM()
394 if (osm->sort_indices) { in PCSetUp_GASM()
395 for (i = 0; i < osm->n; i++) { in PCSetUp_GASM()
396 PetscCall(ISSort(osm->ois[i])); in PCSetUp_GASM()
397 PetscCall(ISSort(osm->iis[i])); in PCSetUp_GASM()
408 for (i = 0; i < osm->n; i++) { in PCSetUp_GASM()
409 PetscCall(ISGetLocalSize(osm->ois[i], &oni)); in PCSetUp_GASM()
415 for (i = 0; i < osm->n; i++) { in PCSetUp_GASM()
416 PetscCall(ISGetLocalSize(osm->ois[i], &oni)); in PCSetUp_GASM()
417 PetscCall(ISGetIndices(osm->ois[i], &oidxi)); in PCSetUp_GASM()
419 PetscCall(ISRestoreIndices(osm->ois[i], &oidxi)); in PCSetUp_GASM()
424 for (i = 0; i < osm->n; i++) { in PCSetUp_GASM()
425 PetscCall(ISGetLocalSize(osm->iis[i], &nInnerIndices)); in PCSetUp_GASM()
431 PetscCall(VecCreateMPI(PetscObjectComm((PetscObject)pc), on, PETSC_DECIDE, &osm->gx)); in PCSetUp_GASM()
432 PetscCall(VecDuplicate(osm->gx, &osm->gy)); in PCSetUp_GASM()
433 PetscCall(VecGetOwnershipRange(osm->gx, &gostart, NULL)); in PCSetUp_GASM()
436 PetscCall(VecScatterCreate(x, gois, osm->gx, goid, &osm->gorestriction)); in PCSetUp_GASM()
437 PetscCall(PetscMalloc1(osm->n, &numbering)); in PCSetUp_GASM()
438 …bjectsListGetGlobalNumbering(PetscObjectComm((PetscObject)pc), osm->n, (PetscObject *)osm->ois, NU… in PCSetUp_GASM()
454 for (i = 0; i < osm->n; i++) { in PCSetUp_GASM()
455 PetscCall(ISGetLocalSize(osm->ois[i], &oni)); in PCSetUp_GASM()
463 for (i = 0; i < osm->n; i++) { in PCSetUp_GASM()
464 PetscCall(ISGetLocalSize(osm->iis[i], &ini)); in PCSetUp_GASM()
469 PetscCall(VecScatterBegin(osm->gorestriction, y, osm->gy, INSERT_VALUES, SCATTER_FORWARD)); in PCSetUp_GASM()
470 PetscCall(VecScatterEnd(osm->gorestriction, y, osm->gy, INSERT_VALUES, SCATTER_FORWARD)); in PCSetUp_GASM()
471 PetscCall(VecGetOwnershipRange(osm->gy, &gostart, NULL)); in PCSetUp_GASM()
472 PetscCall(VecGetArray(osm->gy, &array)); in PCSetUp_GASM()
475 for (i = 0; i < osm->n; i++) { in PCSetUp_GASM()
476 PetscCall(ISGetLocalSize(osm->ois[i], &oni)); in PCSetUp_GASM()
477 PetscCall(ISGetIndices(osm->ois[i], &indices)); in PCSetUp_GASM()
484 PetscCall(ISRestoreIndices(osm->ois[i], &indices)); in PCSetUp_GASM()
487 PetscCall(VecRestoreArray(osm->gy, &array)); in PCSetUp_GASM()
490 PetscCall(VecScatterCreate(y, giis, osm->gy, giois, &osm->girestriction)); in PCSetUp_GASM()
499 PetscCall(PetscMalloc1(osm->n, &osm->x)); in PCSetUp_GASM()
500 PetscCall(PetscMalloc1(osm->n, &osm->y)); in PCSetUp_GASM()
501 PetscCall(VecGetArray(osm->gx, &gxarray)); in PCSetUp_GASM()
502 PetscCall(VecGetArray(osm->gy, &gyarray)); in PCSetUp_GASM()
503 for (i = 0, on = 0; i < osm->n; ++i, on += oni) { in PCSetUp_GASM()
505 PetscCall(ISGetLocalSize(osm->ois[i], &oni)); in PCSetUp_GASM()
507 PetscCall(ISGetSize(osm->ois[i], &oNi)); in PCSetUp_GASM()
508 …PetscCall(VecCreateMPIWithArray(((PetscObject)osm->ois[i])->comm, 1, oni, oNi, gxarray + on, &osm-… in PCSetUp_GASM()
509 …PetscCall(VecCreateMPIWithArray(((PetscObject)osm->ois[i])->comm, 1, oni, oNi, gyarray + on, &osm-… in PCSetUp_GASM()
511 PetscCall(VecRestoreArray(osm->gx, &gxarray)); in PCSetUp_GASM()
512 PetscCall(VecRestoreArray(osm->gy, &gyarray)); in PCSetUp_GASM()
514 PetscCall(PetscMalloc1(osm->n, &osm->ksp)); in PCSetUp_GASM()
515 for (i = 0; i < osm->n; i++) { in PCSetUp_GASM()
517 PetscCall(KSPCreate(((PetscObject)osm->ois[i])->comm, &ksp)); in PCSetUp_GASM()
535 osm->ksp[i] = ksp; in PCSetUp_GASM()
545 PetscCall(MatDestroyMatrices(osm->n, &osm->pmat)); in PCSetUp_GASM()
548 if (osm->permutationIS) { in PCSetUp_GASM()
549 …PetscCall(MatCreateSubMatrix(pc->pmat, osm->permutationIS, osm->permutationIS, scall, &osm->permut… in PCSetUp_GASM()
550 PetscCall(PetscObjectReference((PetscObject)osm->permutationP)); in PCSetUp_GASM()
551 osm->pcmat = pc->pmat; in PCSetUp_GASM()
552 pc->pmat = osm->permutationP; in PCSetUp_GASM()
560 PetscCall(MatCreateSubMatricesMPI(pc->pmat, osm->n, osm->ois, osm->ois, scall, &osm->pmat)); in PCSetUp_GASM()
562 PetscCall(MatCreateSubMatrices(pc->pmat, osm->n, osm->ois, osm->ois, scall, &osm->pmat)); in PCSetUp_GASM()
566 …for (i = 0; i < osm->n; i++) PetscCall(PetscObjectSetOptionsPrefix((PetscObject)osm->pmat[i], ppre… in PCSetUp_GASM()
571 PetscCall(PCModifySubMatrices(pc, osm->n, osm->ois, osm->ois, osm->pmat, pc->modifysubmatricesP)); in PCSetUp_GASM()
576 for (i = 0; i < osm->n; i++) { in PCSetUp_GASM()
577 PetscCall(KSPSetOperators(osm->ksp[i], osm->pmat[i], osm->pmat[i])); in PCSetUp_GASM()
578 PetscCall(KSPGetOptionsPrefix(osm->ksp[i], &prefix)); in PCSetUp_GASM()
579 PetscCall(MatSetOptionsPrefix(osm->pmat[i], prefix)); in PCSetUp_GASM()
580 if (!pc->setupcalled) PetscCall(KSPSetFromOptions(osm->ksp[i])); in PCSetUp_GASM()
582 if (osm->pcmat) { in PCSetUp_GASM()
584 pc->pmat = osm->pcmat; in PCSetUp_GASM()
585 osm->pcmat = NULL; in PCSetUp_GASM()
592 PC_GASM *osm = (PC_GASM *)pc->data; in PCSetUpOnBlocks_GASM() local
596 for (i = 0; i < osm->n; i++) PetscCall(KSPSetUp(osm->ksp[i])); in PCSetUpOnBlocks_GASM()
602 PC_GASM *osm = (PC_GASM *)pc->data; in PCApply_GASM() local
608 if (osm->pctoouter) { in PCApply_GASM()
609 PetscCall(VecScatterBegin(osm->pctoouter, xin, osm->pcx, INSERT_VALUES, SCATTER_REVERSE)); in PCApply_GASM()
610 PetscCall(VecScatterEnd(osm->pctoouter, xin, osm->pcx, INSERT_VALUES, SCATTER_REVERSE)); in PCApply_GASM()
611 x = osm->pcx; in PCApply_GASM()
612 y = osm->pcy; in PCApply_GASM()
621 if (!(osm->type & PC_GASM_RESTRICT)) { in PCApply_GASM()
623 PetscCall(VecZeroEntries(osm->gx)); in PCApply_GASM()
624 PetscCall(VecScatterBegin(osm->girestriction, x, osm->gx, INSERT_VALUES, forward)); in PCApply_GASM()
626 PetscCall(VecScatterBegin(osm->gorestriction, x, osm->gx, INSERT_VALUES, forward)); in PCApply_GASM()
628 PetscCall(VecZeroEntries(osm->gy)); in PCApply_GASM()
629 if (!(osm->type & PC_GASM_RESTRICT)) { in PCApply_GASM()
630 PetscCall(VecScatterEnd(osm->girestriction, x, osm->gx, INSERT_VALUES, forward)); in PCApply_GASM()
632 PetscCall(VecScatterEnd(osm->gorestriction, x, osm->gx, INSERT_VALUES, forward)); in PCApply_GASM()
635 for (i = 0; i < osm->n; ++i) { in PCApply_GASM()
636 PetscCall(KSPSolve(osm->ksp[i], osm->x[i], osm->y[i])); in PCApply_GASM()
637 PetscCall(KSPCheckSolve(osm->ksp[i], pc, osm->y[i])); in PCApply_GASM()
641 if (!(osm->type & PC_GASM_INTERPOLATE)) { in PCApply_GASM()
642 PetscCall(VecScatterBegin(osm->girestriction, osm->gy, y, ADD_VALUES, reverse)); in PCApply_GASM()
643 PetscCall(VecScatterEnd(osm->girestriction, osm->gy, y, ADD_VALUES, reverse)); in PCApply_GASM()
645 PetscCall(VecScatterBegin(osm->gorestriction, osm->gy, y, ADD_VALUES, reverse)); in PCApply_GASM()
646 PetscCall(VecScatterEnd(osm->gorestriction, osm->gy, y, ADD_VALUES, reverse)); in PCApply_GASM()
648 if (osm->pctoouter) { in PCApply_GASM()
649 PetscCall(VecScatterBegin(osm->pctoouter, y, yout, INSERT_VALUES, SCATTER_FORWARD)); in PCApply_GASM()
650 PetscCall(VecScatterEnd(osm->pctoouter, y, yout, INSERT_VALUES, SCATTER_FORWARD)); in PCApply_GASM()
657 PC_GASM *osm = (PC_GASM *)pc->data; in PCMatApply_GASM() local
664 PetscCheck(osm->n == 1, PetscObjectComm((PetscObject)pc), PETSC_ERR_SUP, "Not yet implemented"); in PCMatApply_GASM()
666 if (osm->pctoouter) { in PCMatApply_GASM()
667 PetscCall(VecGetLocalSize(osm->pcx, &m)); in PCMatApply_GASM()
668 PetscCall(VecGetSize(osm->pcx, &M)); in PCMatApply_GASM()
669 …PetscCall(MatCreateDense(PetscObjectComm((PetscObject)osm->ois[0]), m, PETSC_DECIDE, M, N, NULL, &… in PCMatApply_GASM()
673 PetscCall(VecScatterBegin(osm->pctoouter, x, y, INSERT_VALUES, SCATTER_REVERSE)); in PCMatApply_GASM()
674 PetscCall(VecScatterEnd(osm->pctoouter, x, y, INSERT_VALUES, SCATTER_REVERSE)); in PCMatApply_GASM()
687 PetscCall(VecGetLocalSize(osm->x[0], &m)); in PCMatApply_GASM()
688 PetscCall(VecGetSize(osm->x[0], &M)); in PCMatApply_GASM()
689 …PetscCall(MatCreateDense(PetscObjectComm((PetscObject)osm->ois[0]), m, PETSC_DECIDE, M, N, NULL, &… in PCMatApply_GASM()
693 if (!(osm->type & PC_GASM_RESTRICT)) { in PCMatApply_GASM()
696 PetscCall(VecScatterBegin(osm->girestriction, x, y, INSERT_VALUES, forward)); in PCMatApply_GASM()
697 PetscCall(VecScatterEnd(osm->girestriction, x, y, INSERT_VALUES, forward)); in PCMatApply_GASM()
699 PetscCall(VecScatterBegin(osm->gorestriction, x, y, INSERT_VALUES, forward)); in PCMatApply_GASM()
700 PetscCall(VecScatterEnd(osm->gorestriction, x, y, INSERT_VALUES, forward)); in PCMatApply_GASM()
705 …PetscCall(MatCreateDense(PetscObjectComm((PetscObject)osm->ois[0]), m, PETSC_DECIDE, M, N, NULL, &… in PCMatApply_GASM()
710 PetscCall(KSPMatSolve(osm->ksp[0], Z, W)); in PCMatApply_GASM()
711 PetscCall(KSPCheckSolve(osm->ksp[0], pc, NULL)); in PCMatApply_GASM()
718 if (!(osm->type & PC_GASM_INTERPOLATE)) { in PCMatApply_GASM()
719 PetscCall(VecScatterBegin(osm->girestriction, x, y, ADD_VALUES, reverse)); in PCMatApply_GASM()
720 PetscCall(VecScatterEnd(osm->girestriction, x, y, ADD_VALUES, reverse)); in PCMatApply_GASM()
722 PetscCall(VecScatterBegin(osm->gorestriction, x, y, ADD_VALUES, reverse)); in PCMatApply_GASM()
723 PetscCall(VecScatterEnd(osm->gorestriction, x, y, ADD_VALUES, reverse)); in PCMatApply_GASM()
726 if (osm->pctoouter) { in PCMatApply_GASM()
728 PetscCall(VecScatterBegin(osm->pctoouter, y, x, INSERT_VALUES, SCATTER_FORWARD)); in PCMatApply_GASM()
729 PetscCall(VecScatterEnd(osm->pctoouter, y, x, INSERT_VALUES, SCATTER_FORWARD)); in PCMatApply_GASM()
741 PC_GASM *osm = (PC_GASM *)pc->data; in PCApplyTranspose_GASM() local
747 if (osm->pctoouter) { in PCApplyTranspose_GASM()
748 PetscCall(VecScatterBegin(osm->pctoouter, xin, osm->pcx, INSERT_VALUES, SCATTER_REVERSE)); in PCApplyTranspose_GASM()
749 PetscCall(VecScatterEnd(osm->pctoouter, xin, osm->pcx, INSERT_VALUES, SCATTER_REVERSE)); in PCApplyTranspose_GASM()
750 x = osm->pcx; in PCApplyTranspose_GASM()
751 y = osm->pcy; in PCApplyTranspose_GASM()
763 if (!(osm->type & PC_GASM_INTERPOLATE)) { in PCApplyTranspose_GASM()
765 PetscCall(VecZeroEntries(osm->gx)); in PCApplyTranspose_GASM()
766 PetscCall(VecScatterBegin(osm->girestriction, x, osm->gx, INSERT_VALUES, forward)); in PCApplyTranspose_GASM()
768 PetscCall(VecScatterBegin(osm->gorestriction, x, osm->gx, INSERT_VALUES, forward)); in PCApplyTranspose_GASM()
770 PetscCall(VecZeroEntries(osm->gy)); in PCApplyTranspose_GASM()
771 if (!(osm->type & PC_GASM_INTERPOLATE)) { in PCApplyTranspose_GASM()
772 PetscCall(VecScatterEnd(osm->girestriction, x, osm->gx, INSERT_VALUES, forward)); in PCApplyTranspose_GASM()
774 PetscCall(VecScatterEnd(osm->gorestriction, x, osm->gx, INSERT_VALUES, forward)); in PCApplyTranspose_GASM()
777 …for (i = 0; i < osm->n; ++i) { /* Note that the solves are local, so we can go to osm->n, rather t… in PCApplyTranspose_GASM()
778 PetscCall(KSPSolveTranspose(osm->ksp[i], osm->x[i], osm->y[i])); in PCApplyTranspose_GASM()
779 PetscCall(KSPCheckSolve(osm->ksp[i], pc, osm->y[i])); in PCApplyTranspose_GASM()
782 if (!(osm->type & PC_GASM_RESTRICT)) { in PCApplyTranspose_GASM()
783 PetscCall(VecScatterBegin(osm->girestriction, osm->gy, y, ADD_VALUES, reverse)); in PCApplyTranspose_GASM()
784 PetscCall(VecScatterEnd(osm->girestriction, osm->gy, y, ADD_VALUES, reverse)); in PCApplyTranspose_GASM()
786 PetscCall(VecScatterBegin(osm->gorestriction, osm->gy, y, ADD_VALUES, reverse)); in PCApplyTranspose_GASM()
787 PetscCall(VecScatterEnd(osm->gorestriction, osm->gy, y, ADD_VALUES, reverse)); in PCApplyTranspose_GASM()
789 if (osm->pctoouter) { in PCApplyTranspose_GASM()
790 PetscCall(VecScatterBegin(osm->pctoouter, y, yout, INSERT_VALUES, SCATTER_FORWARD)); in PCApplyTranspose_GASM()
791 PetscCall(VecScatterEnd(osm->pctoouter, y, yout, INSERT_VALUES, SCATTER_FORWARD)); in PCApplyTranspose_GASM()
798 PC_GASM *osm = (PC_GASM *)pc->data; in PCReset_GASM() local
802 if (osm->ksp) { in PCReset_GASM()
803 for (i = 0; i < osm->n; i++) PetscCall(KSPReset(osm->ksp[i])); in PCReset_GASM()
805 if (osm->pmat) { in PCReset_GASM()
806 if (osm->n > 0) { in PCReset_GASM()
811 PetscCall(MatDestroyMatrices(osm->n, &osm->pmat)); in PCReset_GASM()
813 PetscCall(MatDestroySubMatrices(osm->n, &osm->pmat)); in PCReset_GASM()
817 if (osm->x) { in PCReset_GASM()
818 for (i = 0; i < osm->n; i++) { in PCReset_GASM()
819 PetscCall(VecDestroy(&osm->x[i])); in PCReset_GASM()
820 PetscCall(VecDestroy(&osm->y[i])); in PCReset_GASM()
823 PetscCall(VecDestroy(&osm->gx)); in PCReset_GASM()
824 PetscCall(VecDestroy(&osm->gy)); in PCReset_GASM()
826 PetscCall(VecScatterDestroy(&osm->gorestriction)); in PCReset_GASM()
827 PetscCall(VecScatterDestroy(&osm->girestriction)); in PCReset_GASM()
828 if (!osm->user_subdomains) { in PCReset_GASM()
829 PetscCall(PCGASMDestroySubdomains(osm->n, &osm->ois, &osm->iis)); in PCReset_GASM()
830 osm->N = PETSC_DETERMINE; in PCReset_GASM()
831 osm->nmax = PETSC_DETERMINE; in PCReset_GASM()
833 if (osm->pctoouter) PetscCall(VecScatterDestroy(&osm->pctoouter)); in PCReset_GASM()
834 if (osm->permutationIS) PetscCall(ISDestroy(&osm->permutationIS)); in PCReset_GASM()
835 if (osm->pcx) PetscCall(VecDestroy(&osm->pcx)); in PCReset_GASM()
836 if (osm->pcy) PetscCall(VecDestroy(&osm->pcy)); in PCReset_GASM()
837 if (osm->permutationP) PetscCall(MatDestroy(&osm->permutationP)); in PCReset_GASM()
838 if (osm->pcmat) PetscCall(MatDestroy(&osm->pcmat)); in PCReset_GASM()
844 PC_GASM *osm = (PC_GASM *)pc->data; in PCDestroy_GASM() local
850 PetscCall(PCGASMDestroySubdomains(osm->n, &osm->ois, &osm->iis)); in PCDestroy_GASM()
851 if (osm->ksp) { in PCDestroy_GASM()
852 for (i = 0; i < osm->n; i++) PetscCall(KSPDestroy(&osm->ksp[i])); in PCDestroy_GASM()
853 PetscCall(PetscFree(osm->ksp)); in PCDestroy_GASM()
855 PetscCall(PetscFree(osm->x)); in PCDestroy_GASM()
856 PetscCall(PetscFree(osm->y)); in PCDestroy_GASM()
868 PC_GASM *osm = (PC_GASM *)pc->data; in PCSetFromOptions_GASM() local
875 …mposition() to define subdomains.", "PCGASMSetUseDMSubdomains", osm->dm_subdomains, &osm->dm_subdo… in PCSetFromOptions_GASM()
876 …tal number of subdomains across communicator", "PCGASMSetTotalSubdomains", osm->N, &blocks, &flg)); in PCSetFromOptions_GASM()
878 …_overlap", "Number of overlapping degrees of freedom", "PCGASMSetOverlap", osm->overlap, &ovl, &fl… in PCSetFromOptions_GASM()
881 osm->dm_subdomains = PETSC_FALSE; in PCSetFromOptions_GASM()
884 … "Type of restriction/extension", "PCGASMSetType", PCGASMTypes, (PetscEnum)osm->type, (PetscEnum *… in PCSetFromOptions_GASM()
886 …ical_partitioning", "use hierarchical partitioning", NULL, osm->hierarchicalpartitioning, &osm->hi… in PCSetFromOptions_GASM()
907 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMSetTotalSubdomains() local
914 PetscCall(PCGASMDestroySubdomains(osm->n, &osm->iis, &osm->ois)); in PCGASMSetTotalSubdomains()
915 osm->ois = osm->iis = NULL; in PCGASMSetTotalSubdomains()
919 osm->N = N; in PCGASMSetTotalSubdomains()
920 osm->n = PETSC_DETERMINE; in PCGASMSetTotalSubdomains()
921 osm->nmax = PETSC_DETERMINE; in PCGASMSetTotalSubdomains()
922 osm->dm_subdomains = PETSC_FALSE; in PCGASMSetTotalSubdomains()
928 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMSetSubdomains_GASM() local
935 PetscCall(PCGASMDestroySubdomains(osm->n, &osm->iis, &osm->ois)); in PCGASMSetSubdomains_GASM()
936 osm->iis = osm->ois = NULL; in PCGASMSetSubdomains_GASM()
937 osm->n = n; in PCGASMSetSubdomains_GASM()
938 osm->N = PETSC_DETERMINE; in PCGASMSetSubdomains_GASM()
939 osm->nmax = PETSC_DETERMINE; in PCGASMSetSubdomains_GASM()
941 PetscCall(PetscMalloc1(n, &osm->ois)); in PCGASMSetSubdomains_GASM()
944 osm->ois[i] = ois[i]; in PCGASMSetSubdomains_GASM()
950 osm->overlap = -1; in PCGASMSetSubdomains_GASM()
955 PetscCall(PetscMalloc1(n, &osm->iis)); in PCGASMSetSubdomains_GASM()
958 osm->iis[i] = iis[i]; in PCGASMSetSubdomains_GASM()
961 osm->ois = NULL; in PCGASMSetSubdomains_GASM()
969 if (osm->iis) { in PCGASMSetSubdomains_GASM()
975 PetscCall(ISGetIndices(osm->iis[i], &indices)); in PCGASMSetSubdomains_GASM()
976 PetscCall(ISGetLocalSize(osm->iis[i], &lsize)); in PCGASMSetSubdomains_GASM()
982 PetscCall(ISRestoreIndices(osm->iis[i], &indices)); in PCGASMSetSubdomains_GASM()
989 if (iis) osm->user_subdomains = PETSC_TRUE; in PCGASMSetSubdomains_GASM()
995 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMSetOverlap_GASM() local
999 …PetscCheck(!pc->setupcalled || ovl == osm->overlap, PetscObjectComm((PetscObject)pc), PETSC_ERR_AR… in PCGASMSetOverlap_GASM()
1000 if (!pc->setupcalled) osm->overlap = ovl; in PCGASMSetOverlap_GASM()
1006 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMSetType_GASM() local
1009 osm->type = type; in PCGASMSetType_GASM()
1010 osm->type_set = PETSC_TRUE; in PCGASMSetType_GASM()
1016 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMSetSortIndices_GASM() local
1019 osm->sort_indices = doSort; in PCGASMSetSortIndices_GASM()
1029 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMGetSubKSP_GASM() local
1032 …PetscCheck(osm->n >= 1, PetscObjectComm((PetscObject)pc), PETSC_ERR_ORDER, "Need to call PCSetUp()… in PCGASMGetSubKSP_GASM()
1034 if (n) *n = osm->n; in PCGASMGetSubKSP_GASM()
1036 PetscCallMPI(MPI_Scan(&osm->n, first, 1, MPIU_INT, MPI_SUM, PetscObjectComm((PetscObject)pc))); in PCGASMGetSubKSP_GASM()
1037 *first -= osm->n; in PCGASMGetSubKSP_GASM()
1042 *ksp = osm->ksp; in PCGASMGetSubKSP_GASM()
1043 osm->same_subdomain_solvers = PETSC_FALSE; in PCGASMGetSubKSP_GASM()
1089 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMSetSubdomains() local
1094 osm->dm_subdomains = PETSC_FALSE; in PCGASMSetSubdomains()
1135 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMSetOverlap() local
1141 osm->dm_subdomains = PETSC_FALSE; in PCGASMSetOverlap()
1268 PC_GASM *osm; in PCCreate_GASM() local
1271 PetscCall(PetscNew(&osm)); in PCCreate_GASM()
1273 osm->N = PETSC_DETERMINE; in PCCreate_GASM()
1274 osm->n = PETSC_DECIDE; in PCCreate_GASM()
1275 osm->nmax = PETSC_DETERMINE; in PCCreate_GASM()
1276 osm->overlap = 0; in PCCreate_GASM()
1277 osm->ksp = NULL; in PCCreate_GASM()
1278 osm->gorestriction = NULL; in PCCreate_GASM()
1279 osm->girestriction = NULL; in PCCreate_GASM()
1280 osm->pctoouter = NULL; in PCCreate_GASM()
1281 osm->gx = NULL; in PCCreate_GASM()
1282 osm->gy = NULL; in PCCreate_GASM()
1283 osm->x = NULL; in PCCreate_GASM()
1284 osm->y = NULL; in PCCreate_GASM()
1285 osm->pcx = NULL; in PCCreate_GASM()
1286 osm->pcy = NULL; in PCCreate_GASM()
1287 osm->permutationIS = NULL; in PCCreate_GASM()
1288 osm->permutationP = NULL; in PCCreate_GASM()
1289 osm->pcmat = NULL; in PCCreate_GASM()
1290 osm->ois = NULL; in PCCreate_GASM()
1291 osm->iis = NULL; in PCCreate_GASM()
1292 osm->pmat = NULL; in PCCreate_GASM()
1293 osm->type = PC_GASM_RESTRICT; in PCCreate_GASM()
1294 osm->same_subdomain_solvers = PETSC_TRUE; in PCCreate_GASM()
1295 osm->sort_indices = PETSC_TRUE; in PCCreate_GASM()
1296 osm->dm_subdomains = PETSC_FALSE; in PCCreate_GASM()
1297 osm->hierarchicalpartitioning = PETSC_FALSE; in PCCreate_GASM()
1299 pc->data = (void *)osm; in PCCreate_GASM()
1794 PC_GASM *osm; in PCGASMGetSubdomains() local
1802 osm = (PC_GASM *)pc->data; in PCGASMGetSubdomains()
1803 if (n) *n = osm->n; in PCGASMGetSubdomains()
1804 if (iis) PetscCall(PetscMalloc1(osm->n, iis)); in PCGASMGetSubdomains()
1805 if (ois) PetscCall(PetscMalloc1(osm->n, ois)); in PCGASMGetSubdomains()
1807 for (i = 0; i < osm->n; ++i) { in PCGASMGetSubdomains()
1808 if (iis) (*iis)[i] = osm->iis[i]; in PCGASMGetSubdomains()
1809 if (ois) (*ois)[i] = osm->ois[i]; in PCGASMGetSubdomains()
1839 PC_GASM *osm; in PCGASMGetSubmatrices() local
1849 osm = (PC_GASM *)pc->data; in PCGASMGetSubmatrices()
1850 if (n) *n = osm->n; in PCGASMGetSubmatrices()
1851 if (mat) *mat = osm->pmat; in PCGASMGetSubmatrices()
1881 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMSetUseDMSubdomains() local
1890 …if (!osm->user_subdomains && osm->N == PETSC_DETERMINE && osm->overlap < 0) osm->dm_subdomains = f… in PCGASMSetUseDMSubdomains()
1913 PC_GASM *osm = (PC_GASM *)pc->data; in PCGASMGetUseDMSubdomains() local
1921 if (flg) *flg = osm->dm_subdomains; in PCGASMGetUseDMSubdomains()