File: | ksp/pc/impls/asm/asm.c |
Warning: | line 821, column 5 Value stored to 'ierr' is never read |
[?] Use j/k keys for keyboard navigation
1 | /* |
2 | This file defines an additive Schwarz preconditioner for any Mat implementation. |
3 | |
4 | Note that each processor may have any number of subdomains. But in order to |
5 | deal easily with the VecScatter(), we treat each processor as if it has the |
6 | same number of subdomains. |
7 | |
8 | n - total number of true subdomains on all processors |
9 | n_local_true - actual number of subdomains on this processor |
10 | n_local = maximum over all processors of n_local_true |
11 | */ |
12 | #include <petsc/private/pcimpl.h> /*I "petscpc.h" I*/ |
13 | #include <petscdm.h> |
14 | #include <../src/mat/impls/dense/seq/dense.h> |
15 | #include <petscblaslapack.h> |
16 | |
17 | typedef struct { |
18 | PetscInt n, n_local, n_local_true; |
19 | PetscInt overlap; /* overlap requested by user */ |
20 | KSP *ksp; /* linear solvers for each block */ |
21 | VecScatter restriction; /* mapping from global to overlapping (process) subdomain*/ |
22 | VecScatter *lrestriction; /* mapping from subregion to overlapping (process) subdomain */ |
23 | VecScatter *lprolongation; /* mapping from non-overlapping subregion to overlapping (process) subdomain; used for restrict additive version of algorithms */ |
24 | Vec lx, ly; /* work vectors */ |
25 | Vec *x,*y; /* work vectors */ |
26 | IS lis; /* index set that defines each overlapping multiplicative (process) subdomain */ |
27 | IS *is; /* index set that defines each overlapping subdomain */ |
28 | IS *is_local; /* index set that defines each non-overlapping subdomain, may be NULL */ |
29 | IS sd_is,is_restrict; /* index set to number the subdomains */ |
30 | Mat locnullsp; /* local null space for coarse problem*/ |
31 | Mat coarseU,coarseVt ; /*SVD factorization of the coarse matrix*/ |
32 | Vec coarseS; /*SVD factorization of the coarse matrix*/ |
33 | Mat *mat,*pmat; /* mat is not currently used */ |
34 | PCASMType type; /* use reduced interpolation, restriction or both */ |
35 | PetscBool type_set; /* if user set this value (so won't change it for symmetric problems) */ |
36 | PetscBool same_local_solves; /* flag indicating whether all local solvers are same */ |
37 | PetscBool sort_indices; /* flag to sort subdomain indices */ |
38 | PetscBool dm_subdomains; /* whether DM is allowed to define subdomains */ |
39 | PetscInt use_kernel; /* used in multiprecond 0 no kernel, 1 1 vector/subdomain ... ; should be an enum in the end*/ |
40 | PetscScalar smallAbs; /* criterion for svd truncation */ |
41 | PCCompositeType loctype; /* the type of composition for local solves */ |
42 | MatType sub_mat_type; /* the type of Mat used for subdomain solves (can be MATSAME or NULL) */ |
43 | /* For multiplicative solve */ |
44 | Mat *lmats; /* submatrices for overlapping multiplicative (process) subdomain */ |
45 | } PC_ASM; |
46 | |
47 | static PetscErrorCode PCView_ASM(PC pc,PetscViewer viewer) |
48 | { |
49 | PC_ASM *osm = (PC_ASM*)pc->data; |
50 | PetscErrorCode ierr; |
51 | PetscMPIInt rank; |
52 | PetscInt i,bsz; |
53 | PetscBool iascii,isstring; |
54 | PetscViewer sviewer; |
55 | |
56 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 56; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
57 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),57,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
58 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERSTRING"string",&isstring);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),58,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
59 | if (iascii) { |
60 | char overlaps[256] = "user-defined overlap",blocks[256] = "total subdomain blocks not yet set"; |
61 | if (osm->overlap >= 0) {ierr = PetscSNPrintf(overlaps,sizeof(overlaps),"amount of overlap = %D",osm->overlap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),61,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
62 | if (osm->n > 0) {ierr = PetscSNPrintf(blocks,sizeof(blocks),"total subdomain blocks = %D",osm->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),62,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
63 | ierr = PetscViewerASCIIPrintf(viewer," %s, %s\n",blocks,overlaps);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),63,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
64 | ierr = PetscViewerASCIIPrintf(viewer," restriction/interpolation type - %s\n",PCASMTypes[osm->type]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),64,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
65 | if (osm->dm_subdomains) {ierr = PetscViewerASCIIPrintf(viewer," Additive Schwarz: using DM to define subdomains\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),65,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
66 | if (osm->loctype != PC_COMPOSITE_ADDITIVE) {ierr = PetscViewerASCIIPrintf(viewer," Additive Schwarz: local solve composition type - %s\n",PCCompositeTypes[osm->loctype]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),66,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
67 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)pc),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),67,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
68 | if (osm->same_local_solves) { |
69 | if (osm->ksp) { |
70 | ierr = PetscViewerASCIIPrintf(viewer," Local solve is same for all blocks, in the following KSP and PC objects:\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),70,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
71 | ierr = PetscViewerGetSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),71,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
72 | if (!rank) { |
73 | ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),73,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
74 | ierr = KSPView(osm->ksp[0],sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),74,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
75 | ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),75,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
76 | } |
77 | ierr = PetscViewerRestoreSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),77,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
78 | } |
79 | } else { |
80 | ierr = PetscViewerASCIIPushSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),80,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
81 | ierr = PetscViewerASCIISynchronizedPrintf(viewer," [%d] number of local blocks = %D\n",(int)rank,osm->n_local_true);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),81,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
82 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),82,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
83 | ierr = PetscViewerASCIIPrintf(viewer," Local solve info for each block is in the following KSP and PC objects:\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),83,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
84 | ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),84,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
85 | ierr = PetscViewerASCIIPrintf(viewer,"- - - - - - - - - - - - - - - - - -\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),85,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
86 | ierr = PetscViewerGetSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),86,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
87 | for (i=0; i<osm->n_local_true; i++) { |
88 | ierr = ISGetLocalSize(osm->is[i],&bsz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),88,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
89 | ierr = PetscViewerASCIISynchronizedPrintf(sviewer,"[%d] local block number %D, size = %D\n",(int)rank,i,bsz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),89,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
90 | ierr = KSPView(osm->ksp[i],sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),90,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
91 | ierr = PetscViewerASCIISynchronizedPrintf(sviewer,"- - - - - - - - - - - - - - - - - -\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),91,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
92 | } |
93 | ierr = PetscViewerRestoreSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),93,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
94 | ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),94,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
95 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),95,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
96 | ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),96,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
97 | } |
98 | } else if (isstring) { |
99 | ierr = PetscViewerStringSPrintf(viewer," blocks=%D, overlap=%D, type=%s",osm->n,osm->overlap,PCASMTypes[osm->type]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),99,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
100 | ierr = PetscViewerGetSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),100,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
101 | if (osm->ksp) {ierr = KSPView(osm->ksp[0],sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),101,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
102 | ierr = PetscViewerRestoreSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),102,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
103 | } |
104 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
105 | } |
106 | |
107 | static PetscErrorCode PCASMPrintSubdomains(PC pc) |
108 | { |
109 | PC_ASM *osm = (PC_ASM*)pc->data; |
110 | const char *prefix; |
111 | char fname[PETSC_MAX_PATH_LEN4096+1]; |
112 | PetscViewer viewer, sviewer; |
113 | char *s; |
114 | PetscInt i,j,nidx; |
115 | const PetscInt *idx; |
116 | PetscMPIInt rank, size; |
117 | PetscErrorCode ierr; |
118 | |
119 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 119; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
120 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)pc), &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),120,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
121 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)pc), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),121,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
122 | ierr = PCGetOptionsPrefix(pc,&prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),122,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
123 | ierr = PetscOptionsGetString(NULL((void*)0),prefix,"-pc_asm_print_subdomains",fname,PETSC_MAX_PATH_LEN4096,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),123,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
124 | if (fname[0] == 0) { ierr = PetscStrcpy(fname,"stdout");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),124,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); }; |
125 | ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)pc),fname,&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),125,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
126 | for (i=0; i<osm->n_local; i++) { |
127 | if (i < osm->n_local_true) { |
128 | ierr = ISGetLocalSize(osm->is[i],&nidx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),128,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
129 | ierr = ISGetIndices(osm->is[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),129,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
130 | /* Print to a string viewer; no more than 15 characters per index plus 512 char for the header.*/ |
131 | #define len 16*(nidx+1)+512 |
132 | ierr = PetscMalloc1(len,&s)PetscMallocA(1,PETSC_FALSE,132,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(len)*sizeof(**(&s)),(&s));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),132,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
133 | ierr = PetscViewerStringOpen(PETSC_COMM_SELF((MPI_Comm)0x44000001), s, len, &sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),133,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
134 | #undef len |
135 | ierr = PetscViewerStringSPrintf(sviewer, "[%D:%D] Subdomain %D with overlap:\n", rank, size, i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),135,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
136 | for (j=0; j<nidx; j++) { |
137 | ierr = PetscViewerStringSPrintf(sviewer,"%D ",idx[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),137,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
138 | } |
139 | ierr = ISRestoreIndices(osm->is[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),139,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
140 | ierr = PetscViewerStringSPrintf(sviewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),140,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
141 | ierr = PetscViewerDestroy(&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),141,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
142 | ierr = PetscViewerASCIIPushSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),142,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
143 | ierr = PetscViewerASCIISynchronizedPrintf(viewer, s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),143,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
144 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),144,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
145 | ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),145,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
146 | ierr = PetscFree(s)((*PetscTrFree)((void*)(s),146,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((s) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),146,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
147 | if (osm->is_local) { |
148 | /* Print to a string viewer; no more than 15 characters per index plus 512 char for the header.*/ |
149 | #define len 16*(nidx+1)+512 |
150 | ierr = PetscMalloc1(len, &s)PetscMallocA(1,PETSC_FALSE,150,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(len)*sizeof(**(&s)),(&s));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),150,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
151 | ierr = PetscViewerStringOpen(PETSC_COMM_SELF((MPI_Comm)0x44000001), s, len, &sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
152 | #undef len |
153 | ierr = PetscViewerStringSPrintf(sviewer, "[%D:%D] Subdomain %D without overlap:\n", rank, size, i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),153,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
154 | ierr = ISGetLocalSize(osm->is_local[i],&nidx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),154,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
155 | ierr = ISGetIndices(osm->is_local[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),155,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
156 | for (j=0; j<nidx; j++) { |
157 | ierr = PetscViewerStringSPrintf(sviewer,"%D ",idx[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),157,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
158 | } |
159 | ierr = ISRestoreIndices(osm->is_local[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),159,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
160 | ierr = PetscViewerStringSPrintf(sviewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),160,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
161 | ierr = PetscViewerDestroy(&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),161,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
162 | ierr = PetscViewerASCIIPushSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),162,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
163 | ierr = PetscViewerASCIISynchronizedPrintf(viewer, s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),163,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
164 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
165 | ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),165,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
166 | ierr = PetscFree(s)((*PetscTrFree)((void*)(s),166,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((s) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),166,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
167 | } |
168 | } else { |
169 | /* Participate in collective viewer calls. */ |
170 | ierr = PetscViewerASCIIPushSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),170,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
171 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),171,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
172 | ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),172,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
173 | /* Assume either all ranks have is_local or none do. */ |
174 | if (osm->is_local) { |
175 | ierr = PetscViewerASCIIPushSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),175,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
176 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),176,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
177 | ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),177,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
178 | } |
179 | } |
180 | } |
181 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),181,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
182 | ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),182,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
183 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
184 | } |
185 | |
186 | static PetscErrorCode PCSetUp_ASM(PC pc) |
187 | { |
188 | PC_ASM *osm = (PC_ASM*)pc->data; |
189 | PetscErrorCode ierr; |
190 | PetscBool symset,flg; |
191 | PetscInt i,m,m_local; |
192 | MatReuse scall = MAT_REUSE_MATRIX; |
193 | IS isl; |
194 | KSP ksp; |
195 | PC subpc; |
196 | const char *prefix,*pprefix; |
197 | Vec vec; |
198 | DM *domain_dm = NULL((void*)0); |
199 | |
200 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 200; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
201 | if (!pc->setupcalled) { |
202 | PetscInt m; |
203 | |
204 | if (!osm->type_set) { |
205 | ierr = MatIsSymmetricKnown(pc->pmat,&symset,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),205,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
206 | if (symset && flg) osm->type = PC_ASM_BASIC; |
207 | } |
208 | |
209 | /* Note: if subdomains have been set either via PCASMSetTotalSubdomains() or via PCASMSetLocalSubdomains(), osm->n_local_true will not be PETSC_DECIDE */ |
210 | if (osm->n_local_true == PETSC_DECIDE-1) { |
211 | /* no subdomains given */ |
212 | /* try pc->dm first, if allowed */ |
213 | if (osm->dm_subdomains && pc->dm) { |
214 | PetscInt num_domains, d; |
215 | char **domain_names; |
216 | IS *inner_domain_is, *outer_domain_is; |
217 | ierr = DMCreateDomainDecomposition(pc->dm, &num_domains, &domain_names, &inner_domain_is, &outer_domain_is, &domain_dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),217,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
218 | osm->overlap = -1; /* We do not want to increase the overlap of the IS. |
219 | A future improvement of this code might allow one to use |
220 | DM-defined subdomains and also increase the overlap, |
221 | but that is not currently supported */ |
222 | if (num_domains) { |
223 | ierr = PCASMSetLocalSubdomains(pc, num_domains, outer_domain_is, inner_domain_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),223,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
224 | } |
225 | for (d = 0; d < num_domains; ++d) { |
226 | if (domain_names) {ierr = PetscFree(domain_names[d])((*PetscTrFree)((void*)(domain_names[d]),226,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((domain_names[d]) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),226,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
227 | if (inner_domain_is) {ierr = ISDestroy(&inner_domain_is[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),227,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
228 | if (outer_domain_is) {ierr = ISDestroy(&outer_domain_is[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),228,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
229 | } |
230 | ierr = PetscFree(domain_names)((*PetscTrFree)((void*)(domain_names),230,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((domain_names) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),230,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
231 | ierr = PetscFree(inner_domain_is)((*PetscTrFree)((void*)(inner_domain_is),231,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((inner_domain_is) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),231,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
232 | ierr = PetscFree(outer_domain_is)((*PetscTrFree)((void*)(outer_domain_is),232,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((outer_domain_is) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),232,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
233 | } |
234 | if (osm->n_local_true == PETSC_DECIDE-1) { |
235 | /* still no subdomains; use one subdomain per processor */ |
236 | osm->n_local_true = 1; |
237 | } |
238 | } |
239 | { /* determine the global and max number of subdomains */ |
240 | struct {PetscInt max,sum;} inwork,outwork; |
241 | PetscMPIInt size; |
242 | |
243 | inwork.max = osm->n_local_true; |
244 | inwork.sum = osm->n_local_true; |
245 | ierr = MPIU_Allreduce(&inwork,&outwork,1,MPIU_2INT,MPIU_MAXSUM_OP,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc), 1,245,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)pc))),0) || MPI_Allreduce((&inwork),(&outwork ),(1),(((MPI_Datatype)0x4c000816)),(MPIU_MAXSUM_OP),(PetscObjectComm ((PetscObject)pc)))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),245,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
246 | osm->n_local = outwork.max; |
247 | osm->n = outwork.sum; |
248 | |
249 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)pc),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
250 | if (outwork.max == 1 && outwork.sum == size) { |
251 | /* osm->n_local_true = 1 on all processes, set this option may enable use of optimized MatCreateSubMatrices() implementation */ |
252 | ierr = MatSetOption(pc->pmat,MAT_SUBMAT_SINGLEIS,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),252,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
253 | } |
254 | } |
255 | if (!osm->is) { /* create the index sets */ |
256 | ierr = PCASMCreateSubdomains(pc->pmat,osm->n_local_true,&osm->is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),256,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
257 | } |
258 | if (osm->n_local_true > 1 && !osm->is_local) { |
259 | ierr = PetscMalloc1(osm->n_local_true,&osm->is_local)PetscMallocA(1,PETSC_FALSE,259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(osm->n_local_true)*sizeof(**(&osm->is_local )),(&osm->is_local));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
260 | for (i=0; i<osm->n_local_true; i++) { |
261 | if (osm->overlap > 0) { /* With positive overlap, osm->is[i] will be modified */ |
262 | ierr = ISDuplicate(osm->is[i],&osm->is_local[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),262,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
263 | ierr = ISCopy(osm->is[i],osm->is_local[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),263,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
264 | } else { |
265 | ierr = PetscObjectReference((PetscObject)osm->is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),265,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
266 | osm->is_local[i] = osm->is[i]; |
267 | } |
268 | } |
269 | } |
270 | ierr = PCGetOptionsPrefix(pc,&prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),270,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
271 | flg = PETSC_FALSE; |
272 | ierr = PetscOptionsGetBool(NULL((void*)0),prefix,"-pc_asm_print_subdomains",&flg,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),272,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
273 | if (flg) { ierr = PCASMPrintSubdomains(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),273,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } |
274 | |
275 | if (osm->overlap > 0) { |
276 | /* Extend the "overlapping" regions by a number of steps */ |
277 | ierr = MatIncreaseOverlap(pc->pmat,osm->n_local_true,osm->is,osm->overlap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),277,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
278 | } |
279 | if (osm->sort_indices) { |
280 | for (i=0; i<osm->n_local_true; i++) { |
281 | ierr = ISSort(osm->is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),281,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
282 | if (osm->is_local) { |
283 | ierr = ISSort(osm->is_local[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),283,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
284 | } |
285 | } |
286 | } |
287 | |
288 | if (!osm->ksp) { |
289 | /* Create the local solvers */ |
290 | ierr = PetscMalloc1(osm->n_local_true,&osm->ksp)PetscMallocA(1,PETSC_FALSE,290,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(osm->n_local_true)*sizeof(**(&osm->ksp)), (&osm->ksp));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),290,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
291 | if (domain_dm) { |
292 | ierr = PetscInfo(pc,"Setting up ASM subproblems using the embedded DM\n")PetscInfo_Private(__func__,pc,"Setting up ASM subproblems using the embedded DM\n" );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),292,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
293 | } |
294 | for (i=0; i<osm->n_local_true; i++) { |
295 | ierr = KSPCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
296 | ierr = KSPSetErrorIfNotConverged(ksp,pc->erroriffailure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
297 | ierr = PetscLogObjectParent((PetscObject)pc,(PetscObject)ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),297,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
298 | ierr = PetscObjectIncrementTabLevel((PetscObject)ksp,(PetscObject)pc,1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),298,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
299 | ierr = KSPSetType(ksp,KSPPREONLY"preonly");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),299,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
300 | ierr = KSPGetPC(ksp,&subpc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),300,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
301 | ierr = PCGetOptionsPrefix(pc,&prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),301,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
302 | ierr = KSPSetOptionsPrefix(ksp,prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),302,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
303 | ierr = KSPAppendOptionsPrefix(ksp,"sub_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),303,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
304 | if (domain_dm) { |
305 | ierr = KSPSetDM(ksp, domain_dm[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),305,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
306 | ierr = KSPSetDMActive(ksp, PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
307 | ierr = DMDestroy(&domain_dm[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),307,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
308 | } |
309 | osm->ksp[i] = ksp; |
310 | } |
311 | if (domain_dm) { |
312 | ierr = PetscFree(domain_dm)((*PetscTrFree)((void*)(domain_dm),312,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((domain_dm) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),312,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
313 | } |
314 | } |
315 | |
316 | ierr = ISConcatenate(PETSC_COMM_SELF((MPI_Comm)0x44000001), osm->n_local_true, osm->is, &osm->lis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),316,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
317 | ierr = ISSortRemoveDups(osm->lis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),317,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
318 | ierr = ISGetLocalSize(osm->lis, &m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),318,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
319 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001), m, &osm->lx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),319,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
320 | ierr = VecDuplicate(osm->lx, &osm->ly);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),320,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
321 | |
322 | scall = MAT_INITIAL_MATRIX; |
323 | } else { |
324 | /* |
325 | Destroy the blocks from the previous iteration |
326 | */ |
327 | if (pc->flag == DIFFERENT_NONZERO_PATTERN) { |
328 | ierr = MatDestroyMatrices(osm->n_local_true,&osm->pmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),328,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
329 | scall = MAT_INITIAL_MATRIX; |
330 | } |
331 | } |
332 | |
333 | /* |
334 | Extract out the submatrices |
335 | */ |
336 | ierr = MatCreateSubMatrices(pc->pmat,osm->n_local_true,osm->is,osm->is,scall,&osm->pmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),336,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
337 | if (scall == MAT_INITIAL_MATRIX) { |
338 | ierr = PetscObjectGetOptionsPrefix((PetscObject)pc->pmat,&pprefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),338,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
339 | for (i=0; i<osm->n_local_true; i++) { |
340 | ierr = PetscLogObjectParent((PetscObject)pc,(PetscObject)osm->pmat[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),340,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
341 | ierr = PetscObjectSetOptionsPrefix((PetscObject)osm->pmat[i],pprefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),341,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
342 | } |
343 | } |
344 | |
345 | /* Convert the types of the submatrices (if needbe) */ |
346 | if (osm->sub_mat_type) { |
347 | for (i=0; i<osm->n_local_true; i++) { |
348 | ierr = MatConvert(osm->pmat[i],osm->sub_mat_type,MAT_INPLACE_MATRIX,&(osm->pmat[i]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),348,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
349 | } |
350 | } |
351 | |
352 | if(!pc->setupcalled){ |
353 | /* Create the local work vectors (from the local matrices) and scatter contexts */ |
354 | ierr = MatCreateVecs(pc->pmat,&vec,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),354,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
355 | |
356 | if (osm->is_local && (osm->type == PC_ASM_INTERPOLATE || osm->type == PC_ASM_NONE )) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_SUP,"Cannot use interpolate or none PCASMType if is_local was provided to PCASMSetLocalSubdomains()")return PetscError(PetscObjectComm((PetscObject)pc),356,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",56 ,PETSC_ERROR_INITIAL,"Cannot use interpolate or none PCASMType if is_local was provided to PCASMSetLocalSubdomains()" ); |
357 | if (osm->is_local && osm->type == PC_ASM_RESTRICT && osm->loctype == PC_COMPOSITE_ADDITIVE) { |
358 | ierr = PetscMalloc1(osm->n_local_true,&osm->lprolongation)PetscMallocA(1,PETSC_FALSE,358,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(osm->n_local_true)*sizeof(**(&osm->lprolongation )),(&osm->lprolongation));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),358,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
359 | } |
360 | ierr = PetscMalloc1(osm->n_local_true,&osm->lrestriction)PetscMallocA(1,PETSC_FALSE,360,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(osm->n_local_true)*sizeof(**(&osm->lrestriction )),(&osm->lrestriction));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),360,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
361 | ierr = PetscMalloc1(osm->n_local_true,&osm->x)PetscMallocA(1,PETSC_FALSE,361,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(osm->n_local_true)*sizeof(**(&osm->x)),(& osm->x));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),361,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
362 | ierr = PetscMalloc1(osm->n_local_true,&osm->y)PetscMallocA(1,PETSC_FALSE,362,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(osm->n_local_true)*sizeof(**(&osm->y)),(& osm->y));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),362,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
363 | |
364 | ierr = ISGetLocalSize(osm->lis,&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),364,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
365 | ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),m,0,1,&isl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),365,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
366 | ierr = VecScatterCreate(vec,osm->lis,osm->lx,isl,&osm->restriction);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),366,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
367 | ierr = ISDestroy(&isl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),367,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
368 | |
369 | |
370 | for (i=0; i<osm->n_local_true; ++i) { |
371 | ISLocalToGlobalMapping ltog; |
372 | IS isll; |
373 | const PetscInt *idx_is; |
374 | PetscInt *idx_lis,nout; |
375 | |
376 | ierr = ISGetLocalSize(osm->is[i],&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),376,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
377 | ierr = MatCreateVecs(osm->pmat[i],&osm->x[i],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),377,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
378 | ierr = VecDuplicate(osm->x[i],&osm->y[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),378,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
379 | |
380 | /* generate a scatter from ly to y[i] picking all the overlapping is[i] entries */ |
381 | ierr = ISLocalToGlobalMappingCreateIS(osm->lis,<og);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),381,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
382 | ierr = ISGetLocalSize(osm->is[i],&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),382,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
383 | ierr = ISGetIndices(osm->is[i], &idx_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),383,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
384 | ierr = PetscMalloc1(m,&idx_lis)PetscMallocA(1,PETSC_FALSE,384,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(m)*sizeof(**(&idx_lis)),(&idx_lis));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),384,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
385 | ierr = ISGlobalToLocalMappingApply(ltog,IS_GTOLM_DROP,m,idx_is,&nout,idx_lis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),385,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
386 | if (nout != m) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"is not a subset of lis")return PetscError(((MPI_Comm)0x44000001),386,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,77,PETSC_ERROR_INITIAL,"is not a subset of lis"); |
387 | ierr = ISRestoreIndices(osm->is[i], &idx_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),387,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
388 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),m,idx_lis,PETSC_OWN_POINTER,&isll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),388,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
389 | ierr = ISLocalToGlobalMappingDestroy(<og);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),389,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
390 | ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),m,0,1,&isl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),390,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
391 | ierr = VecScatterCreate(osm->ly,isll,osm->y[i],isl,&osm->lrestriction[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),391,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
392 | ierr = ISDestroy(&isll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),392,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
393 | ierr = ISDestroy(&isl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),393,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
394 | if (osm->lprolongation) { /* generate a scatter from y[i] to ly picking only the the non-overalapping is_local[i] entries */ |
395 | ISLocalToGlobalMapping ltog; |
396 | IS isll,isll_local; |
397 | const PetscInt *idx_local; |
398 | PetscInt *idx1, *idx2, nout; |
399 | |
400 | ierr = ISGetLocalSize(osm->is_local[i],&m_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),400,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
401 | ierr = ISGetIndices(osm->is_local[i], &idx_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),401,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
402 | |
403 | ierr = ISLocalToGlobalMappingCreateIS(osm->is[i],<og);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),403,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
404 | ierr = PetscMalloc1(m_local,&idx1)PetscMallocA(1,PETSC_FALSE,404,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(m_local)*sizeof(**(&idx1)),(&idx1));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),404,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
405 | ierr = ISGlobalToLocalMappingApply(ltog,IS_GTOLM_DROP,m_local,idx_local,&nout,idx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),405,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
406 | ierr = ISLocalToGlobalMappingDestroy(<og);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),406,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
407 | if (nout != m_local) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"is_local not a subset of is")return PetscError(((MPI_Comm)0x44000001),407,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,77,PETSC_ERROR_INITIAL,"is_local not a subset of is"); |
408 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),m_local,idx1,PETSC_OWN_POINTER,&isll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),408,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
409 | |
410 | ierr = ISLocalToGlobalMappingCreateIS(osm->lis,<og);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),410,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
411 | ierr = PetscMalloc1(m_local,&idx2)PetscMallocA(1,PETSC_FALSE,411,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(m_local)*sizeof(**(&idx2)),(&idx2));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),411,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
412 | ierr = ISGlobalToLocalMappingApply(ltog,IS_GTOLM_DROP,m_local,idx_local,&nout,idx2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),412,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
413 | ierr = ISLocalToGlobalMappingDestroy(<og);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),413,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
414 | if (nout != m_local) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"is_local not a subset of lis")return PetscError(((MPI_Comm)0x44000001),414,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,77,PETSC_ERROR_INITIAL,"is_local not a subset of lis"); |
415 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),m_local,idx2,PETSC_OWN_POINTER,&isll_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),415,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
416 | |
417 | ierr = ISRestoreIndices(osm->is_local[i], &idx_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),417,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
418 | ierr = VecScatterCreate(osm->y[i],isll,osm->ly,isll_local,&osm->lprolongation[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),418,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
419 | |
420 | ierr = ISDestroy(&isll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),420,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
421 | ierr = ISDestroy(&isll_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),421,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
422 | } |
423 | } |
424 | ierr = VecDestroy(&vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),424,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
425 | } |
426 | |
427 | if (osm->loctype == PC_COMPOSITE_MULTIPLICATIVE) { |
428 | IS *cis; |
429 | PetscInt c; |
430 | |
431 | ierr = PetscMalloc1(osm->n_local_true, &cis)PetscMallocA(1,PETSC_FALSE,431,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(osm->n_local_true)*sizeof(**(&cis)),(&cis ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),431,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
432 | for (c = 0; c < osm->n_local_true; ++c) cis[c] = osm->lis; |
433 | ierr = MatCreateSubMatrices(pc->pmat, osm->n_local_true, osm->is, cis, scall, &osm->lmats);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),433,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
434 | ierr = PetscFree(cis)((*PetscTrFree)((void*)(cis),434,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((cis) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),434,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
435 | } |
436 | |
437 | /* Return control to the user so that the submatrices can be modified (e.g., to apply |
438 | different boundary conditions for the submatrices than for the global problem) */ |
439 | ierr = PCModifySubMatrices(pc,osm->n_local_true,osm->is,osm->is,osm->pmat,pc->modifysubmatricesP);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),439,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
440 | |
441 | /* |
442 | Loop over subdomains putting them into local ksp |
443 | */ |
444 | for (i=0; i<osm->n_local_true; i++) { |
445 | ierr = KSPSetOperators(osm->ksp[i],osm->pmat[i],osm->pmat[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),445,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
446 | if (!pc->setupcalled) { |
447 | ierr = KSPSetFromOptions(osm->ksp[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),447,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
448 | } |
449 | } |
450 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
451 | } |
452 | |
453 | static PetscErrorCode PCSetUpOnBlocks_ASM(PC pc) |
454 | { |
455 | PC_ASM *osm = (PC_ASM*)pc->data; |
456 | PetscErrorCode ierr; |
457 | PetscInt i; |
458 | KSPConvergedReason reason; |
459 | |
460 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 460; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
461 | for (i=0; i<osm->n_local_true; i++) { |
462 | ierr = KSPSetUp(osm->ksp[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),462,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
463 | ierr = KSPGetConvergedReason(osm->ksp[i],&reason);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),463,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
464 | if (reason == KSP_DIVERGED_PC_FAILED) { |
465 | pc->failedreason = PC_SUBPC_ERROR; |
466 | } |
467 | } |
468 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
469 | } |
470 | |
471 | static PetscErrorCode PCApply_ASM(PC pc,Vec x,Vec y) |
472 | { |
473 | PC_ASM *osm = (PC_ASM*)pc->data; |
474 | PetscErrorCode ierr; |
475 | PetscInt i,n_local_true = osm->n_local_true; |
476 | ScatterMode forward = SCATTER_FORWARD,reverse = SCATTER_REVERSE; |
477 | |
478 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 478; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
479 | /* |
480 | Support for limiting the restriction or interpolation to only local |
481 | subdomain values (leaving the other values 0). |
482 | */ |
483 | if (!(osm->type & PC_ASM_RESTRICT)) { |
484 | forward = SCATTER_FORWARD_LOCAL; |
485 | /* have to zero the work RHS since scatter may leave some slots empty */ |
486 | ierr = VecSet(osm->lx, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),486,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
487 | } |
488 | if (!(osm->type & PC_ASM_INTERPOLATE)) { |
489 | reverse = SCATTER_REVERSE_LOCAL; |
490 | } |
491 | |
492 | if(osm->loctype == PC_COMPOSITE_MULTIPLICATIVE || osm->loctype == PC_COMPOSITE_ADDITIVE){ |
493 | /* zero the global and the local solutions */ |
494 | ierr = VecZeroEntries(y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),494,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
495 | ierr = VecSet(osm->ly, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),495,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
496 | |
497 | /* Copy the global RHS to local RHS including the ghost nodes */ |
498 | ierr = VecScatterBegin(osm->restriction, x, osm->lx, INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),498,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
499 | ierr = VecScatterEnd(osm->restriction, x, osm->lx, INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),499,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
500 | |
501 | /* Restrict local RHS to the overlapping 0-block RHS */ |
502 | ierr = VecScatterBegin(osm->lrestriction[0], osm->lx, osm->x[0], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),502,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
503 | ierr = VecScatterEnd(osm->lrestriction[0], osm->lx, osm->x[0], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),503,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
504 | |
505 | /* do the local solves */ |
506 | for (i = 0; i < n_local_true; ++i) { |
507 | |
508 | /* solve the overlapping i-block */ |
509 | ierr = PetscLogEventBegin(PC_ApplyOnBlocks,osm->ksp[i],osm->x[i],osm->y[i],0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_ApplyOnBlocks].active) ? (*PetscLogPLB)((PC_ApplyOnBlocks ),0,(PetscObject)(osm->ksp[i]),(PetscObject)(osm->x[i]) ,(PetscObject)(osm->y[i]),(PetscObject)(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),509,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
510 | ierr = KSPSolve(osm->ksp[i], osm->x[i], osm->y[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),510,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
511 | ierr = KSPCheckSolve(osm->ksp[i],pc,osm->y[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),511,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
512 | ierr = PetscLogEventEnd(PC_ApplyOnBlocks,osm->ksp[i],osm->x[i],osm->y[i],0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_ApplyOnBlocks].active) ? (*PetscLogPLE)((PC_ApplyOnBlocks ),0,(PetscObject)(osm->ksp[i]),(PetscObject)(osm->x[i]) ,(PetscObject)(osm->y[i]),(PetscObject)(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),512,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
513 | |
514 | if (osm->lprolongation) { /* interpolate the non-overalapping i-block solution to the local solution (only for restrictive additive) */ |
515 | ierr = VecScatterBegin(osm->lprolongation[i], osm->y[i], osm->ly, ADD_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),515,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
516 | ierr = VecScatterEnd(osm->lprolongation[i], osm->y[i], osm->ly, ADD_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),516,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
517 | } |
518 | else{ /* interpolate the overalapping i-block solution to the local solution */ |
519 | ierr = VecScatterBegin(osm->lrestriction[i], osm->y[i], osm->ly, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),519,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
520 | ierr = VecScatterEnd(osm->lrestriction[i], osm->y[i], osm->ly, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),520,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
521 | } |
522 | |
523 | if (i < n_local_true-1) { |
524 | /* Restrict local RHS to the overlapping (i+1)-block RHS */ |
525 | ierr = VecScatterBegin(osm->lrestriction[i+1], osm->lx, osm->x[i+1], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),525,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
526 | ierr = VecScatterEnd(osm->lrestriction[i+1], osm->lx, osm->x[i+1], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),526,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
527 | |
528 | if ( osm->loctype == PC_COMPOSITE_MULTIPLICATIVE){ |
529 | /* udpdate the overlapping (i+1)-block RHS using the current local solution */ |
530 | ierr = MatMult(osm->lmats[i+1], osm->ly, osm->y[i+1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),530,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
531 | ierr = VecAXPBY(osm->x[i+1],-1.,1., osm->y[i+1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),531,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
532 | } |
533 | } |
534 | } |
535 | /* Add the local solution to the global solution including the ghost nodes */ |
536 | ierr = VecScatterBegin(osm->restriction, osm->ly, y, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),536,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
537 | ierr = VecScatterEnd(osm->restriction, osm->ly, y, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),537,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
538 | }else{ |
539 | SETERRQ1(PetscObjectComm((PetscObject) pc), PETSC_ERR_ARG_WRONG, "Invalid local composition type: %s", PCCompositeTypes[osm->loctype])return PetscError(PetscObjectComm((PetscObject) pc),539,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Invalid local composition type: %s",PCCompositeTypes [osm->loctype]); |
540 | } |
541 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
542 | } |
543 | |
544 | /*@C |
545 | PCApplyMP_ASM - Each block returns one search directions (instead of just one direction for all blocks). |
546 | |
547 | Input Parameters: |
548 | pc - the preconditioner context |
549 | . x - the input vector (in general residual) |
550 | . |
551 | Output: |
552 | Y - the matrix gathering the search direction |
553 | |
554 | Options Database Key: |
555 | -pc_asm_use_kernel <num> : experimental taking account of (near)nullspace |
556 | 0 (default) : no support, 1 the nearnullspace contributes to one extra direction. |
557 | |
558 | Notes: |
559 | The treatment of redundant search directions is delegated to the multipreconditioned solver. |
560 | |
561 | Level: advanced |
562 | |
563 | .seealso: KSPMPCG, KSPMPOMIN |
564 | |
565 | @*/ |
566 | static PetscErrorCode PCApplyMP_ASM(PC pc, Vec x, Mat Z) |
567 | { |
568 | PC_ASM *osm = (PC_ASM*)pc->data; |
569 | PetscErrorCode ierr; |
570 | PetscInt i,j,n_local_true = osm->n_local_true,Vsize,VVsize; |
571 | PetscMPIInt rank,size; |
572 | ScatterMode forward = SCATTER_FORWARD,reverse = SCATTER_REVERSE; |
573 | const PetscInt *idcol,*idrows; |
574 | PetscScalar *Vvalues,*arrayS,dummy; |
575 | Vec y; |
576 | Vec multiplicity,locmultiplicity; |
577 | Mat Amat,Pmat,coarseR; |
578 | MatNullSpace nullsp; |
579 | PetscMPIInt *sd_by_pro, nn; |
580 | PetscInt start,end,first,k,total,thecol,nullspcol; |
581 | PetscInt VecGloSize,VecLocSize; |
582 | Mat_SeqDense *matU,*matVt,*matcoarseR; |
583 | Mat W,coarse_mat; |
584 | Vec rhs,rhs_R; |
585 | VecScatter vs; |
586 | IS glo_is; |
587 | PetscBLASInt info; |
588 | PetscBool has_cst ; |
589 | |
590 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 590; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
591 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)pc), &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),591,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
592 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)pc), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),592,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
593 | /* |
594 | Support for limiting the restriction or interpolation to only local |
595 | subdomain values (leaving the other values 0). |
596 | */ |
597 | if (!(osm->type & PC_ASM_RESTRICT)) { |
598 | forward = SCATTER_FORWARD_LOCAL; |
599 | /* have to zero the work RHS since scatter may leave some slots empty */ |
600 | ierr = VecSet(osm->lx, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),600,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
601 | } |
602 | if (!(osm->type & PC_ASM_INTERPOLATE)) { |
603 | reverse = SCATTER_REVERSE_LOCAL; |
604 | ierr = VecGetOwnershipRange(x, &start, &end);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),604,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
605 | Vsize = end-start; |
606 | } else { |
607 | ierr = VecGetLocalSize(osm->ly, &Vsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),607,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
608 | } |
609 | |
610 | /* |
611 | Reverse communication to inform the solver on how to allocate Z |
612 | First call to the method to intialize data |
613 | */ |
614 | ierr = MatGetSize(Z, &i, &j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),614,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
615 | if (i == 1 && j == 3) { |
616 | ierr = MatSetValue(Z, 0, 0, osm->n, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),616,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
617 | ierr = MatSetValue(Z, 0, 1, osm->n_local_true, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),617,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
618 | ierr = MatSetValue(Z, 0, 2, osm->use_kernel, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),618,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
619 | ierr = MatAssemblyBegin(Z, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),619,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
620 | ierr = MatAssemblyEnd(Z, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),620,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
621 | |
622 | ierr = PetscMalloc1(size, &sd_by_pro)PetscMallocA(1,PETSC_FALSE,622,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(size)*sizeof(**(&sd_by_pro)),(&sd_by_pro));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),622,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
623 | ierr = PetscMPIIntCast(osm->n_local_true, &nn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),623,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
624 | ierr = MPI_Allgather(&nn, 1, MPI_INT, sd_by_pro, 1, MPI_INT, PetscObjectComm((PetscObject)pc))((petsc_gather_ct += PetscMPIParallelComm((PetscObjectComm((PetscObject )pc))),0) || MPI_Allgather((&nn),(1),(((MPI_Datatype)0x4c000405 )),(sd_by_pro),(1),(((MPI_Datatype)0x4c000405)),(PetscObjectComm ((PetscObject)pc))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),624,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
625 | first=0; |
626 | for (k = 0; k < rank; ++k) { |
627 | first += sd_by_pro[k]; |
628 | } |
629 | total=first; |
630 | for (k = rank; k < size; ++k) { |
631 | total += sd_by_pro[k]; |
632 | } |
633 | ierr = ISCreateStride(PetscObjectComm((PetscObject)pc), osm->n_local_true, first, 1, &osm->sd_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),633,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
634 | ierr = VecGetOwnershipRange(x, &start, &end);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),634,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
635 | ierr = ISCreateStride(PetscObjectComm((PetscObject)pc), end-start, start, 1, &osm->is_restrict);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),635,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
636 | PetscFree(sd_by_pro)((*PetscTrFree)((void*)(sd_by_pro),636,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((sd_by_pro) = 0,0)); |
637 | |
638 | /* Preparation of second level if available */ |
639 | ierr = PCGetOperators(pc, &Amat, &Pmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),639,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
640 | ierr = MatGetNullSpace(Amat, &nullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),640,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
641 | if (!nullsp) { |
642 | ierr = MatGetNearNullSpace(Amat, &nullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),642,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
643 | } |
644 | if (nullsp) { |
645 | ierr = MatCreateVecs(Amat,&multiplicity,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),645,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
646 | const Vec *nullvecs ; |
647 | ierr = MatNullSpaceGetVecs(nullsp,&has_cst,&nullspcol,&nullvecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),647,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
648 | nullspcol += has_cst ; |
649 | |
650 | ierr = VecGetSize(multiplicity,&VecGloSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),650,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
651 | ierr = VecGetLocalSize(multiplicity,&VecLocSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),651,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
652 | ierr = MatCreateAIJ(PetscObjectComm((PetscObject)pc), VecLocSize, osm->n_local_true * nullspcol, VecGloSize, total*nullspcol, 0, NULL((void*)0), 0, NULL((void*)0), &osm->locnullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),652,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
653 | ierr = MatSetOption(osm->locnullsp, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),653,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
654 | ierr = ISGetIndices(osm->lis, &idrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),654,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
655 | ierr = VecGetLocalSize(osm->ly, &VVsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),655,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
656 | |
657 | ierr = VecDuplicate(x,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),657,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
658 | ierr = VecSet(y,1.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),658,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
659 | for (j = 0; j<nullspcol;++j){ |
660 | ierr = VecSet(osm->lx, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),660,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
661 | if (j<nullspcol-has_cst){ |
662 | ierr = VecScatterBegin(osm->restriction, nullvecs[j], osm->lx, INSERT_VALUES, SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),662,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
663 | ierr = VecScatterEnd(osm->restriction, nullvecs[j], osm->lx, INSERT_VALUES, SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),663,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
664 | } else { |
665 | ierr = VecScatterBegin(osm->restriction, y, osm->lx, INSERT_VALUES, SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),665,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
666 | ierr = VecScatterEnd(osm->restriction, y, osm->lx, INSERT_VALUES, SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),666,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
667 | } |
668 | for (k = 0; k<osm->n_local_true ; ++k) { |
669 | ierr = VecSet(osm->x[k], 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),669,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
670 | ierr = VecScatterBegin(osm->lrestriction[k], osm->lx, osm->x[k], INSERT_VALUES, SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),670,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
671 | ierr = VecScatterEnd(osm->lrestriction[k], osm->lx, osm->x[k], INSERT_VALUES, SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),671,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
672 | ierr = VecSet(osm->ly, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),672,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
673 | ierr = VecScatterBegin(osm->lrestriction[k], osm->x[k], osm->ly, INSERT_VALUES, SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),673,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
674 | ierr = VecScatterEnd(osm->lrestriction[k], osm->x[k], osm->ly, INSERT_VALUES, SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),674,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
675 | ierr = VecGetArray(osm->ly, &Vvalues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),675,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
676 | thecol = (first+k)*nullspcol +j ; |
677 | ierr = MatSetValues(osm->locnullsp, VVsize, idrows, 1, &thecol, Vvalues, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),677,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
678 | ierr = VecRestoreArray(osm->ly, &Vvalues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),678,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
679 | } |
680 | } |
681 | ierr = ISRestoreIndices(osm->lis, &idrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),681,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
682 | ierr = MatAssemblyBegin(osm->locnullsp, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),682,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
683 | ierr = MatAssemblyEnd(osm->locnullsp, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),683,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
684 | |
685 | ierr = VecDuplicate(osm->ly,&locmultiplicity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),685,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
686 | ierr = VecSet(locmultiplicity, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),686,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
687 | ierr = VecSet(multiplicity, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),687,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
688 | for (k = 0; k < osm->n_local_true; ++k) { |
689 | ierr = VecSet(osm->y[k],1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),689,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
690 | if (osm->lprolongation) { /* interpolate the non-overalapping i-block solution to the local solution (only for restrictive additive) */ |
691 | ierr = VecScatterBegin(osm->lprolongation[k], osm->y[k], locmultiplicity, ADD_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),691,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
692 | ierr = VecScatterEnd(osm->lprolongation[k], osm->y[k], locmultiplicity, ADD_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),692,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
693 | } |
694 | else { /* interpolate the overalapping i-block solution to the local solution */ |
695 | ierr = VecScatterBegin(osm->lrestriction[k], osm->y[k], locmultiplicity, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),695,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
696 | ierr = VecScatterEnd(osm->lrestriction[k], osm->y[k], locmultiplicity, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),696,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
697 | } |
698 | } |
699 | ierr = VecScatterBegin(osm->restriction, locmultiplicity, multiplicity, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),699,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
700 | ierr = VecScatterEnd(osm->restriction, locmultiplicity, multiplicity, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),700,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
701 | ierr = VecSet(y,1.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),701,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
702 | ierr = VecPointwiseDivide(multiplicity,y,multiplicity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),702,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
703 | ierr = MatDiagonalScale(osm->locnullsp,multiplicity,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),703,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
704 | |
705 | ierr = MatMatMult(Amat, osm->locnullsp, MAT_INITIAL_MATRIX, PETSC_DEFAULT-2, &W);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),705,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
706 | ierr = MatTransposeMatMult(osm->locnullsp, W, MAT_INITIAL_MATRIX, PETSC_DEFAULT-2, &coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),706,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
707 | |
708 | ierr = MatDestroy(&W);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),708,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
709 | ierr = VecDestroy(&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),709,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
710 | ierr = VecDestroy(&multiplicity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),710,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
711 | ierr = VecDestroy(&locmultiplicity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),711,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
712 | |
713 | ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001), total*nullspcol, total*nullspcol, NULL((void*)0), &osm->coarseU);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),713,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
714 | ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001), total*nullspcol, total*nullspcol, NULL((void*)0), &osm->coarseVt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),714,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
715 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001), total*nullspcol, &osm->coarseS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),715,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
716 | |
717 | ierr = MatCreateRedundantMatrix(coarse_mat, size, MPI_COMM_NULL((MPI_Comm)0x04000000), MAT_INITIAL_MATRIX, &coarseR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),717,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
718 | ierr = MatDestroy(&coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),718,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
719 | ierr = MatConvert(coarseR, MATSEQDENSE"seqdense", MAT_INPLACE_MATRIX, &coarseR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),719,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
720 | |
721 | matcoarseR = (Mat_SeqDense *)coarseR->data; |
722 | matU = (Mat_SeqDense *)osm->coarseU->data; |
723 | matVt = (Mat_SeqDense *)osm->coarseVt->data; |
724 | ierr = VecGetArray(osm->coarseS,&arrayS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),724,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
725 | |
726 | if (!matcoarseR->fwork) |
727 | { |
728 | matcoarseR->lfwork = -1; |
729 | PetscStackCallBLAS("LAPACKgesvd",LAPACKgesvd_("A","A",&nullspcol,&nullspcol,matcoarseR->v,&nullspcol,arrayS,matU->v,&nullspcol,matVt->v,&nullspcol, &dummy, &matcoarseR->lfwork, &info))do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "LAPACKgesvd"; petscstack->file[petscstack->currentsize ] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 729; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); dgesvd_("A","A",&nullspcol,&nullspcol,matcoarseR-> v,&nullspcol,arrayS,matU->v,&nullspcol,matVt->v ,&nullspcol, &dummy, &matcoarseR->lfwork, & info); do { do {PetscErrorCode _7_ierr = PetscMallocValidate( 729,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),729,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); |
730 | matcoarseR->lfwork = (PetscInt)PetscRealPart(dummy)(dummy); |
731 | ierr = PetscMalloc1(matcoarseR->lfwork, &matcoarseR->fwork)PetscMallocA(1,PETSC_FALSE,731,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(matcoarseR->lfwork)*sizeof(**(&matcoarseR-> fwork)),(&matcoarseR->fwork));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),731,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
732 | } |
733 | PetscStackCallBLAS("LAPACKgesvd",LAPACKgesvd_("A","A",&nullspcol,&nullspcol,matcoarseR->v,&nullspcol,arrayS,matU->v,&nullspcol,matVt->v,&nullspcol,matcoarseR->fwork, &matcoarseR->lfwork, &info))do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "LAPACKgesvd"; petscstack->file[petscstack->currentsize ] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 733; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); dgesvd_("A","A",&nullspcol,&nullspcol,matcoarseR-> v,&nullspcol,arrayS,matU->v,&nullspcol,matVt->v ,&nullspcol,matcoarseR->fwork, &matcoarseR->lfwork , &info); do { do {PetscErrorCode _7_ierr = PetscMallocValidate (733,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),733,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); |
734 | if (info < 0) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_MAT_CH_ZRPVT, "Bad parameter %D", (PetscInt)info - 1)return PetscError(((MPI_Comm)0x44000001),734,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,81,PETSC_ERROR_INITIAL,"Bad parameter %D",(PetscInt)info - 1 ); |
735 | |
736 | for (k=0;k<nullspcol;++k){ |
737 | if (arrayS[k]>osm->smallAbs) arrayS[k]=1/arrayS[k]; |
738 | else arrayS[k]=0.; |
739 | } |
740 | ierr = VecRestoreArray(osm->coarseS,&arrayS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),740,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
741 | ierr = MatDestroy(&coarseR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),741,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
742 | } |
743 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
744 | } |
745 | |
746 | ierr = ISGetIndices(osm->sd_is, &idcol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),746,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
747 | ierr = VecDuplicate(x,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),747,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
748 | |
749 | if (osm->type & PC_ASM_INTERPOLATE) { |
750 | ierr = ISGetIndices(osm->lis, &idrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),750,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
751 | } else { |
752 | ierr = ISGetIndices(osm->is_restrict, &idrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),752,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
753 | } |
754 | |
755 | /* zero the global and the local solutions */ |
756 | ierr = MatZeroEntries(Z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),756,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
757 | /* Copy the global RHS to local RHS including the ghost nodes */ |
758 | ierr = VecScatterBegin(osm->restriction, x, osm->lx, INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),758,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
759 | ierr = VecScatterEnd(osm->restriction, x, osm->lx, INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),759,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
760 | |
761 | /* Restrict local RHS to the overlapping 0-block RHS */ |
762 | ierr = VecScatterBegin(osm->lrestriction[0], osm->lx, osm->x[0], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),762,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
763 | ierr = VecScatterEnd(osm->lrestriction[0], osm->lx, osm->x[0], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),763,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
764 | |
765 | /* do the local solves */ |
766 | for (i = 0; i < n_local_true; ++i) { |
767 | ierr = VecSet(osm->ly, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),767,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
768 | /* solve the overlapping i-block */ |
769 | ierr = PetscLogEventBegin(PC_ApplyOnBlocks,osm->ksp[i],osm->x[i],osm->y[i],0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_ApplyOnBlocks].active) ? (*PetscLogPLB)((PC_ApplyOnBlocks ),0,(PetscObject)(osm->ksp[i]),(PetscObject)(osm->x[i]) ,(PetscObject)(osm->y[i]),(PetscObject)(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),769,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
770 | ierr = KSPSolve(osm->ksp[i], osm->x[i], osm->y[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),770,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
771 | ierr = PetscLogEventEnd(PC_ApplyOnBlocks,osm->ksp[i],osm->x[i],osm->y[i],0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_ApplyOnBlocks].active) ? (*PetscLogPLE)((PC_ApplyOnBlocks ),0,(PetscObject)(osm->ksp[i]),(PetscObject)(osm->x[i]) ,(PetscObject)(osm->y[i]),(PetscObject)(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),771,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
772 | if (osm->lprolongation) { /* interpolate the non-overalapping i-block solution to the local solution (only for restrictive additive) */ |
773 | ierr = VecScatterBegin(osm->lprolongation[i], osm->y[i], osm->ly, ADD_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),773,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
774 | ierr = VecScatterEnd(osm->lprolongation[i], osm->y[i], osm->ly, ADD_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),774,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
775 | } |
776 | else{ /* interpolate the overalapping i-block solution to the local solution */ |
777 | ierr = VecScatterBegin(osm->lrestriction[i], osm->y[i], osm->ly, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),777,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
778 | ierr = VecScatterEnd(osm->lrestriction[i], osm->y[i], osm->ly, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),778,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
779 | } |
780 | if (i < n_local_true-1) { |
781 | /* Restrict local RHS to the overlapping (i+1)-block RHS */ |
782 | ierr = VecScatterBegin(osm->lrestriction[i+1], osm->lx, osm->x[i+1], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),782,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
783 | ierr = VecScatterEnd(osm->lrestriction[i+1], osm->lx, osm->x[i+1], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),783,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
784 | } |
785 | |
786 | if (osm->type & PC_ASM_INTERPOLATE){ |
787 | ierr = VecGetArray(osm->ly, &Vvalues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),787,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
788 | ierr = MatSetValues(Z, Vsize, idrows, 1, &idcol[i], Vvalues, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),788,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
789 | ierr = VecRestoreArray(osm->ly, &Vvalues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),789,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
790 | } else { |
791 | ierr = VecZeroEntries(y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),791,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
792 | ierr = VecScatterBegin(osm->restriction, osm->ly, y, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),792,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
793 | ierr = VecScatterEnd(osm->restriction, osm->ly, y, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),793,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
794 | ierr = VecGetArray(y, &Vvalues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),794,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
795 | ierr = MatSetValues(Z, Vsize, idrows, 1, &idcol[i], Vvalues, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),795,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
796 | ierr = VecRestoreArray(y, &Vvalues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),796,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
797 | } |
798 | } |
799 | |
800 | if (osm->use_kernel>0) { |
801 | ierr = MatGetSize(osm->locnullsp,NULL((void*)0),&nullspcol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),801,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
802 | ierr = ISCreateStride(((PetscObject)x)->comm,nullspcol,0,1,&glo_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),802,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
803 | ierr = VecCreateMPI(((PetscObject)x)->comm, PETSC_DECIDE-1, nullspcol, &rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),803,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
804 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001), nullspcol, &rhs_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),804,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
805 | ierr = VecZeroEntries(rhs_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),805,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
806 | ierr = MatMultTranspose(osm->locnullsp,x,rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),806,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
807 | ierr = VecScatterCreate(rhs,glo_is,rhs_R,glo_is,&vs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),807,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
808 | ierr = ISDestroy(&glo_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),808,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
809 | ierr = VecScatterBegin(vs,rhs,rhs_R,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),809,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
810 | ierr = VecScatterEnd(vs,rhs,rhs_R,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),810,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
811 | |
812 | ierr = MatMultTranspose(osm->coarseU,rhs_R,rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),812,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
813 | ierr = VecPointwiseMult(rhs,osm->coarseS,rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),813,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
814 | ierr = MatMultTranspose(osm->coarseVt,rhs,rhs_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),814,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
815 | |
816 | ierr = VecZeroEntries(rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),816,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
817 | ierr = VecScatterBegin(vs,rhs_R,rhs,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),817,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
818 | ierr = VecScatterEnd(vs,rhs_R,rhs,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),818,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
819 | ierr = VecScatterDestroy(&vs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),819,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
820 | |
821 | ierr = MatMult(osm->locnullsp,rhs,y); |
Value stored to 'ierr' is never read | |
822 | ierr = VecDestroy(&rhs_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),822,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
823 | ierr = VecDestroy(&rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),823,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
824 | |
825 | ierr = VecGetArray(y, &Vvalues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),825,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
826 | ierr = MatSetValues(Z, Vsize, idrows, 1, &osm->n, Vvalues, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),826,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
827 | ierr = VecRestoreArray(y, &Vvalues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),827,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
828 | } |
829 | |
830 | ierr = ISRestoreIndices(osm->sd_is, &idcol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),830,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
831 | if (osm->type & PC_ASM_INTERPOLATE){ |
832 | ierr = ISRestoreIndices(osm->lis, &idrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),832,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
833 | } else { |
834 | ierr = ISRestoreIndices(osm->is_restrict, &idrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),834,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
835 | } |
836 | ierr = VecDestroy(&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),836,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
837 | |
838 | ierr = MatAssemblyBegin(Z, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),838,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
839 | ierr = MatAssemblyEnd(Z, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),839,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
840 | |
841 | |
842 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
843 | } |
844 | |
845 | static PetscErrorCode PCApplyTranspose_ASM(PC pc,Vec x,Vec y) |
846 | { |
847 | PC_ASM *osm = (PC_ASM*)pc->data; |
848 | PetscErrorCode ierr; |
849 | PetscInt i,n_local_true = osm->n_local_true; |
850 | ScatterMode forward = SCATTER_FORWARD,reverse = SCATTER_REVERSE; |
851 | |
852 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 852; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
853 | /* |
854 | Support for limiting the restriction or interpolation to only local |
855 | subdomain values (leaving the other values 0). |
856 | |
857 | Note: these are reversed from the PCApply_ASM() because we are applying the |
858 | transpose of the three terms |
859 | */ |
860 | |
861 | if (!(osm->type & PC_ASM_INTERPOLATE)) { |
862 | forward = SCATTER_FORWARD_LOCAL; |
863 | /* have to zero the work RHS since scatter may leave some slots empty */ |
864 | ierr = VecSet(osm->lx, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),864,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
865 | } |
866 | if (!(osm->type & PC_ASM_RESTRICT)) reverse = SCATTER_REVERSE_LOCAL; |
867 | |
868 | /* zero the global and the local solutions */ |
869 | ierr = VecZeroEntries(y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),869,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
870 | ierr = VecSet(osm->ly, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),870,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
871 | |
872 | /* Copy the global RHS to local RHS including the ghost nodes */ |
873 | ierr = VecScatterBegin(osm->restriction, x, osm->lx, INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),873,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
874 | ierr = VecScatterEnd(osm->restriction, x, osm->lx, INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),874,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
875 | |
876 | /* Restrict local RHS to the overlapping 0-block RHS */ |
877 | ierr = VecScatterBegin(osm->lrestriction[0], osm->lx, osm->x[0], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
878 | ierr = VecScatterEnd(osm->lrestriction[0], osm->lx, osm->x[0], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),878,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
879 | |
880 | /* do the local solves */ |
881 | for (i = 0; i < n_local_true; ++i) { |
882 | |
883 | /* solve the overlapping i-block */ |
884 | ierr = PetscLogEventBegin(PC_ApplyOnBlocks,osm->ksp[i],osm->x[i],osm->y[i],0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_ApplyOnBlocks].active) ? (*PetscLogPLB)((PC_ApplyOnBlocks ),0,(PetscObject)(osm->ksp[i]),(PetscObject)(osm->x[i]) ,(PetscObject)(osm->y[i]),(PetscObject)(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),884,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
885 | ierr = KSPSolveTranspose(osm->ksp[i], osm->x[i], osm->y[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),885,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
886 | ierr = KSPCheckSolve(osm->ksp[i],pc,osm->y[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),886,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
887 | ierr = PetscLogEventEnd(PC_ApplyOnBlocks,osm->ksp[i],osm->x[i],osm->y[i],0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_ApplyOnBlocks].active) ? (*PetscLogPLE)((PC_ApplyOnBlocks ),0,(PetscObject)(osm->ksp[i]),(PetscObject)(osm->x[i]) ,(PetscObject)(osm->y[i]),(PetscObject)(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),887,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
888 | |
889 | if (osm->lprolongation) { /* interpolate the non-overalapping i-block solution to the local solution */ |
890 | ierr = VecScatterBegin(osm->lprolongation[i], osm->y[i], osm->ly, ADD_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),890,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
891 | ierr = VecScatterEnd(osm->lprolongation[i], osm->y[i], osm->ly, ADD_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),891,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
892 | } |
893 | else{ /* interpolate the overalapping i-block solution to the local solution */ |
894 | ierr = VecScatterBegin(osm->lrestriction[i], osm->y[i], osm->ly, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),894,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
895 | ierr = VecScatterEnd(osm->lrestriction[i], osm->y[i], osm->ly, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),895,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
896 | } |
897 | |
898 | if (i < n_local_true-1) { |
899 | /* Restrict local RHS to the overlapping (i+1)-block RHS */ |
900 | ierr = VecScatterBegin(osm->lrestriction[i+1], osm->lx, osm->x[i+1], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),900,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
901 | ierr = VecScatterEnd(osm->lrestriction[i+1], osm->lx, osm->x[i+1], INSERT_VALUES, forward);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),901,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
902 | } |
903 | } |
904 | /* Add the local solution to the global solution including the ghost nodes */ |
905 | ierr = VecScatterBegin(osm->restriction, osm->ly, y, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),905,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
906 | ierr = VecScatterEnd(osm->restriction, osm->ly, y, ADD_VALUES, reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
907 | |
908 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
909 | |
910 | } |
911 | |
912 | static PetscErrorCode PCReset_ASM(PC pc) |
913 | { |
914 | PC_ASM *osm = (PC_ASM*)pc->data; |
915 | PetscErrorCode ierr; |
916 | PetscInt i; |
917 | |
918 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 918; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
919 | if (osm->ksp) { |
920 | for (i=0; i<osm->n_local_true; i++) { |
921 | ierr = KSPReset(osm->ksp[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),921,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
922 | } |
923 | } |
924 | if (osm->pmat) { |
925 | if (osm->n_local_true > 0) { |
926 | ierr = MatDestroySubMatrices(osm->n_local_true,&osm->pmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),926,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
927 | } |
928 | } |
929 | if (osm->lrestriction) { |
930 | ierr = VecScatterDestroy(&osm->restriction);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),930,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
931 | for (i=0; i<osm->n_local_true; i++) { |
932 | ierr = VecScatterDestroy(&osm->lrestriction[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),932,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
933 | if (osm->lprolongation) {ierr = VecScatterDestroy(&osm->lprolongation[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),933,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
934 | ierr = VecDestroy(&osm->x[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),934,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
935 | ierr = VecDestroy(&osm->y[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),935,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
936 | } |
937 | ierr = PetscFree(osm->lrestriction)((*PetscTrFree)((void*)(osm->lrestriction),937,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((osm->lrestriction) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),937,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
938 | if (osm->lprolongation) {ierr = PetscFree(osm->lprolongation)((*PetscTrFree)((void*)(osm->lprolongation),938,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((osm->lprolongation) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),938,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
939 | ierr = PetscFree(osm->x)((*PetscTrFree)((void*)(osm->x),939,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((osm->x) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),939,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
940 | ierr = PetscFree(osm->y)((*PetscTrFree)((void*)(osm->y),940,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((osm->y) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),940,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
941 | |
942 | } |
943 | ierr = PCASMDestroySubdomains(osm->n_local_true,osm->is,osm->is_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),943,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
944 | ierr = ISDestroy(&osm->lis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),944,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
945 | ierr = VecDestroy(&osm->lx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),945,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
946 | ierr = VecDestroy(&osm->ly);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),946,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
947 | if (osm->loctype == PC_COMPOSITE_MULTIPLICATIVE) { |
948 | ierr = MatDestroyMatrices(osm->n_local_true, &osm->lmats);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),948,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
949 | } |
950 | |
951 | ierr = PetscFree(osm->sub_mat_type)((*PetscTrFree)((void*)(osm->sub_mat_type),951,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((osm->sub_mat_type) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),951,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
952 | ierr = ISDestroy(&osm->sd_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),952,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
953 | |
954 | if (osm->is_restrict) {ierr=ISDestroy(&osm->is_restrict);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),954,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
955 | if (osm->locnullsp) {ierr=MatDestroy(&osm->locnullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),955,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
956 | if (osm->coarseU) {ierr=MatDestroy(&osm->coarseU);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),956,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
957 | if (osm->coarseVt) {ierr=MatDestroy(&osm->coarseVt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),957,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
958 | if (osm->coarseS) {ierr=VecDestroy(&osm->coarseS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),958,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
959 | |
960 | |
961 | osm->is = 0; |
962 | osm->is_local = 0; |
963 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
964 | } |
965 | |
966 | static PetscErrorCode PCDestroy_ASM(PC pc) |
967 | { |
968 | PC_ASM *osm = (PC_ASM*)pc->data; |
969 | PetscErrorCode ierr; |
970 | PetscInt i; |
971 | |
972 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 972; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
973 | ierr = PCReset_ASM(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),973,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
974 | if (osm->ksp) { |
975 | for (i=0; i<osm->n_local_true; i++) { |
976 | ierr = KSPDestroy(&osm->ksp[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),976,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
977 | } |
978 | ierr = PetscFree(osm->ksp)((*PetscTrFree)((void*)(osm->ksp),978,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((osm->ksp) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),978,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
979 | } |
980 | ierr = PetscFree(pc->data)((*PetscTrFree)((void*)(pc->data),980,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((pc->data) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),980,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
981 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
982 | } |
983 | |
984 | static PetscErrorCode PCSetFromOptions_ASM(PetscOptionItems *PetscOptionsObject,PC pc) |
985 | { |
986 | PC_ASM *osm = (PC_ASM*)pc->data; |
987 | PetscErrorCode ierr; |
988 | PetscInt blocks,ovl; |
989 | PetscBool symset,flg; |
990 | PCASMType asmtype; |
991 | PCCompositeType loctype; |
992 | char sub_mat_type[256]; |
993 | |
994 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 994; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
995 | /* set the type to symmetric if matrix is symmetric */ |
996 | if (!osm->type_set && pc->pmat) { |
997 | ierr = MatIsSymmetricKnown(pc->pmat,&symset,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),997,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
998 | if (symset && flg) osm->type = PC_ASM_BASIC; |
999 | } |
1000 | ierr = PetscOptionsHead(PetscOptionsObject,"Additive Schwarz options");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1000,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1001 | ierr = PetscOptionsBool("-pc_asm_dm_subdomains","Use DMCreateDomainDecomposition() to define subdomains","PCASMSetDMSubdomains",osm->dm_subdomains,&osm->dm_subdomains,&flg)PetscOptionsBool_Private(PetscOptionsObject,"-pc_asm_dm_subdomains" ,"Use DMCreateDomainDecomposition() to define subdomains","PCASMSetDMSubdomains" ,osm->dm_subdomains,&osm->dm_subdomains,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1001,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1002 | ierr = PetscOptionsInt("-pc_asm_blocks","Number of subdomains","PCASMSetTotalSubdomains",osm->n,&blocks,&flg)PetscOptionsInt_Private(PetscOptionsObject,"-pc_asm_blocks","Number of subdomains" ,"PCASMSetTotalSubdomains",osm->n,&blocks,&flg,(-2147483647 - 1),2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1002,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1003 | if (flg) { |
1004 | ierr = PCASMSetTotalSubdomains(pc,blocks,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1004,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1005 | osm->dm_subdomains = PETSC_FALSE; |
1006 | } |
1007 | ierr = PetscOptionsInt("-pc_asm_local_blocks","Number of local subdomains","PCASMSetLocalSubdomains",osm->n_local_true,&blocks,&flg)PetscOptionsInt_Private(PetscOptionsObject,"-pc_asm_local_blocks" ,"Number of local subdomains","PCASMSetLocalSubdomains",osm-> n_local_true,&blocks,&flg,(-2147483647 - 1),2147483647 );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1007,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1008 | if (flg) { |
1009 | ierr = PCASMSetLocalSubdomains(pc,blocks,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1009,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1010 | osm->dm_subdomains = PETSC_FALSE; |
1011 | } |
1012 | ierr = PetscOptionsInt("-pc_asm_overlap","Number of grid points overlap","PCASMSetOverlap",osm->overlap,&ovl,&flg)PetscOptionsInt_Private(PetscOptionsObject,"-pc_asm_overlap", "Number of grid points overlap","PCASMSetOverlap",osm->overlap ,&ovl,&flg,(-2147483647 - 1),2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1012,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1013 | if (flg) { |
1014 | ierr = PCASMSetOverlap(pc,ovl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1014,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1015 | osm->dm_subdomains = PETSC_FALSE; |
1016 | } |
1017 | osm->use_kernel = 0; |
1018 | ierr = PetscOptionsInt("-pc_asm_use_kernel","Variant of kernel handling with multipreconditioning","PCASM",osm->use_kernel,&osm->use_kernel,&flg)PetscOptionsInt_Private(PetscOptionsObject,"-pc_asm_use_kernel" ,"Variant of kernel handling with multipreconditioning","PCASM" ,osm->use_kernel,&osm->use_kernel,&flg,(-2147483647 - 1),2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1018,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);/* PG */ |
1019 | osm->smallAbs = 1.e-12; |
1020 | ierr = PetscOptionsScalar("-pc_asm_use_kernel_svd_trunc","Truncation in svd for kernel modes","PCASM",osm->smallAbs,&osm->smallAbs,&flg)PetscOptionsScalar_Private(PetscOptionsObject,"-pc_asm_use_kernel_svd_trunc" ,"Truncation in svd for kernel modes","PCASM",osm->smallAbs ,&osm->smallAbs,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1020,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);/* PG */ |
1021 | flg = PETSC_FALSE; |
1022 | ierr = PetscOptionsEnum("-pc_asm_type","Type of restriction/extension","PCASMSetType",PCASMTypes,(PetscEnum)osm->type,(PetscEnum*)&asmtype,&flg)PetscOptionsEnum_Private(PetscOptionsObject,"-pc_asm_type","Type of restriction/extension" ,"PCASMSetType",PCASMTypes,(PetscEnum)osm->type,(PetscEnum *)&asmtype,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1022,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1023 | if (flg) {ierr = PCASMSetType(pc,asmtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1023,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } |
1024 | flg = PETSC_FALSE; |
1025 | ierr = PetscOptionsEnum("-pc_asm_local_type","Type of local solver composition","PCASMSetLocalType",PCCompositeTypes,(PetscEnum)osm->loctype,(PetscEnum*)&loctype,&flg)PetscOptionsEnum_Private(PetscOptionsObject,"-pc_asm_local_type" ,"Type of local solver composition","PCASMSetLocalType",PCCompositeTypes ,(PetscEnum)osm->loctype,(PetscEnum*)&loctype,&flg );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1025,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1026 | if (flg) {ierr = PCASMSetLocalType(pc,loctype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1026,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } |
1027 | ierr = PetscOptionsFList("-pc_asm_sub_mat_type","Subsolve Matrix Type","PCASMSetSubMatType",MatList,NULL,sub_mat_type,256,&flg)PetscOptionsFList_Private(PetscOptionsObject,"-pc_asm_sub_mat_type" ,"Subsolve Matrix Type","PCASMSetSubMatType",MatList,((void*) 0),sub_mat_type,256,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1027,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1028 | if(flg){ |
1029 | ierr = PCASMSetSubMatType(pc,sub_mat_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1029,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1030 | } |
1031 | ierr = PetscOptionsTail()0; do {if (PetscOptionsObject->count != 1) do { do { ; if ( petscstack && petscstack->currentsize > 0) { petscstack ->currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0);} while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1031,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1032 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1033 | } |
1034 | |
1035 | /*------------------------------------------------------------------------------------*/ |
1036 | |
1037 | static PetscErrorCode PCASMSetLocalSubdomains_ASM(PC pc,PetscInt n,IS is[],IS is_local[]) |
1038 | { |
1039 | PC_ASM *osm = (PC_ASM*)pc->data; |
1040 | PetscErrorCode ierr; |
1041 | PetscInt i; |
1042 | |
1043 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1043; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1044 | if (n < 1) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Each process must have 1 or more blocks, n = %D",n)return PetscError(((MPI_Comm)0x44000001),1044,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,63,PETSC_ERROR_INITIAL,"Each process must have 1 or more blocks, n = %D" ,n); |
1045 | if (pc->setupcalled && (n != osm->n_local_true || is)) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_WRONGSTATE,"PCASMSetLocalSubdomains() should be called before calling PCSetUp().")return PetscError(PetscObjectComm((PetscObject)pc),1045,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",73 ,PETSC_ERROR_INITIAL,"PCASMSetLocalSubdomains() should be called before calling PCSetUp()." ); |
1046 | |
1047 | if (!pc->setupcalled) { |
1048 | if (is) { |
1049 | for (i=0; i<n; i++) {ierr = PetscObjectReference((PetscObject)is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1049,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
1050 | } |
1051 | if (is_local) { |
1052 | for (i=0; i<n; i++) {ierr = PetscObjectReference((PetscObject)is_local[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1052,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
1053 | } |
1054 | ierr = PCASMDestroySubdomains(osm->n_local_true,osm->is,osm->is_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1054,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1055 | |
1056 | osm->n_local_true = n; |
1057 | osm->is = 0; |
1058 | osm->is_local = 0; |
1059 | if (is) { |
1060 | ierr = PetscMalloc1(n,&osm->is)PetscMallocA(1,PETSC_FALSE,1060,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(n)*sizeof(**(&osm->is)),(&osm->is));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1060,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1061 | for (i=0; i<n; i++) osm->is[i] = is[i]; |
1062 | /* Flag indicating that the user has set overlapping subdomains so PCASM should not increase their size. */ |
1063 | osm->overlap = -1; |
1064 | } |
1065 | if (is_local) { |
1066 | ierr = PetscMalloc1(n,&osm->is_local)PetscMallocA(1,PETSC_FALSE,1066,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(n)*sizeof(**(&osm->is_local)),(&osm-> is_local));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1066,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1067 | for (i=0; i<n; i++) osm->is_local[i] = is_local[i]; |
1068 | if (!is) { |
1069 | ierr = PetscMalloc1(osm->n_local_true,&osm->is)PetscMallocA(1,PETSC_FALSE,1069,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(osm->n_local_true)*sizeof(**(&osm->is)),( &osm->is));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1069,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1070 | for (i=0; i<osm->n_local_true; i++) { |
1071 | if (osm->overlap > 0) { /* With positive overlap, osm->is[i] will be modified */ |
1072 | ierr = ISDuplicate(osm->is_local[i],&osm->is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1072,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1073 | ierr = ISCopy(osm->is_local[i],osm->is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1073,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1074 | } else { |
1075 | ierr = PetscObjectReference((PetscObject)osm->is_local[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1075,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1076 | osm->is[i] = osm->is_local[i]; |
1077 | } |
1078 | } |
1079 | } |
1080 | } |
1081 | } |
1082 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1083 | } |
1084 | |
1085 | static PetscErrorCode PCASMSetTotalSubdomains_ASM(PC pc,PetscInt N,IS *is,IS *is_local) |
1086 | { |
1087 | PC_ASM *osm = (PC_ASM*)pc->data; |
1088 | PetscErrorCode ierr; |
1089 | PetscMPIInt rank,size; |
1090 | PetscInt n; |
1091 | |
1092 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1092; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1093 | if (N < 1) SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_OUTOFRANGE,"Number of total blocks must be > 0, N = %D",N)return PetscError(PetscObjectComm((PetscObject)pc),1093,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",63 ,PETSC_ERROR_INITIAL,"Number of total blocks must be > 0, N = %D" ,N); |
1094 | if (is || is_local) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_SUP,"Use PCASMSetLocalSubdomains() to set specific index sets\n\they cannot be set globally yet.")return PetscError(PetscObjectComm((PetscObject)pc),1094,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",56 ,PETSC_ERROR_INITIAL,"Use PCASMSetLocalSubdomains() to set specific index sets\n\they cannot be set globally yet." ); |
1095 | |
1096 | /* |
1097 | Split the subdomains equally among all processors |
1098 | */ |
1099 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)pc),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1099,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1100 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)pc),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1100,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1101 | n = N/size + ((N % size) > rank); |
1102 | if (!n) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Process %d must have at least one block: total processors %d total blocks %D",(int)rank,(int)size,N)return PetscError(((MPI_Comm)0x44000001),1102,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,63,PETSC_ERROR_INITIAL,"Process %d must have at least one block: total processors %d total blocks %D" ,(int)rank,(int)size,N); |
1103 | if (pc->setupcalled && n != osm->n_local_true) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"PCASMSetTotalSubdomains() should be called before PCSetUp().")return PetscError(((MPI_Comm)0x44000001),1103,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,73,PETSC_ERROR_INITIAL,"PCASMSetTotalSubdomains() should be called before PCSetUp()." ); |
1104 | if (!pc->setupcalled) { |
1105 | ierr = PCASMDestroySubdomains(osm->n_local_true,osm->is,osm->is_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1105,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1106 | |
1107 | osm->n_local_true = n; |
1108 | osm->is = 0; |
1109 | osm->is_local = 0; |
1110 | } |
1111 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1112 | } |
1113 | |
1114 | static PetscErrorCode PCASMSetOverlap_ASM(PC pc,PetscInt ovl) |
1115 | { |
1116 | PC_ASM *osm = (PC_ASM*)pc->data; |
1117 | |
1118 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1118; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1119 | if (ovl < 0) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_OUTOFRANGE,"Negative overlap value requested")return PetscError(PetscObjectComm((PetscObject)pc),1119,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",63 ,PETSC_ERROR_INITIAL,"Negative overlap value requested"); |
1120 | if (pc->setupcalled && ovl != osm->overlap) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_WRONGSTATE,"PCASMSetOverlap() should be called before PCSetUp().")return PetscError(PetscObjectComm((PetscObject)pc),1120,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",73 ,PETSC_ERROR_INITIAL,"PCASMSetOverlap() should be called before PCSetUp()." ); |
1121 | if (!pc->setupcalled) osm->overlap = ovl; |
1122 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1123 | } |
1124 | |
1125 | static PetscErrorCode PCASMSetType_ASM(PC pc,PCASMType type) |
1126 | { |
1127 | PC_ASM *osm = (PC_ASM*)pc->data; |
1128 | |
1129 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1129; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1130 | osm->type = type; |
1131 | osm->type_set = PETSC_TRUE; |
1132 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1133 | } |
1134 | |
1135 | static PetscErrorCode PCASMGetType_ASM(PC pc,PCASMType *type) |
1136 | { |
1137 | PC_ASM *osm = (PC_ASM*)pc->data; |
1138 | |
1139 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1139; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1140 | *type = osm->type; |
1141 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1142 | } |
1143 | |
1144 | static PetscErrorCode PCASMSetLocalType_ASM(PC pc, PCCompositeType type) |
1145 | { |
1146 | PC_ASM *osm = (PC_ASM *) pc->data; |
1147 | |
1148 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1148; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1149 | if (type != PC_COMPOSITE_ADDITIVE && type != PC_COMPOSITE_MULTIPLICATIVE) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_SUP,"Only supports additive or multiplicative as the local type")return PetscError(PetscObjectComm((PetscObject)pc),1149,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",56 ,PETSC_ERROR_INITIAL,"Only supports additive or multiplicative as the local type" ); |
1150 | osm->loctype = type; |
1151 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1152 | } |
1153 | |
1154 | static PetscErrorCode PCASMGetLocalType_ASM(PC pc, PCCompositeType *type) |
1155 | { |
1156 | PC_ASM *osm = (PC_ASM *) pc->data; |
1157 | |
1158 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1158; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1159 | *type = osm->loctype; |
1160 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1161 | } |
1162 | |
1163 | static PetscErrorCode PCASMSetSortIndices_ASM(PC pc,PetscBool doSort) |
1164 | { |
1165 | PC_ASM *osm = (PC_ASM*)pc->data; |
1166 | |
1167 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1167; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1168 | osm->sort_indices = doSort; |
1169 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1170 | } |
1171 | |
1172 | static PetscErrorCode PCASMGetSubKSP_ASM(PC pc,PetscInt *n_local,PetscInt *first_local,KSP **ksp) |
1173 | { |
1174 | PC_ASM *osm = (PC_ASM*)pc->data; |
1175 | PetscErrorCode ierr; |
1176 | |
1177 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1177; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1178 | if (osm->n_local_true < 1) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_ORDER,"Need to call PCSetUP() on PC (or KSPSetUp() on the outer KSP object) before calling here")return PetscError(PetscObjectComm((PetscObject)pc),1178,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",58 ,PETSC_ERROR_INITIAL,"Need to call PCSetUP() on PC (or KSPSetUp() on the outer KSP object) before calling here" ); |
1179 | |
1180 | if (n_local) *n_local = osm->n_local_true; |
1181 | if (first_local) { |
1182 | ierr = MPI_Scan(&osm->n_local_true,first_local,1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_SUM(MPI_Op)(0x58000003),PetscObjectComm((PetscObject)pc));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1182,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1183 | *first_local -= osm->n_local_true; |
1184 | } |
1185 | if (ksp) { |
1186 | /* Assume that local solves are now different; not necessarily |
1187 | true though! This flag is used only for PCView_ASM() */ |
1188 | *ksp = osm->ksp; |
1189 | osm->same_local_solves = PETSC_FALSE; |
1190 | } |
1191 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1192 | } |
1193 | |
1194 | static PetscErrorCode PCASMGetSubMatType_ASM(PC pc,MatType *sub_mat_type) |
1195 | { |
1196 | PC_ASM *osm = (PC_ASM*)pc->data; |
1197 | |
1198 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1198; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1199 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1199,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1199 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1199,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1199,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1200 | PetscValidPointer(sub_mat_type,2)do { if (!sub_mat_type) return PetscError(((MPI_Comm)0x44000001 ),1200,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(sub_mat_type,PETSC_CHAR)) return PetscError (((MPI_Comm)0x44000001),1200,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); |
1201 | *sub_mat_type = osm->sub_mat_type; |
1202 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1203 | } |
1204 | |
1205 | static PetscErrorCode PCASMSetSubMatType_ASM(PC pc,MatType sub_mat_type) |
1206 | { |
1207 | PetscErrorCode ierr; |
1208 | PC_ASM *osm = (PC_ASM*)pc->data; |
1209 | |
1210 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1210; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1211 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1211,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1211 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1211,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1211,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1212 | ierr = PetscFree(osm->sub_mat_type)((*PetscTrFree)((void*)(osm->sub_mat_type),1212,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((osm->sub_mat_type) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1212,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1213 | ierr = PetscStrallocpy(sub_mat_type,(char**)&osm->sub_mat_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1213,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1214 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1215 | } |
1216 | |
1217 | /*@C |
1218 | PCASMSetLocalSubdomains - Sets the local subdomains (for this processor only) for the additive Schwarz preconditioner. |
1219 | |
1220 | Collective on pc |
1221 | |
1222 | Input Parameters: |
1223 | + pc - the preconditioner context |
1224 | . n - the number of subdomains for this processor (default value = 1) |
1225 | . is - the index set that defines the subdomains for this processor |
1226 | (or NULL for PETSc to determine subdomains) |
1227 | - is_local - the index sets that define the local part of the subdomains for this processor, not used unless PCASMType is PC_ASM_RESTRICT |
1228 | (or NULL to not provide these) |
1229 | |
1230 | Options Database Key: |
1231 | To set the total number of subdomain blocks rather than specify the |
1232 | index sets, use the option |
1233 | . -pc_asm_local_blocks <blks> - Sets local blocks |
1234 | |
1235 | Notes: |
1236 | The IS numbering is in the parallel, global numbering of the vector for both is and is_local |
1237 | |
1238 | By default the ASM preconditioner uses 1 block per processor. |
1239 | |
1240 | Use PCASMSetTotalSubdomains() to set the subdomains for all processors. |
1241 | |
1242 | If is_local is provided and PCASMType is PC_ASM_RESTRICT then the solution only over the is_local region is interpolated |
1243 | back to form the global solution (this is the standard restricted additive Schwarz method) |
1244 | |
1245 | If the is_local is provided and PCASMType is PC_ASM_INTERPOLATE or PC_ASM_NONE then an error is generated since there is |
1246 | no code to handle that case. |
1247 | |
1248 | Level: advanced |
1249 | |
1250 | .seealso: PCASMSetTotalSubdomains(), PCASMSetOverlap(), PCASMGetSubKSP(), |
1251 | PCASMCreateSubdomains2D(), PCASMGetLocalSubdomains(), PCASMType, PCASMSetType() |
1252 | @*/ |
1253 | PetscErrorCode PCASMSetLocalSubdomains(PC pc,PetscInt n,IS is[],IS is_local[]) |
1254 | { |
1255 | PetscErrorCode ierr; |
1256 | |
1257 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1257; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1258 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1258,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1258 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1258,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1258,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1259 | ierr = PetscTryMethod(pc,"PCASMSetLocalSubdomains_C",(PC,PetscInt,IS[],IS[]),(pc,n,is,is_local))0; do { PetscErrorCode (*f)(PC,PetscInt,IS[],IS[]), __ierr; __ierr = PetscObjectQueryFunction_Private(((PetscObject)pc),("PCASMSetLocalSubdomains_C" ),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr ),0)) return PetscError(((MPI_Comm)0x44000001),1259,__func__, "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",__ierr ,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(pc ,n,is,is_local);do {if (__builtin_expect(!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),1259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1260 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1261 | } |
1262 | |
1263 | /*@C |
1264 | PCASMSetTotalSubdomains - Sets the subdomains for all processors for the |
1265 | additive Schwarz preconditioner. Either all or no processors in the |
1266 | PC communicator must call this routine, with the same index sets. |
1267 | |
1268 | Collective on pc |
1269 | |
1270 | Input Parameters: |
1271 | + pc - the preconditioner context |
1272 | . N - the number of subdomains for all processors |
1273 | . is - the index sets that define the subdomains for all processors |
1274 | (or NULL to ask PETSc to determine the subdomains) |
1275 | - is_local - the index sets that define the local part of the subdomains for this processor |
1276 | (or NULL to not provide this information) |
1277 | |
1278 | Options Database Key: |
1279 | To set the total number of subdomain blocks rather than specify the |
1280 | index sets, use the option |
1281 | . -pc_asm_blocks <blks> - Sets total blocks |
1282 | |
1283 | Notes: |
1284 | Currently you cannot use this to set the actual subdomains with the argument is or is_local. |
1285 | |
1286 | By default the ASM preconditioner uses 1 block per processor. |
1287 | |
1288 | These index sets cannot be destroyed until after completion of the |
1289 | linear solves for which the ASM preconditioner is being used. |
1290 | |
1291 | Use PCASMSetLocalSubdomains() to set local subdomains. |
1292 | |
1293 | The IS numbering is in the parallel, global numbering of the vector for both is and is_local |
1294 | |
1295 | Level: advanced |
1296 | |
1297 | .seealso: PCASMSetLocalSubdomains(), PCASMSetOverlap(), PCASMGetSubKSP(), |
1298 | PCASMCreateSubdomains2D() |
1299 | @*/ |
1300 | PetscErrorCode PCASMSetTotalSubdomains(PC pc,PetscInt N,IS is[],IS is_local[]) |
1301 | { |
1302 | PetscErrorCode ierr; |
1303 | |
1304 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1304; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1305 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1305,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1305 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1305,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1305,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1306 | ierr = PetscTryMethod(pc,"PCASMSetTotalSubdomains_C",(PC,PetscInt,IS[],IS[]),(pc,N,is,is_local))0; do { PetscErrorCode (*f)(PC,PetscInt,IS[],IS[]), __ierr; __ierr = PetscObjectQueryFunction_Private(((PetscObject)pc),("PCASMSetTotalSubdomains_C" ),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr ),0)) return PetscError(((MPI_Comm)0x44000001),1306,__func__, "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",__ierr ,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(pc ,N,is,is_local);do {if (__builtin_expect(!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),1306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1307 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1308 | } |
1309 | |
1310 | /*@ |
1311 | PCASMSetOverlap - Sets the overlap between a pair of subdomains for the |
1312 | additive Schwarz preconditioner. Either all or no processors in the |
1313 | PC communicator must call this routine. |
1314 | |
1315 | Logically Collective on pc |
1316 | |
1317 | Input Parameters: |
1318 | + pc - the preconditioner context |
1319 | - ovl - the amount of overlap between subdomains (ovl >= 0, default value = 1) |
1320 | |
1321 | Options Database Key: |
1322 | . -pc_asm_overlap <ovl> - Sets overlap |
1323 | |
1324 | Notes: |
1325 | By default the ASM preconditioner uses 1 block per processor. To use |
1326 | multiple blocks per perocessor, see PCASMSetTotalSubdomains() and |
1327 | PCASMSetLocalSubdomains() (and the option -pc_asm_blocks <blks>). |
1328 | |
1329 | The overlap defaults to 1, so if one desires that no additional |
1330 | overlap be computed beyond what may have been set with a call to |
1331 | PCASMSetTotalSubdomains() or PCASMSetLocalSubdomains(), then ovl |
1332 | must be set to be 0. In particular, if one does not explicitly set |
1333 | the subdomains an application code, then all overlap would be computed |
1334 | internally by PETSc, and using an overlap of 0 would result in an ASM |
1335 | variant that is equivalent to the block Jacobi preconditioner. |
1336 | |
1337 | The default algorithm used by PETSc to increase overlap is fast, but not scalable, |
1338 | use the option -mat_increase_overlap_scalable when the problem and number of processes is large. |
1339 | |
1340 | Note that one can define initial index sets with any overlap via |
1341 | PCASMSetLocalSubdomains(); the routine |
1342 | PCASMSetOverlap() merely allows PETSc to extend that overlap further |
1343 | if desired. |
1344 | |
1345 | Level: intermediate |
1346 | |
1347 | .seealso: PCASMSetTotalSubdomains(), PCASMSetLocalSubdomains(), PCASMGetSubKSP(), |
1348 | PCASMCreateSubdomains2D(), PCASMGetLocalSubdomains(), MatIncreaseOverlap() |
1349 | @*/ |
1350 | PetscErrorCode PCASMSetOverlap(PC pc,PetscInt ovl) |
1351 | { |
1352 | PetscErrorCode ierr; |
1353 | |
1354 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1354; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1355 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1355,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1355 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1355,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1355,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1356 | PetscValidLogicalCollectiveInt(pc,ovl,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -ovl ; b1[1] = ovl; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm ((PetscObject)pc),2,1356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)pc))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype )0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject )pc)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),1356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2 [1]) return PetscError(PetscObjectComm((PetscObject)pc),1356, __func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d" ,2); } while (0); |
1357 | ierr = PetscTryMethod(pc,"PCASMSetOverlap_C",(PC,PetscInt),(pc,ovl))0; do { PetscErrorCode (*f)(PC,PetscInt), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)pc),("PCASMSetOverlap_C"),(PetscVoidFunction*) (&f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),1357,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(pc,ovl);do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),1357,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1357,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1358 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1359 | } |
1360 | |
1361 | /*@ |
1362 | PCASMSetType - Sets the type of restriction and interpolation used |
1363 | for local problems in the additive Schwarz method. |
1364 | |
1365 | Logically Collective on pc |
1366 | |
1367 | Input Parameters: |
1368 | + pc - the preconditioner context |
1369 | - type - variant of ASM, one of |
1370 | .vb |
1371 | PC_ASM_BASIC - full interpolation and restriction |
1372 | PC_ASM_RESTRICT - full restriction, local processor interpolation |
1373 | PC_ASM_INTERPOLATE - full interpolation, local processor restriction |
1374 | PC_ASM_NONE - local processor restriction and interpolation |
1375 | .ve |
1376 | |
1377 | Options Database Key: |
1378 | . -pc_asm_type [basic,restrict,interpolate,none] - Sets ASM type |
1379 | |
1380 | Notes: |
1381 | if the is_local arguments are passed to PCASMSetLocalSubdomains() then they are used when PC_ASM_RESTRICT has been selected |
1382 | to limit the local processor interpolation |
1383 | |
1384 | Level: intermediate |
1385 | |
1386 | .seealso: PCASMSetTotalSubdomains(), PCASMSetTotalSubdomains(), PCASMGetSubKSP(), |
1387 | PCASMCreateSubdomains2D(), PCASMType, PCASMSetLocalType(), PCASMGetLocalType() |
1388 | @*/ |
1389 | PetscErrorCode PCASMSetType(PC pc,PCASMType type) |
1390 | { |
1391 | PetscErrorCode ierr; |
1392 | |
1393 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1393; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1394 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1394,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1394 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1394,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1394,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1395 | PetscValidLogicalCollectiveEnum(pc,type,2)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] = -(PetscMPIInt)type; b1[1] = (PetscMPIInt)type; _7_ierr = (PetscAllreduceBarrierCheck (PetscObjectComm((PetscObject)pc),2,1395,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)pc))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype )0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject )pc)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),1395,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2 [1]) return PetscError(PetscObjectComm((PetscObject)pc),1395, __func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,62,PETSC_ERROR_INITIAL,"Enum value must be same on all processes, argument # %d" ,2); } while (0); |
1396 | ierr = PetscTryMethod(pc,"PCASMSetType_C",(PC,PCASMType),(pc,type))0; do { PetscErrorCode (*f)(PC,PCASMType), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)pc),("PCASMSetType_C"),(PetscVoidFunction*)(& f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),1396,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(pc,type);do {if (__builtin_expect(!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),1396,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1396,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1397 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1398 | } |
1399 | |
1400 | /*@ |
1401 | PCASMGetType - Gets the type of restriction and interpolation used |
1402 | for local problems in the additive Schwarz method. |
1403 | |
1404 | Logically Collective on pc |
1405 | |
1406 | Input Parameter: |
1407 | . pc - the preconditioner context |
1408 | |
1409 | Output Parameter: |
1410 | . type - variant of ASM, one of |
1411 | |
1412 | .vb |
1413 | PC_ASM_BASIC - full interpolation and restriction |
1414 | PC_ASM_RESTRICT - full restriction, local processor interpolation |
1415 | PC_ASM_INTERPOLATE - full interpolation, local processor restriction |
1416 | PC_ASM_NONE - local processor restriction and interpolation |
1417 | .ve |
1418 | |
1419 | Options Database Key: |
1420 | . -pc_asm_type [basic,restrict,interpolate,none] - Sets ASM type |
1421 | |
1422 | Level: intermediate |
1423 | |
1424 | .seealso: PCASMSetTotalSubdomains(), PCASMSetTotalSubdomains(), PCASMGetSubKSP(), |
1425 | PCASMCreateSubdomains2D(), PCASMType, PCASMSetType(), PCASMSetLocalType(), PCASMGetLocalType() |
1426 | @*/ |
1427 | PetscErrorCode PCASMGetType(PC pc,PCASMType *type) |
1428 | { |
1429 | PetscErrorCode ierr; |
1430 | |
1431 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1431; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1432 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1432,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1432 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1432,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1432,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1433 | ierr = PetscUseMethod(pc,"PCASMGetType_C",(PC,PCASMType*),(pc,type))0; do { PetscErrorCode (*f)(PC,PCASMType*), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)pc),("PCASMGetType_C"),(PetscVoidFunction*)(& f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),1433,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(pc,type);do {if (__builtin_expect(!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),1433,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} else return PetscError (PetscObjectComm((PetscObject)pc),1433,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object" ,"PCASMGetType_C"); } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1433,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1434 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1435 | } |
1436 | |
1437 | /*@ |
1438 | PCASMSetLocalType - Sets the type of composition used for local problems in the additive Schwarz method. |
1439 | |
1440 | Logically Collective on pc |
1441 | |
1442 | Input Parameters: |
1443 | + pc - the preconditioner context |
1444 | - type - type of composition, one of |
1445 | .vb |
1446 | PC_COMPOSITE_ADDITIVE - local additive combination |
1447 | PC_COMPOSITE_MULTIPLICATIVE - local multiplicative combination |
1448 | .ve |
1449 | |
1450 | Options Database Key: |
1451 | . -pc_asm_local_type [additive,multiplicative] - Sets local solver composition type |
1452 | |
1453 | Level: intermediate |
1454 | |
1455 | .seealso: PCASMSetType(), PCASMGetType(), PCASMGetLocalType(), PCASM, PCASMType, PCASMSetType(), PCASMGetType(), PCCompositeType |
1456 | @*/ |
1457 | PetscErrorCode PCASMSetLocalType(PC pc, PCCompositeType type) |
1458 | { |
1459 | PetscErrorCode ierr; |
1460 | |
1461 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1461; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1462 | PetscValidHeaderSpecific(pc, PC_CLASSID, 1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1462,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1462 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1462,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1462,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1463 | PetscValidLogicalCollectiveEnum(pc, type, 2)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] = -(PetscMPIInt)type; b1[1] = (PetscMPIInt)type; _7_ierr = (PetscAllreduceBarrierCheck (PetscObjectComm((PetscObject)pc),2,1463,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)pc))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype )0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject )pc)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),1463,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2 [1]) return PetscError(PetscObjectComm((PetscObject)pc),1463, __func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,62,PETSC_ERROR_INITIAL,"Enum value must be same on all processes, argument # %d" ,2); } while (0); |
1464 | ierr = PetscTryMethod(pc, "PCASMSetLocalType_C", (PC, PCCompositeType), (pc, type))0; do { PetscErrorCode (*f)(PC, PCCompositeType), __ierr; __ierr = PetscObjectQueryFunction_Private(((PetscObject)pc),("PCASMSetLocalType_C" ),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr ),0)) return PetscError(((MPI_Comm)0x44000001),1464,__func__, "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",__ierr ,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(pc , type);do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),1464,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1464,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1465 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1466 | } |
1467 | |
1468 | /*@ |
1469 | PCASMGetLocalType - Gets the type of composition used for local problems in the additive Schwarz method. |
1470 | |
1471 | Logically Collective on pc |
1472 | |
1473 | Input Parameter: |
1474 | . pc - the preconditioner context |
1475 | |
1476 | Output Parameter: |
1477 | . type - type of composition, one of |
1478 | .vb |
1479 | PC_COMPOSITE_ADDITIVE - local additive combination |
1480 | PC_COMPOSITE_MULTIPLICATIVE - local multiplicative combination |
1481 | .ve |
1482 | |
1483 | Options Database Key: |
1484 | . -pc_asm_local_type [additive,multiplicative] - Sets local solver composition type |
1485 | |
1486 | Level: intermediate |
1487 | |
1488 | .seealso: PCASMSetType(), PCASMGetType(), PCASMSetLocalType(), PCASMCreate(), PCASMType, PCASMSetType(), PCASMGetType(), PCCompositeType |
1489 | @*/ |
1490 | PetscErrorCode PCASMGetLocalType(PC pc, PCCompositeType *type) |
1491 | { |
1492 | PetscErrorCode ierr; |
1493 | |
1494 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1494; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1495 | PetscValidHeaderSpecific(pc, PC_CLASSID, 1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1495,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1495 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1495,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1495,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1496 | PetscValidPointer(type, 2)do { if (!type) return PetscError(((MPI_Comm)0x44000001),1496 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(type,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),1496,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); |
1497 | ierr = PetscUseMethod(pc, "PCASMGetLocalType_C", (PC, PCCompositeType *), (pc, type))0; do { PetscErrorCode (*f)(PC, PCCompositeType *), __ierr; __ierr = PetscObjectQueryFunction_Private(((PetscObject)pc),("PCASMGetLocalType_C" ),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr ),0)) return PetscError(((MPI_Comm)0x44000001),1497,__func__, "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",__ierr ,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(pc , type);do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),1497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} else return PetscError (PetscObjectComm((PetscObject)pc),1497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object" ,"PCASMGetLocalType_C"); } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1498 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1499 | } |
1500 | |
1501 | /*@ |
1502 | PCASMSetSortIndices - Determines whether subdomain indices are sorted. |
1503 | |
1504 | Logically Collective on pc |
1505 | |
1506 | Input Parameters: |
1507 | + pc - the preconditioner context |
1508 | - doSort - sort the subdomain indices |
1509 | |
1510 | Level: intermediate |
1511 | |
1512 | .seealso: PCASMSetLocalSubdomains(), PCASMSetTotalSubdomains(), PCASMGetSubKSP(), |
1513 | PCASMCreateSubdomains2D() |
1514 | @*/ |
1515 | PetscErrorCode PCASMSetSortIndices(PC pc,PetscBool doSort) |
1516 | { |
1517 | PetscErrorCode ierr; |
1518 | |
1519 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1519; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1520 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1520,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1520 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1520,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1520,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1521 | PetscValidLogicalCollectiveBool(pc,doSort,2)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] = -(PetscMPIInt)doSort; b1[1] = (PetscMPIInt)doSort; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc) ,2,1521,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)pc))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype )0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject )pc)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),1521,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2 [1]) return PetscError(PetscObjectComm((PetscObject)pc),1521, __func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d" ,2); } while (0); |
1522 | ierr = PetscTryMethod(pc,"PCASMSetSortIndices_C",(PC,PetscBool),(pc,doSort))0; do { PetscErrorCode (*f)(PC,PetscBool), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)pc),("PCASMSetSortIndices_C"),(PetscVoidFunction *)(&f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),1522,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(pc,doSort);do {if (__builtin_expect(!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),1522,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1522,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1523 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1524 | } |
1525 | |
1526 | /*@C |
1527 | PCASMGetSubKSP - Gets the local KSP contexts for all blocks on |
1528 | this processor. |
1529 | |
1530 | Collective on pc iff first_local is requested |
1531 | |
1532 | Input Parameter: |
1533 | . pc - the preconditioner context |
1534 | |
1535 | Output Parameters: |
1536 | + n_local - the number of blocks on this processor or NULL |
1537 | . first_local - the global number of the first block on this processor or NULL, |
1538 | all processors must request or all must pass NULL |
1539 | - ksp - the array of KSP contexts |
1540 | |
1541 | Note: |
1542 | After PCASMGetSubKSP() the array of KSPes is not to be freed. |
1543 | |
1544 | You must call KSPSetUp() before calling PCASMGetSubKSP(). |
1545 | |
1546 | Fortran note: |
1547 | The output argument 'ksp' must be an array of sufficient length or PETSC_NULL_KSP. The latter can be used to learn the necessary length. |
1548 | |
1549 | Level: advanced |
1550 | |
1551 | .seealso: PCASMSetTotalSubdomains(), PCASMSetTotalSubdomains(), PCASMSetOverlap(), |
1552 | PCASMCreateSubdomains2D(), |
1553 | @*/ |
1554 | PetscErrorCode PCASMGetSubKSP(PC pc,PetscInt *n_local,PetscInt *first_local,KSP *ksp[]) |
1555 | { |
1556 | PetscErrorCode ierr; |
1557 | |
1558 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1558; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1559 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1559,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1559 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1559,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1559,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1560 | ierr = PetscUseMethod(pc,"PCASMGetSubKSP_C",(PC,PetscInt*,PetscInt*,KSP **),(pc,n_local,first_local,ksp))0; do { PetscErrorCode (*f)(PC,PetscInt*,PetscInt*,KSP **), __ierr ; __ierr = PetscObjectQueryFunction_Private(((PetscObject)pc) ,("PCASMGetSubKSP_C"),(PetscVoidFunction*)(&f));do {if (__builtin_expect (!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),1560 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(pc,n_local,first_local,ksp);do {if (__builtin_expect(!! (__ierr),0)) return PetscError(((MPI_Comm)0x44000001),1560,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",__ierr ,PETSC_ERROR_REPEAT," ");} while (0);} else return PetscError (PetscObjectComm((PetscObject)pc),1560,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object" ,"PCASMGetSubKSP_C"); } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1560,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1561 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1562 | } |
1563 | |
1564 | /* -------------------------------------------------------------------------------------*/ |
1565 | /*MC |
1566 | PCASM - Use the (restricted) additive Schwarz method, each block is (approximately) solved with |
1567 | its own KSP object. |
1568 | |
1569 | Options Database Keys: |
1570 | + -pc_asm_blocks <blks> - Sets total blocks |
1571 | . -pc_asm_overlap <ovl> - Sets overlap |
1572 | . -pc_asm_type [basic,restrict,interpolate,none] - Sets ASM type, default is restrict |
1573 | - -pc_asm_local_type [additive, multiplicative] - Sets ASM type, default is additive |
1574 | |
1575 | IMPORTANT: If you run with, for example, 3 blocks on 1 processor or 3 blocks on 3 processors you |
1576 | will get a different convergence rate due to the default option of -pc_asm_type restrict. Use |
1577 | -pc_asm_type basic to use the standard ASM. |
1578 | |
1579 | Notes: |
1580 | Each processor can have one or more blocks, but a block cannot be shared by more |
1581 | than one processor. Use PCGASM for subdomains shared by multiple processes. Defaults to one block per processor. |
1582 | |
1583 | To set options on the solvers for each block append -sub_ to all the KSP, and PC |
1584 | options database keys. For example, -sub_pc_type ilu -sub_pc_factor_levels 1 -sub_ksp_type preonly |
1585 | |
1586 | To set the options on the solvers separate for each block call PCASMGetSubKSP() |
1587 | and set the options directly on the resulting KSP object (you can access its PC |
1588 | with KSPGetPC()) |
1589 | |
1590 | Level: beginner |
1591 | |
1592 | References: |
1593 | + 1. - M Dryja, OB Widlund, An additive variant of the Schwarz alternating method for the case of many subregions |
1594 | Courant Institute, New York University Technical report |
1595 | - 1. - Barry Smith, Petter Bjorstad, and William Gropp, Domain Decompositions: Parallel Multilevel Methods for Elliptic Partial Differential Equations, |
1596 | Cambridge University Press. |
1597 | |
1598 | .seealso: PCCreate(), PCSetType(), PCType (for list of available types), PC, |
1599 | PCBJACOBI, PCASMGetSubKSP(), PCASMSetLocalSubdomains(), PCASMType, PCASMGetType(), PCASMSetLocalType(), PCASMGetLocalType() |
1600 | PCASMSetTotalSubdomains(), PCSetModifySubmatrices(), PCASMSetOverlap(), PCASMSetType(), PCCompositeType |
1601 | |
1602 | M*/ |
1603 | |
1604 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PCCreate_ASM(PC pc) |
1605 | { |
1606 | PetscErrorCode ierr; |
1607 | PC_ASM *osm; |
1608 | |
1609 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1609; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1610 | ierr = PetscNewLog(pc,&osm)(PetscMallocA(1,PETSC_TRUE,1610,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(1)*sizeof(**(((&osm)))),(((&osm)))) || PetscLogObjectMemory ((PetscObject)pc,sizeof(**(&osm))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1610,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1611 | |
1612 | osm->n = PETSC_DECIDE-1; |
1613 | osm->n_local = 0; |
1614 | osm->n_local_true = PETSC_DECIDE-1; |
1615 | osm->overlap = 1; |
1616 | osm->ksp = 0; |
1617 | osm->restriction = 0; |
1618 | osm->lprolongation = 0; |
1619 | osm->lrestriction = 0; |
1620 | osm->x = 0; |
1621 | osm->y = 0; |
1622 | osm->is = 0; |
1623 | osm->is_local = 0; |
1624 | osm->mat = 0; |
1625 | osm->pmat = 0; |
1626 | osm->type = PC_ASM_RESTRICT; |
1627 | osm->loctype = PC_COMPOSITE_ADDITIVE; |
1628 | osm->same_local_solves = PETSC_TRUE; |
1629 | osm->sort_indices = PETSC_TRUE; |
1630 | osm->dm_subdomains = PETSC_FALSE; |
1631 | osm->sub_mat_type = NULL((void*)0); |
1632 | |
1633 | pc->data = (void*)osm; |
1634 | pc->ops->apply = PCApply_ASM; |
1635 | pc->ops->applytranspose = PCApplyTranspose_ASM; |
1636 | pc->ops->applymultiprecond = PCApplyMP_ASM; |
1637 | pc->ops->setup = PCSetUp_ASM; |
1638 | pc->ops->reset = PCReset_ASM; |
1639 | pc->ops->destroy = PCDestroy_ASM; |
1640 | pc->ops->setfromoptions = PCSetFromOptions_ASM; |
1641 | pc->ops->setuponblocks = PCSetUpOnBlocks_ASM; |
1642 | pc->ops->view = PCView_ASM; |
1643 | pc->ops->applyrichardson = 0; |
1644 | |
1645 | ierr = PetscObjectComposeFunction((PetscObject)pc,"PCASMSetLocalSubdomains_C",PCASMSetLocalSubdomains_ASM)PetscObjectComposeFunction_Private((PetscObject)pc,"PCASMSetLocalSubdomains_C" ,(PetscVoidFunction)(PCASMSetLocalSubdomains_ASM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1645,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1646 | ierr = PetscObjectComposeFunction((PetscObject)pc,"PCASMSetTotalSubdomains_C",PCASMSetTotalSubdomains_ASM)PetscObjectComposeFunction_Private((PetscObject)pc,"PCASMSetTotalSubdomains_C" ,(PetscVoidFunction)(PCASMSetTotalSubdomains_ASM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1646,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1647 | ierr = PetscObjectComposeFunction((PetscObject)pc,"PCASMSetOverlap_C",PCASMSetOverlap_ASM)PetscObjectComposeFunction_Private((PetscObject)pc,"PCASMSetOverlap_C" ,(PetscVoidFunction)(PCASMSetOverlap_ASM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1647,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1648 | ierr = PetscObjectComposeFunction((PetscObject)pc,"PCASMSetType_C",PCASMSetType_ASM)PetscObjectComposeFunction_Private((PetscObject)pc,"PCASMSetType_C" ,(PetscVoidFunction)(PCASMSetType_ASM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1648,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1649 | ierr = PetscObjectComposeFunction((PetscObject)pc,"PCASMGetType_C",PCASMGetType_ASM)PetscObjectComposeFunction_Private((PetscObject)pc,"PCASMGetType_C" ,(PetscVoidFunction)(PCASMGetType_ASM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1649,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1650 | ierr = PetscObjectComposeFunction((PetscObject)pc,"PCASMSetLocalType_C",PCASMSetLocalType_ASM)PetscObjectComposeFunction_Private((PetscObject)pc,"PCASMSetLocalType_C" ,(PetscVoidFunction)(PCASMSetLocalType_ASM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1650,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1651 | ierr = PetscObjectComposeFunction((PetscObject)pc,"PCASMGetLocalType_C",PCASMGetLocalType_ASM)PetscObjectComposeFunction_Private((PetscObject)pc,"PCASMGetLocalType_C" ,(PetscVoidFunction)(PCASMGetLocalType_ASM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1651,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1652 | ierr = PetscObjectComposeFunction((PetscObject)pc,"PCASMSetSortIndices_C",PCASMSetSortIndices_ASM)PetscObjectComposeFunction_Private((PetscObject)pc,"PCASMSetSortIndices_C" ,(PetscVoidFunction)(PCASMSetSortIndices_ASM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1652,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1653 | ierr = PetscObjectComposeFunction((PetscObject)pc,"PCASMGetSubKSP_C",PCASMGetSubKSP_ASM)PetscObjectComposeFunction_Private((PetscObject)pc,"PCASMGetSubKSP_C" ,(PetscVoidFunction)(PCASMGetSubKSP_ASM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1653,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1654 | ierr = PetscObjectComposeFunction((PetscObject)pc,"PCASMGetSubMatType_C",PCASMGetSubMatType_ASM)PetscObjectComposeFunction_Private((PetscObject)pc,"PCASMGetSubMatType_C" ,(PetscVoidFunction)(PCASMGetSubMatType_ASM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1654,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1655 | ierr = PetscObjectComposeFunction((PetscObject)pc,"PCASMSetSubMatType_C",PCASMSetSubMatType_ASM)PetscObjectComposeFunction_Private((PetscObject)pc,"PCASMSetSubMatType_C" ,(PetscVoidFunction)(PCASMSetSubMatType_ASM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1655,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1656 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1657 | } |
1658 | |
1659 | /*@C |
1660 | PCASMCreateSubdomains - Creates the index sets for the overlapping Schwarz |
1661 | preconditioner for a any problem on a general grid. |
1662 | |
1663 | Collective |
1664 | |
1665 | Input Parameters: |
1666 | + A - The global matrix operator |
1667 | - n - the number of local blocks |
1668 | |
1669 | Output Parameters: |
1670 | . outis - the array of index sets defining the subdomains |
1671 | |
1672 | Level: advanced |
1673 | |
1674 | Note: this generates nonoverlapping subdomains; the PCASM will generate the overlap |
1675 | from these if you use PCASMSetLocalSubdomains() |
1676 | |
1677 | In the Fortran version you must provide the array outis[] already allocated of length n. |
1678 | |
1679 | .seealso: PCASMSetLocalSubdomains(), PCASMDestroySubdomains() |
1680 | @*/ |
1681 | PetscErrorCode PCASMCreateSubdomains(Mat A, PetscInt n, IS* outis[]) |
1682 | { |
1683 | MatPartitioning mpart; |
1684 | const char *prefix; |
1685 | PetscInt i,j,rstart,rend,bs; |
1686 | PetscBool hasop, isbaij = PETSC_FALSE,foundpart = PETSC_FALSE; |
1687 | Mat Ad = NULL((void*)0), adj; |
1688 | IS ispart,isnumb,*is; |
1689 | PetscErrorCode ierr; |
1690 | |
1691 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1691; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1692 | PetscValidHeaderSpecific(A,MAT_CLASSID,1)do { if (!A) return PetscError(((MPI_Comm)0x44000001),1692,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (A,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1692 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(A))->classid != MAT_CLASSID) { if ( ((PetscObject)(A))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1692,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1692,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1693 | PetscValidPointer(outis,3)do { if (!outis) return PetscError(((MPI_Comm)0x44000001),1693 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(outis,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),1693,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); |
1694 | if (n < 1) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"number of local blocks must be > 0, n = %D",n)return PetscError(((MPI_Comm)0x44000001),1694,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,62,PETSC_ERROR_INITIAL,"number of local blocks must be > 0, n = %D" ,n); |
1695 | |
1696 | /* Get prefix, row distribution, and block size */ |
1697 | ierr = MatGetOptionsPrefix(A,&prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1697,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1698 | ierr = MatGetOwnershipRange(A,&rstart,&rend);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1698,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1699 | ierr = MatGetBlockSize(A,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1699,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1700 | if (rstart/bs*bs != rstart || rend/bs*bs != rend) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"bad row distribution [%D,%D) for matrix block size %D",rstart,rend,bs)return PetscError(((MPI_Comm)0x44000001),1700,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,62,PETSC_ERROR_INITIAL,"bad row distribution [%D,%D) for matrix block size %D" ,rstart,rend,bs); |
1701 | |
1702 | /* Get diagonal block from matrix if possible */ |
1703 | ierr = MatHasOperation(A,MATOP_GET_DIAGONAL_BLOCK,&hasop);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1703,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1704 | if (hasop) { |
1705 | ierr = MatGetDiagonalBlock(A,&Ad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1705,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1706 | } |
1707 | if (Ad) { |
1708 | ierr = PetscObjectBaseTypeCompare((PetscObject)Ad,MATSEQBAIJ"seqbaij",&isbaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1708,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1709 | if (!isbaij) {ierr = PetscObjectBaseTypeCompare((PetscObject)Ad,MATSEQSBAIJ"seqsbaij",&isbaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1709,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} |
1710 | } |
1711 | if (Ad && n > 1) { |
1712 | PetscBool match,done; |
1713 | /* Try to setup a good matrix partitioning if available */ |
1714 | ierr = MatPartitioningCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&mpart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1714,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1715 | ierr = PetscObjectSetOptionsPrefix((PetscObject)mpart,prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1715,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1716 | ierr = MatPartitioningSetFromOptions(mpart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1716,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1717 | ierr = PetscObjectTypeCompare((PetscObject)mpart,MATPARTITIONINGCURRENT"current",&match);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1717,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1718 | if (!match) { |
1719 | ierr = PetscObjectTypeCompare((PetscObject)mpart,MATPARTITIONINGSQUARE"square",&match);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1719,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1720 | } |
1721 | if (!match) { /* assume a "good" partitioner is available */ |
1722 | PetscInt na; |
1723 | const PetscInt *ia,*ja; |
1724 | ierr = MatGetRowIJ(Ad,0,PETSC_TRUE,isbaij,&na,&ia,&ja,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1724,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1725 | if (done) { |
1726 | /* Build adjacency matrix by hand. Unfortunately a call to |
1727 | MatConvert(Ad,MATMPIADJ,MAT_INITIAL_MATRIX,&adj) will |
1728 | remove the block-aij structure and we cannot expect |
1729 | MatPartitioning to split vertices as we need */ |
1730 | PetscInt i,j,len,nnz,cnt,*iia=0,*jja=0; |
1731 | const PetscInt *row; |
1732 | nnz = 0; |
1733 | for (i=0; i<na; i++) { /* count number of nonzeros */ |
1734 | len = ia[i+1] - ia[i]; |
1735 | row = ja + ia[i]; |
1736 | for (j=0; j<len; j++) { |
1737 | if (row[j] == i) { /* don't count diagonal */ |
1738 | len--; break; |
1739 | } |
1740 | } |
1741 | nnz += len; |
1742 | } |
1743 | ierr = PetscMalloc1(na+1,&iia)PetscMallocA(1,PETSC_FALSE,1743,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(na+1)*sizeof(**(&iia)),(&iia));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1743,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1744 | ierr = PetscMalloc1(nnz,&jja)PetscMallocA(1,PETSC_FALSE,1744,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(nnz)*sizeof(**(&jja)),(&jja));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1744,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1745 | nnz = 0; |
1746 | iia[0] = 0; |
1747 | for (i=0; i<na; i++) { /* fill adjacency */ |
1748 | cnt = 0; |
1749 | len = ia[i+1] - ia[i]; |
1750 | row = ja + ia[i]; |
1751 | for (j=0; j<len; j++) { |
1752 | if (row[j] != i) { /* if not diagonal */ |
1753 | jja[nnz+cnt++] = row[j]; |
1754 | } |
1755 | } |
1756 | nnz += cnt; |
1757 | iia[i+1] = nnz; |
1758 | } |
1759 | /* Partitioning of the adjacency matrix */ |
1760 | ierr = MatCreateMPIAdj(PETSC_COMM_SELF((MPI_Comm)0x44000001),na,na,iia,jja,NULL((void*)0),&adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1760,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1761 | ierr = MatPartitioningSetAdjacency(mpart,adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1761,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1762 | ierr = MatPartitioningSetNParts(mpart,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1762,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1763 | ierr = MatPartitioningApply(mpart,&ispart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1763,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1764 | ierr = ISPartitioningToNumbering(ispart,&isnumb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1764,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1765 | ierr = MatDestroy(&adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1765,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1766 | foundpart = PETSC_TRUE; |
1767 | } |
1768 | ierr = MatRestoreRowIJ(Ad,0,PETSC_TRUE,isbaij,&na,&ia,&ja,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1768,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1769 | } |
1770 | ierr = MatPartitioningDestroy(&mpart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1770,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1771 | } |
1772 | |
1773 | ierr = PetscMalloc1(n,&is)PetscMallocA(1,PETSC_FALSE,1773,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(n)*sizeof(**(&is)),(&is));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1773,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1774 | *outis = is; |
1775 | |
1776 | if (!foundpart) { |
1777 | |
1778 | /* Partitioning by contiguous chunks of rows */ |
1779 | |
1780 | PetscInt mbs = (rend-rstart)/bs; |
1781 | PetscInt start = rstart; |
1782 | for (i=0; i<n; i++) { |
1783 | PetscInt count = (mbs/n + ((mbs % n) > i)) * bs; |
1784 | ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),count,start,1,&is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1784,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1785 | start += count; |
1786 | } |
1787 | |
1788 | } else { |
1789 | |
1790 | /* Partitioning by adjacency of diagonal block */ |
1791 | |
1792 | const PetscInt *numbering; |
1793 | PetscInt *count,nidx,*indices,*newidx,start=0; |
1794 | /* Get node count in each partition */ |
1795 | ierr = PetscMalloc1(n,&count)PetscMallocA(1,PETSC_FALSE,1795,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(n)*sizeof(**(&count)),(&count));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1795,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1796 | ierr = ISPartitioningCount(ispart,n,count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1796,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1797 | if (isbaij && bs > 1) { /* adjust for the block-aij case */ |
1798 | for (i=0; i<n; i++) count[i] *= bs; |
1799 | } |
1800 | /* Build indices from node numbering */ |
1801 | ierr = ISGetLocalSize(isnumb,&nidx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1801,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1802 | ierr = PetscMalloc1(nidx,&indices)PetscMallocA(1,PETSC_FALSE,1802,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(nidx)*sizeof(**(&indices)),(&indices));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1802,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1803 | for (i=0; i<nidx; i++) indices[i] = i; /* needs to be initialized */ |
1804 | ierr = ISGetIndices(isnumb,&numbering);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1804,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1805 | ierr = PetscSortIntWithPermutation(nidx,numbering,indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1805,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1806 | ierr = ISRestoreIndices(isnumb,&numbering);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1806,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1807 | if (isbaij && bs > 1) { /* adjust for the block-aij case */ |
1808 | ierr = PetscMalloc1(nidx*bs,&newidx)PetscMallocA(1,PETSC_FALSE,1808,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(nidx*bs)*sizeof(**(&newidx)),(&newidx));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1808,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1809 | for (i=0; i<nidx; i++) { |
1810 | for (j=0; j<bs; j++) newidx[i*bs+j] = indices[i]*bs + j; |
1811 | } |
1812 | ierr = PetscFree(indices)((*PetscTrFree)((void*)(indices),1812,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((indices) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1812,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1813 | nidx *= bs; |
1814 | indices = newidx; |
1815 | } |
1816 | /* Shift to get global indices */ |
1817 | for (i=0; i<nidx; i++) indices[i] += rstart; |
1818 | |
1819 | /* Build the index sets for each block */ |
1820 | for (i=0; i<n; i++) { |
1821 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),count[i],&indices[start],PETSC_COPY_VALUES,&is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1821,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1822 | ierr = ISSort(is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1822,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1823 | start += count[i]; |
1824 | } |
1825 | |
1826 | ierr = PetscFree(count)((*PetscTrFree)((void*)(count),1826,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((count) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1826,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1827 | ierr = PetscFree(indices)((*PetscTrFree)((void*)(indices),1827,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((indices) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1827,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1828 | ierr = ISDestroy(&isnumb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1828,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1829 | ierr = ISDestroy(&ispart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1829,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1830 | |
1831 | } |
1832 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1833 | } |
1834 | |
1835 | /*@C |
1836 | PCASMDestroySubdomains - Destroys the index sets created with |
1837 | PCASMCreateSubdomains(). Should be called after setting subdomains |
1838 | with PCASMSetLocalSubdomains(). |
1839 | |
1840 | Collective |
1841 | |
1842 | Input Parameters: |
1843 | + n - the number of index sets |
1844 | . is - the array of index sets |
1845 | - is_local - the array of local index sets, can be NULL |
1846 | |
1847 | Level: advanced |
1848 | |
1849 | .seealso: PCASMCreateSubdomains(), PCASMSetLocalSubdomains() |
1850 | @*/ |
1851 | PetscErrorCode PCASMDestroySubdomains(PetscInt n, IS is[], IS is_local[]) |
1852 | { |
1853 | PetscInt i; |
1854 | PetscErrorCode ierr; |
1855 | |
1856 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1856; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1857 | if (n <= 0) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1858 | if (is) { |
1859 | PetscValidPointer(is,2)do { if (!is) return PetscError(((MPI_Comm)0x44000001),1859,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (! PetscCheckPointer(is,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),1859,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); |
1860 | for (i=0; i<n; i++) { ierr = ISDestroy(&is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1860,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } |
1861 | ierr = PetscFree(is)((*PetscTrFree)((void*)(is),1861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((is) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1862 | } |
1863 | if (is_local) { |
1864 | PetscValidPointer(is_local,3)do { if (!is_local) return PetscError(((MPI_Comm)0x44000001), 1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(is_local,PETSC_CHAR)) return PetscError( ((MPI_Comm)0x44000001),1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); |
1865 | for (i=0; i<n; i++) { ierr = ISDestroy(&is_local[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1865,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } |
1866 | ierr = PetscFree(is_local)((*PetscTrFree)((void*)(is_local),1866,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((is_local) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1866,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1867 | } |
1868 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1869 | } |
1870 | |
1871 | /*@ |
1872 | PCASMCreateSubdomains2D - Creates the index sets for the overlapping Schwarz |
1873 | preconditioner for a two-dimensional problem on a regular grid. |
1874 | |
1875 | Not Collective |
1876 | |
1877 | Input Parameters: |
1878 | + m, n - the number of mesh points in the x and y directions |
1879 | . M, N - the number of subdomains in the x and y directions |
1880 | . dof - degrees of freedom per node |
1881 | - overlap - overlap in mesh lines |
1882 | |
1883 | Output Parameters: |
1884 | + Nsub - the number of subdomains created |
1885 | . is - array of index sets defining overlapping (if overlap > 0) subdomains |
1886 | - is_local - array of index sets defining non-overlapping subdomains |
1887 | |
1888 | Note: |
1889 | Presently PCAMSCreateSubdomains2d() is valid only for sequential |
1890 | preconditioners. More general related routines are |
1891 | PCASMSetTotalSubdomains() and PCASMSetLocalSubdomains(). |
1892 | |
1893 | Level: advanced |
1894 | |
1895 | .seealso: PCASMSetTotalSubdomains(), PCASMSetLocalSubdomains(), PCASMGetSubKSP(), |
1896 | PCASMSetOverlap() |
1897 | @*/ |
1898 | PetscErrorCode PCASMCreateSubdomains2D(PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt dof,PetscInt overlap,PetscInt *Nsub,IS **is,IS **is_local) |
1899 | { |
1900 | PetscInt i,j,height,width,ystart,xstart,yleft,yright,xleft,xright,loc_outer; |
1901 | PetscErrorCode ierr; |
1902 | PetscInt nidx,*idx,loc,ii,jj,count; |
1903 | |
1904 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1904; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1905 | if (dof != 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP," ")return PetscError(((MPI_Comm)0x44000001),1905,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,56,PETSC_ERROR_INITIAL," "); |
1906 | |
1907 | *Nsub = N*M; |
1908 | ierr = PetscMalloc1(*Nsub,is)PetscMallocA(1,PETSC_FALSE,1908,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(*Nsub)*sizeof(**(is)),(is));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1908,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1909 | ierr = PetscMalloc1(*Nsub,is_local)PetscMallocA(1,PETSC_FALSE,1909,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(*Nsub)*sizeof(**(is_local)),(is_local));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1909,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1910 | ystart = 0; |
1911 | loc_outer = 0; |
1912 | for (i=0; i<N; i++) { |
1913 | height = n/N + ((n % N) > i); /* height of subdomain */ |
1914 | if (height < 2) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Too many N subdomains for mesh dimension n")return PetscError(((MPI_Comm)0x44000001),1914,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,63,PETSC_ERROR_INITIAL,"Too many N subdomains for mesh dimension n" ); |
1915 | yleft = ystart - overlap; if (yleft < 0) yleft = 0; |
1916 | yright = ystart + height + overlap; if (yright > n) yright = n; |
1917 | xstart = 0; |
1918 | for (j=0; j<M; j++) { |
1919 | width = m/M + ((m % M) > j); /* width of subdomain */ |
1920 | if (width < 2) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Too many M subdomains for mesh dimension m")return PetscError(((MPI_Comm)0x44000001),1920,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,63,PETSC_ERROR_INITIAL,"Too many M subdomains for mesh dimension m" ); |
1921 | xleft = xstart - overlap; if (xleft < 0) xleft = 0; |
1922 | xright = xstart + width + overlap; if (xright > m) xright = m; |
1923 | nidx = (xright - xleft)*(yright - yleft); |
1924 | ierr = PetscMalloc1(nidx,&idx)PetscMallocA(1,PETSC_FALSE,1924,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,(size_t)(nidx)*sizeof(**(&idx)),(&idx));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1924,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1925 | loc = 0; |
1926 | for (ii=yleft; ii<yright; ii++) { |
1927 | count = m*ii + xleft; |
1928 | for (jj=xleft; jj<xright; jj++) idx[loc++] = count++; |
1929 | } |
1930 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),nidx,idx,PETSC_COPY_VALUES,(*is)+loc_outer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1930,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1931 | if (overlap == 0) { |
1932 | ierr = PetscObjectReference((PetscObject)(*is)[loc_outer]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1932,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1933 | |
1934 | (*is_local)[loc_outer] = (*is)[loc_outer]; |
1935 | } else { |
1936 | for (loc=0,ii=ystart; ii<ystart+height; ii++) { |
1937 | for (jj=xstart; jj<xstart+width; jj++) { |
1938 | idx[loc++] = m*ii + jj; |
1939 | } |
1940 | } |
1941 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),loc,idx,PETSC_COPY_VALUES,*is_local+loc_outer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1941,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1942 | } |
1943 | ierr = PetscFree(idx)((*PetscTrFree)((void*)(idx),1943,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((idx) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1943,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1944 | xstart += width; |
1945 | loc_outer++; |
1946 | } |
1947 | ystart += height; |
1948 | } |
1949 | for (i=0; i<*Nsub; i++) { ierr = ISSort((*is)[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1949,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } |
1950 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1951 | } |
1952 | |
1953 | /*@C |
1954 | PCASMGetLocalSubdomains - Gets the local subdomains (for this processor |
1955 | only) for the additive Schwarz preconditioner. |
1956 | |
1957 | Not Collective |
1958 | |
1959 | Input Parameter: |
1960 | . pc - the preconditioner context |
1961 | |
1962 | Output Parameters: |
1963 | + n - the number of subdomains for this processor (default value = 1) |
1964 | . is - the index sets that define the subdomains for this processor |
1965 | - is_local - the index sets that define the local part of the subdomains for this processor (can be NULL) |
1966 | |
1967 | |
1968 | Notes: |
1969 | The IS numbering is in the parallel, global numbering of the vector. |
1970 | |
1971 | Level: advanced |
1972 | |
1973 | .seealso: PCASMSetTotalSubdomains(), PCASMSetOverlap(), PCASMGetSubKSP(), |
1974 | PCASMCreateSubdomains2D(), PCASMSetLocalSubdomains(), PCASMGetLocalSubmatrices() |
1975 | @*/ |
1976 | PetscErrorCode PCASMGetLocalSubdomains(PC pc,PetscInt *n,IS *is[],IS *is_local[]) |
1977 | { |
1978 | PC_ASM *osm = (PC_ASM*)pc->data; |
1979 | PetscErrorCode ierr; |
1980 | PetscBool match; |
1981 | |
1982 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 1982; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
1983 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),1983,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1983 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1983,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1983,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
1984 | PetscValidIntPointer(n,2)do { if (!n) return PetscError(((MPI_Comm)0x44000001),1984,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",68 ,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (! PetscCheckPointer(n,PETSC_INT)) return PetscError(((MPI_Comm) 0x44000001),1984,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); |
1985 | if (is) PetscValidPointer(is,3)do { if (!is) return PetscError(((MPI_Comm)0x44000001),1985,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (! PetscCheckPointer(is,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),1985,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); |
1986 | ierr = PetscObjectTypeCompare((PetscObject)pc,PCASM"asm",&match);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1986,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
1987 | if (!match) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_WRONG,"PC is not a PCASM")return PetscError(PetscObjectComm((PetscObject)pc),1987,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"PC is not a PCASM"); |
1988 | if (n) *n = osm->n_local_true; |
1989 | if (is) *is = osm->is; |
1990 | if (is_local) *is_local = osm->is_local; |
1991 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
1992 | } |
1993 | |
1994 | /*@C |
1995 | PCASMGetLocalSubmatrices - Gets the local submatrices (for this processor |
1996 | only) for the additive Schwarz preconditioner. |
1997 | |
1998 | Not Collective |
1999 | |
2000 | Input Parameter: |
2001 | . pc - the preconditioner context |
2002 | |
2003 | Output Parameters: |
2004 | + n - the number of matrices for this processor (default value = 1) |
2005 | - mat - the matrices |
2006 | |
2007 | Level: advanced |
2008 | |
2009 | Notes: |
2010 | Call after PCSetUp() (or KSPSetUp()) but before PCApply() (or KSPApply()) and before PCSetUpOnBlocks()) |
2011 | |
2012 | Usually one would use PCSetModifySubmatrices() to change the submatrices in building the preconditioner. |
2013 | |
2014 | .seealso: PCASMSetTotalSubdomains(), PCASMSetOverlap(), PCASMGetSubKSP(), |
2015 | PCASMCreateSubdomains2D(), PCASMSetLocalSubdomains(), PCASMGetLocalSubdomains(), PCSetModifySubmatrices() |
2016 | @*/ |
2017 | PetscErrorCode PCASMGetLocalSubmatrices(PC pc,PetscInt *n,Mat *mat[]) |
2018 | { |
2019 | PC_ASM *osm; |
2020 | PetscErrorCode ierr; |
2021 | PetscBool match; |
2022 | |
2023 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 2023; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
2024 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),2024,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2024 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),2024,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),2024,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
2025 | PetscValidIntPointer(n,2)do { if (!n) return PetscError(((MPI_Comm)0x44000001),2025,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",68 ,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (! PetscCheckPointer(n,PETSC_INT)) return PetscError(((MPI_Comm) 0x44000001),2025,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); |
2026 | if (mat) PetscValidPointer(mat,3)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),2026, __func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(mat,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),2026,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); |
2027 | if (!pc->setupcalled) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_WRONGSTATE,"Must call after KSPSetUP() or PCSetUp().")return PetscError(PetscObjectComm((PetscObject)pc),2027,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",73 ,PETSC_ERROR_INITIAL,"Must call after KSPSetUP() or PCSetUp()." ); |
2028 | ierr = PetscObjectTypeCompare((PetscObject)pc,PCASM"asm",&match);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2028,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
2029 | if (!match) { |
2030 | if (n) *n = 0; |
2031 | if (mat) *mat = NULL((void*)0); |
2032 | } else { |
2033 | osm = (PC_ASM*)pc->data; |
2034 | if (n) *n = osm->n_local_true; |
2035 | if (mat) *mat = osm->pmat; |
2036 | } |
2037 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
2038 | } |
2039 | |
2040 | /*@ |
2041 | PCASMSetDMSubdomains - Indicates whether to use DMCreateDomainDecomposition() to define the subdomains, whenever possible. |
2042 | |
2043 | Logically Collective |
2044 | |
2045 | Input Parameter: |
2046 | + pc - the preconditioner |
2047 | - flg - boolean indicating whether to use subdomains defined by the DM |
2048 | |
2049 | Options Database Key: |
2050 | . -pc_asm_dm_subdomains |
2051 | |
2052 | Level: intermediate |
2053 | |
2054 | Notes: |
2055 | PCASMSetTotalSubdomains() and PCASMSetOverlap() take precedence over PCASMSetDMSubdomains(), |
2056 | so setting either of the first two effectively turns the latter off. |
2057 | |
2058 | .seealso: PCASMGetDMSubdomains(), PCASMSetTotalSubdomains(), PCASMSetOverlap() |
2059 | PCASMCreateSubdomains2D(), PCASMSetLocalSubdomains(), PCASMGetLocalSubdomains() |
2060 | @*/ |
2061 | PetscErrorCode PCASMSetDMSubdomains(PC pc,PetscBool flg) |
2062 | { |
2063 | PC_ASM *osm = (PC_ASM*)pc->data; |
2064 | PetscErrorCode ierr; |
2065 | PetscBool match; |
2066 | |
2067 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 2067; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
2068 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),2068,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2068 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),2068,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),2068,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
2069 | PetscValidLogicalCollectiveBool(pc,flg,2)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] = -(PetscMPIInt)flg; b1[1] = (PetscMPIInt)flg; _7_ierr = (PetscAllreduceBarrierCheck (PetscObjectComm((PetscObject)pc),2,2069,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)pc))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype )0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject )pc)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),2069,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2 [1]) return PetscError(PetscObjectComm((PetscObject)pc),2069, __func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d" ,2); } while (0); |
2070 | if (pc->setupcalled) SETERRQ(((PetscObject)pc)->comm,PETSC_ERR_ARG_WRONGSTATE,"Not for a setup PC.")return PetscError(((PetscObject)pc)->comm,2070,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,73,PETSC_ERROR_INITIAL,"Not for a setup PC."); |
2071 | ierr = PetscObjectTypeCompare((PetscObject)pc,PCASM"asm",&match);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2071,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
2072 | if (match) { |
2073 | osm->dm_subdomains = flg; |
2074 | } |
2075 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
2076 | } |
2077 | |
2078 | /*@ |
2079 | PCASMGetDMSubdomains - Returns flag indicating whether to use DMCreateDomainDecomposition() to define the subdomains, whenever possible. |
2080 | Not Collective |
2081 | |
2082 | Input Parameter: |
2083 | . pc - the preconditioner |
2084 | |
2085 | Output Parameter: |
2086 | . flg - boolean indicating whether to use subdomains defined by the DM |
2087 | |
2088 | Level: intermediate |
2089 | |
2090 | .seealso: PCASMSetDMSubdomains(), PCASMSetTotalSubdomains(), PCASMSetOverlap() |
2091 | PCASMCreateSubdomains2D(), PCASMSetLocalSubdomains(), PCASMGetLocalSubdomains() |
2092 | @*/ |
2093 | PetscErrorCode PCASMGetDMSubdomains(PC pc,PetscBool* flg) |
2094 | { |
2095 | PC_ASM *osm = (PC_ASM*)pc->data; |
2096 | PetscErrorCode ierr; |
2097 | PetscBool match; |
2098 | |
2099 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ; petscstack->line[petscstack->currentsize] = 2099; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); |
2100 | PetscValidHeaderSpecific(pc,PC_CLASSID,1)do { if (!pc) return PetscError(((MPI_Comm)0x44000001),2100,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",85 ,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer (pc,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2100 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(pc))->classid != PC_CLASSID) { if ( ((PetscObject)(pc))->classid == -1) return PetscError(((MPI_Comm )0x44000001),2100,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),2100,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c",62 ,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1 ); } } while (0); |
2101 | PetscValidPointer(flg,2)do { if (!flg) return PetscError(((MPI_Comm)0x44000001),2101, __func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(flg,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),2101,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); |
2102 | ierr = PetscObjectTypeCompare((PetscObject)pc,PCASM"asm",&match);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2102,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
2103 | if (match) { |
2104 | if (flg) *flg = osm->dm_subdomains; |
2105 | } |
2106 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
2107 | } |
2108 | |
2109 | /*@ |
2110 | PCASMGetSubMatType - Gets the matrix type used for ASM subsolves, as a string. |
2111 | |
2112 | Not Collective |
2113 | |
2114 | Input Parameter: |
2115 | . pc - the PC |
2116 | |
2117 | Output Parameter: |
2118 | . -pc_asm_sub_mat_type - name of matrix type |
2119 | |
2120 | Level: advanced |
2121 | |
2122 | .seealso: PCASMSetSubMatType(), PCASM, PCSetType(), VecSetType(), MatType, Mat |
2123 | @*/ |
2124 | PetscErrorCode PCASMGetSubMatType(PC pc,MatType *sub_mat_type){ |
2125 | PetscErrorCode ierr; |
2126 | |
2127 | ierr = PetscTryMethod(pc,"PCASMGetSubMatType_C",(PC,MatType*),(pc,sub_mat_type))0; do { PetscErrorCode (*f)(PC,MatType*), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)pc),("PCASMGetSubMatType_C"),(PetscVoidFunction *)(&f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),2127,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(pc,sub_mat_type);do {if (__builtin_expect(!!(__ierr),0) ) return PetscError(((MPI_Comm)0x44000001),2127,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2127,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
2128 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
2129 | } |
2130 | |
2131 | /*@ |
2132 | PCASMSetSubMatType - Set the type of matrix used for ASM subsolves |
2133 | |
2134 | Collective on Mat |
2135 | |
2136 | Input Parameters: |
2137 | + pc - the PC object |
2138 | - sub_mat_type - matrix type |
2139 | |
2140 | Options Database Key: |
2141 | . -pc_asm_sub_mat_type <sub_mat_type> - Sets the matrix type used for subsolves, for example, seqaijviennacl. If you specify a base name like aijviennacl, the corresponding sequential type is assumed. |
2142 | |
2143 | Notes: |
2144 | See "${PETSC_DIR}/include/petscmat.h" for available types |
2145 | |
2146 | Level: advanced |
2147 | |
2148 | .seealso: PCASMGetSubMatType(), PCASM, PCSetType(), VecSetType(), MatType, Mat |
2149 | @*/ |
2150 | PetscErrorCode PCASMSetSubMatType(PC pc,MatType sub_mat_type) |
2151 | { |
2152 | PetscErrorCode ierr; |
2153 | |
2154 | ierr = PetscTryMethod(pc,"PCASMSetSubMatType_C",(PC,MatType),(pc,sub_mat_type))0; do { PetscErrorCode (*f)(PC,MatType), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)pc),("PCASMSetSubMatType_C"),(PetscVoidFunction *)(&f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),2154,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(pc,sub_mat_type);do {if (__builtin_expect(!!(__ierr),0) ) return PetscError(((MPI_Comm)0x44000001),2154,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2154,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/asm/asm.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); |
2155 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); |
2156 | } |