File: | ksp/pc/impls/patch/pcpatch.c |
Warning: | line 110, column 24 2nd function call argument is an uninitialized value |
[?] Use j/k keys for keyboard navigation
1 | #include <petsc/private/pcpatchimpl.h> /*I "petscpc.h" I*/ | |||
2 | #include <petsc/private/kspimpl.h> /* For ksp->setfromoptionscalled */ | |||
3 | #include <petsc/private/dmpleximpl.h> /* For DMPlexComputeJacobian_Patch_Internal() */ | |||
4 | #include <petscsf.h> | |||
5 | #include <petscbt.h> | |||
6 | #include <petscds.h> | |||
7 | ||||
8 | PetscLogEvent PC_Patch_CreatePatches, PC_Patch_ComputeOp, PC_Patch_Solve, PC_Patch_Scatter, PC_Patch_Apply, PC_Patch_Prealloc; | |||
9 | ||||
10 | PETSC_STATIC_INLINEstatic inline PetscErrorCode ObjectView(PetscObject obj, PetscViewer viewer, PetscViewerFormat format) | |||
11 | { | |||
12 | PetscErrorCode ierr; | |||
13 | ||||
14 | ierr = PetscViewerPushFormat(viewer, format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),14,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
15 | ierr = PetscObjectView(obj, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),15,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
16 | ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),16,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
17 | return(0); | |||
18 | } | |||
19 | ||||
20 | static PetscErrorCode PCPatchConstruct_Star(void *vpatch, DM dm, PetscInt point, PetscHSetI ht) | |||
21 | { | |||
22 | PetscInt starSize; | |||
23 | PetscInt *star = NULL((void*)0), si; | |||
24 | PetscErrorCode ierr; | |||
25 | ||||
26 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 26; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
27 | PetscHSetIClear(ht); | |||
28 | /* To start with, add the point we care about */ | |||
29 | ierr = PetscHSetIAdd(ht, point);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),29,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
30 | /* Loop over all the points that this point connects to */ | |||
31 | ierr = DMPlexGetTransitiveClosure(dm, point, PETSC_FALSE, &starSize, &star);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),31,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
32 | for (si = 0; si < starSize*2; si += 2) {ierr = PetscHSetIAdd(ht, star[si]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),32,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
33 | ierr = DMPlexRestoreTransitiveClosure(dm, point, PETSC_FALSE, &starSize, &star);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),33,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
34 | 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); | |||
35 | } | |||
36 | ||||
37 | static PetscErrorCode PCPatchConstruct_Vanka(void *vpatch, DM dm, PetscInt point, PetscHSetI ht) | |||
38 | { | |||
39 | PC_PATCH *patch = (PC_PATCH *) vpatch; | |||
40 | PetscInt starSize; | |||
41 | PetscInt *star = NULL((void*)0); | |||
42 | PetscBool shouldIgnore = PETSC_FALSE; | |||
43 | PetscInt cStart, cEnd, iStart, iEnd, si; | |||
44 | PetscErrorCode ierr; | |||
45 | ||||
46 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 46; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
47 | ierr = PetscHSetIClear(ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),47,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
48 | /* To start with, add the point we care about */ | |||
49 | ierr = PetscHSetIAdd(ht, point);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),49,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
50 | /* Should we ignore any points of a certain dimension? */ | |||
51 | if (patch->vankadim >= 0) { | |||
52 | shouldIgnore = PETSC_TRUE; | |||
53 | ierr = DMPlexGetDepthStratum(dm, patch->vankadim, &iStart, &iEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),53,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
54 | } | |||
55 | ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),55,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
56 | /* Loop over all the cells that this point connects to */ | |||
57 | ierr = DMPlexGetTransitiveClosure(dm, point, PETSC_FALSE, &starSize, &star);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),57,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
58 | for (si = 0; si < starSize*2; si += 2) { | |||
59 | const PetscInt cell = star[si]; | |||
60 | PetscInt closureSize; | |||
61 | PetscInt *closure = NULL((void*)0), ci; | |||
62 | ||||
63 | if (cell < cStart || cell >= cEnd) continue; | |||
64 | /* now loop over all entities in the closure of that cell */ | |||
65 | ierr = DMPlexGetTransitiveClosure(dm, cell, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),65,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
66 | for (ci = 0; ci < closureSize*2; ci += 2) { | |||
67 | const PetscInt newpoint = closure[ci]; | |||
68 | ||||
69 | /* We've been told to ignore entities of this type.*/ | |||
70 | if (shouldIgnore && newpoint >= iStart && newpoint < iEnd) continue; | |||
71 | ierr = PetscHSetIAdd(ht, newpoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),71,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
72 | } | |||
73 | ierr = DMPlexRestoreTransitiveClosure(dm, cell, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),73,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
74 | } | |||
75 | ierr = DMPlexRestoreTransitiveClosure(dm, point, PETSC_FALSE, &starSize, &star);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),75,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
76 | 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); | |||
77 | } | |||
78 | ||||
79 | static PetscErrorCode PCPatchConstruct_Pardecomp(void *vpatch, DM dm, PetscInt point, PetscHSetI ht) | |||
80 | { | |||
81 | PC_PATCH *patch = (PC_PATCH *) vpatch; | |||
82 | DMLabel ghost = NULL((void*)0); | |||
83 | const PetscInt *leaves; | |||
84 | PetscInt nleaves, pStart, pEnd, loc; | |||
| ||||
85 | PetscBool isFiredrake; | |||
86 | PetscBool flg; | |||
87 | PetscInt starSize; | |||
88 | PetscInt *star = NULL((void*)0); | |||
89 | PetscInt opoint, overlapi; | |||
90 | PetscErrorCode ierr; | |||
91 | ||||
92 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 92; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
93 | PetscHSetIClear(ht); | |||
94 | ||||
95 | ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),95,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
96 | ||||
97 | ierr = DMHasLabel(dm, "pyop2_ghost", &isFiredrake);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),97,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
98 | if (isFiredrake) { | |||
99 | ierr = DMGetLabel(dm, "pyop2_ghost", &ghost);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),99,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
100 | ierr = DMLabelCreateIndex(ghost, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),100,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
101 | } else { | |||
102 | PetscSF sf; | |||
103 | ierr = DMGetPointSF(dm, &sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),103,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
104 | ierr = PetscSFGetGraph(sf, NULL((void*)0), &nleaves, &leaves, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),104,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
105 | nleaves = PetscMax(nleaves, 0)(((nleaves)<(0)) ? (0) : (nleaves)); | |||
106 | } | |||
107 | ||||
108 | for (opoint = pStart; opoint < pEnd; ++opoint) { | |||
109 | if (ghost) {ierr = DMLabelHasPoint(ghost, opoint, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),109,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
110 | else {ierr = PetscFindInt(opoint, nleaves, leaves, &loc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),110,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); flg = loc >=0 ? PETSC_TRUE : PETSC_FALSE;} | |||
| ||||
111 | /* Not an owned entity, don't make a cell patch. */ | |||
112 | if (flg) continue; | |||
113 | ierr = PetscHSetIAdd(ht, opoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),113,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
114 | } | |||
115 | ||||
116 | /* Now build the overlap for the patch */ | |||
117 | for (overlapi = 0; overlapi < patch->pardecomp_overlap; ++overlapi) { | |||
118 | PetscInt index = 0; | |||
119 | PetscInt *htpoints = NULL((void*)0); | |||
120 | PetscInt htsize; | |||
121 | PetscInt i; | |||
122 | ||||
123 | ierr = PetscHSetIGetSize(ht, &htsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),123,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
124 | ierr = PetscMalloc1(htsize, &htpoints)PetscMallocA(1,PETSC_FALSE,124,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(htsize)*sizeof(**(&htpoints)),(&htpoints));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),124,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
125 | ierr = PetscHSetIGetElems(ht, &index, htpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),125,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
126 | ||||
127 | for (i = 0; i < htsize; ++i) { | |||
128 | PetscInt hpoint = htpoints[i]; | |||
129 | PetscInt si; | |||
130 | ||||
131 | ierr = DMPlexGetTransitiveClosure(dm, hpoint, PETSC_FALSE, &starSize, &star);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),131,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
132 | for (si = 0; si < starSize*2; si += 2) { | |||
133 | const PetscInt starp = star[si]; | |||
134 | PetscInt closureSize; | |||
135 | PetscInt *closure = NULL((void*)0), ci; | |||
136 | ||||
137 | /* now loop over all entities in the closure of starp */ | |||
138 | ierr = DMPlexGetTransitiveClosure(dm, starp, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),138,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
139 | for (ci = 0; ci < closureSize*2; ci += 2) { | |||
140 | const PetscInt closstarp = closure[ci]; | |||
141 | ierr = PetscHSetIAdd(ht, closstarp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),141,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
142 | } | |||
143 | ierr = DMPlexRestoreTransitiveClosure(dm, starp, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),143,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
144 | } | |||
145 | ierr = DMPlexRestoreTransitiveClosure(dm, hpoint, PETSC_FALSE, &starSize, &star);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),145,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
146 | } | |||
147 | ierr = PetscFree(htpoints)((*PetscTrFree)((void*)(htpoints),147,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((htpoints) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),147,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
148 | } | |||
149 | ||||
150 | 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); | |||
151 | } | |||
152 | ||||
153 | /* The user's already set the patches in patch->userIS. Build the hash tables */ | |||
154 | static PetscErrorCode PCPatchConstruct_User(void *vpatch, DM dm, PetscInt point, PetscHSetI ht) | |||
155 | { | |||
156 | PC_PATCH *patch = (PC_PATCH *) vpatch; | |||
157 | IS patchis = patch->userIS[point]; | |||
158 | PetscInt n; | |||
159 | const PetscInt *patchdata; | |||
160 | PetscInt pStart, pEnd, i; | |||
161 | PetscErrorCode ierr; | |||
162 | ||||
163 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 163; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
164 | ierr = PetscHSetIClear(ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
165 | ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),165,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
166 | ierr = ISGetLocalSize(patchis, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),166,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
167 | ierr = ISGetIndices(patchis, &patchdata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),167,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
168 | for (i = 0; i < n; ++i) { | |||
169 | const PetscInt ownedpoint = patchdata[i]; | |||
170 | ||||
171 | if (ownedpoint < pStart || ownedpoint >= pEnd) { | |||
172 | SETERRQ3(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_OUTOFRANGE, "Mesh point %D was not in [%D, %D)", ownedpoint, pStart, pEnd)return PetscError(PetscObjectComm((PetscObject) dm),172,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,63,PETSC_ERROR_INITIAL,"Mesh point %D was not in [%D, %D)",ownedpoint ,pStart,pEnd); | |||
173 | } | |||
174 | ierr = PetscHSetIAdd(ht, ownedpoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),174,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
175 | } | |||
176 | ierr = ISRestoreIndices(patchis, &patchdata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),176,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
177 | 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); | |||
178 | } | |||
179 | ||||
180 | static PetscErrorCode PCPatchCreateDefaultSF_Private(PC pc, PetscInt n, const PetscSF *sf, const PetscInt *bs) | |||
181 | { | |||
182 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
183 | PetscInt i; | |||
184 | PetscErrorCode ierr; | |||
185 | ||||
186 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 186; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
187 | if (n == 1 && bs[0] == 1) { | |||
188 | patch->defaultSF = sf[0]; | |||
189 | ierr = PetscObjectReference((PetscObject) patch->defaultSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),189,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
190 | } else { | |||
191 | PetscInt allRoots = 0, allLeaves = 0; | |||
192 | PetscInt leafOffset = 0; | |||
193 | PetscInt *ilocal = NULL((void*)0); | |||
194 | PetscSFNode *iremote = NULL((void*)0); | |||
195 | PetscInt *remoteOffsets = NULL((void*)0); | |||
196 | PetscInt index = 0; | |||
197 | PetscHMapI rankToIndex; | |||
198 | PetscInt numRanks = 0; | |||
199 | PetscSFNode *remote = NULL((void*)0); | |||
200 | PetscSF rankSF; | |||
201 | PetscInt *ranks = NULL((void*)0); | |||
202 | PetscInt *offsets = NULL((void*)0); | |||
203 | MPI_Datatype contig; | |||
204 | PetscHSetI ranksUniq; | |||
205 | ||||
206 | /* First figure out how many dofs there are in the concatenated numbering. | |||
207 | * allRoots: number of owned global dofs; | |||
208 | * allLeaves: number of visible dofs (global + ghosted). | |||
209 | */ | |||
210 | for (i = 0; i < n; ++i) { | |||
211 | PetscInt nroots, nleaves; | |||
212 | ||||
213 | ierr = PetscSFGetGraph(sf[i], &nroots, &nleaves, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),213,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
214 | allRoots += nroots * bs[i]; | |||
215 | allLeaves += nleaves * bs[i]; | |||
216 | } | |||
217 | ierr = PetscMalloc1(allLeaves, &ilocal)PetscMallocA(1,PETSC_FALSE,217,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(allLeaves)*sizeof(**(&ilocal)),(&ilocal));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),217,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
218 | ierr = PetscMalloc1(allLeaves, &iremote)PetscMallocA(1,PETSC_FALSE,218,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(allLeaves)*sizeof(**(&iremote)),(&iremote));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),218,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
219 | /* Now build an SF that just contains process connectivity. */ | |||
220 | ierr = PetscHSetICreate(&ranksUniq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),220,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
221 | for (i = 0; i < n; ++i) { | |||
222 | const PetscMPIInt *ranks = NULL((void*)0); | |||
223 | PetscInt nranks, j; | |||
224 | ||||
225 | ierr = PetscSFSetUp(sf[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),225,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
226 | ierr = PetscSFGetRanks(sf[i], &nranks, &ranks, NULL((void*)0), NULL((void*)0), NULL((void*)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/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
227 | /* These are all the ranks who communicate with me. */ | |||
228 | for (j = 0; j < nranks; ++j) { | |||
229 | ierr = PetscHSetIAdd(ranksUniq, (PetscInt) ranks[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),229,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
230 | } | |||
231 | } | |||
232 | ierr = PetscHSetIGetSize(ranksUniq, &numRanks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),232,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
233 | ierr = PetscMalloc1(numRanks, &remote)PetscMallocA(1,PETSC_FALSE,233,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numRanks)*sizeof(**(&remote)),(&remote));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),233,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
234 | ierr = PetscMalloc1(numRanks, &ranks)PetscMallocA(1,PETSC_FALSE,234,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numRanks)*sizeof(**(&ranks)),(&ranks));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),234,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
235 | ierr = PetscHSetIGetElems(ranksUniq, &index, ranks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),235,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
236 | ||||
237 | ierr = PetscHMapICreate(&rankToIndex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),237,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
238 | for (i = 0; i < numRanks; ++i) { | |||
239 | remote[i].rank = ranks[i]; | |||
240 | remote[i].index = 0; | |||
241 | ierr = PetscHMapISet(rankToIndex, ranks[i], i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),241,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
242 | } | |||
243 | ierr = PetscFree(ranks)((*PetscTrFree)((void*)(ranks),243,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((ranks) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),243,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
244 | ierr = PetscHSetIDestroy(&ranksUniq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),244,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
245 | ierr = PetscSFCreate(PetscObjectComm((PetscObject) pc), &rankSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),245,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
246 | ierr = PetscSFSetGraph(rankSF, 1, numRanks, NULL((void*)0), PETSC_OWN_POINTER, remote, PETSC_OWN_POINTER);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),246,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
247 | ierr = PetscSFSetUp(rankSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),247,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
248 | /* OK, use it to communicate the root offset on the remote | |||
249 | * processes for each subspace. */ | |||
250 | ierr = PetscMalloc1(n, &offsets)PetscMallocA(1,PETSC_FALSE,250,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(n)*sizeof(**(&offsets)),(&offsets));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),250,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
251 | ierr = PetscMalloc1(n*numRanks, &remoteOffsets)PetscMallocA(1,PETSC_FALSE,251,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(n*numRanks)*sizeof(**(&remoteOffsets)),(&remoteOffsets ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),251,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
252 | ||||
253 | offsets[0] = 0; | |||
254 | for (i = 1; i < n; ++i) { | |||
255 | PetscInt nroots; | |||
256 | ||||
257 | ierr = PetscSFGetGraph(sf[i-1], &nroots, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),257,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
258 | offsets[i] = offsets[i-1] + nroots*bs[i-1]; | |||
259 | } | |||
260 | /* Offsets are the offsets on the current process of the | |||
261 | * global dof numbering for the subspaces. */ | |||
262 | ierr = MPI_Type_contiguous(n, MPIU_INT((MPI_Datatype)0x4c000405), &contig);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),262,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
263 | ierr = MPI_Type_commit(&contig);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),263,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
264 | ||||
265 | ierr = PetscSFBcastBegin(rankSF, contig, offsets, remoteOffsets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),265,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
266 | ierr = PetscSFBcastEnd(rankSF, contig, offsets, remoteOffsets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),266,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
267 | ierr = MPI_Type_free(&contig);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
268 | ierr = PetscFree(offsets)((*PetscTrFree)((void*)(offsets),268,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((offsets) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),268,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
269 | ierr = PetscSFDestroy(&rankSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),269,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
270 | /* Now remoteOffsets contains the offsets on the remote | |||
271 | * processes who communicate with me. So now we can | |||
272 | * concatenate the list of SFs into a single one. */ | |||
273 | index = 0; | |||
274 | for (i = 0; i < n; ++i) { | |||
275 | const PetscSFNode *remote = NULL((void*)0); | |||
276 | const PetscInt *local = NULL((void*)0); | |||
277 | PetscInt nroots, nleaves, j; | |||
278 | ||||
279 | ierr = PetscSFGetGraph(sf[i], &nroots, &nleaves, &local, &remote);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),279,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
280 | for (j = 0; j < nleaves; ++j) { | |||
281 | PetscInt rank = remote[j].rank; | |||
282 | PetscInt idx, rootOffset, k; | |||
283 | ||||
284 | ierr = PetscHMapIGet(rankToIndex, rank, &idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),284,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
285 | if (idx == -1) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "Didn't find rank, huh?")return PetscError(((MPI_Comm)0x44000001),285,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,73,PETSC_ERROR_INITIAL,"Didn't find rank, huh?"); | |||
286 | /* Offset on given rank for ith subspace */ | |||
287 | rootOffset = remoteOffsets[n*idx + i]; | |||
288 | for (k = 0; k < bs[i]; ++k) { | |||
289 | ilocal[index] = (local ? local[j] : j)*bs[i] + k + leafOffset; | |||
290 | iremote[index].rank = remote[j].rank; | |||
291 | iremote[index].index = remote[j].index*bs[i] + k + rootOffset; | |||
292 | ++index; | |||
293 | } | |||
294 | } | |||
295 | leafOffset += nleaves * bs[i]; | |||
296 | } | |||
297 | ierr = PetscHMapIDestroy(&rankToIndex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),297,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
298 | ierr = PetscFree(remoteOffsets)((*PetscTrFree)((void*)(remoteOffsets),298,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((remoteOffsets) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),298,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
299 | ierr = PetscSFCreate(PetscObjectComm((PetscObject)pc), &patch->defaultSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),299,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
300 | ierr = PetscSFSetGraph(patch->defaultSF, allRoots, allLeaves, ilocal, PETSC_OWN_POINTER, iremote, PETSC_OWN_POINTER);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),300,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
301 | } | |||
302 | 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); | |||
303 | } | |||
304 | ||||
305 | /* TODO: Docs */ | |||
306 | PetscErrorCode PCPatchSetIgnoreDim(PC pc, PetscInt dim) | |||
307 | { | |||
308 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
309 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 309; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
310 | patch->ignoredim = dim; | |||
311 | 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); | |||
312 | } | |||
313 | ||||
314 | /* TODO: Docs */ | |||
315 | PetscErrorCode PCPatchGetIgnoreDim(PC pc, PetscInt *dim) | |||
316 | { | |||
317 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
318 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 318; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
319 | *dim = patch->ignoredim; | |||
320 | 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); | |||
321 | } | |||
322 | ||||
323 | /* TODO: Docs */ | |||
324 | PetscErrorCode PCPatchSetSaveOperators(PC pc, PetscBool flg) | |||
325 | { | |||
326 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
327 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 327; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
328 | patch->save_operators = flg; | |||
329 | 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); | |||
330 | } | |||
331 | ||||
332 | /* TODO: Docs */ | |||
333 | PetscErrorCode PCPatchGetSaveOperators(PC pc, PetscBool *flg) | |||
334 | { | |||
335 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
336 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 336; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
337 | *flg = patch->save_operators; | |||
338 | 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); | |||
339 | } | |||
340 | ||||
341 | /* TODO: Docs */ | |||
342 | PetscErrorCode PCPatchSetPrecomputeElementTensors(PC pc, PetscBool flg) | |||
343 | { | |||
344 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
345 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 345; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
346 | patch->precomputeElementTensors = flg; | |||
347 | 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); | |||
348 | } | |||
349 | ||||
350 | /* TODO: Docs */ | |||
351 | PetscErrorCode PCPatchGetPrecomputeElementTensors(PC pc, PetscBool *flg) | |||
352 | { | |||
353 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
354 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 354; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
355 | *flg = patch->precomputeElementTensors; | |||
356 | 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); | |||
357 | } | |||
358 | ||||
359 | /* TODO: Docs */ | |||
360 | PetscErrorCode PCPatchSetPartitionOfUnity(PC pc, PetscBool flg) | |||
361 | { | |||
362 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
363 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 363; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
364 | patch->partition_of_unity = flg; | |||
365 | 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); | |||
366 | } | |||
367 | ||||
368 | /* TODO: Docs */ | |||
369 | PetscErrorCode PCPatchGetPartitionOfUnity(PC pc, PetscBool *flg) | |||
370 | { | |||
371 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
372 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 372; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
373 | *flg = patch->partition_of_unity; | |||
374 | 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); | |||
375 | } | |||
376 | ||||
377 | /* TODO: Docs */ | |||
378 | PetscErrorCode PCPatchSetLocalComposition(PC pc, PCCompositeType type) | |||
379 | { | |||
380 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
381 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 381; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
382 | 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),382,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,56,PETSC_ERROR_INITIAL,"Only supports additive or multiplicative as the local type" ); | |||
383 | patch->local_composition_type = type; | |||
384 | 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); | |||
385 | } | |||
386 | ||||
387 | /* TODO: Docs */ | |||
388 | PetscErrorCode PCPatchGetLocalComposition(PC pc, PCCompositeType *type) | |||
389 | { | |||
390 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
391 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 391; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
392 | *type = patch->local_composition_type; | |||
393 | 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); | |||
394 | } | |||
395 | ||||
396 | /* TODO: Docs */ | |||
397 | PetscErrorCode PCPatchSetSubMatType(PC pc, MatType sub_mat_type) | |||
398 | { | |||
399 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
400 | PetscErrorCode ierr; | |||
401 | ||||
402 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 402; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
403 | if (patch->sub_mat_type) {ierr = PetscFree(patch->sub_mat_type)((*PetscTrFree)((void*)(patch->sub_mat_type),403,__func__, "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->sub_mat_type) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),403,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
404 | ierr = PetscStrallocpy(sub_mat_type, (char **) &patch->sub_mat_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),404,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
405 | 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); | |||
406 | } | |||
407 | ||||
408 | /* TODO: Docs */ | |||
409 | PetscErrorCode PCPatchGetSubMatType(PC pc, MatType *sub_mat_type) | |||
410 | { | |||
411 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
412 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 412; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
413 | *sub_mat_type = patch->sub_mat_type; | |||
414 | 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); | |||
415 | } | |||
416 | ||||
417 | /* TODO: Docs */ | |||
418 | PetscErrorCode PCPatchSetCellNumbering(PC pc, PetscSection cellNumbering) | |||
419 | { | |||
420 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
421 | PetscErrorCode ierr; | |||
422 | ||||
423 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 423; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
424 | patch->cellNumbering = cellNumbering; | |||
425 | ierr = PetscObjectReference((PetscObject) cellNumbering);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),425,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
426 | 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); | |||
427 | } | |||
428 | ||||
429 | /* TODO: Docs */ | |||
430 | PetscErrorCode PCPatchGetCellNumbering(PC pc, PetscSection *cellNumbering) | |||
431 | { | |||
432 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
433 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 433; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
434 | *cellNumbering = patch->cellNumbering; | |||
435 | 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); | |||
436 | } | |||
437 | ||||
438 | /* TODO: Docs */ | |||
439 | PetscErrorCode PCPatchSetConstructType(PC pc, PCPatchConstructType ctype, PetscErrorCode (*func)(PC, PetscInt *, IS **, IS *, void *), void *ctx) | |||
440 | { | |||
441 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
442 | ||||
443 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 443; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
444 | patch->ctype = ctype; | |||
445 | switch (ctype) { | |||
446 | case PC_PATCH_STAR: | |||
447 | patch->user_patches = PETSC_FALSE; | |||
448 | patch->patchconstructop = PCPatchConstruct_Star; | |||
449 | break; | |||
450 | case PC_PATCH_VANKA: | |||
451 | patch->user_patches = PETSC_FALSE; | |||
452 | patch->patchconstructop = PCPatchConstruct_Vanka; | |||
453 | break; | |||
454 | case PC_PATCH_PARDECOMP: | |||
455 | patch->user_patches = PETSC_FALSE; | |||
456 | patch->patchconstructop = PCPatchConstruct_Pardecomp; | |||
457 | break; | |||
458 | case PC_PATCH_USER: | |||
459 | case PC_PATCH_PYTHON: | |||
460 | patch->user_patches = PETSC_TRUE; | |||
461 | patch->patchconstructop = PCPatchConstruct_User; | |||
462 | if (func) { | |||
463 | patch->userpatchconstructionop = func; | |||
464 | patch->userpatchconstructctx = ctx; | |||
465 | } | |||
466 | break; | |||
467 | default: | |||
468 | SETERRQ1(PetscObjectComm((PetscObject) pc), PETSC_ERR_USER, "Unknown patch construction type %D", (PetscInt) patch->ctype)return PetscError(PetscObjectComm((PetscObject) pc),468,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,83,PETSC_ERROR_INITIAL,"Unknown patch construction type %D", (PetscInt) patch->ctype); | |||
469 | } | |||
470 | 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); | |||
471 | } | |||
472 | ||||
473 | /* TODO: Docs */ | |||
474 | PetscErrorCode PCPatchGetConstructType(PC pc, PCPatchConstructType *ctype, PetscErrorCode (**func)(PC, PetscInt *, IS **, IS *, void *), void **ctx) | |||
475 | { | |||
476 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
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/patch/pcpatch.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 | *ctype = patch->ctype; | |||
480 | switch (patch->ctype) { | |||
481 | case PC_PATCH_STAR: | |||
482 | case PC_PATCH_VANKA: | |||
483 | case PC_PATCH_PARDECOMP: | |||
484 | break; | |||
485 | case PC_PATCH_USER: | |||
486 | case PC_PATCH_PYTHON: | |||
487 | *func = patch->userpatchconstructionop; | |||
488 | *ctx = patch->userpatchconstructctx; | |||
489 | break; | |||
490 | default: | |||
491 | SETERRQ1(PetscObjectComm((PetscObject) pc), PETSC_ERR_USER, "Unknown patch construction type %D", (PetscInt) patch->ctype)return PetscError(PetscObjectComm((PetscObject) pc),491,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,83,PETSC_ERROR_INITIAL,"Unknown patch construction type %D", (PetscInt) patch->ctype); | |||
492 | } | |||
493 | 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); | |||
494 | } | |||
495 | ||||
496 | /* TODO: Docs */ | |||
497 | PetscErrorCode PCPatchSetDiscretisationInfo(PC pc, PetscInt nsubspaces, DM *dms, PetscInt *bs, PetscInt *nodesPerCell, const PetscInt **cellNodeMap, | |||
498 | const PetscInt *subspaceOffsets, PetscInt numGhostBcs, const PetscInt *ghostBcNodes, PetscInt numGlobalBcs, const PetscInt *globalBcNodes) | |||
499 | { | |||
500 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
501 | DM dm, plex; | |||
502 | PetscSF *sfs; | |||
503 | PetscInt cStart, cEnd, i, j; | |||
504 | PetscErrorCode ierr; | |||
505 | ||||
506 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 506; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
507 | ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),507,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
508 | ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),508,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
509 | dm = plex; | |||
510 | ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),510,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
511 | ierr = PetscMalloc1(nsubspaces, &sfs)PetscMallocA(1,PETSC_FALSE,511,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(nsubspaces)*sizeof(**(&sfs)),(&sfs));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),511,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
512 | ierr = PetscMalloc1(nsubspaces, &patch->dofSection)PetscMallocA(1,PETSC_FALSE,512,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(nsubspaces)*sizeof(**(&patch->dofSection)),( &patch->dofSection));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),512,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
513 | ierr = PetscMalloc1(nsubspaces, &patch->bs)PetscMallocA(1,PETSC_FALSE,513,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(nsubspaces)*sizeof(**(&patch->bs)),(&patch ->bs));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),513,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
514 | ierr = PetscMalloc1(nsubspaces, &patch->nodesPerCell)PetscMallocA(1,PETSC_FALSE,514,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(nsubspaces)*sizeof(**(&patch->nodesPerCell)) ,(&patch->nodesPerCell));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),514,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
515 | ierr = PetscMalloc1(nsubspaces, &patch->cellNodeMap)PetscMallocA(1,PETSC_FALSE,515,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(nsubspaces)*sizeof(**(&patch->cellNodeMap)), (&patch->cellNodeMap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),515,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
516 | ierr = PetscMalloc1(nsubspaces+1, &patch->subspaceOffsets)PetscMallocA(1,PETSC_FALSE,516,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(nsubspaces+1)*sizeof(**(&patch->subspaceOffsets )),(&patch->subspaceOffsets));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),516,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
517 | ||||
518 | patch->nsubspaces = nsubspaces; | |||
519 | patch->totalDofsPerCell = 0; | |||
520 | for (i = 0; i < nsubspaces; ++i) { | |||
521 | ierr = DMGetDefaultSection(dms[i], &patch->dofSection[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),521,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
522 | ierr = PetscObjectReference((PetscObject) patch->dofSection[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),522,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
523 | ierr = DMGetDefaultSF(dms[i], &sfs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),523,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
524 | patch->bs[i] = bs[i]; | |||
525 | patch->nodesPerCell[i] = nodesPerCell[i]; | |||
526 | patch->totalDofsPerCell += nodesPerCell[i]*bs[i]; | |||
527 | ierr = PetscMalloc1((cEnd-cStart)*nodesPerCell[i], &patch->cellNodeMap[i])PetscMallocA(1,PETSC_FALSE,527,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)((cEnd-cStart)*nodesPerCell[i])*sizeof(**(&patch ->cellNodeMap[i])),(&patch->cellNodeMap[i]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),527,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
528 | for (j = 0; j < (cEnd-cStart)*nodesPerCell[i]; ++j) patch->cellNodeMap[i][j] = cellNodeMap[i][j]; | |||
529 | patch->subspaceOffsets[i] = subspaceOffsets[i]; | |||
530 | } | |||
531 | ierr = PCPatchCreateDefaultSF_Private(pc, nsubspaces, sfs, patch->bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),531,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
532 | ierr = PetscFree(sfs)((*PetscTrFree)((void*)(sfs),532,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((sfs) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),532,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
533 | ||||
534 | patch->subspaceOffsets[nsubspaces] = subspaceOffsets[nsubspaces]; | |||
535 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numGhostBcs, ghostBcNodes, PETSC_COPY_VALUES, &patch->ghostBcNodes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),535,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
536 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numGlobalBcs, globalBcNodes, PETSC_COPY_VALUES, &patch->globalBcNodes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),536,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
537 | ierr = DMDestroy(&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),537,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
538 | 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); | |||
539 | } | |||
540 | ||||
541 | /* TODO: Docs */ | |||
542 | PetscErrorCode PCPatchSetDiscretisationInfoCombined(PC pc, DM dm, PetscInt *nodesPerCell, const PetscInt **cellNodeMap, PetscInt numGhostBcs, const PetscInt *ghostBcNodes, PetscInt numGlobalBcs, const PetscInt *globalBcNodes) | |||
543 | { | |||
544 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
545 | PetscInt cStart, cEnd, i, j; | |||
546 | PetscErrorCode ierr; | |||
547 | ||||
548 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 548; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
549 | patch->combined = PETSC_TRUE; | |||
550 | ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),550,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
551 | ierr = DMGetNumFields(dm, &patch->nsubspaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),551,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
552 | ierr = PetscCalloc1(patch->nsubspaces, &patch->dofSection)PetscMallocA(1,PETSC_TRUE,552,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->nsubspaces)*sizeof(**(&patch->dofSection )),(&patch->dofSection));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),552,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
553 | ierr = PetscMalloc1(patch->nsubspaces, &patch->bs)PetscMallocA(1,PETSC_FALSE,553,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->nsubspaces)*sizeof(**(&patch->bs)) ,(&patch->bs));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),553,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
554 | ierr = PetscMalloc1(patch->nsubspaces, &patch->nodesPerCell)PetscMallocA(1,PETSC_FALSE,554,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->nsubspaces)*sizeof(**(&patch->nodesPerCell )),(&patch->nodesPerCell));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),554,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
555 | ierr = PetscMalloc1(patch->nsubspaces, &patch->cellNodeMap)PetscMallocA(1,PETSC_FALSE,555,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->nsubspaces)*sizeof(**(&patch->cellNodeMap )),(&patch->cellNodeMap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),555,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
556 | ierr = PetscCalloc1(patch->nsubspaces+1, &patch->subspaceOffsets)PetscMallocA(1,PETSC_TRUE,556,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->nsubspaces+1)*sizeof(**(&patch->subspaceOffsets )),(&patch->subspaceOffsets));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),556,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
557 | ierr = DMGetDefaultSection(dm, &patch->dofSection[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),557,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
558 | ierr = PetscObjectReference((PetscObject) patch->dofSection[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),558,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
559 | ierr = PetscSectionGetStorageSize(patch->dofSection[0], &patch->subspaceOffsets[patch->nsubspaces]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),559,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
560 | patch->totalDofsPerCell = 0; | |||
561 | for (i = 0; i < patch->nsubspaces; ++i) { | |||
562 | patch->bs[i] = 1; | |||
563 | patch->nodesPerCell[i] = nodesPerCell[i]; | |||
564 | patch->totalDofsPerCell += nodesPerCell[i]; | |||
565 | ierr = PetscMalloc1((cEnd-cStart)*nodesPerCell[i], &patch->cellNodeMap[i])PetscMallocA(1,PETSC_FALSE,565,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)((cEnd-cStart)*nodesPerCell[i])*sizeof(**(&patch ->cellNodeMap[i])),(&patch->cellNodeMap[i]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),565,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
566 | for (j = 0; j < (cEnd-cStart)*nodesPerCell[i]; ++j) patch->cellNodeMap[i][j] = cellNodeMap[i][j]; | |||
567 | } | |||
568 | ierr = DMGetDefaultSF(dm, &patch->defaultSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),568,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
569 | ierr = PetscObjectReference((PetscObject) patch->defaultSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),569,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
570 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numGhostBcs, ghostBcNodes, PETSC_COPY_VALUES, &patch->ghostBcNodes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),570,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
571 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numGlobalBcs, globalBcNodes, PETSC_COPY_VALUES, &patch->globalBcNodes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),571,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
572 | 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); | |||
573 | } | |||
574 | ||||
575 | /*@C | |||
576 | ||||
577 | PCPatchSetComputeFunction - Set the callback used to compute patch residuals | |||
578 | ||||
579 | Logically collective on PC | |||
580 | ||||
581 | Input Parameters: | |||
582 | + pc - The PC | |||
583 | . func - The callback | |||
584 | - ctx - The user context | |||
585 | ||||
586 | Calling sequence of func: | |||
587 | $ func (PC pc,PetscInt point,Vec x,Vec f,IS cellIS,PetscInt n,const PetscInt* dofsArray,const PetscInt* dofsArrayWithAll,void* ctx) | |||
588 | ||||
589 | + pc - The PC | |||
590 | . point - The point | |||
591 | . x - The input solution (not used in linear problems) | |||
592 | . f - The patch residual vector | |||
593 | . cellIS - An array of the cell numbers | |||
594 | . n - The size of dofsArray | |||
595 | . dofsArray - The dofmap for the dofs to be solved for | |||
596 | . dofsArrayWithAll - The dofmap for all dofs on the patch | |||
597 | - ctx - The user context | |||
598 | ||||
599 | Level: advanced | |||
600 | ||||
601 | Notes: | |||
602 | The entries of F (the output residual vector) have been set to zero before the call. | |||
603 | ||||
604 | .seealso: PCPatchSetComputeOperator(), PCPatchGetComputeOperator(), PCPatchSetDiscretisationInfo(), PCPatchSetComputeFunctionInteriorFacets() | |||
605 | @*/ | |||
606 | PetscErrorCode PCPatchSetComputeFunction(PC pc, PetscErrorCode (*func)(PC, PetscInt, Vec, Vec, IS, PetscInt, const PetscInt *, const PetscInt *, void *), void *ctx) | |||
607 | { | |||
608 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
609 | ||||
610 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 610; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
611 | patch->usercomputef = func; | |||
612 | patch->usercomputefctx = ctx; | |||
613 | 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); | |||
614 | } | |||
615 | ||||
616 | /*@C | |||
617 | ||||
618 | PCPatchSetComputeFunctionInteriorFacets - Set the callback used to compute facet integrals for patch residuals | |||
619 | ||||
620 | Logically collective on PC | |||
621 | ||||
622 | Input Parameters: | |||
623 | + pc - The PC | |||
624 | . func - The callback | |||
625 | - ctx - The user context | |||
626 | ||||
627 | Calling sequence of func: | |||
628 | $ func (PC pc,PetscInt point,Vec x,Vec f,IS facetIS,PetscInt n,const PetscInt* dofsArray,const PetscInt* dofsArrayWithAll,void* ctx) | |||
629 | ||||
630 | + pc - The PC | |||
631 | . point - The point | |||
632 | . x - The input solution (not used in linear problems) | |||
633 | . f - The patch residual vector | |||
634 | . facetIS - An array of the facet numbers | |||
635 | . n - The size of dofsArray | |||
636 | . dofsArray - The dofmap for the dofs to be solved for | |||
637 | . dofsArrayWithAll - The dofmap for all dofs on the patch | |||
638 | - ctx - The user context | |||
639 | ||||
640 | Level: advanced | |||
641 | ||||
642 | Notes: | |||
643 | The entries of F (the output residual vector) have been set to zero before the call. | |||
644 | ||||
645 | .seealso: PCPatchSetComputeOperator(), PCPatchGetComputeOperator(), PCPatchSetDiscretisationInfo(), PCPatchSetComputeFunction() | |||
646 | @*/ | |||
647 | PetscErrorCode PCPatchSetComputeFunctionInteriorFacets(PC pc, PetscErrorCode (*func)(PC, PetscInt, Vec, Vec, IS, PetscInt, const PetscInt *, const PetscInt *, void *), void *ctx) | |||
648 | { | |||
649 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
650 | ||||
651 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 651; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
652 | patch->usercomputefintfacet = func; | |||
653 | patch->usercomputefintfacetctx = ctx; | |||
654 | 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); | |||
655 | } | |||
656 | ||||
657 | /*@C | |||
658 | ||||
659 | PCPatchSetComputeOperator - Set the callback used to compute patch matrices | |||
660 | ||||
661 | Logically collective on PC | |||
662 | ||||
663 | Input Parameters: | |||
664 | + pc - The PC | |||
665 | . func - The callback | |||
666 | - ctx - The user context | |||
667 | ||||
668 | Calling sequence of func: | |||
669 | $ func (PC pc,PetscInt point,Vec x,Mat mat,IS facetIS,PetscInt n,const PetscInt* dofsArray,const PetscInt* dofsArrayWithAll,void* ctx) | |||
670 | ||||
671 | + pc - The PC | |||
672 | . point - The point | |||
673 | . x - The input solution (not used in linear problems) | |||
674 | . mat - The patch matrix | |||
675 | . cellIS - An array of the cell numbers | |||
676 | . n - The size of dofsArray | |||
677 | . dofsArray - The dofmap for the dofs to be solved for | |||
678 | . dofsArrayWithAll - The dofmap for all dofs on the patch | |||
679 | - ctx - The user context | |||
680 | ||||
681 | Level: advanced | |||
682 | ||||
683 | Notes: | |||
684 | The matrix entries have been set to zero before the call. | |||
685 | ||||
686 | .seealso: PCPatchGetComputeOperator(), PCPatchSetComputeFunction(), PCPatchSetDiscretisationInfo() | |||
687 | @*/ | |||
688 | PetscErrorCode PCPatchSetComputeOperator(PC pc, PetscErrorCode (*func)(PC, PetscInt, Vec, Mat, IS, PetscInt, const PetscInt *, const PetscInt *, void *), void *ctx) | |||
689 | { | |||
690 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
691 | ||||
692 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 692; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
693 | patch->usercomputeop = func; | |||
694 | patch->usercomputeopctx = ctx; | |||
695 | 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); | |||
696 | } | |||
697 | ||||
698 | /*@C | |||
699 | ||||
700 | PCPatchSetComputeOperatorInteriorFacets - Set the callback used to compute facet integrals for patch matrices | |||
701 | ||||
702 | Logically collective on PC | |||
703 | ||||
704 | Input Parameters: | |||
705 | + pc - The PC | |||
706 | . func - The callback | |||
707 | - ctx - The user context | |||
708 | ||||
709 | Calling sequence of func: | |||
710 | $ func (PC pc,PetscInt point,Vec x,Mat mat,IS facetIS,PetscInt n,const PetscInt* dofsArray,const PetscInt* dofsArrayWithAll,void* ctx) | |||
711 | ||||
712 | + pc - The PC | |||
713 | . point - The point | |||
714 | . x - The input solution (not used in linear problems) | |||
715 | . mat - The patch matrix | |||
716 | . facetIS - An array of the facet numbers | |||
717 | . n - The size of dofsArray | |||
718 | . dofsArray - The dofmap for the dofs to be solved for | |||
719 | . dofsArrayWithAll - The dofmap for all dofs on the patch | |||
720 | - ctx - The user context | |||
721 | ||||
722 | Level: advanced | |||
723 | ||||
724 | Notes: | |||
725 | The matrix entries have been set to zero before the call. | |||
726 | ||||
727 | .seealso: PCPatchGetComputeOperator(), PCPatchSetComputeFunction(), PCPatchSetDiscretisationInfo() | |||
728 | @*/ | |||
729 | PetscErrorCode PCPatchSetComputeOperatorInteriorFacets(PC pc, PetscErrorCode (*func)(PC, PetscInt, Vec, Mat, IS, PetscInt, const PetscInt *, const PetscInt *, void *), void *ctx) | |||
730 | { | |||
731 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
732 | ||||
733 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 733; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
734 | patch->usercomputeopintfacet = func; | |||
735 | patch->usercomputeopintfacetctx = ctx; | |||
736 | 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); | |||
737 | } | |||
738 | ||||
739 | /* On entry, ht contains the topological entities whose dofs we are responsible for solving for; | |||
740 | on exit, cht contains all the topological entities we need to compute their residuals. | |||
741 | In full generality this should incorporate knowledge of the sparsity pattern of the matrix; | |||
742 | here we assume a standard FE sparsity pattern.*/ | |||
743 | /* TODO: Use DMPlexGetAdjacency() */ | |||
744 | static PetscErrorCode PCPatchCompleteCellPatch(PC pc, PetscHSetI ht, PetscHSetI cht) | |||
745 | { | |||
746 | DM dm, plex; | |||
747 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
748 | PetscHashIter hi; | |||
749 | PetscInt point; | |||
750 | PetscInt *star = NULL((void*)0), *closure = NULL((void*)0); | |||
751 | PetscInt ignoredim, iStart = 0, iEnd = -1, starSize, closureSize, si, ci; | |||
752 | PetscInt *fStar = NULL((void*)0), *fClosure = NULL((void*)0); | |||
753 | PetscInt fBegin, fEnd, fsi, fci, fStarSize, fClosureSize; | |||
754 | PetscErrorCode ierr; | |||
755 | ||||
756 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 756; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
757 | ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),757,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
758 | ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),758,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
759 | dm = plex; | |||
760 | ierr = DMPlexGetHeightStratum(dm, 1, &fBegin, &fEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),760,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
761 | ierr = PCPatchGetIgnoreDim(pc, &ignoredim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),761,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
762 | if (ignoredim >= 0) {ierr = DMPlexGetDepthStratum(dm, ignoredim, &iStart, &iEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),762,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
763 | ierr = PetscHSetIClear(cht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),763,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
764 | PetscHashIterBegin(ht, hi)do { (hi) = (khint_t)(0); if ((hi) != (((ht))->n_buckets) && !(!((((ht))->flags[((hi))>>4]>>((((hi))&0xfU )<<1))&3))) do { ++((hi)); } while (((hi)) != ((((ht )))->n_buckets) && !(!(((((ht)))->flags[(((hi)) )>>4]>>(((((hi)))&0xfU)<<1))&3))); } while (0); | |||
765 | while (!PetscHashIterAtEnd(ht, hi)((hi) == (((ht))->n_buckets))) { | |||
766 | ||||
767 | PetscHashIterGetKey(ht, hi, point)((point) = (((ht))->keys[(hi)])); | |||
768 | PetscHashIterNext(ht, hi)do { ++(hi); } while ((hi) != (((ht))->n_buckets) && !(!((((ht))->flags[((hi))>>4]>>((((hi))&0xfU )<<1))&3))); | |||
769 | ||||
770 | /* Loop over all the cells that this point connects to */ | |||
771 | ierr = DMPlexGetTransitiveClosure(dm, point, PETSC_FALSE, &starSize, &star);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),771,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
772 | for (si = 0; si < starSize*2; si += 2) { | |||
773 | const PetscInt ownedpoint = star[si]; | |||
774 | /* TODO Check for point in cht before running through closure again */ | |||
775 | /* now loop over all entities in the closure of that cell */ | |||
776 | ierr = DMPlexGetTransitiveClosure(dm, ownedpoint, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),776,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
777 | for (ci = 0; ci < closureSize*2; ci += 2) { | |||
778 | const PetscInt seenpoint = closure[ci]; | |||
779 | if (ignoredim >= 0 && seenpoint >= iStart && seenpoint < iEnd) continue; | |||
780 | ierr = PetscHSetIAdd(cht, seenpoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),780,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
781 | /* Facet integrals couple dofs across facets, so in that case for each of | |||
782 | * the facets we need to add all dofs on the other side of the facet to | |||
783 | * the seen dofs. */ | |||
784 | if(patch->usercomputeopintfacet){ | |||
785 | if(fBegin <= seenpoint && seenpoint < fEnd){ | |||
786 | ierr = DMPlexGetTransitiveClosure(dm, seenpoint, PETSC_FALSE, &fStarSize, &fStar);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),786,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
787 | for (fsi = 0; fsi < fStarSize*2; fsi += 2) { | |||
788 | ierr = DMPlexGetTransitiveClosure(dm, fStar[fsi], PETSC_TRUE, &fClosureSize, &fClosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),788,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
789 | for (fci = 0; fci < fClosureSize*2; fci += 2) { | |||
790 | ierr = PetscHSetIAdd(cht, fClosure[fci]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),790,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
791 | } | |||
792 | ierr = DMPlexRestoreTransitiveClosure(dm, fStar[fsi], PETSC_TRUE, NULL((void*)0), &fClosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),792,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
793 | } | |||
794 | ierr = DMPlexRestoreTransitiveClosure(dm, seenpoint, PETSC_FALSE, NULL((void*)0), &fStar);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),794,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
795 | } | |||
796 | } | |||
797 | } | |||
798 | ierr = DMPlexRestoreTransitiveClosure(dm, ownedpoint, PETSC_TRUE, NULL((void*)0), &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),798,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
799 | } | |||
800 | ierr = DMPlexRestoreTransitiveClosure(dm, point, PETSC_FALSE, NULL((void*)0), &star);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),800,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
801 | } | |||
802 | ierr = DMDestroy(&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),802,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
803 | 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); | |||
804 | } | |||
805 | ||||
806 | static PetscErrorCode PCPatchGetGlobalDofs(PC pc, PetscSection dofSection[], PetscInt f, PetscBool combined, PetscInt p, PetscInt *dof, PetscInt *off) | |||
807 | { | |||
808 | PetscErrorCode ierr; | |||
809 | ||||
810 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 810; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
811 | if (combined) { | |||
812 | if (f < 0) { | |||
813 | if (dof) {ierr = PetscSectionGetDof(dofSection[0], p, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),813,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
814 | if (off) {ierr = PetscSectionGetOffset(dofSection[0], p, off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),814,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
815 | } else { | |||
816 | if (dof) {ierr = PetscSectionGetFieldDof(dofSection[0], p, f, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),816,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
817 | if (off) {ierr = PetscSectionGetFieldOffset(dofSection[0], p, f, off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),817,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
818 | } | |||
819 | } else { | |||
820 | if (f < 0) { | |||
821 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
822 | PetscInt fdof, g; | |||
823 | ||||
824 | if (dof) { | |||
825 | *dof = 0; | |||
826 | for (g = 0; g < patch->nsubspaces; ++g) { | |||
827 | ierr = PetscSectionGetDof(dofSection[g], p, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),827,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
828 | *dof += fdof; | |||
829 | } | |||
830 | } | |||
831 | if (off) { | |||
832 | *off = 0; | |||
833 | for (g = 0; g < patch->nsubspaces; ++g) { | |||
834 | ierr = PetscSectionGetOffset(dofSection[g], p, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),834,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
835 | *off += fdof; | |||
836 | } | |||
837 | } | |||
838 | } else { | |||
839 | if (dof) {ierr = PetscSectionGetDof(dofSection[f], p, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),839,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
840 | if (off) {ierr = PetscSectionGetOffset(dofSection[f], p, off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),840,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
841 | } | |||
842 | } | |||
843 | 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); | |||
844 | } | |||
845 | ||||
846 | /* Given a hash table with a set of topological entities (pts), compute the degrees of | |||
847 | freedom in global concatenated numbering on those entities. | |||
848 | For Vanka smoothing, this needs to do something special: ignore dofs of the | |||
849 | constraint subspace on entities that aren't the base entity we're building the patch | |||
850 | around. */ | |||
851 | static PetscErrorCode PCPatchGetPointDofs(PC pc, PetscHSetI pts, PetscHSetI dofs, PetscInt base, PetscHSetI* subspaces_to_exclude) | |||
852 | { | |||
853 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
854 | PetscHashIter hi; | |||
855 | PetscInt ldof, loff; | |||
856 | PetscInt k, p; | |||
857 | PetscErrorCode ierr; | |||
858 | ||||
859 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 859; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
860 | ierr = PetscHSetIClear(dofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),860,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
861 | for (k = 0; k < patch->nsubspaces; ++k) { | |||
862 | PetscInt subspaceOffset = patch->subspaceOffsets[k]; | |||
863 | PetscInt bs = patch->bs[k]; | |||
864 | PetscInt j, l; | |||
865 | ||||
866 | if (subspaces_to_exclude != NULL((void*)0)) { | |||
867 | PetscBool should_exclude_k = PETSC_FALSE; | |||
868 | PetscHSetIHas(*subspaces_to_exclude, k, &should_exclude_k); | |||
869 | if (should_exclude_k) { | |||
870 | /* only get this subspace dofs at the base entity, not any others */ | |||
871 | ierr = PCPatchGetGlobalDofs(pc, patch->dofSection, k, patch->combined, base, &ldof, &loff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),871,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
872 | if (0 == ldof) continue; | |||
873 | for (j = loff; j < ldof + loff; ++j) { | |||
874 | for (l = 0; l < bs; ++l) { | |||
875 | PetscInt dof = bs*j + l + subspaceOffset; | |||
876 | ierr = PetscHSetIAdd(dofs, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),876,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
877 | } | |||
878 | } | |||
879 | continue; /* skip the other dofs of this subspace */ | |||
880 | } | |||
881 | } | |||
882 | ||||
883 | PetscHashIterBegin(pts, hi)do { (hi) = (khint_t)(0); if ((hi) != (((pts))->n_buckets) && !(!((((pts))->flags[((hi))>>4]>>(( ((hi))&0xfU)<<1))&3))) do { ++((hi)); } while ( ((hi)) != ((((pts)))->n_buckets) && !(!(((((pts))) ->flags[(((hi)))>>4]>>(((((hi)))&0xfU)<< 1))&3))); } while (0); | |||
884 | while (!PetscHashIterAtEnd(pts, hi)((hi) == (((pts))->n_buckets))) { | |||
885 | PetscHashIterGetKey(pts, hi, p)((p) = (((pts))->keys[(hi)])); | |||
886 | PetscHashIterNext(pts, hi)do { ++(hi); } while ((hi) != (((pts))->n_buckets) && !(!((((pts))->flags[((hi))>>4]>>((((hi))& 0xfU)<<1))&3))); | |||
887 | ierr = PCPatchGetGlobalDofs(pc, patch->dofSection, k, patch->combined, p, &ldof, &loff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),887,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
888 | if (0 == ldof) continue; | |||
889 | for (j = loff; j < ldof + loff; ++j) { | |||
890 | for (l = 0; l < bs; ++l) { | |||
891 | PetscInt dof = bs*j + l + subspaceOffset; | |||
892 | ierr = PetscHSetIAdd(dofs, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),892,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
893 | } | |||
894 | } | |||
895 | } | |||
896 | } | |||
897 | 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); | |||
898 | } | |||
899 | ||||
900 | /* Given two hash tables A and B, compute the keys in B that are not in A, and put them in C */ | |||
901 | static PetscErrorCode PCPatchComputeSetDifference_Private(PetscHSetI A, PetscHSetI B, PetscHSetI C) | |||
902 | { | |||
903 | PetscHashIter hi; | |||
904 | PetscInt key; | |||
905 | PetscBool flg; | |||
906 | PetscErrorCode ierr; | |||
907 | ||||
908 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 908; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
909 | ierr = PetscHSetIClear(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),909,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
910 | PetscHashIterBegin(B, hi)do { (hi) = (khint_t)(0); if ((hi) != (((B))->n_buckets) && !(!((((B))->flags[((hi))>>4]>>((((hi))&0xfU )<<1))&3))) do { ++((hi)); } while (((hi)) != ((((B )))->n_buckets) && !(!(((((B)))->flags[(((hi))) >>4]>>(((((hi)))&0xfU)<<1))&3))); } while (0); | |||
911 | while (!PetscHashIterAtEnd(B, hi)((hi) == (((B))->n_buckets))) { | |||
912 | PetscHashIterGetKey(B, hi, key)((key) = (((B))->keys[(hi)])); | |||
913 | PetscHashIterNext(B, hi)do { ++(hi); } while ((hi) != (((B))->n_buckets) && !(!((((B))->flags[((hi))>>4]>>((((hi))&0xfU )<<1))&3))); | |||
914 | ierr = PetscHSetIHas(A, key, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),914,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
915 | if (!flg) {ierr = PetscHSetIAdd(C, key);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),915,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
916 | } | |||
917 | 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); | |||
918 | } | |||
919 | ||||
920 | /* | |||
921 | * PCPatchCreateCellPatches - create patches. | |||
922 | * | |||
923 | * Input Parameters: | |||
924 | * + dm - The DMPlex object defining the mesh | |||
925 | * | |||
926 | * Output Parameters: | |||
927 | * + cellCounts - Section with counts of cells around each vertex | |||
928 | * . cells - IS of the cell point indices of cells in each patch | |||
929 | * . pointCounts - Section with counts of cells around each vertex | |||
930 | * - point - IS of the cell point indices of cells in each patch | |||
931 | */ | |||
932 | static PetscErrorCode PCPatchCreateCellPatches(PC pc) | |||
933 | { | |||
934 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
935 | DMLabel ghost = NULL((void*)0); | |||
936 | DM dm, plex; | |||
937 | PetscHSetI ht, cht; | |||
938 | PetscSection cellCounts, pointCounts, intFacetCounts, extFacetCounts; | |||
939 | PetscInt *cellsArray, *pointsArray, *intFacetsArray, *extFacetsArray, *intFacetsToPatchCell; | |||
940 | PetscInt numCells, numPoints, numIntFacets, numExtFacets; | |||
941 | const PetscInt *leaves; | |||
942 | PetscInt nleaves, pStart, pEnd, cStart, cEnd, vStart, vEnd, fStart, fEnd, v; | |||
943 | PetscBool isFiredrake; | |||
944 | PetscErrorCode ierr; | |||
945 | ||||
946 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 946; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
947 | /* Used to keep track of the cells in the patch. */ | |||
948 | ierr = PetscHSetICreate(&ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),948,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
949 | ierr = PetscHSetICreate(&cht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),949,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
950 | ||||
951 | ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),951,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
952 | if (!dm) SETERRQ(PetscObjectComm((PetscObject) pc), PETSC_ERR_ARG_WRONGSTATE, "DM not yet set on patch PC\n")return PetscError(PetscObjectComm((PetscObject) pc),952,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,73,PETSC_ERROR_INITIAL,"DM not yet set on patch PC\n"); | |||
953 | ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),953,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
954 | dm = plex; | |||
955 | ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),955,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
956 | ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),956,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
957 | ||||
958 | if (patch->user_patches) { | |||
959 | ierr = patch->userpatchconstructionop(pc, &patch->npatch, &patch->userIS, &patch->iterationSet, patch->userpatchconstructctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),959,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
960 | vStart = 0; vEnd = patch->npatch; | |||
961 | } else if (patch->ctype == PC_PATCH_PARDECOMP) { | |||
962 | vStart = 0; vEnd = 1; | |||
963 | } else if (patch->codim < 0) { | |||
964 | if (patch->dim < 0) {ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),964,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
965 | else {ierr = DMPlexGetDepthStratum(dm, patch->dim, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),965,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
966 | } else {ierr = DMPlexGetHeightStratum(dm, patch->codim, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),966,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
967 | patch->npatch = vEnd - vStart; | |||
968 | ||||
969 | /* These labels mark the owned points. We only create patches around points that this process owns. */ | |||
970 | ierr = DMHasLabel(dm, "pyop2_ghost", &isFiredrake);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),970,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
971 | if (isFiredrake) { | |||
972 | ierr = DMGetLabel(dm, "pyop2_ghost", &ghost);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),972,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
973 | ierr = DMLabelCreateIndex(ghost, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),973,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
974 | } else { | |||
975 | PetscSF sf; | |||
976 | ||||
977 | ierr = DMGetPointSF(dm, &sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),977,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
978 | ierr = PetscSFGetGraph(sf, NULL((void*)0), &nleaves, &leaves, NULL((void*)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/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
979 | nleaves = PetscMax(nleaves, 0)(((nleaves)<(0)) ? (0) : (nleaves)); | |||
980 | } | |||
981 | ||||
982 | ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->cellCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),982,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
983 | ierr = PetscObjectSetName((PetscObject) patch->cellCounts, "Patch Cell Layout");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),983,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
984 | cellCounts = patch->cellCounts; | |||
985 | ierr = PetscSectionSetChart(cellCounts, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),985,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
986 | ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->pointCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),986,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
987 | ierr = PetscObjectSetName((PetscObject) patch->pointCounts, "Patch Point Layout");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),987,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
988 | pointCounts = patch->pointCounts; | |||
989 | ierr = PetscSectionSetChart(pointCounts, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),989,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
990 | ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->extFacetCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),990,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
991 | ierr = PetscObjectSetName((PetscObject) patch->extFacetCounts, "Patch Exterior Facet Layout");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),991,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
992 | extFacetCounts = patch->extFacetCounts; | |||
993 | ierr = PetscSectionSetChart(extFacetCounts, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),993,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
994 | ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->intFacetCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),994,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
995 | ierr = PetscObjectSetName((PetscObject) patch->intFacetCounts, "Patch Interior Facet Layout");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),995,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
996 | intFacetCounts = patch->intFacetCounts; | |||
997 | ierr = PetscSectionSetChart(intFacetCounts, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),997,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
998 | /* Count cells and points in the patch surrounding each entity */ | |||
999 | ierr = DMPlexGetHeightStratum(dm, 1, &fStart, &fEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),999,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1000 | for (v = vStart; v < vEnd; ++v) { | |||
1001 | PetscHashIter hi; | |||
1002 | PetscInt chtSize, loc = -1; | |||
1003 | PetscBool flg; | |||
1004 | ||||
1005 | if (!patch->user_patches && patch->ctype != PC_PATCH_PARDECOMP) { | |||
1006 | if (ghost) {ierr = DMLabelHasPoint(ghost, v, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1006,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1007 | else {ierr = PetscFindInt(v, nleaves, leaves, &loc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1007,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); flg = loc >=0 ? PETSC_TRUE : PETSC_FALSE;} | |||
1008 | /* Not an owned entity, don't make a cell patch. */ | |||
1009 | if (flg) continue; | |||
1010 | } | |||
1011 | ||||
1012 | ierr = patch->patchconstructop((void *) patch, dm, v, ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1012,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1013 | ierr = PCPatchCompleteCellPatch(pc, ht, cht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1013,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1014 | ierr = PetscHSetIGetSize(cht, &chtSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1014,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1015 | /* empty patch, continue */ | |||
1016 | if (chtSize == 0) continue; | |||
1017 | ||||
1018 | /* safe because size(cht) > 0 from above */ | |||
1019 | PetscHashIterBegin(cht, hi)do { (hi) = (khint_t)(0); if ((hi) != (((cht))->n_buckets) && !(!((((cht))->flags[((hi))>>4]>>(( ((hi))&0xfU)<<1))&3))) do { ++((hi)); } while ( ((hi)) != ((((cht)))->n_buckets) && !(!(((((cht))) ->flags[(((hi)))>>4]>>(((((hi)))&0xfU)<< 1))&3))); } while (0); | |||
1020 | while (!PetscHashIterAtEnd(cht, hi)((hi) == (((cht))->n_buckets))) { | |||
1021 | PetscInt point, pdof; | |||
1022 | ||||
1023 | PetscHashIterGetKey(cht, hi, point)((point) = (((cht))->keys[(hi)])); | |||
1024 | if (fStart <= point && point < fEnd) { | |||
1025 | const PetscInt *support; | |||
1026 | PetscInt supportSize, p; | |||
1027 | PetscBool interior = PETSC_TRUE; | |||
1028 | ierr = DMPlexGetSupport(dm, point, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1028,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1029 | ierr = DMPlexGetSupportSize(dm, point, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1029,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1030 | if (supportSize == 1) { | |||
1031 | interior = PETSC_FALSE; | |||
1032 | } else { | |||
1033 | for (p = 0; p < supportSize; p++) { | |||
1034 | PetscBool found; | |||
1035 | /* FIXME: can I do this while iterating over cht? */ | |||
1036 | PetscHSetIHas(cht, support[p], &found); | |||
1037 | if (!found) { | |||
1038 | interior = PETSC_FALSE; | |||
1039 | break; | |||
1040 | } | |||
1041 | } | |||
1042 | } | |||
1043 | if (interior) { | |||
1044 | ierr = PetscSectionAddDof(intFacetCounts, v, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1044,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1045 | } else { | |||
1046 | ierr = PetscSectionAddDof(extFacetCounts, v, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1046,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1047 | } | |||
1048 | } | |||
1049 | ierr = PCPatchGetGlobalDofs(pc, patch->dofSection, -1, patch->combined, point, &pdof, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1049,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1050 | if (pdof) {ierr = PetscSectionAddDof(pointCounts, v, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1050,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1051 | if (point >= cStart && point < cEnd) {ierr = PetscSectionAddDof(cellCounts, v, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1051,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1052 | PetscHashIterNext(cht, hi)do { ++(hi); } while ((hi) != (((cht))->n_buckets) && !(!((((cht))->flags[((hi))>>4]>>((((hi))& 0xfU)<<1))&3))); | |||
1053 | } | |||
1054 | } | |||
1055 | if (isFiredrake) {ierr = DMLabelDestroyIndex(ghost);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1055,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1056 | ||||
1057 | ierr = PetscSectionSetUp(cellCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1057,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1058 | ierr = PetscSectionGetStorageSize(cellCounts, &numCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1058,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1059 | ierr = PetscMalloc1(numCells, &cellsArray)PetscMallocA(1,PETSC_FALSE,1059,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numCells)*sizeof(**(&cellsArray)),(&cellsArray ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1059,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1060 | ierr = PetscSectionSetUp(pointCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1060,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1061 | ierr = PetscSectionGetStorageSize(pointCounts, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1061,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1062 | ierr = PetscMalloc1(numPoints, &pointsArray)PetscMallocA(1,PETSC_FALSE,1062,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numPoints)*sizeof(**(&pointsArray)),(&pointsArray ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1062,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1063 | ||||
1064 | ierr = PetscSectionSetUp(intFacetCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1064,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1065 | ierr = PetscSectionSetUp(extFacetCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1065,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1066 | ierr = PetscSectionGetStorageSize(intFacetCounts, &numIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1066,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1067 | ierr = PetscSectionGetStorageSize(extFacetCounts, &numExtFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1067,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1068 | ierr = PetscMalloc1(numIntFacets, &intFacetsArray)PetscMallocA(1,PETSC_FALSE,1068,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numIntFacets)*sizeof(**(&intFacetsArray)),(& intFacetsArray));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1068,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1069 | ierr = PetscMalloc1(numIntFacets*2, &intFacetsToPatchCell)PetscMallocA(1,PETSC_FALSE,1069,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numIntFacets*2)*sizeof(**(&intFacetsToPatchCell )),(&intFacetsToPatchCell));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1069,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1070 | ierr = PetscMalloc1(numExtFacets, &extFacetsArray)PetscMallocA(1,PETSC_FALSE,1070,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numExtFacets)*sizeof(**(&extFacetsArray)),(& extFacetsArray));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1070,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1071 | ||||
1072 | ||||
1073 | /* Now that we know how much space we need, run through again and actually remember the cells. */ | |||
1074 | for (v = vStart; v < vEnd; v++ ) { | |||
1075 | PetscHashIter hi; | |||
1076 | PetscInt dof, off, cdof, coff, efdof, efoff, ifdof, ifoff, pdof, n = 0, cn = 0, ifn = 0, efn = 0; | |||
1077 | ||||
1078 | ierr = PetscSectionGetDof(pointCounts, v, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1078,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1079 | ierr = PetscSectionGetOffset(pointCounts, v, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1079,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1080 | ierr = PetscSectionGetDof(cellCounts, v, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1080,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1081 | ierr = PetscSectionGetOffset(cellCounts, v, &coff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1081,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1082 | ierr = PetscSectionGetDof(intFacetCounts, v, &ifdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1082,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1083 | ierr = PetscSectionGetOffset(intFacetCounts, v, &ifoff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1083,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1084 | ierr = PetscSectionGetDof(extFacetCounts, v, &efdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1084,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1085 | ierr = PetscSectionGetOffset(extFacetCounts, v, &efoff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1085,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1086 | if (dof <= 0) continue; | |||
1087 | ierr = patch->patchconstructop((void *) patch, dm, v, ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1087,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1088 | ierr = PCPatchCompleteCellPatch(pc, ht, cht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1088,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1089 | PetscHashIterBegin(cht, hi)do { (hi) = (khint_t)(0); if ((hi) != (((cht))->n_buckets) && !(!((((cht))->flags[((hi))>>4]>>(( ((hi))&0xfU)<<1))&3))) do { ++((hi)); } while ( ((hi)) != ((((cht)))->n_buckets) && !(!(((((cht))) ->flags[(((hi)))>>4]>>(((((hi)))&0xfU)<< 1))&3))); } while (0); | |||
1090 | while (!PetscHashIterAtEnd(cht, hi)((hi) == (((cht))->n_buckets))) { | |||
1091 | PetscInt point; | |||
1092 | ||||
1093 | PetscHashIterGetKey(cht, hi, point)((point) = (((cht))->keys[(hi)])); | |||
1094 | if (fStart <= point && point < fEnd) { | |||
1095 | const PetscInt *support; | |||
1096 | PetscInt supportSize, p; | |||
1097 | PetscBool interior = PETSC_TRUE; | |||
1098 | ierr = DMPlexGetSupport(dm, point, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1098,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1099 | ierr = DMPlexGetSupportSize(dm, point, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1099,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1100 | if (supportSize == 1) { | |||
1101 | interior = PETSC_FALSE; | |||
1102 | } else { | |||
1103 | for (p = 0; p < supportSize; p++) { | |||
1104 | PetscBool found; | |||
1105 | /* FIXME: can I do this while iterating over cht? */ | |||
1106 | PetscHSetIHas(cht, support[p], &found); | |||
1107 | if (!found) { | |||
1108 | interior = PETSC_FALSE; | |||
1109 | break; | |||
1110 | } | |||
1111 | } | |||
1112 | } | |||
1113 | if (interior) { | |||
1114 | intFacetsToPatchCell[2*(ifoff + ifn)] = support[0]; | |||
1115 | intFacetsToPatchCell[2*(ifoff + ifn) + 1] = support[1]; | |||
1116 | intFacetsArray[ifoff + ifn++] = point; | |||
1117 | } else { | |||
1118 | extFacetsArray[efoff + efn++] = point; | |||
1119 | } | |||
1120 | } | |||
1121 | ierr = PCPatchGetGlobalDofs(pc, patch->dofSection, -1, patch->combined, point, &pdof, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1121,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1122 | if (pdof) {pointsArray[off + n++] = point;} | |||
1123 | if (point >= cStart && point < cEnd) {cellsArray[coff + cn++] = point;} | |||
1124 | PetscHashIterNext(cht, hi)do { ++(hi); } while ((hi) != (((cht))->n_buckets) && !(!((((cht))->flags[((hi))>>4]>>((((hi))& 0xfU)<<1))&3))); | |||
1125 | } | |||
1126 | if (ifn != ifdof) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_SIZ, "Number of interior facets in patch %D is %D, but should be %D", v, ifn, ifdof)return PetscError(((MPI_Comm)0x44000001),1126,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,60,PETSC_ERROR_INITIAL,"Number of interior facets in patch %D is %D, but should be %D" ,v,ifn,ifdof); | |||
1127 | if (efn != efdof) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_SIZ, "Number of exterior facets in patch %D is %D, but should be %D", v, efn, efdof)return PetscError(((MPI_Comm)0x44000001),1127,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,60,PETSC_ERROR_INITIAL,"Number of exterior facets in patch %D is %D, but should be %D" ,v,efn,efdof); | |||
1128 | if (cn != cdof) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_SIZ, "Number of cells in patch %D is %D, but should be %D", v, cn, cdof)return PetscError(((MPI_Comm)0x44000001),1128,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,60,PETSC_ERROR_INITIAL,"Number of cells in patch %D is %D, but should be %D" ,v,cn,cdof); | |||
1129 | if (n != dof) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_SIZ, "Number of points in patch %D is %D, but should be %D", v, n, dof)return PetscError(((MPI_Comm)0x44000001),1129,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,60,PETSC_ERROR_INITIAL,"Number of points in patch %D is %D, but should be %D" ,v,n,dof); | |||
1130 | ||||
1131 | for (ifn = 0; ifn < ifdof; ifn++) { | |||
1132 | PetscInt cell0 = intFacetsToPatchCell[2*(ifoff + ifn)]; | |||
1133 | PetscInt cell1 = intFacetsToPatchCell[2*(ifoff + ifn) + 1]; | |||
1134 | PetscBool found0 = PETSC_FALSE, found1 = PETSC_FALSE; | |||
1135 | for (n = 0; n < cdof; n++) { | |||
1136 | if (!found0 && cell0 == cellsArray[coff + n]) { | |||
1137 | intFacetsToPatchCell[2*(ifoff + ifn)] = n; | |||
1138 | found0 = PETSC_TRUE; | |||
1139 | } | |||
1140 | if (!found1 && cell1 == cellsArray[coff + n]) { | |||
1141 | intFacetsToPatchCell[2*(ifoff + ifn) + 1] = n; | |||
1142 | found1 = PETSC_TRUE; | |||
1143 | } | |||
1144 | if (found0 && found1) break; | |||
1145 | } | |||
1146 | if (!(found0 && found1)) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_SIZ, "Didn't manage to find local point numbers for facet support")return PetscError(((MPI_Comm)0x44000001),1146,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,60,PETSC_ERROR_INITIAL,"Didn't manage to find local point numbers for facet support" ); | |||
1147 | } | |||
1148 | } | |||
1149 | ierr = PetscHSetIDestroy(&ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1149,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1150 | ierr = PetscHSetIDestroy(&cht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1150,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1151 | ||||
1152 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numCells, cellsArray, PETSC_OWN_POINTER, &patch->cells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1152,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1153 | ierr = PetscObjectSetName((PetscObject) patch->cells, "Patch Cells");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1153,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1154 | if (patch->viewCells) { | |||
1155 | ierr = ObjectView((PetscObject) patch->cellCounts, patch->viewerCells, patch->formatCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1155,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1156 | ierr = ObjectView((PetscObject) patch->cells, patch->viewerCells, patch->formatCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1156,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1157 | } | |||
1158 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numIntFacets, intFacetsArray, PETSC_OWN_POINTER, &patch->intFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1158,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1159 | ierr = PetscObjectSetName((PetscObject) patch->intFacets, "Patch Interior Facets");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1159,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1160 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), 2*numIntFacets, intFacetsToPatchCell, PETSC_OWN_POINTER, &patch->intFacetsToPatchCell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1160,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1161 | ierr = PetscObjectSetName((PetscObject) patch->intFacetsToPatchCell, "Patch Interior Facets local support");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1161,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1162 | if (patch->viewIntFacets) { | |||
1163 | ierr = ObjectView((PetscObject) patch->intFacetCounts, patch->viewerIntFacets, patch->formatIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1164 | ierr = ObjectView((PetscObject) patch->intFacets, patch->viewerIntFacets, patch->formatIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1164,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1165 | ierr = ObjectView((PetscObject) patch->intFacetsToPatchCell, patch->viewerIntFacets, patch->formatIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1165,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1166 | } | |||
1167 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numExtFacets, extFacetsArray, PETSC_OWN_POINTER, &patch->extFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1167,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1168 | ierr = PetscObjectSetName((PetscObject) patch->extFacets, "Patch Exterior Facets");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1168,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1169 | if (patch->viewExtFacets) { | |||
1170 | ierr = ObjectView((PetscObject) patch->extFacetCounts, patch->viewerExtFacets, patch->formatExtFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1170,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1171 | ierr = ObjectView((PetscObject) patch->extFacets, patch->viewerExtFacets, patch->formatExtFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1171,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1172 | } | |||
1173 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numPoints, pointsArray, PETSC_OWN_POINTER, &patch->points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1173,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1174 | ierr = PetscObjectSetName((PetscObject) patch->points, "Patch Points");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1174,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1175 | if (patch->viewPoints) { | |||
1176 | ierr = ObjectView((PetscObject) patch->pointCounts, patch->viewerPoints, patch->formatPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1176,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1177 | ierr = ObjectView((PetscObject) patch->points, patch->viewerPoints, patch->formatPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1177,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1178 | } | |||
1179 | ierr = DMDestroy(&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1179,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1180 | 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); | |||
1181 | } | |||
1182 | ||||
1183 | /* | |||
1184 | * PCPatchCreateCellPatchDiscretisationInfo - Build the dof maps for cell patches | |||
1185 | * | |||
1186 | * Input Parameters: | |||
1187 | * + dm - The DMPlex object defining the mesh | |||
1188 | * . cellCounts - Section with counts of cells around each vertex | |||
1189 | * . cells - IS of the cell point indices of cells in each patch | |||
1190 | * . cellNumbering - Section mapping plex cell points to Firedrake cell indices. | |||
1191 | * . nodesPerCell - number of nodes per cell. | |||
1192 | * - cellNodeMap - map from cells to node indices (nodesPerCell * numCells) | |||
1193 | * | |||
1194 | * Output Parameters: | |||
1195 | * + dofs - IS of local dof numbers of each cell in the patch, where local is a patch local numbering | |||
1196 | * . gtolCounts - Section with counts of dofs per cell patch | |||
1197 | * - gtol - IS mapping from global dofs to local dofs for each patch. | |||
1198 | */ | |||
1199 | static PetscErrorCode PCPatchCreateCellPatchDiscretisationInfo(PC pc) | |||
1200 | { | |||
1201 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
1202 | PetscSection cellCounts = patch->cellCounts; | |||
1203 | PetscSection pointCounts = patch->pointCounts; | |||
1204 | PetscSection gtolCounts, gtolCountsWithArtificial = NULL((void*)0), gtolCountsWithAll = NULL((void*)0); | |||
1205 | IS cells = patch->cells; | |||
1206 | IS points = patch->points; | |||
1207 | PetscSection cellNumbering = patch->cellNumbering; | |||
1208 | PetscInt Nf = patch->nsubspaces; | |||
1209 | PetscInt numCells, numPoints; | |||
1210 | PetscInt numDofs; | |||
1211 | PetscInt numGlobalDofs, numGlobalDofsWithArtificial, numGlobalDofsWithAll; | |||
1212 | PetscInt totalDofsPerCell = patch->totalDofsPerCell; | |||
1213 | PetscInt vStart, vEnd, v; | |||
1214 | const PetscInt *cellsArray, *pointsArray; | |||
1215 | PetscInt *newCellsArray = NULL((void*)0); | |||
1216 | PetscInt *dofsArray = NULL((void*)0); | |||
1217 | PetscInt *dofsArrayWithArtificial = NULL((void*)0); | |||
1218 | PetscInt *dofsArrayWithAll = NULL((void*)0); | |||
1219 | PetscInt *offsArray = NULL((void*)0); | |||
1220 | PetscInt *offsArrayWithArtificial = NULL((void*)0); | |||
1221 | PetscInt *offsArrayWithAll = NULL((void*)0); | |||
1222 | PetscInt *asmArray = NULL((void*)0); | |||
1223 | PetscInt *asmArrayWithArtificial = NULL((void*)0); | |||
1224 | PetscInt *asmArrayWithAll = NULL((void*)0); | |||
1225 | PetscInt *globalDofsArray = NULL((void*)0); | |||
1226 | PetscInt *globalDofsArrayWithArtificial = NULL((void*)0); | |||
1227 | PetscInt *globalDofsArrayWithAll = NULL((void*)0); | |||
1228 | PetscInt globalIndex = 0; | |||
1229 | PetscInt key = 0; | |||
1230 | PetscInt asmKey = 0; | |||
1231 | DM dm = NULL((void*)0), plex; | |||
1232 | const PetscInt *bcNodes = NULL((void*)0); | |||
1233 | PetscHMapI ht; | |||
1234 | PetscHMapI htWithArtificial; | |||
1235 | PetscHMapI htWithAll; | |||
1236 | PetscHSetI globalBcs; | |||
1237 | PetscInt numBcs; | |||
1238 | PetscHSetI ownedpts, seenpts, owneddofs, seendofs, artificialbcs; | |||
1239 | PetscInt pStart, pEnd, p, i; | |||
1240 | char option[PETSC_MAX_PATH_LEN4096]; | |||
1241 | PetscBool isNonlinear; | |||
1242 | PetscErrorCode ierr; | |||
1243 | ||||
1244 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 1244; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1245 | ||||
1246 | ierr = PCGetDM(pc, &dm); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1246,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1247 | ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1247,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1248 | dm = plex; | |||
1249 | /* dofcounts section is cellcounts section * dofPerCell */ | |||
1250 | ierr = PetscSectionGetStorageSize(cellCounts, &numCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1250,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1251 | ierr = PetscSectionGetStorageSize(patch->pointCounts, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1251,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1252 | numDofs = numCells * totalDofsPerCell; | |||
1253 | ierr = PetscMalloc1(numDofs, &dofsArray)PetscMallocA(1,PETSC_FALSE,1253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numDofs)*sizeof(**(&dofsArray)),(&dofsArray ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1254 | ierr = PetscMalloc1(numPoints*Nf, &offsArray)PetscMallocA(1,PETSC_FALSE,1254,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numPoints*Nf)*sizeof(**(&offsArray)),(&offsArray ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1254,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1255 | ierr = PetscMalloc1(numDofs, &asmArray)PetscMallocA(1,PETSC_FALSE,1255,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numDofs)*sizeof(**(&asmArray)),(&asmArray));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1255,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1256 | ierr = PetscMalloc1(numCells, &newCellsArray)PetscMallocA(1,PETSC_FALSE,1256,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numCells)*sizeof(**(&newCellsArray)),(&newCellsArray ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1256,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1257 | ierr = PetscSectionGetChart(cellCounts, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1257,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1258 | ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->gtolCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1258,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1259 | gtolCounts = patch->gtolCounts; | |||
1260 | ierr = PetscSectionSetChart(gtolCounts, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1260,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1261 | ierr = PetscObjectSetName((PetscObject) patch->gtolCounts, "Patch Global Index Section");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1261,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1262 | ||||
1263 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
1264 | ierr = PetscMalloc1(numPoints*Nf, &offsArrayWithArtificial)PetscMallocA(1,PETSC_FALSE,1264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numPoints*Nf)*sizeof(**(&offsArrayWithArtificial )),(&offsArrayWithArtificial));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1265 | ierr = PetscMalloc1(numDofs, &asmArrayWithArtificial)PetscMallocA(1,PETSC_FALSE,1265,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numDofs)*sizeof(**(&asmArrayWithArtificial)),(& asmArrayWithArtificial));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1265,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1266 | ierr = PetscMalloc1(numDofs, &dofsArrayWithArtificial)PetscMallocA(1,PETSC_FALSE,1266,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numDofs)*sizeof(**(&dofsArrayWithArtificial)),( &dofsArrayWithArtificial));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1266,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1267 | ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->gtolCountsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1267,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1268 | gtolCountsWithArtificial = patch->gtolCountsWithArtificial; | |||
1269 | ierr = PetscSectionSetChart(gtolCountsWithArtificial, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1269,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1270 | ierr = PetscObjectSetName((PetscObject) patch->gtolCountsWithArtificial, "Patch Global Index Section Including Artificial BCs");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1270,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1271 | } | |||
1272 | ||||
1273 | isNonlinear = patch->isNonlinear; | |||
1274 | if (isNonlinear) { | |||
1275 | ierr = PetscMalloc1(numPoints*Nf, &offsArrayWithAll)PetscMallocA(1,PETSC_FALSE,1275,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numPoints*Nf)*sizeof(**(&offsArrayWithAll)),(& offsArrayWithAll));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1275,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1276 | ierr = PetscMalloc1(numDofs, &asmArrayWithAll)PetscMallocA(1,PETSC_FALSE,1276,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numDofs)*sizeof(**(&asmArrayWithAll)),(&asmArrayWithAll ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1276,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1277 | ierr = PetscMalloc1(numDofs, &dofsArrayWithAll)PetscMallocA(1,PETSC_FALSE,1277,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numDofs)*sizeof(**(&dofsArrayWithAll)),(&dofsArrayWithAll ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1277,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1278 | ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->gtolCountsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1278,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1279 | gtolCountsWithAll = patch->gtolCountsWithAll; | |||
1280 | ierr = PetscSectionSetChart(gtolCountsWithAll, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1280,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1281 | ierr = PetscObjectSetName((PetscObject) patch->gtolCountsWithAll, "Patch Global Index Section Including All BCs");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1281,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1282 | } | |||
1283 | ||||
1284 | /* Outside the patch loop, get the dofs that are globally-enforced Dirichlet | |||
1285 | conditions */ | |||
1286 | ierr = PetscHSetICreate(&globalBcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1287 | ierr = ISGetIndices(patch->ghostBcNodes, &bcNodes); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1287,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1288 | ierr = ISGetSize(patch->ghostBcNodes, &numBcs); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1288,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1289 | for (i = 0; i < numBcs; ++i) { | |||
1290 | ierr = PetscHSetIAdd(globalBcs, bcNodes[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1290,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); /* these are already in concatenated numbering */ | |||
1291 | } | |||
1292 | ierr = ISRestoreIndices(patch->ghostBcNodes, &bcNodes); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1292,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1293 | ierr = ISDestroy(&patch->ghostBcNodes); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1293,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); /* memory optimisation */ | |||
1294 | ||||
1295 | /* Hash tables for artificial BC construction */ | |||
1296 | ierr = PetscHSetICreate(&ownedpts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1296,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1297 | ierr = PetscHSetICreate(&seenpts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1297,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1298 | ierr = PetscHSetICreate(&owneddofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1298,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1299 | ierr = PetscHSetICreate(&seendofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1299,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1300 | ierr = PetscHSetICreate(&artificialbcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1300,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1301 | ||||
1302 | ierr = ISGetIndices(cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1302,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1303 | ierr = ISGetIndices(points, &pointsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1303,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1304 | ierr = PetscHMapICreate(&ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1304,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1305 | ierr = PetscHMapICreate(&htWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1305,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1306 | ierr = PetscHMapICreate(&htWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1307 | for (v = vStart; v < vEnd; ++v) { | |||
1308 | PetscInt localIndex = 0; | |||
1309 | PetscInt localIndexWithArtificial = 0; | |||
1310 | PetscInt localIndexWithAll = 0; | |||
1311 | PetscInt dof, off, i, j, k, l; | |||
1312 | ||||
1313 | ierr = PetscHMapIClear(ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1313,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1314 | ierr = PetscHMapIClear(htWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1314,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1315 | ierr = PetscHMapIClear(htWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1315,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1316 | ierr = PetscSectionGetDof(cellCounts, v, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1316,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1317 | ierr = PetscSectionGetOffset(cellCounts, v, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1317,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1318 | if (dof <= 0) continue; | |||
1319 | ||||
1320 | /* Calculate the global numbers of the artificial BC dofs here first */ | |||
1321 | ierr = patch->patchconstructop((void*)patch, dm, v, ownedpts); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1321,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1322 | ierr = PCPatchCompleteCellPatch(pc, ownedpts, seenpts); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1322,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1323 | ierr = PCPatchGetPointDofs(pc, ownedpts, owneddofs, v, &patch->subspaces_to_exclude); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1323,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1324 | ierr = PCPatchGetPointDofs(pc, seenpts, seendofs, v, NULL((void*)0)); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1324,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1325 | ierr = PCPatchComputeSetDifference_Private(owneddofs, seendofs, artificialbcs); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1325,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1326 | if (patch->viewPatches) { | |||
1327 | PetscHSetI globalbcdofs; | |||
1328 | PetscHashIter hi; | |||
1329 | MPI_Comm comm = PetscObjectComm((PetscObject)pc); | |||
1330 | ||||
1331 | ierr = PetscHSetICreate(&globalbcdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1331,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1332 | ierr = PetscSynchronizedPrintf(comm, "Patch %d: owned dofs:\n", v); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1332,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1333 | PetscHashIterBegin(owneddofs, hi)do { (hi) = (khint_t)(0); if ((hi) != (((owneddofs))->n_buckets ) && !(!((((owneddofs))->flags[((hi))>>4]>> ((((hi))&0xfU)<<1))&3))) do { ++((hi)); } while (((hi)) != ((((owneddofs)))->n_buckets) && !(!((( ((owneddofs)))->flags[(((hi)))>>4]>>(((((hi))) &0xfU)<<1))&3))); } while (0); | |||
1334 | while (!PetscHashIterAtEnd(owneddofs, hi)((hi) == (((owneddofs))->n_buckets))) { | |||
1335 | PetscInt globalDof; | |||
1336 | ||||
1337 | PetscHashIterGetKey(owneddofs, hi, globalDof)((globalDof) = (((owneddofs))->keys[(hi)])); | |||
1338 | PetscHashIterNext(owneddofs, hi)do { ++(hi); } while ((hi) != (((owneddofs))->n_buckets) && !(!((((owneddofs))->flags[((hi))>>4]>>((((hi) )&0xfU)<<1))&3))); | |||
1339 | ierr = PetscSynchronizedPrintf(comm, "%d ", globalDof); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1339,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1340 | } | |||
1341 | ierr = PetscSynchronizedPrintf(comm, "\n"); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1341,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1342 | ierr = PetscSynchronizedPrintf(comm, "Patch %d: seen dofs:\n", v); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1342,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1343 | PetscHashIterBegin(seendofs, hi)do { (hi) = (khint_t)(0); if ((hi) != (((seendofs))->n_buckets ) && !(!((((seendofs))->flags[((hi))>>4]>> ((((hi))&0xfU)<<1))&3))) do { ++((hi)); } while (((hi)) != ((((seendofs)))->n_buckets) && !(!(((( (seendofs)))->flags[(((hi)))>>4]>>(((((hi)))& 0xfU)<<1))&3))); } while (0); | |||
1344 | while (!PetscHashIterAtEnd(seendofs, hi)((hi) == (((seendofs))->n_buckets))) { | |||
1345 | PetscInt globalDof; | |||
1346 | PetscBool flg; | |||
1347 | ||||
1348 | PetscHashIterGetKey(seendofs, hi, globalDof)((globalDof) = (((seendofs))->keys[(hi)])); | |||
1349 | PetscHashIterNext(seendofs, hi)do { ++(hi); } while ((hi) != (((seendofs))->n_buckets) && !(!((((seendofs))->flags[((hi))>>4]>>((((hi)) &0xfU)<<1))&3))); | |||
1350 | ierr = PetscSynchronizedPrintf(comm, "%d ", globalDof); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1350,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1351 | ||||
1352 | ierr = PetscHSetIHas(globalBcs, globalDof, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1352,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1353 | if (flg) {ierr = PetscHSetIAdd(globalbcdofs, globalDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1353,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1354 | } | |||
1355 | ierr = PetscSynchronizedPrintf(comm, "\n"); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1355,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1356 | ierr = PetscSynchronizedPrintf(comm, "Patch %d: global BCs:\n", v); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1357 | ierr = PetscHSetIGetSize(globalbcdofs, &numBcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1357,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1358 | if (numBcs > 0) { | |||
1359 | PetscHashIterBegin(globalbcdofs, hi)do { (hi) = (khint_t)(0); if ((hi) != (((globalbcdofs))->n_buckets ) && !(!((((globalbcdofs))->flags[((hi))>>4] >>((((hi))&0xfU)<<1))&3))) do { ++((hi)); } while (((hi)) != ((((globalbcdofs)))->n_buckets) && !(!(((((globalbcdofs)))->flags[(((hi)))>>4]>> (((((hi)))&0xfU)<<1))&3))); } while (0); | |||
1360 | while (!PetscHashIterAtEnd(globalbcdofs, hi)((hi) == (((globalbcdofs))->n_buckets))) { | |||
1361 | PetscInt globalDof; | |||
1362 | PetscHashIterGetKey(globalbcdofs, hi, globalDof)((globalDof) = (((globalbcdofs))->keys[(hi)])); | |||
1363 | PetscHashIterNext(globalbcdofs, hi)do { ++(hi); } while ((hi) != (((globalbcdofs))->n_buckets ) && !(!((((globalbcdofs))->flags[((hi))>>4] >>((((hi))&0xfU)<<1))&3))); | |||
1364 | ierr = PetscSynchronizedPrintf(comm, "%d ", globalDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1364,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1365 | } | |||
1366 | } | |||
1367 | ierr = PetscSynchronizedPrintf(comm, "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1367,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1368 | ierr = PetscSynchronizedPrintf(comm, "Patch %d: artificial BCs:\n", v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1368,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1369 | ierr = PetscHSetIGetSize(artificialbcs, &numBcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1369,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1370 | if (numBcs > 0) { | |||
1371 | PetscHashIterBegin(artificialbcs, hi)do { (hi) = (khint_t)(0); if ((hi) != (((artificialbcs))-> n_buckets) && !(!((((artificialbcs))->flags[((hi)) >>4]>>((((hi))&0xfU)<<1))&3))) do { ++((hi)); } while (((hi)) != ((((artificialbcs)))->n_buckets ) && !(!(((((artificialbcs)))->flags[(((hi)))>> 4]>>(((((hi)))&0xfU)<<1))&3))); } while ( 0); | |||
1372 | while (!PetscHashIterAtEnd(artificialbcs, hi)((hi) == (((artificialbcs))->n_buckets))) { | |||
1373 | PetscInt globalDof; | |||
1374 | PetscHashIterGetKey(artificialbcs, hi, globalDof)((globalDof) = (((artificialbcs))->keys[(hi)])); | |||
1375 | PetscHashIterNext(artificialbcs, hi)do { ++(hi); } while ((hi) != (((artificialbcs))->n_buckets ) && !(!((((artificialbcs))->flags[((hi))>>4 ]>>((((hi))&0xfU)<<1))&3))); | |||
1376 | ierr = PetscSynchronizedPrintf(comm, "%d ", globalDof); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1376,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1377 | } | |||
1378 | } | |||
1379 | ierr = PetscSynchronizedPrintf(comm, "\n\n"); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1379,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1380 | ierr = PetscHSetIDestroy(&globalbcdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1380,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1381 | } | |||
1382 | for (k = 0; k < patch->nsubspaces; ++k) { | |||
1383 | const PetscInt *cellNodeMap = patch->cellNodeMap[k]; | |||
1384 | PetscInt nodesPerCell = patch->nodesPerCell[k]; | |||
1385 | PetscInt subspaceOffset = patch->subspaceOffsets[k]; | |||
1386 | PetscInt bs = patch->bs[k]; | |||
1387 | ||||
1388 | for (i = off; i < off + dof; ++i) { | |||
1389 | /* Walk over the cells in this patch. */ | |||
1390 | const PetscInt c = cellsArray[i]; | |||
1391 | PetscInt cell = c; | |||
1392 | ||||
1393 | /* TODO Change this to an IS */ | |||
1394 | if (cellNumbering) { | |||
1395 | ierr = PetscSectionGetDof(cellNumbering, c, &cell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1395,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1396 | if (cell <= 0) SETERRQ1(PetscObjectComm((PetscObject) pc), PETSC_ERR_ARG_OUTOFRANGE, "Cell %D doesn't appear in cell numbering map", c)return PetscError(PetscObjectComm((PetscObject) pc),1396,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,63,PETSC_ERROR_INITIAL,"Cell %D doesn't appear in cell numbering map" ,c); | |||
1397 | ierr = PetscSectionGetOffset(cellNumbering, c, &cell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1397,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1398 | } | |||
1399 | newCellsArray[i] = cell; | |||
1400 | for (j = 0; j < nodesPerCell; ++j) { | |||
1401 | /* For each global dof, map it into contiguous local storage. */ | |||
1402 | const PetscInt globalDof = cellNodeMap[cell*nodesPerCell + j]*bs + subspaceOffset; | |||
1403 | /* finally, loop over block size */ | |||
1404 | for (l = 0; l < bs; ++l) { | |||
1405 | PetscInt localDof; | |||
1406 | PetscBool isGlobalBcDof, isArtificialBcDof; | |||
1407 | ||||
1408 | /* first, check if this is either a globally enforced or locally enforced BC dof */ | |||
1409 | ierr = PetscHSetIHas(globalBcs, globalDof + l, &isGlobalBcDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1409,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1410 | ierr = PetscHSetIHas(artificialbcs, globalDof + l, &isArtificialBcDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1410,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1411 | ||||
1412 | /* if it's either, don't ever give it a local dof number */ | |||
1413 | if (isGlobalBcDof || isArtificialBcDof) { | |||
1414 | dofsArray[globalIndex] = -1; /* don't use this in assembly in this patch */ | |||
1415 | } else { | |||
1416 | ierr = PetscHMapIGet(ht, globalDof + l, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1416,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1417 | if (localDof == -1) { | |||
1418 | localDof = localIndex++; | |||
1419 | ierr = PetscHMapISet(ht, globalDof + l, localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1419,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1420 | } | |||
1421 | if ( globalIndex >= numDofs ) SETERRQ2(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, "Found more dofs %D than expected %D", globalIndex+1, numDofs)return PetscError(PETSC_COMM_WORLD,1421,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,63,PETSC_ERROR_INITIAL,"Found more dofs %D than expected %D" ,globalIndex+1,numDofs); | |||
1422 | /* And store. */ | |||
1423 | dofsArray[globalIndex] = localDof; | |||
1424 | } | |||
1425 | ||||
1426 | if(patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
1427 | if (isGlobalBcDof) { | |||
1428 | dofsArrayWithArtificial[globalIndex] = -1; /* don't use this in assembly in this patch */ | |||
1429 | } else { | |||
1430 | ierr = PetscHMapIGet(htWithArtificial, globalDof + l, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1430,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1431 | if (localDof == -1) { | |||
1432 | localDof = localIndexWithArtificial++; | |||
1433 | ierr = PetscHMapISet(htWithArtificial, globalDof + l, localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1433,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1434 | } | |||
1435 | if ( globalIndex >= numDofs ) SETERRQ2(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, "Found more dofs %D than expected %D", globalIndex+1, numDofs)return PetscError(PETSC_COMM_WORLD,1435,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,63,PETSC_ERROR_INITIAL,"Found more dofs %D than expected %D" ,globalIndex+1,numDofs); | |||
1436 | /* And store.*/ | |||
1437 | dofsArrayWithArtificial[globalIndex] = localDof; | |||
1438 | } | |||
1439 | } | |||
1440 | ||||
1441 | if(isNonlinear) { | |||
1442 | /* Build the dofmap for the function space with _all_ dofs, | |||
1443 | including those in any kind of boundary condition */ | |||
1444 | ierr = PetscHMapIGet(htWithAll, globalDof + l, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1444,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1445 | if (localDof == -1) { | |||
1446 | localDof = localIndexWithAll++; | |||
1447 | ierr = PetscHMapISet(htWithAll, globalDof + l, localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1447,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1448 | } | |||
1449 | if ( globalIndex >= numDofs ) SETERRQ2(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, "Found more dofs %D than expected %D", globalIndex+1, numDofs)return PetscError(PETSC_COMM_WORLD,1449,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,63,PETSC_ERROR_INITIAL,"Found more dofs %D than expected %D" ,globalIndex+1,numDofs); | |||
1450 | /* And store.*/ | |||
1451 | dofsArrayWithAll[globalIndex] = localDof; | |||
1452 | } | |||
1453 | globalIndex++; | |||
1454 | } | |||
1455 | } | |||
1456 | } | |||
1457 | } | |||
1458 | /*How many local dofs in this patch? */ | |||
1459 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
1460 | ierr = PetscHMapIGetSize(htWithArtificial, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1460,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1461 | ierr = PetscSectionSetDof(gtolCountsWithArtificial, v, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1461,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1462 | } | |||
1463 | if (isNonlinear) { | |||
1464 | ierr = PetscHMapIGetSize(htWithAll, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1464,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1465 | ierr = PetscSectionSetDof(gtolCountsWithAll, v, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1465,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1466 | } | |||
1467 | ierr = PetscHMapIGetSize(ht, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1467,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1468 | ierr = PetscSectionSetDof(gtolCounts, v, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1468,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1469 | } | |||
1470 | ||||
1471 | ierr = DMDestroy(&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1471,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1472 | if (globalIndex != numDofs) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Expected number of dofs (%d) doesn't match found number (%d)", numDofs, globalIndex)return PetscError(((MPI_Comm)0x44000001),1472,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,63,PETSC_ERROR_INITIAL,"Expected number of dofs (%d) doesn't match found number (%d)" ,numDofs,globalIndex); | |||
1473 | ierr = PetscSectionSetUp(gtolCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1473,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1474 | ierr = PetscSectionGetStorageSize(gtolCounts, &numGlobalDofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1474,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1475 | ierr = PetscMalloc1(numGlobalDofs, &globalDofsArray)PetscMallocA(1,PETSC_FALSE,1475,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numGlobalDofs)*sizeof(**(&globalDofsArray)),(& globalDofsArray));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1475,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1476 | ||||
1477 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
1478 | ierr = PetscSectionSetUp(gtolCountsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1478,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1479 | ierr = PetscSectionGetStorageSize(gtolCountsWithArtificial, &numGlobalDofsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1479,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1480 | ierr = PetscMalloc1(numGlobalDofsWithArtificial, &globalDofsArrayWithArtificial)PetscMallocA(1,PETSC_FALSE,1480,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numGlobalDofsWithArtificial)*sizeof(**(&globalDofsArrayWithArtificial )),(&globalDofsArrayWithArtificial));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1480,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1481 | } | |||
1482 | if (isNonlinear) { | |||
1483 | ierr = PetscSectionSetUp(gtolCountsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1483,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1484 | ierr = PetscSectionGetStorageSize(gtolCountsWithAll, &numGlobalDofsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1484,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1485 | ierr = PetscMalloc1(numGlobalDofsWithAll, &globalDofsArrayWithAll)PetscMallocA(1,PETSC_FALSE,1485,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numGlobalDofsWithAll)*sizeof(**(&globalDofsArrayWithAll )),(&globalDofsArrayWithAll));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1485,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1486 | } | |||
1487 | /* Now populate the global to local map. This could be merged into the above loop if we were willing to deal with reallocs. */ | |||
1488 | for (v = vStart; v < vEnd; ++v) { | |||
1489 | PetscHashIter hi; | |||
1490 | PetscInt dof, off, Np, ooff, i, j, k, l; | |||
1491 | ||||
1492 | ierr = PetscHMapIClear(ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1492,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1493 | ierr = PetscHMapIClear(htWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1493,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1494 | ierr = PetscHMapIClear(htWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1494,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1495 | ierr = PetscSectionGetDof(cellCounts, v, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1495,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1496 | ierr = PetscSectionGetOffset(cellCounts, v, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1496,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1497 | ierr = PetscSectionGetDof(pointCounts, v, &Np);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1498 | ierr = PetscSectionGetOffset(pointCounts, v, &ooff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1498,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1499 | if (dof <= 0) continue; | |||
1500 | ||||
1501 | for (k = 0; k < patch->nsubspaces; ++k) { | |||
1502 | const PetscInt *cellNodeMap = patch->cellNodeMap[k]; | |||
1503 | PetscInt nodesPerCell = patch->nodesPerCell[k]; | |||
1504 | PetscInt subspaceOffset = patch->subspaceOffsets[k]; | |||
1505 | PetscInt bs = patch->bs[k]; | |||
1506 | PetscInt goff; | |||
1507 | ||||
1508 | for (i = off; i < off + dof; ++i) { | |||
1509 | /* Reconstruct mapping of global-to-local on this patch. */ | |||
1510 | const PetscInt c = cellsArray[i]; | |||
1511 | PetscInt cell = c; | |||
1512 | ||||
1513 | if (cellNumbering) {ierr = PetscSectionGetOffset(cellNumbering, c, &cell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1513,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1514 | for (j = 0; j < nodesPerCell; ++j) { | |||
1515 | for (l = 0; l < bs; ++l) { | |||
1516 | const PetscInt globalDof = cellNodeMap[cell*nodesPerCell + j]*bs + l + subspaceOffset; | |||
1517 | const PetscInt localDof = dofsArray[key]; | |||
1518 | if (localDof >= 0) {ierr = PetscHMapISet(ht, globalDof, localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1518,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1519 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
1520 | const PetscInt localDofWithArtificial = dofsArrayWithArtificial[key]; | |||
1521 | if (localDofWithArtificial >= 0) { | |||
1522 | ierr = PetscHMapISet(htWithArtificial, globalDof, localDofWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1522,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1523 | } | |||
1524 | } | |||
1525 | if (isNonlinear) { | |||
1526 | const PetscInt localDofWithAll = dofsArrayWithAll[key]; | |||
1527 | if (localDofWithAll >= 0) { | |||
1528 | ierr = PetscHMapISet(htWithAll, globalDof, localDofWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1528,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1529 | } | |||
1530 | } | |||
1531 | key++; | |||
1532 | } | |||
1533 | } | |||
1534 | } | |||
1535 | ||||
1536 | /* Shove it in the output data structure. */ | |||
1537 | ierr = PetscSectionGetOffset(gtolCounts, v, &goff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1537,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1538 | PetscHashIterBegin(ht, hi)do { (hi) = (khint_t)(0); if ((hi) != (((ht))->n_buckets) && !(!((((ht))->flags[((hi))>>4]>>((((hi))&0xfU )<<1))&3))) do { ++((hi)); } while (((hi)) != ((((ht )))->n_buckets) && !(!(((((ht)))->flags[(((hi)) )>>4]>>(((((hi)))&0xfU)<<1))&3))); } while (0); | |||
1539 | while (!PetscHashIterAtEnd(ht, hi)((hi) == (((ht))->n_buckets))) { | |||
1540 | PetscInt globalDof, localDof; | |||
1541 | ||||
1542 | PetscHashIterGetKey(ht, hi, globalDof)((globalDof) = (((ht))->keys[(hi)])); | |||
1543 | PetscHashIterGetVal(ht, hi, localDof)((localDof) = (((ht))->vals[(hi)])); | |||
1544 | if (globalDof >= 0) globalDofsArray[goff + localDof] = globalDof; | |||
1545 | PetscHashIterNext(ht, hi)do { ++(hi); } while ((hi) != (((ht))->n_buckets) && !(!((((ht))->flags[((hi))>>4]>>((((hi))&0xfU )<<1))&3))); | |||
1546 | } | |||
1547 | ||||
1548 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
1549 | ierr = PetscSectionGetOffset(gtolCountsWithArtificial, v, &goff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1549,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1550 | PetscHashIterBegin(htWithArtificial, hi)do { (hi) = (khint_t)(0); if ((hi) != (((htWithArtificial))-> n_buckets) && !(!((((htWithArtificial))->flags[((hi ))>>4]>>((((hi))&0xfU)<<1))&3))) do { ++((hi)); } while (((hi)) != ((((htWithArtificial)))->n_buckets ) && !(!(((((htWithArtificial)))->flags[(((hi)))>> 4]>>(((((hi)))&0xfU)<<1))&3))); } while ( 0); | |||
1551 | while (!PetscHashIterAtEnd(htWithArtificial, hi)((hi) == (((htWithArtificial))->n_buckets))) { | |||
1552 | PetscInt globalDof, localDof; | |||
1553 | PetscHashIterGetKey(htWithArtificial, hi, globalDof)((globalDof) = (((htWithArtificial))->keys[(hi)])); | |||
1554 | PetscHashIterGetVal(htWithArtificial, hi, localDof)((localDof) = (((htWithArtificial))->vals[(hi)])); | |||
1555 | if (globalDof >= 0) globalDofsArrayWithArtificial[goff + localDof] = globalDof; | |||
1556 | PetscHashIterNext(htWithArtificial, hi)do { ++(hi); } while ((hi) != (((htWithArtificial))->n_buckets ) && !(!((((htWithArtificial))->flags[((hi))>> 4]>>((((hi))&0xfU)<<1))&3))); | |||
1557 | } | |||
1558 | } | |||
1559 | if (isNonlinear) { | |||
1560 | ierr = PetscSectionGetOffset(gtolCountsWithAll, v, &goff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1560,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1561 | PetscHashIterBegin(htWithAll, hi)do { (hi) = (khint_t)(0); if ((hi) != (((htWithAll))->n_buckets ) && !(!((((htWithAll))->flags[((hi))>>4]>> ((((hi))&0xfU)<<1))&3))) do { ++((hi)); } while (((hi)) != ((((htWithAll)))->n_buckets) && !(!((( ((htWithAll)))->flags[(((hi)))>>4]>>(((((hi))) &0xfU)<<1))&3))); } while (0); | |||
1562 | while (!PetscHashIterAtEnd(htWithAll, hi)((hi) == (((htWithAll))->n_buckets))) { | |||
1563 | PetscInt globalDof, localDof; | |||
1564 | PetscHashIterGetKey(htWithAll, hi, globalDof)((globalDof) = (((htWithAll))->keys[(hi)])); | |||
1565 | PetscHashIterGetVal(htWithAll, hi, localDof)((localDof) = (((htWithAll))->vals[(hi)])); | |||
1566 | if (globalDof >= 0) globalDofsArrayWithAll[goff + localDof] = globalDof; | |||
1567 | PetscHashIterNext(htWithAll, hi)do { ++(hi); } while ((hi) != (((htWithAll))->n_buckets) && !(!((((htWithAll))->flags[((hi))>>4]>>((((hi) )&0xfU)<<1))&3))); | |||
1568 | } | |||
1569 | } | |||
1570 | ||||
1571 | for (p = 0; p < Np; ++p) { | |||
1572 | const PetscInt point = pointsArray[ooff + p]; | |||
1573 | PetscInt globalDof, localDof; | |||
1574 | ||||
1575 | ierr = PCPatchGetGlobalDofs(pc, patch->dofSection, k, patch->combined, point, NULL((void*)0), &globalDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1575,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1576 | ierr = PetscHMapIGet(ht, globalDof, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1576,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1577 | offsArray[(ooff + p)*Nf + k] = localDof; | |||
1578 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
1579 | ierr = PetscHMapIGet(htWithArtificial, globalDof, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1579,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1580 | offsArrayWithArtificial[(ooff + p)*Nf + k] = localDof; | |||
1581 | } | |||
1582 | if (isNonlinear) { | |||
1583 | ierr = PetscHMapIGet(htWithAll, globalDof, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1583,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1584 | offsArrayWithAll[(ooff + p)*Nf + k] = localDof; | |||
1585 | } | |||
1586 | } | |||
1587 | } | |||
1588 | ||||
1589 | ierr = PetscHSetIDestroy(&globalBcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1589,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1590 | ierr = PetscHSetIDestroy(&ownedpts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1590,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1591 | ierr = PetscHSetIDestroy(&seenpts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1591,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1592 | ierr = PetscHSetIDestroy(&owneddofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1592,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1593 | ierr = PetscHSetIDestroy(&seendofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1593,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1594 | ierr = PetscHSetIDestroy(&artificialbcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1594,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1595 | ||||
1596 | /* At this point, we have a hash table ht built that maps globalDof -> localDof. | |||
1597 | We need to create the dof table laid out cellwise first, then by subspace, | |||
1598 | as the assembler assembles cell-wise and we need to stuff the different | |||
1599 | contributions of the different function spaces to the right places. So we loop | |||
1600 | over cells, then over subspaces. */ | |||
1601 | if (patch->nsubspaces > 1) { /* for nsubspaces = 1, data we need is already in dofsArray */ | |||
1602 | for (i = off; i < off + dof; ++i) { | |||
1603 | const PetscInt c = cellsArray[i]; | |||
1604 | PetscInt cell = c; | |||
1605 | ||||
1606 | if (cellNumbering) {ierr = PetscSectionGetOffset(cellNumbering, c, &cell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1606,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1607 | for (k = 0; k < patch->nsubspaces; ++k) { | |||
1608 | const PetscInt *cellNodeMap = patch->cellNodeMap[k]; | |||
1609 | PetscInt nodesPerCell = patch->nodesPerCell[k]; | |||
1610 | PetscInt subspaceOffset = patch->subspaceOffsets[k]; | |||
1611 | PetscInt bs = patch->bs[k]; | |||
1612 | ||||
1613 | for (j = 0; j < nodesPerCell; ++j) { | |||
1614 | for (l = 0; l < bs; ++l) { | |||
1615 | const PetscInt globalDof = cellNodeMap[cell*nodesPerCell + j]*bs + l + subspaceOffset; | |||
1616 | PetscInt localDof; | |||
1617 | ||||
1618 | ierr = PetscHMapIGet(ht, globalDof, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1618,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1619 | /* If it's not in the hash table, i.e. is a BC dof, | |||
1620 | then the PetscHSetIMap above gives -1, which matches | |||
1621 | exactly the convention for PETSc's matrix assembly to | |||
1622 | ignore the dof. So we don't need to do anything here */ | |||
1623 | asmArray[asmKey] = localDof; | |||
1624 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
1625 | ierr = PetscHMapIGet(htWithArtificial, globalDof, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1625,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1626 | asmArrayWithArtificial[asmKey] = localDof; | |||
1627 | } | |||
1628 | if (isNonlinear) { | |||
1629 | ierr = PetscHMapIGet(htWithAll, globalDof, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1629,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1630 | asmArrayWithAll[asmKey] = localDof; | |||
1631 | } | |||
1632 | asmKey++; | |||
1633 | } | |||
1634 | } | |||
1635 | } | |||
1636 | } | |||
1637 | } | |||
1638 | } | |||
1639 | if (1 == patch->nsubspaces) { | |||
1640 | ierr = PetscArraycpy(asmArray, dofsArray, numDofs)((sizeof(*(asmArray)) != sizeof(*(dofsArray))) || PetscMemcpy (asmArray,dofsArray,(numDofs)*sizeof(*(asmArray))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1640,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1641 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
1642 | ierr = PetscArraycpy(asmArrayWithArtificial, dofsArrayWithArtificial, numDofs)((sizeof(*(asmArrayWithArtificial)) != sizeof(*(dofsArrayWithArtificial ))) || PetscMemcpy(asmArrayWithArtificial,dofsArrayWithArtificial ,(numDofs)*sizeof(*(asmArrayWithArtificial))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1642,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1643 | } | |||
1644 | if (isNonlinear) { | |||
1645 | ierr = PetscArraycpy(asmArrayWithAll, dofsArrayWithAll, numDofs)((sizeof(*(asmArrayWithAll)) != sizeof(*(dofsArrayWithAll))) || PetscMemcpy(asmArrayWithAll,dofsArrayWithAll,(numDofs)*sizeof (*(asmArrayWithAll))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1645,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1646 | } | |||
1647 | } | |||
1648 | ||||
1649 | ierr = PetscHMapIDestroy(&ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1649,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1650 | ierr = PetscHMapIDestroy(&htWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1650,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1651 | ierr = PetscHMapIDestroy(&htWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1651,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1652 | ierr = ISRestoreIndices(cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1652,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1653 | ierr = ISRestoreIndices(points, &pointsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1653,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1654 | ierr = PetscFree(dofsArray)((*PetscTrFree)((void*)(dofsArray),1654,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((dofsArray) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1654,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1655 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
1656 | ierr = PetscFree(dofsArrayWithArtificial)((*PetscTrFree)((void*)(dofsArrayWithArtificial),1656,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((dofsArrayWithArtificial) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1656,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1657 | } | |||
1658 | if (isNonlinear) { | |||
1659 | ierr = PetscFree(dofsArrayWithAll)((*PetscTrFree)((void*)(dofsArrayWithAll),1659,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((dofsArrayWithAll) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1659,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1660 | } | |||
1661 | /* Create placeholder section for map from points to patch dofs */ | |||
1662 | ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->patchSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1662,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1663 | ierr = PetscSectionSetNumFields(patch->patchSection, patch->nsubspaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1663,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1664 | if (patch->combined) { | |||
1665 | PetscInt numFields; | |||
1666 | ierr = PetscSectionGetNumFields(patch->dofSection[0], &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1666,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1667 | if (numFields != patch->nsubspaces) SETERRQ2(PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_WRONG, "Mismatch between number of section fields %D and number of subspaces %D", numFields, patch->nsubspaces)return PetscError(PetscObjectComm((PetscObject)pc),1667,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,62,PETSC_ERROR_INITIAL,"Mismatch between number of section fields %D and number of subspaces %D" ,numFields,patch->nsubspaces); | |||
1668 | ierr = PetscSectionGetChart(patch->dofSection[0], &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1668,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1669 | ierr = PetscSectionSetChart(patch->patchSection, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1669,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1670 | for (p = pStart; p < pEnd; ++p) { | |||
1671 | PetscInt dof, fdof, f; | |||
1672 | ||||
1673 | ierr = PetscSectionGetDof(patch->dofSection[0], p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1673,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1674 | ierr = PetscSectionSetDof(patch->patchSection, p, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1674,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1675 | for (f = 0; f < patch->nsubspaces; ++f) { | |||
1676 | ierr = PetscSectionGetFieldDof(patch->dofSection[0], p, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1676,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1677 | ierr = PetscSectionSetFieldDof(patch->patchSection, p, f, fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1677,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1678 | } | |||
1679 | } | |||
1680 | } else { | |||
1681 | PetscInt pStartf, pEndf, f; | |||
1682 | pStart = PETSC_MAX_INT2147483647; | |||
1683 | pEnd = PETSC_MIN_INT(-2147483647 - 1); | |||
1684 | for (f = 0; f < patch->nsubspaces; ++f) { | |||
1685 | ierr = PetscSectionGetChart(patch->dofSection[f], &pStartf, &pEndf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1685,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1686 | pStart = PetscMin(pStart, pStartf)(((pStart)<(pStartf)) ? (pStart) : (pStartf)); | |||
1687 | pEnd = PetscMax(pEnd, pEndf)(((pEnd)<(pEndf)) ? (pEndf) : (pEnd)); | |||
1688 | } | |||
1689 | ierr = PetscSectionSetChart(patch->patchSection, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1689,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1690 | for (f = 0; f < patch->nsubspaces; ++f) { | |||
1691 | ierr = PetscSectionGetChart(patch->dofSection[f], &pStartf, &pEndf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1691,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1692 | for (p = pStartf; p < pEndf; ++p) { | |||
1693 | PetscInt fdof; | |||
1694 | ierr = PetscSectionGetDof(patch->dofSection[f], p, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1694,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1695 | ierr = PetscSectionAddDof(patch->patchSection, p, fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1695,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1696 | ierr = PetscSectionSetFieldDof(patch->patchSection, p, f, fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1696,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1697 | } | |||
1698 | } | |||
1699 | } | |||
1700 | ierr = PetscSectionSetUp(patch->patchSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1700,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1701 | ierr = PetscSectionSetUseFieldOffsets(patch->patchSection, PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1701,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1702 | /* Replace cell indices with firedrake-numbered ones. */ | |||
1703 | ierr = ISGeneralSetIndices(cells, numCells, (const PetscInt *) newCellsArray, PETSC_OWN_POINTER);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1703,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1704 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numGlobalDofs, globalDofsArray, PETSC_OWN_POINTER, &patch->gtol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1704,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1705 | ierr = PetscObjectSetName((PetscObject) patch->gtol, "Global Indices");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1705,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1706 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_g2l_view", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1706,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1707 | ierr = PetscSectionViewFromOptions(patch->gtolCounts, (PetscObject) pc, option);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1707,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1708 | ierr = ISViewFromOptions(patch->gtol, (PetscObject) pc, option);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1708,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1709 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numDofs, asmArray, PETSC_OWN_POINTER, &patch->dofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1709,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1710 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numPoints*Nf, offsArray, PETSC_OWN_POINTER, &patch->offs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1710,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1711 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
1712 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numGlobalDofsWithArtificial, globalDofsArrayWithArtificial, PETSC_OWN_POINTER, &patch->gtolWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1712,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1713 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numDofs, asmArrayWithArtificial, PETSC_OWN_POINTER, &patch->dofsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1713,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1714 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numPoints*Nf, offsArrayWithArtificial, PETSC_OWN_POINTER, &patch->offsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1714,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1715 | } | |||
1716 | if (isNonlinear) { | |||
1717 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numGlobalDofsWithAll, globalDofsArrayWithAll, PETSC_OWN_POINTER, &patch->gtolWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1717,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1718 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numDofs, asmArrayWithAll, PETSC_OWN_POINTER, &patch->dofsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1718,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1719 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numPoints*Nf, offsArrayWithAll, PETSC_OWN_POINTER, &patch->offsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1719,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1720 | } | |||
1721 | 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); | |||
1722 | } | |||
1723 | ||||
1724 | static PetscErrorCode PCPatchCreateMatrix_Private(PC pc, PetscInt point, Mat *mat, PetscBool withArtificial) | |||
1725 | { | |||
1726 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
1727 | Vec x, y; | |||
1728 | PetscBool flg; | |||
1729 | PetscInt csize, rsize; | |||
1730 | const char *prefix = NULL((void*)0); | |||
1731 | PetscErrorCode ierr; | |||
1732 | ||||
1733 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 1733; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1734 | if(withArtificial) { | |||
1735 | /* would be nice if we could create a rectangular matrix of size numDofsWithArtificial x numDofs here */ | |||
1736 | x = patch->patchRHSWithArtificial[point]; | |||
1737 | y = patch->patchRHSWithArtificial[point]; | |||
1738 | } else { | |||
1739 | x = patch->patchRHS[point]; | |||
1740 | y = patch->patchUpdate[point]; | |||
1741 | } | |||
1742 | ||||
1743 | ierr = VecGetSize(x, &csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1743,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1744 | ierr = VecGetSize(y, &rsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1744,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1745 | ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1745,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1746 | ierr = PCGetOptionsPrefix(pc, &prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1746,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1747 | ierr = MatSetOptionsPrefix(*mat, prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1747,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1748 | ierr = MatAppendOptionsPrefix(*mat, "pc_patch_sub_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1748,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1749 | if (patch->sub_mat_type) {ierr = MatSetType(*mat, patch->sub_mat_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1749,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1750 | else if (!patch->sub_mat_type) {ierr = MatSetType(*mat, MATDENSE"dense");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1750,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1751 | ierr = MatSetSizes(*mat, rsize, csize, rsize, csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1751,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1752 | ierr = PetscObjectTypeCompare((PetscObject) *mat, MATDENSE"dense", &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1752,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1753 | if (!flg) {ierr = PetscObjectTypeCompare((PetscObject)*mat, MATSEQDENSE"seqdense", &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1753,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1754 | /* Sparse patch matrices */ | |||
1755 | if (!flg) { | |||
1756 | PetscBT bt; | |||
1757 | PetscInt *dnnz = NULL((void*)0); | |||
1758 | const PetscInt *dofsArray = NULL((void*)0); | |||
1759 | PetscInt pStart, pEnd, ncell, offset, c, i, j; | |||
1760 | ||||
1761 | if(withArtificial) { | |||
1762 | ierr = ISGetIndices(patch->dofsWithArtificial, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1762,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1763 | } else { | |||
1764 | ierr = ISGetIndices(patch->dofs, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1764,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1765 | } | |||
1766 | ierr = PetscSectionGetChart(patch->cellCounts, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1766,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1767 | point += pStart; | |||
1768 | if (point >= pEnd) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Operator point %D not in [%D, %D)\n", point, pStart, pEnd)return PetscError(((MPI_Comm)0x44000001),1768,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,63,PETSC_ERROR_INITIAL,"Operator point %D not in [%D, %D)\n" ,point,pStart,pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1768,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1769 | ierr = PetscSectionGetDof(patch->cellCounts, point, &ncell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1769,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1770 | ierr = PetscSectionGetOffset(patch->cellCounts, point, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1770,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1771 | ierr = PetscLogEventBegin(PC_Patch_Prealloc, pc, 0, 0, 0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_Prealloc].active) ? (*PetscLogPLB)((PC_Patch_Prealloc ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1771,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1772 | /* A PetscBT uses N^2 bits to store the sparsity pattern on a | |||
1773 | * patch. This is probably OK if the patches are not too big, | |||
1774 | * but uses too much memory. We therefore switch based on rsize. */ | |||
1775 | if (rsize < 3000) { /* FIXME: I picked this switch value out of my hat */ | |||
1776 | PetscScalar *zeroes; | |||
1777 | PetscInt rows; | |||
1778 | ||||
1779 | ierr = PetscCalloc1(rsize, &dnnz)PetscMallocA(1,PETSC_TRUE,1779,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(rsize)*sizeof(**(&dnnz)),(&dnnz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1779,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1780 | ierr = PetscBTCreate(rsize*rsize, &bt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1780,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1781 | for (c = 0; c < ncell; ++c) { | |||
1782 | const PetscInt *idx = dofsArray + (offset + c)*patch->totalDofsPerCell; | |||
1783 | for (i = 0; i < patch->totalDofsPerCell; ++i) { | |||
1784 | const PetscInt row = idx[i]; | |||
1785 | if (row < 0) continue; | |||
1786 | for (j = 0; j < patch->totalDofsPerCell; ++j) { | |||
1787 | const PetscInt col = idx[j]; | |||
1788 | const PetscInt key = row*rsize + col; | |||
1789 | if (col < 0) continue; | |||
1790 | if (!PetscBTLookupSet(bt, key)) ++dnnz[row]; | |||
1791 | } | |||
1792 | } | |||
1793 | } | |||
1794 | ||||
1795 | if (patch->usercomputeopintfacet) { | |||
1796 | const PetscInt *intFacetsArray = NULL((void*)0); | |||
1797 | PetscInt i, numIntFacets, intFacetOffset; | |||
1798 | const PetscInt *facetCells = NULL((void*)0); | |||
1799 | ||||
1800 | ierr = PetscSectionGetDof(patch->intFacetCounts, point, &numIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1800,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1801 | ierr = PetscSectionGetOffset(patch->intFacetCounts, point, &intFacetOffset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1801,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1802 | ierr = ISGetIndices(patch->intFacetsToPatchCell, &facetCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1802,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1803 | ierr = ISGetIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1803,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1804 | for (i = 0; i < numIntFacets; i++) { | |||
1805 | const PetscInt cell0 = facetCells[2*(intFacetOffset + i) + 0]; | |||
1806 | const PetscInt cell1 = facetCells[2*(intFacetOffset + i) + 1]; | |||
1807 | PetscInt celli, cellj; | |||
1808 | ||||
1809 | for (celli = 0; celli < patch->totalDofsPerCell; celli++) { | |||
1810 | const PetscInt row = dofsArray[(offset + cell0)*patch->totalDofsPerCell + celli]; | |||
1811 | if (row < 0) continue; | |||
1812 | for (cellj = 0; cellj < patch->totalDofsPerCell; cellj++) { | |||
1813 | const PetscInt col = dofsArray[(offset + cell1)*patch->totalDofsPerCell + cellj]; | |||
1814 | const PetscInt key = row*rsize + col; | |||
1815 | if (col < 0) continue; | |||
1816 | if (!PetscBTLookupSet(bt, key)) ++dnnz[row]; | |||
1817 | } | |||
1818 | } | |||
1819 | ||||
1820 | for (celli = 0; celli < patch->totalDofsPerCell; celli++) { | |||
1821 | const PetscInt row = dofsArray[(offset + cell1)*patch->totalDofsPerCell + celli]; | |||
1822 | if (row < 0) continue; | |||
1823 | for (cellj = 0; cellj < patch->totalDofsPerCell; cellj++) { | |||
1824 | const PetscInt col = dofsArray[(offset + cell0)*patch->totalDofsPerCell + cellj]; | |||
1825 | const PetscInt key = row*rsize + col; | |||
1826 | if (col < 0) continue; | |||
1827 | if (!PetscBTLookupSet(bt, key)) ++dnnz[row]; | |||
1828 | } | |||
1829 | } | |||
1830 | } | |||
1831 | } | |||
1832 | ierr = PetscBTDestroy(&bt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1832,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1833 | ierr = MatXAIJSetPreallocation(*mat, 1, dnnz, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1833,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1834 | ierr = PetscFree(dnnz)((*PetscTrFree)((void*)(dnnz),1834,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((dnnz) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1834,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1835 | ||||
1836 | ierr = PetscCalloc1(patch->totalDofsPerCell*patch->totalDofsPerCell, &zeroes)PetscMallocA(1,PETSC_TRUE,1836,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->totalDofsPerCell*patch->totalDofsPerCell )*sizeof(**(&zeroes)),(&zeroes));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1836,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1837 | for (c = 0; c < ncell; ++c) { | |||
1838 | const PetscInt *idx = &dofsArray[(offset + c)*patch->totalDofsPerCell]; | |||
1839 | ierr = MatSetValues(*mat, patch->totalDofsPerCell, idx, patch->totalDofsPerCell, idx, zeroes, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1839,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1840 | } | |||
1841 | ierr = MatGetLocalSize(*mat, &rows, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1841,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1842 | for (i = 0; i < rows; ++i) { | |||
1843 | ierr = MatSetValues(*mat, 1, &i, 1, &i, zeroes, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1843,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1844 | } | |||
1845 | ||||
1846 | if (patch->usercomputeopintfacet) { | |||
1847 | const PetscInt *intFacetsArray = NULL((void*)0); | |||
1848 | PetscInt i, numIntFacets, intFacetOffset; | |||
1849 | const PetscInt *facetCells = NULL((void*)0); | |||
1850 | ||||
1851 | ierr = PetscSectionGetDof(patch->intFacetCounts, point, &numIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1851,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1852 | ierr = PetscSectionGetOffset(patch->intFacetCounts, point, &intFacetOffset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1852,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1853 | ierr = ISGetIndices(patch->intFacetsToPatchCell, &facetCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1853,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1854 | ierr = ISGetIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1854,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1855 | for (i = 0; i < numIntFacets; i++) { | |||
1856 | const PetscInt cell0 = facetCells[2*(intFacetOffset + i) + 0]; | |||
1857 | const PetscInt cell1 = facetCells[2*(intFacetOffset + i) + 1]; | |||
1858 | const PetscInt *cell0idx = &dofsArray[(offset + cell0)*patch->totalDofsPerCell]; | |||
1859 | const PetscInt *cell1idx = &dofsArray[(offset + cell1)*patch->totalDofsPerCell]; | |||
1860 | ierr = MatSetValues(*mat, patch->totalDofsPerCell, cell0idx, patch->totalDofsPerCell, cell1idx, zeroes, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1860,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1861 | ierr = MatSetValues(*mat, patch->totalDofsPerCell, cell1idx, patch->totalDofsPerCell, cell0idx, zeroes, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1862 | } | |||
1863 | } | |||
1864 | ||||
1865 | ierr = MatAssemblyBegin(*mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1865,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1866 | ierr = MatAssemblyEnd(*mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1866,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1867 | ||||
1868 | ierr = PetscFree(zeroes)((*PetscTrFree)((void*)(zeroes),1868,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((zeroes) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1868,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1869 | ||||
1870 | } else { /* rsize too big, use MATPREALLOCATOR */ | |||
1871 | Mat preallocator; | |||
1872 | PetscScalar* vals; | |||
1873 | ||||
1874 | ierr = PetscCalloc1(patch->totalDofsPerCell*patch->totalDofsPerCell, &vals)PetscMallocA(1,PETSC_TRUE,1874,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->totalDofsPerCell*patch->totalDofsPerCell )*sizeof(**(&vals)),(&vals));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1874,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1875 | ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1875,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1876 | ierr = MatSetType(preallocator, MATPREALLOCATOR"preallocator");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1876,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1877 | ierr = MatSetSizes(preallocator, rsize, rsize, rsize, rsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1877,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1878 | ierr = MatSetUp(preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1878,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1879 | ||||
1880 | for (c = 0; c < ncell; ++c) { | |||
1881 | const PetscInt *idx = dofsArray + (offset + c)*patch->totalDofsPerCell; | |||
1882 | ierr = MatSetValues(preallocator, patch->totalDofsPerCell, idx, patch->totalDofsPerCell, idx, vals, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1882,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1883 | } | |||
1884 | ||||
1885 | if (patch->usercomputeopintfacet) { | |||
1886 | const PetscInt *intFacetsArray = NULL((void*)0); | |||
1887 | PetscInt i, numIntFacets, intFacetOffset; | |||
1888 | const PetscInt *facetCells = NULL((void*)0); | |||
1889 | ||||
1890 | ierr = PetscSectionGetDof(patch->intFacetCounts, point, &numIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1890,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1891 | ierr = PetscSectionGetOffset(patch->intFacetCounts, point, &intFacetOffset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1891,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1892 | ierr = ISGetIndices(patch->intFacetsToPatchCell, &facetCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1892,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1893 | ierr = ISGetIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1893,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1894 | for (i = 0; i < numIntFacets; i++) { | |||
1895 | const PetscInt cell0 = facetCells[2*(intFacetOffset + i) + 0]; | |||
1896 | const PetscInt cell1 = facetCells[2*(intFacetOffset + i) + 1]; | |||
1897 | const PetscInt *cell0idx = &dofsArray[(offset + cell0)*patch->totalDofsPerCell]; | |||
1898 | const PetscInt *cell1idx = &dofsArray[(offset + cell1)*patch->totalDofsPerCell]; | |||
1899 | ierr = MatSetValues(preallocator, patch->totalDofsPerCell, cell0idx, patch->totalDofsPerCell, cell1idx, vals, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1899,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1900 | ierr = MatSetValues(preallocator, patch->totalDofsPerCell, cell1idx, patch->totalDofsPerCell, cell0idx, vals, INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1900,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1901 | } | |||
1902 | } | |||
1903 | ||||
1904 | ierr = PetscFree(vals)((*PetscTrFree)((void*)(vals),1904,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((vals) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1904,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1905 | ierr = MatAssemblyBegin(preallocator, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1905,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1906 | ierr = MatAssemblyEnd(preallocator, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1906,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1907 | ierr = MatPreallocatorPreallocate(preallocator, PETSC_TRUE, *mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1907,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1908 | ierr = MatDestroy(&preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1908,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1909 | } | |||
1910 | ierr = PetscLogEventEnd(PC_Patch_Prealloc, pc, 0, 0, 0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_Prealloc].active) ? (*PetscLogPLE)((PC_Patch_Prealloc ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1910,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1911 | if(withArtificial) { | |||
1912 | ierr = ISRestoreIndices(patch->dofsWithArtificial, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1912,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1913 | } else { | |||
1914 | ierr = ISRestoreIndices(patch->dofs, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1914,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1915 | } | |||
1916 | } | |||
1917 | ierr = MatSetUp(*mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1917,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1918 | 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); | |||
1919 | } | |||
1920 | ||||
1921 | static PetscErrorCode PCPatchComputeFunction_DMPlex_Private(PC pc, PetscInt patchNum, Vec x, Vec F, IS cellIS, PetscInt n, const PetscInt *l2p, const PetscInt *l2pWithAll, void *ctx) | |||
1922 | { | |||
1923 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
1924 | DM dm, plex; | |||
1925 | PetscSection s; | |||
1926 | const PetscInt *parray, *oarray; | |||
1927 | PetscInt Nf = patch->nsubspaces, Np, poff, p, f; | |||
1928 | PetscErrorCode ierr; | |||
1929 | ||||
1930 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 1930; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1931 | if (patch->precomputeElementTensors) SETERRQ(PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_WRONGSTATE, "Precomputing element tensors not implemented with DMPlex compute operator")return PetscError(PetscObjectComm((PetscObject)pc),1931,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,73,PETSC_ERROR_INITIAL,"Precomputing element tensors not implemented with DMPlex compute operator" ); | |||
1932 | ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1932,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1933 | ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1933,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1934 | dm = plex; | |||
1935 | ierr = DMGetDefaultSection(dm, &s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1935,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1936 | /* Set offset into patch */ | |||
1937 | ierr = PetscSectionGetDof(patch->pointCounts, patchNum, &Np);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1937,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1938 | ierr = PetscSectionGetOffset(patch->pointCounts, patchNum, &poff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1938,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1939 | ierr = ISGetIndices(patch->points, &parray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1939,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1940 | ierr = ISGetIndices(patch->offs, &oarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1940,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1941 | for (f = 0; f < Nf; ++f) { | |||
1942 | for (p = 0; p < Np; ++p) { | |||
1943 | const PetscInt point = parray[poff+p]; | |||
1944 | PetscInt dof; | |||
1945 | ||||
1946 | ierr = PetscSectionGetFieldDof(patch->patchSection, point, f, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1946,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1947 | ierr = PetscSectionSetFieldOffset(patch->patchSection, point, f, oarray[(poff+p)*Nf+f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1947,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1948 | if (patch->nsubspaces == 1) {ierr = PetscSectionSetOffset(patch->patchSection, point, oarray[(poff+p)*Nf+f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1948,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1949 | else {ierr = PetscSectionSetOffset(patch->patchSection, point, -1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1949,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1950 | } | |||
1951 | } | |||
1952 | ierr = ISRestoreIndices(patch->points, &parray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1952,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1953 | ierr = ISRestoreIndices(patch->offs, &oarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1953,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1954 | if (patch->viewSection) {ierr = ObjectView((PetscObject) patch->patchSection, patch->viewerSection, patch->formatSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1954,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1955 | ierr = DMPlexComputeResidual_Patch_Internal(dm, patch->patchSection, cellIS, 0.0, x, NULL((void*)0), F, ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1955,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1956 | ierr = DMDestroy(&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1956,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1957 | 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); | |||
1958 | } | |||
1959 | ||||
1960 | PetscErrorCode PCPatchComputeFunction_Internal(PC pc, Vec x, Vec F, PetscInt point) | |||
1961 | { | |||
1962 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
1963 | const PetscInt *dofsArray; | |||
1964 | const PetscInt *dofsArrayWithAll; | |||
1965 | const PetscInt *cellsArray; | |||
1966 | PetscInt ncell, offset, pStart, pEnd; | |||
1967 | PetscErrorCode ierr; | |||
1968 | ||||
1969 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 1969; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1970 | ierr = PetscLogEventBegin(PC_Patch_ComputeOp, pc, 0, 0, 0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_ComputeOp].active) ? (*PetscLogPLB)((PC_Patch_ComputeOp ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1970,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1971 | if (!patch->usercomputeop) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "Must call PCPatchSetComputeOperator() to set user callback\n")return PetscError(((MPI_Comm)0x44000001),1971,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,73,PETSC_ERROR_INITIAL,"Must call PCPatchSetComputeOperator() to set user callback\n" ); | |||
1972 | ierr = ISGetIndices(patch->dofs, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1972,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1973 | ierr = ISGetIndices(patch->dofsWithAll, &dofsArrayWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1973,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1974 | ierr = ISGetIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1974,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1975 | ierr = PetscSectionGetChart(patch->cellCounts, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1975,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1976 | ||||
1977 | point += pStart; | |||
1978 | if (point >= pEnd) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Operator point %D not in [%D, %D)\n", point, pStart, pEnd)return PetscError(((MPI_Comm)0x44000001),1978,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,63,PETSC_ERROR_INITIAL,"Operator point %D not in [%D, %D)\n" ,point,pStart,pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1978,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1979 | ||||
1980 | ierr = PetscSectionGetDof(patch->cellCounts, point, &ncell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1980,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1981 | ierr = PetscSectionGetOffset(patch->cellCounts, point, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1981,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1982 | if (ncell <= 0) { | |||
1983 | ierr = PetscLogEventEnd(PC_Patch_ComputeOp, pc, 0, 0, 0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_ComputeOp].active) ? (*PetscLogPLE)((PC_Patch_ComputeOp ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1983,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1984 | 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); | |||
1985 | } | |||
1986 | ierr = VecSet(F, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1986,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1987 | PetscStackPush("PCPatch user callback")do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "PCPatch user callback"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 1987; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(1987,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),1987,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0); | |||
1988 | /* Cannot reuse the same IS because the geometry info is being cached in it */ | |||
1989 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), ncell, cellsArray + offset, PETSC_USE_POINTER, &patch->cellIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1989,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1990 | ierr = patch->usercomputef(pc, point, x, F, patch->cellIS, ncell*patch->totalDofsPerCell, dofsArray + offset*patch->totalDofsPerCell, | |||
1991 | dofsArrayWithAll + offset*patch->totalDofsPerCell, | |||
1992 | patch->usercomputefctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1992,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1993 | PetscStackPopdo { do {PetscErrorCode _7_ierr = PetscMallocValidate(1993,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),1993,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.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); | |||
1994 | ierr = ISDestroy(&patch->cellIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1994,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1995 | ierr = ISRestoreIndices(patch->dofs, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1995,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1996 | ierr = ISRestoreIndices(patch->dofsWithAll, &dofsArrayWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1996,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1997 | ierr = ISRestoreIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1997,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1998 | if (patch->viewMatrix) { | |||
1999 | char name[PETSC_MAX_PATH_LEN4096]; | |||
2000 | ||||
2001 | ierr = PetscSNPrintf(name, PETSC_MAX_PATH_LEN4096-1, "Patch vector for Point %D", point);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2001,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2002 | ierr = PetscObjectSetName((PetscObject) F, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2002,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2003 | ierr = ObjectView((PetscObject) F, patch->viewerMatrix, patch->formatMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2003,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2004 | } | |||
2005 | ierr = PetscLogEventEnd(PC_Patch_ComputeOp, pc, 0, 0, 0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_ComputeOp].active) ? (*PetscLogPLE)((PC_Patch_ComputeOp ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2005,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2006 | 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); | |||
2007 | } | |||
2008 | ||||
2009 | static PetscErrorCode PCPatchComputeOperator_DMPlex_Private(PC pc, PetscInt patchNum, Vec x, Mat J, IS cellIS, PetscInt n, const PetscInt *l2p, const PetscInt *l2pWithAll, void *ctx) | |||
2010 | { | |||
2011 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
2012 | DM dm, plex; | |||
2013 | PetscSection s; | |||
2014 | const PetscInt *parray, *oarray; | |||
2015 | PetscInt Nf = patch->nsubspaces, Np, poff, p, f; | |||
2016 | PetscErrorCode ierr; | |||
2017 | ||||
2018 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2018; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2019 | ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2019,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2020 | ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2020,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2021 | dm = plex; | |||
2022 | ierr = DMGetDefaultSection(dm, &s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2022,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2023 | /* Set offset into patch */ | |||
2024 | ierr = PetscSectionGetDof(patch->pointCounts, patchNum, &Np);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2024,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2025 | ierr = PetscSectionGetOffset(patch->pointCounts, patchNum, &poff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2025,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2026 | ierr = ISGetIndices(patch->points, &parray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2026,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2027 | ierr = ISGetIndices(patch->offs, &oarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2027,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2028 | for (f = 0; f < Nf; ++f) { | |||
2029 | for (p = 0; p < Np; ++p) { | |||
2030 | const PetscInt point = parray[poff+p]; | |||
2031 | PetscInt dof; | |||
2032 | ||||
2033 | ierr = PetscSectionGetFieldDof(patch->patchSection, point, f, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2033,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2034 | ierr = PetscSectionSetFieldOffset(patch->patchSection, point, f, oarray[(poff+p)*Nf+f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2034,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2035 | if (patch->nsubspaces == 1) {ierr = PetscSectionSetOffset(patch->patchSection, point, oarray[(poff+p)*Nf+f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2035,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2036 | else {ierr = PetscSectionSetOffset(patch->patchSection, point, -1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2036,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2037 | } | |||
2038 | } | |||
2039 | ierr = ISRestoreIndices(patch->points, &parray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2039,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2040 | ierr = ISRestoreIndices(patch->offs, &oarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2040,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2041 | if (patch->viewSection) {ierr = ObjectView((PetscObject) patch->patchSection, patch->viewerSection, patch->formatSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2041,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2042 | /* TODO Shut off MatViewFromOptions() in MatAssemblyEnd() here */ | |||
2043 | ierr = DMPlexComputeJacobian_Patch_Internal(dm, patch->patchSection, patch->patchSection, cellIS, 0.0, 0.0, x, NULL((void*)0), J, J, ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2043,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2044 | ierr = DMDestroy(&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2044,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2045 | 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); | |||
2046 | } | |||
2047 | ||||
2048 | /* This function zeros mat on entry */ | |||
2049 | PetscErrorCode PCPatchComputeOperator_Internal(PC pc, Vec x, Mat mat, PetscInt point, PetscBool withArtificial) | |||
2050 | { | |||
2051 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
2052 | const PetscInt *dofsArray; | |||
2053 | const PetscInt *dofsArrayWithAll = NULL((void*)0); | |||
2054 | const PetscInt *cellsArray; | |||
2055 | PetscInt ncell, offset, pStart, pEnd, numIntFacets, intFacetOffset; | |||
2056 | PetscBool isNonlinear; | |||
2057 | PetscErrorCode ierr; | |||
2058 | ||||
2059 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2059; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2060 | ierr = PetscLogEventBegin(PC_Patch_ComputeOp, pc, 0, 0, 0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_ComputeOp].active) ? (*PetscLogPLB)((PC_Patch_ComputeOp ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2060,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2061 | isNonlinear = patch->isNonlinear; | |||
2062 | if (!patch->usercomputeop) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "Must call PCPatchSetComputeOperator() to set user callback\n")return PetscError(((MPI_Comm)0x44000001),2062,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,73,PETSC_ERROR_INITIAL,"Must call PCPatchSetComputeOperator() to set user callback\n" ); | |||
2063 | if(withArtificial) { | |||
2064 | ierr = ISGetIndices(patch->dofsWithArtificial, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2064,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2065 | } else { | |||
2066 | ierr = ISGetIndices(patch->dofs, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2066,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2067 | } | |||
2068 | if (isNonlinear) { | |||
2069 | ierr = ISGetIndices(patch->dofsWithAll, &dofsArrayWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2069,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2070 | } | |||
2071 | ierr = ISGetIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2071,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2072 | ierr = PetscSectionGetChart(patch->cellCounts, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2072,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2073 | ||||
2074 | point += pStart; | |||
2075 | if (point >= pEnd) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Operator point %D not in [%D, %D)\n", point, pStart, pEnd)return PetscError(((MPI_Comm)0x44000001),2075,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,63,PETSC_ERROR_INITIAL,"Operator point %D not in [%D, %D)\n" ,point,pStart,pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2075,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2076 | ||||
2077 | ierr = PetscSectionGetDof(patch->cellCounts, point, &ncell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2077,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2078 | ierr = PetscSectionGetOffset(patch->cellCounts, point, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2078,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2079 | if (ncell <= 0) { | |||
2080 | ierr = PetscLogEventEnd(PC_Patch_ComputeOp, pc, 0, 0, 0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_ComputeOp].active) ? (*PetscLogPLE)((PC_Patch_ComputeOp ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2080,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2081 | 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); | |||
2082 | } | |||
2083 | ierr = MatZeroEntries(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2083,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2084 | if (patch->precomputeElementTensors) { | |||
2085 | PetscInt i; | |||
2086 | PetscInt ndof = patch->totalDofsPerCell; | |||
2087 | const PetscScalar *elementTensors; | |||
2088 | ||||
2089 | ierr = VecGetArrayRead(patch->cellMats, &elementTensors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2089,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2090 | for (i = 0; i < ncell; i++) { | |||
2091 | const PetscInt cell = cellsArray[i + offset]; | |||
2092 | const PetscInt *idx = dofsArray + (offset + i)*ndof; | |||
2093 | const PetscScalar *v = elementTensors + patch->precomputedTensorLocations[cell]*ndof*ndof; | |||
2094 | ierr = MatSetValues(mat, ndof, idx, ndof, idx, v, ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2094,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2095 | } | |||
2096 | ierr = VecRestoreArrayRead(patch->cellMats, &elementTensors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2096,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2097 | ierr = MatAssemblyBegin(mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2097,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2098 | ierr = MatAssemblyEnd(mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2098,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2099 | } else { | |||
2100 | PetscStackPush("PCPatch user callback")do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "PCPatch user callback"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2100; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(2100,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),2100,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0); | |||
2101 | /* Cannot reuse the same IS because the geometry info is being cached in it */ | |||
2102 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), ncell, cellsArray + offset, PETSC_USE_POINTER, &patch->cellIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2102,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2103 | ierr = patch->usercomputeop(pc, point, x, mat, patch->cellIS, ncell*patch->totalDofsPerCell, dofsArray + offset*patch->totalDofsPerCell, dofsArrayWithAll ? dofsArrayWithAll + offset*patch->totalDofsPerCell : NULL((void*)0), patch->usercomputeopctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2103,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2104 | } | |||
2105 | if (patch->usercomputeopintfacet) { | |||
2106 | ierr = PetscSectionGetDof(patch->intFacetCounts, point, &numIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2106,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2107 | ierr = PetscSectionGetOffset(patch->intFacetCounts, point, &intFacetOffset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2107,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2108 | if (numIntFacets > 0) { | |||
2109 | /* For each interior facet, grab the two cells (in local numbering, and concatenate dof numberings for those cells) */ | |||
2110 | PetscInt *facetDofs = NULL((void*)0), *facetDofsWithAll = NULL((void*)0); | |||
2111 | const PetscInt *intFacetsArray = NULL((void*)0); | |||
2112 | PetscInt idx = 0; | |||
2113 | PetscInt i, c, d; | |||
2114 | PetscInt fStart; | |||
2115 | DM dm, plex; | |||
2116 | IS facetIS = NULL((void*)0); | |||
2117 | const PetscInt *facetCells = NULL((void*)0); | |||
2118 | ||||
2119 | ierr = ISGetIndices(patch->intFacetsToPatchCell, &facetCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2119,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2120 | ierr = ISGetIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2120,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2121 | ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2121,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2122 | ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2122,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2123 | dm = plex; | |||
2124 | ierr = DMPlexGetHeightStratum(dm, 1, &fStart, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2124,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2125 | /* FIXME: Pull this malloc out. */ | |||
2126 | ierr = PetscMalloc1(2 * patch->totalDofsPerCell * numIntFacets, &facetDofs)PetscMallocA(1,PETSC_FALSE,2126,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(2 * patch->totalDofsPerCell * numIntFacets)*sizeof (**(&facetDofs)),(&facetDofs));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2126,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2127 | if (dofsArrayWithAll) { | |||
2128 | ierr = PetscMalloc1(2 * patch->totalDofsPerCell * numIntFacets, &facetDofsWithAll)PetscMallocA(1,PETSC_FALSE,2128,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(2 * patch->totalDofsPerCell * numIntFacets)*sizeof (**(&facetDofsWithAll)),(&facetDofsWithAll));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2128,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2129 | } | |||
2130 | if (patch->precomputeElementTensors) { | |||
2131 | PetscInt nFacetDof = 2*patch->totalDofsPerCell; | |||
2132 | const PetscScalar *elementTensors; | |||
2133 | ||||
2134 | ierr = VecGetArrayRead(patch->intFacetMats, &elementTensors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2134,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2135 | ||||
2136 | for (i = 0; i < numIntFacets; i++) { | |||
2137 | const PetscInt facet = intFacetsArray[i + intFacetOffset]; | |||
2138 | const PetscScalar *v = elementTensors + patch->precomputedIntFacetTensorLocations[facet - fStart]*nFacetDof*nFacetDof; | |||
2139 | idx = 0; | |||
2140 | /* | |||
2141 | * 0--1 | |||
2142 | * |\-| | |||
2143 | * |+\| | |||
2144 | * 2--3 | |||
2145 | * [0, 2, 3, 0, 1, 3] | |||
2146 | */ | |||
2147 | for (c = 0; c < 2; c++) { | |||
2148 | const PetscInt cell = facetCells[2*(intFacetOffset + i) + c]; | |||
2149 | for (d = 0; d < patch->totalDofsPerCell; d++) { | |||
2150 | facetDofs[idx] = dofsArray[(offset + cell)*patch->totalDofsPerCell + d]; | |||
2151 | idx++; | |||
2152 | } | |||
2153 | } | |||
2154 | ierr = MatSetValues(mat, nFacetDof, facetDofs, nFacetDof, facetDofs, v, ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2154,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2155 | } | |||
2156 | ierr = VecRestoreArrayRead(patch->intFacetMats, &elementTensors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2156,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2157 | } else { | |||
2158 | /* | |||
2159 | * 0--1 | |||
2160 | * |\-| | |||
2161 | * |+\| | |||
2162 | * 2--3 | |||
2163 | * [0, 2, 3, 0, 1, 3] | |||
2164 | */ | |||
2165 | for (i = 0; i < numIntFacets; i++) { | |||
2166 | for (c = 0; c < 2; c++) { | |||
2167 | const PetscInt cell = facetCells[2*(intFacetOffset + i) + c]; | |||
2168 | for (d = 0; d < patch->totalDofsPerCell; d++) { | |||
2169 | facetDofs[idx] = dofsArray[(offset + cell)*patch->totalDofsPerCell + d]; | |||
2170 | if (dofsArrayWithAll) { | |||
2171 | facetDofsWithAll[idx] = dofsArrayWithAll[(offset + cell)*patch->totalDofsPerCell + d]; | |||
2172 | } | |||
2173 | idx++; | |||
2174 | } | |||
2175 | } | |||
2176 | } | |||
2177 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numIntFacets, intFacetsArray + intFacetOffset, PETSC_USE_POINTER, &facetIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2177,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2178 | ierr = patch->usercomputeopintfacet(pc, point, x, mat, facetIS, 2*numIntFacets*patch->totalDofsPerCell, facetDofs, facetDofsWithAll, patch->usercomputeopintfacetctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2178,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2179 | ierr = ISDestroy(&facetIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2179,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2180 | } | |||
2181 | ierr = ISRestoreIndices(patch->intFacetsToPatchCell, &facetCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2181,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2182 | ierr = ISRestoreIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2182,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2183 | ierr = PetscFree(facetDofs)((*PetscTrFree)((void*)(facetDofs),2183,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((facetDofs) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2183,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2184 | ierr = PetscFree(facetDofsWithAll)((*PetscTrFree)((void*)(facetDofsWithAll),2184,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((facetDofsWithAll) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2184,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2185 | ierr = DMDestroy(&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2185,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2186 | } | |||
2187 | } | |||
2188 | ||||
2189 | ierr = MatAssemblyBegin(mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2189,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2190 | ierr = MatAssemblyEnd(mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2190,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2191 | ||||
2192 | PetscStackPopdo { do {PetscErrorCode _7_ierr = PetscMallocValidate(2192,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),2192,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.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); | |||
2193 | ierr = ISDestroy(&patch->cellIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2193,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2194 | if(withArtificial) { | |||
2195 | ierr = ISRestoreIndices(patch->dofsWithArtificial, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2195,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2196 | } else { | |||
2197 | ierr = ISRestoreIndices(patch->dofs, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2197,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2198 | } | |||
2199 | if (isNonlinear) { | |||
2200 | ierr = ISRestoreIndices(patch->dofsWithAll, &dofsArrayWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2200,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2201 | } | |||
2202 | ierr = ISRestoreIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2202,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2203 | if (patch->viewMatrix) { | |||
2204 | char name[PETSC_MAX_PATH_LEN4096]; | |||
2205 | ||||
2206 | ierr = PetscSNPrintf(name, PETSC_MAX_PATH_LEN4096-1, "Patch matrix for Point %D", point);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2206,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2207 | ierr = PetscObjectSetName((PetscObject) mat, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2207,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2208 | ierr = ObjectView((PetscObject) mat, patch->viewerMatrix, patch->formatMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2208,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2209 | } | |||
2210 | ierr = PetscLogEventEnd(PC_Patch_ComputeOp, pc, 0, 0, 0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_ComputeOp].active) ? (*PetscLogPLE)((PC_Patch_ComputeOp ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2210,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2211 | 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); | |||
2212 | } | |||
2213 | ||||
2214 | static PetscErrorCode MatSetValues_PCPatch_Private(Mat mat, PetscInt m, const PetscInt idxm[], | |||
2215 | PetscInt n, const PetscInt idxn[], const PetscScalar *v, InsertMode addv) | |||
2216 | { | |||
2217 | Vec data; | |||
2218 | PetscScalar *array; | |||
2219 | PetscInt bs, nz, i, j, cell; | |||
2220 | PetscErrorCode ierr; | |||
2221 | ||||
2222 | ierr = MatShellGetContext(mat, &data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2222,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2223 | ierr = VecGetBlockSize(data, &bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2223,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2224 | ierr = VecGetSize(data, &nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2224,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2225 | ierr = VecGetArray(data, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2225,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2226 | if (m != n) SETERRQ(PetscObjectComm((PetscObject)mat), PETSC_ERR_ARG_WRONG, "Only for square insertion")return PetscError(PetscObjectComm((PetscObject)mat),2226,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,62,PETSC_ERROR_INITIAL,"Only for square insertion"); | |||
2227 | cell = (PetscInt)(idxm[0]/bs); /* use the fact that this is called once per cell */ | |||
2228 | for (i = 0; i < m; i++) { | |||
2229 | if (idxm[i] != idxn[i]) SETERRQ(PetscObjectComm((PetscObject)mat), PETSC_ERR_ARG_WRONG, "Row and column indices must match!")return PetscError(PetscObjectComm((PetscObject)mat),2229,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,62,PETSC_ERROR_INITIAL,"Row and column indices must match!"); | |||
2230 | for (j = 0; j < n; j++) { | |||
2231 | const PetscScalar v_ = v[i*bs + j]; | |||
2232 | /* Indexing is special to the data structure we have! */ | |||
2233 | if (addv == INSERT_VALUES) { | |||
2234 | array[cell*bs*bs + i*bs + j] = v_; | |||
2235 | } else { | |||
2236 | array[cell*bs*bs + i*bs + j] += v_; | |||
2237 | } | |||
2238 | } | |||
2239 | } | |||
2240 | ierr = VecRestoreArray(data, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2240,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2241 | 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); | |||
2242 | } | |||
2243 | ||||
2244 | static PetscErrorCode PCPatchPrecomputePatchTensors_Private(PC pc) | |||
2245 | { | |||
2246 | PC_PATCH *patch = (PC_PATCH *)pc->data; | |||
2247 | const PetscInt *cellsArray; | |||
2248 | PetscInt ncell, offset; | |||
2249 | const PetscInt *dofMapArray; | |||
2250 | PetscInt i, j; | |||
2251 | IS dofMap; | |||
2252 | IS cellIS; | |||
2253 | const PetscInt ndof = patch->totalDofsPerCell; | |||
2254 | PetscErrorCode ierr; | |||
2255 | Mat vecMat; | |||
2256 | PetscInt cStart, cEnd; | |||
2257 | DM dm, plex; | |||
2258 | ||||
2259 | ||||
2260 | ierr = ISGetSize(patch->cells, &ncell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2260,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2261 | if (!ncell) { /* No cells to assemble over -> skip */ | |||
2262 | 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); | |||
2263 | } | |||
2264 | ||||
2265 | ierr = PetscLogEventBegin(PC_Patch_ComputeOp, pc, 0, 0, 0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_ComputeOp].active) ? (*PetscLogPLB)((PC_Patch_ComputeOp ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2265,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2266 | ||||
2267 | ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2267,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2268 | ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2268,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2269 | dm = plex; | |||
2270 | if (!patch->allCells) { | |||
2271 | PetscHSetI cells; | |||
2272 | PetscHashIter hi; | |||
2273 | PetscInt pStart, pEnd; | |||
2274 | PetscInt *allCells = NULL((void*)0); | |||
2275 | ierr = PetscHSetICreate(&cells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2275,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2276 | ierr = ISGetIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2276,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2277 | ierr = PetscSectionGetChart(patch->cellCounts, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2277,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2278 | for (i = pStart; i < pEnd; i++) { | |||
2279 | ierr = PetscSectionGetDof(patch->cellCounts, i, &ncell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2279,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2280 | ierr = PetscSectionGetOffset(patch->cellCounts, i, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2280,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2281 | if (ncell <= 0) continue; | |||
2282 | for (j = 0; j < ncell; j++) { | |||
2283 | PetscHSetIAdd(cells, cellsArray[offset + j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2283,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2284 | } | |||
2285 | } | |||
2286 | ierr = ISRestoreIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2287 | ierr = PetscHSetIGetSize(cells, &ncell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2287,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2288 | ierr = PetscMalloc1(ncell, &allCells)PetscMallocA(1,PETSC_FALSE,2288,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(ncell)*sizeof(**(&allCells)),(&allCells));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2288,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2289 | ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2289,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2290 | ierr = PetscMalloc1(cEnd-cStart, &patch->precomputedTensorLocations)PetscMallocA(1,PETSC_FALSE,2290,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(cEnd-cStart)*sizeof(**(&patch->precomputedTensorLocations )),(&patch->precomputedTensorLocations));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2290,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2291 | i = 0; | |||
2292 | PetscHashIterBegin(cells, hi)do { (hi) = (khint_t)(0); if ((hi) != (((cells))->n_buckets ) && !(!((((cells))->flags[((hi))>>4]>> ((((hi))&0xfU)<<1))&3))) do { ++((hi)); } while (((hi)) != ((((cells)))->n_buckets) && !(!(((((cells )))->flags[(((hi)))>>4]>>(((((hi)))&0xfU)<< 1))&3))); } while (0); | |||
2293 | while (!PetscHashIterAtEnd(cells, hi)((hi) == (((cells))->n_buckets))) { | |||
2294 | PetscHashIterGetKey(cells, hi, allCells[i])((allCells[i]) = (((cells))->keys[(hi)])); | |||
2295 | patch->precomputedTensorLocations[allCells[i]] = i; | |||
2296 | PetscHashIterNext(cells, hi)do { ++(hi); } while ((hi) != (((cells))->n_buckets) && !(!((((cells))->flags[((hi))>>4]>>((((hi))& 0xfU)<<1))&3))); | |||
2297 | i++; | |||
2298 | } | |||
2299 | ierr = PetscHSetIDestroy(&cells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2299,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2300 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), ncell, allCells, PETSC_OWN_POINTER, &patch->allCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2300,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2301 | } | |||
2302 | ierr = ISGetSize(patch->allCells, &ncell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2302,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2303 | if (!patch->cellMats) { | |||
2304 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001), ncell*ndof*ndof, &patch->cellMats);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2304,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2305 | ierr = VecSetBlockSize(patch->cellMats, ndof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2305,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2306 | } | |||
2307 | ierr = VecSet(patch->cellMats, 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2307,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2308 | ||||
2309 | ierr = MatCreateShell(PETSC_COMM_SELF((MPI_Comm)0x44000001), ncell*ndof, ncell*ndof, ncell*ndof, ncell*ndof, | |||
2310 | (void*)patch->cellMats, &vecMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2310,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2311 | ierr = MatShellSetOperation(vecMat, MATOP_SET_VALUES, (void(*)(void))&MatSetValues_PCPatch_Private);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2311,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2312 | ierr = ISGetSize(patch->allCells, &ncell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2312,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2313 | ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001), ndof*ncell, 0, 1, &dofMap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2313,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2314 | ierr = ISGetIndices(dofMap, &dofMapArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2314,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2315 | ierr = ISGetIndices(patch->allCells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2315,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2316 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), ncell, cellsArray, PETSC_USE_POINTER, &cellIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2316,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2317 | PetscStackPush("PCPatch user callback")do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "PCPatch user callback"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2317; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(2317,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),2317,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0); | |||
2318 | /* TODO: Fix for DMPlex compute op, this bypasses a lot of the machinery and just assembles every element tensor. */ | |||
2319 | ierr = patch->usercomputeop(pc, -1, NULL((void*)0), vecMat, cellIS, ndof*ncell, dofMapArray, NULL((void*)0), patch->usercomputeopctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2319,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2320 | PetscStackPopdo { do {PetscErrorCode _7_ierr = PetscMallocValidate(2320,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),2320,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.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); | |||
2321 | ierr = ISDestroy(&cellIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2321,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2322 | ierr = MatDestroy(&vecMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2322,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2323 | ierr = ISRestoreIndices(patch->allCells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2323,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2324 | ierr = ISRestoreIndices(dofMap, &dofMapArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2324,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2325 | ierr = ISDestroy(&dofMap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2325,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2326 | ||||
2327 | if (patch->usercomputeopintfacet) { | |||
2328 | PetscInt nIntFacets; | |||
2329 | IS intFacetsIS; | |||
2330 | const PetscInt *intFacetsArray = NULL((void*)0); | |||
2331 | if (!patch->allIntFacets) { | |||
2332 | PetscHSetI facets; | |||
2333 | PetscHashIter hi; | |||
2334 | PetscInt pStart, pEnd, fStart, fEnd; | |||
2335 | PetscInt *allIntFacets = NULL((void*)0); | |||
2336 | ierr = PetscHSetICreate(&facets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2336,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2337 | ierr = ISGetIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2337,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2338 | ierr = PetscSectionGetChart(patch->intFacetCounts, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2338,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2339 | ierr = DMPlexGetHeightStratum(dm, 1, &fStart, &fEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2339,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2340 | for (i = pStart; i < pEnd; i++) { | |||
2341 | ierr = PetscSectionGetDof(patch->intFacetCounts, i, &nIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2341,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2342 | ierr = PetscSectionGetOffset(patch->intFacetCounts, i, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2342,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2343 | if (nIntFacets <= 0) continue; | |||
2344 | for (j = 0; j < nIntFacets; j++) { | |||
2345 | PetscHSetIAdd(facets, intFacetsArray[offset + j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2345,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2346 | } | |||
2347 | } | |||
2348 | ierr = ISRestoreIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2348,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2349 | ierr = PetscHSetIGetSize(facets, &nIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2349,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2350 | ierr = PetscMalloc1(nIntFacets, &allIntFacets)PetscMallocA(1,PETSC_FALSE,2350,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(nIntFacets)*sizeof(**(&allIntFacets)),(&allIntFacets ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2350,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2351 | ierr = PetscMalloc1(fEnd-fStart, &patch->precomputedIntFacetTensorLocations)PetscMallocA(1,PETSC_FALSE,2351,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(fEnd-fStart)*sizeof(**(&patch->precomputedIntFacetTensorLocations )),(&patch->precomputedIntFacetTensorLocations));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2351,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2352 | i = 0; | |||
2353 | PetscHashIterBegin(facets, hi)do { (hi) = (khint_t)(0); if ((hi) != (((facets))->n_buckets ) && !(!((((facets))->flags[((hi))>>4]>> ((((hi))&0xfU)<<1))&3))) do { ++((hi)); } while (((hi)) != ((((facets)))->n_buckets) && !(!(((((facets )))->flags[(((hi)))>>4]>>(((((hi)))&0xfU)<< 1))&3))); } while (0); | |||
2354 | while (!PetscHashIterAtEnd(facets, hi)((hi) == (((facets))->n_buckets))) { | |||
2355 | PetscHashIterGetKey(facets, hi, allIntFacets[i])((allIntFacets[i]) = (((facets))->keys[(hi)])); | |||
2356 | patch->precomputedIntFacetTensorLocations[allIntFacets[i] - fStart] = i; | |||
2357 | PetscHashIterNext(facets, hi)do { ++(hi); } while ((hi) != (((facets))->n_buckets) && !(!((((facets))->flags[((hi))>>4]>>((((hi))& 0xfU)<<1))&3))); | |||
2358 | i++; | |||
2359 | } | |||
2360 | ierr = PetscHSetIDestroy(&facets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2360,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2361 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), nIntFacets, allIntFacets, PETSC_OWN_POINTER, &patch->allIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2361,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2362 | } | |||
2363 | ierr = ISGetSize(patch->allIntFacets, &nIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2363,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2364 | if (!patch->intFacetMats) { | |||
2365 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001), nIntFacets*ndof*ndof*4, &patch->intFacetMats);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2365,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2366 | ierr = VecSetBlockSize(patch->intFacetMats, ndof*2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2366,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2367 | } | |||
2368 | ierr = VecSet(patch->intFacetMats, 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2368,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2369 | ||||
2370 | ierr = MatCreateShell(PETSC_COMM_SELF((MPI_Comm)0x44000001), nIntFacets*ndof*2, nIntFacets*ndof*2, nIntFacets*ndof*2, nIntFacets*ndof*2, | |||
2371 | (void*)patch->intFacetMats, &vecMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2371,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2372 | ierr = MatShellSetOperation(vecMat, MATOP_SET_VALUES, (void(*)(void))&MatSetValues_PCPatch_Private);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2372,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2373 | ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001), 2*ndof*nIntFacets, 0, 1, &dofMap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2373,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2374 | ierr = ISGetIndices(dofMap, &dofMapArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2374,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2375 | ierr = ISGetIndices(patch->allIntFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2375,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2376 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), nIntFacets, intFacetsArray, PETSC_USE_POINTER, &intFacetsIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2376,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2377 | PetscStackPush("PCPatch user callback (interior facets)")do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "PCPatch user callback (interior facets)"; petscstack-> file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2377; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(2377,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),2377,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0); | |||
2378 | /* TODO: Fix for DMPlex compute op, this bypasses a lot of the machinery and just assembles every element tensor. */ | |||
2379 | ierr = patch->usercomputeopintfacet(pc, -1, NULL((void*)0), vecMat, intFacetsIS, 2*ndof*nIntFacets, dofMapArray, NULL((void*)0), patch->usercomputeopintfacetctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2379,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2380 | PetscStackPopdo { do {PetscErrorCode _7_ierr = PetscMallocValidate(2380,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),2380,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.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); | |||
2381 | ierr = ISDestroy(&intFacetsIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2381,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2382 | ierr = MatDestroy(&vecMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2382,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2383 | ierr = ISRestoreIndices(patch->allIntFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2383,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2384 | ierr = ISRestoreIndices(dofMap, &dofMapArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2384,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2385 | ierr = ISDestroy(&dofMap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2385,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2386 | } | |||
2387 | ierr = DMDestroy(&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2387,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2388 | ierr = PetscLogEventEnd(PC_Patch_ComputeOp, pc, 0, 0, 0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_ComputeOp].active) ? (*PetscLogPLE)((PC_Patch_ComputeOp ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2388,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2389 | ||||
2390 | 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); | |||
2391 | } | |||
2392 | ||||
2393 | PetscErrorCode PCPatch_ScatterLocal_Private(PC pc, PetscInt p, Vec x, Vec y, InsertMode mode, ScatterMode scat, PatchScatterType scattertype) | |||
2394 | { | |||
2395 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
2396 | const PetscScalar *xArray = NULL((void*)0); | |||
2397 | PetscScalar *yArray = NULL((void*)0); | |||
2398 | const PetscInt *gtolArray = NULL((void*)0); | |||
2399 | PetscInt dof, offset, lidx; | |||
2400 | PetscErrorCode ierr; | |||
2401 | ||||
2402 | PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2402; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
2403 | ierr = PetscLogEventBegin(PC_Patch_Scatter, pc, 0, 0, 0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_Scatter].active) ? (*PetscLogPLB)((PC_Patch_Scatter ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2403,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2404 | ierr = VecGetArrayRead(x, &xArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2404,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2405 | ierr = VecGetArray(y, &yArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2405,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2406 | if (scattertype == SCATTER_WITHARTIFICIAL) { | |||
2407 | ierr = PetscSectionGetDof(patch->gtolCountsWithArtificial, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2407,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2408 | ierr = PetscSectionGetOffset(patch->gtolCountsWithArtificial, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2408,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2409 | ierr = ISGetIndices(patch->gtolWithArtificial, >olArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2409,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2410 | } else if (scattertype == SCATTER_WITHALL) { | |||
2411 | ierr = PetscSectionGetDof(patch->gtolCountsWithAll, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2411,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2412 | ierr = PetscSectionGetOffset(patch->gtolCountsWithAll, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2412,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2413 | ierr = ISGetIndices(patch->gtolWithAll, >olArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2413,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2414 | } else { | |||
2415 | ierr = PetscSectionGetDof(patch->gtolCounts, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2415,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2416 | ierr = PetscSectionGetOffset(patch->gtolCounts, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2416,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2417 | ierr = ISGetIndices(patch->gtol, >olArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2417,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2418 | } | |||
2419 | if (mode == INSERT_VALUES && scat != SCATTER_FORWARD) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_INCOMP, "Can't insert if not scattering forward\n")return PetscError(((MPI_Comm)0x44000001),2419,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,75,PETSC_ERROR_INITIAL,"Can't insert if not scattering forward\n" ); | |||
2420 | if (mode == ADD_VALUES && scat != SCATTER_REVERSE) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_INCOMP, "Can't add if not scattering reverse\n")return PetscError(((MPI_Comm)0x44000001),2420,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,75,PETSC_ERROR_INITIAL,"Can't add if not scattering reverse\n" ); | |||
2421 | for (lidx = 0; lidx < dof; ++lidx) { | |||
2422 | const PetscInt gidx = gtolArray[offset+lidx]; | |||
2423 | ||||
2424 | if (mode == INSERT_VALUES) yArray[lidx] = xArray[gidx]; /* Forward */ | |||
2425 | else yArray[gidx] += xArray[lidx]; /* Reverse */ | |||
2426 | } | |||
2427 | if (scattertype == SCATTER_WITHARTIFICIAL) { | |||
2428 | ierr = ISRestoreIndices(patch->gtolWithArtificial, >olArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2428,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2429 | } else if (scattertype == SCATTER_WITHALL) { | |||
2430 | ierr = ISRestoreIndices(patch->gtolWithAll, >olArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2430,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2431 | } else { | |||
2432 | ierr = ISRestoreIndices(patch->gtol, >olArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2432,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2433 | } | |||
2434 | ierr = VecRestoreArrayRead(x, &xArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2434,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2435 | ierr = VecRestoreArray(y, &yArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2435,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2436 | ierr = PetscLogEventEnd(PC_Patch_Scatter, pc, 0, 0, 0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_Scatter].active) ? (*PetscLogPLE)((PC_Patch_Scatter ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2436,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2437 | 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); | |||
2438 | } | |||
2439 | ||||
2440 | static PetscErrorCode PCSetUp_PATCH_Linear(PC pc) | |||
2441 | { | |||
2442 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
2443 | const char *prefix; | |||
2444 | PetscInt i; | |||
2445 | PetscErrorCode ierr; | |||
2446 | ||||
2447 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2447; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2448 | if (!pc->setupcalled) { | |||
2449 | ierr = PetscMalloc1(patch->npatch, &patch->solver)PetscMallocA(1,PETSC_FALSE,2449,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->npatch)*sizeof(**(&patch->solver)) ,(&patch->solver));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2449,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2450 | ierr = PCGetOptionsPrefix(pc, &prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2450,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2451 | for (i = 0; i < patch->npatch; ++i) { | |||
2452 | KSP ksp; | |||
2453 | PC subpc; | |||
2454 | ||||
2455 | ierr = KSPCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2455,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2456 | ierr = KSPSetErrorIfNotConverged(ksp, pc->erroriffailure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2456,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2457 | ierr = KSPSetOptionsPrefix(ksp, prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2457,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2458 | ierr = KSPAppendOptionsPrefix(ksp, "sub_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2458,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2459 | ierr = PetscObjectIncrementTabLevel((PetscObject) ksp, (PetscObject) pc, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2459,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2460 | ierr = KSPGetPC(ksp, &subpc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2460,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2461 | ierr = PetscObjectIncrementTabLevel((PetscObject) subpc, (PetscObject) pc, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2461,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2462 | ierr = PetscLogObjectParent((PetscObject) pc, (PetscObject) ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2462,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2463 | patch->solver[i] = (PetscObject) ksp; | |||
2464 | } | |||
2465 | } | |||
2466 | if (patch->save_operators) { | |||
2467 | if (patch->precomputeElementTensors) { | |||
2468 | ierr = PCPatchPrecomputePatchTensors_Private(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2468,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2469 | } | |||
2470 | for (i = 0; i < patch->npatch; ++i) { | |||
2471 | ierr = PCPatchComputeOperator_Internal(pc, NULL((void*)0), patch->mat[i], i, PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2471,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2472 | ierr = KSPSetOperators((KSP) patch->solver[i], patch->mat[i], patch->mat[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2472,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2473 | } | |||
2474 | } | |||
2475 | if(patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
2476 | for (i = 0; i < patch->npatch; ++i) { | |||
2477 | /* Instead of padding patch->patchUpdate with zeros to get */ | |||
2478 | /* patch->patchUpdateWithArtificial and then multiplying with the matrix, */ | |||
2479 | /* just get rid of the columns that correspond to the dofs with */ | |||
2480 | /* artificial bcs. That's of course fairly inefficient, hopefully we */ | |||
2481 | /* can just assemble the rectangular matrix in the first place. */ | |||
2482 | Mat matSquare; | |||
2483 | IS rowis; | |||
2484 | PetscInt dof; | |||
2485 | ||||
2486 | ierr = MatGetSize(patch->mat[i], &dof, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2486,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2487 | if (dof == 0) { | |||
2488 | patch->matWithArtificial[i] = NULL((void*)0); | |||
2489 | continue; | |||
2490 | } | |||
2491 | ||||
2492 | ierr = PCPatchCreateMatrix_Private(pc, i, &matSquare, PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2492,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2493 | ierr = PCPatchComputeOperator_Internal(pc, NULL((void*)0), matSquare, i, PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2493,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2494 | ||||
2495 | ierr = MatGetSize(matSquare, &dof, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2495,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2496 | ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001), dof, 0, 1, &rowis); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2496,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2497 | if(pc->setupcalled) { | |||
2498 | ierr = MatCreateSubMatrix(matSquare, rowis, patch->dofMappingWithoutToWithArtificial[i], MAT_REUSE_MATRIX, &patch->matWithArtificial[i]); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2498,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2499 | } else { | |||
2500 | ierr = MatCreateSubMatrix(matSquare, rowis, patch->dofMappingWithoutToWithArtificial[i], MAT_INITIAL_MATRIX, &patch->matWithArtificial[i]); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2500,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2501 | } | |||
2502 | ierr = ISDestroy(&rowis); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2502,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2503 | ierr = MatDestroy(&matSquare);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2503,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2504 | } | |||
2505 | } | |||
2506 | 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); | |||
2507 | } | |||
2508 | ||||
2509 | static PetscErrorCode PCSetUp_PATCH(PC pc) | |||
2510 | { | |||
2511 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
2512 | PetscInt i; | |||
2513 | PetscBool isNonlinear; | |||
2514 | PetscErrorCode ierr; | |||
2515 | ||||
2516 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2516; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2517 | if (!pc->setupcalled) { | |||
2518 | PetscInt pStart, pEnd, p; | |||
2519 | PetscInt localSize; | |||
2520 | ||||
2521 | ierr = PetscLogEventBegin(PC_Patch_CreatePatches, pc, 0, 0, 0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_CreatePatches].active) ? (*PetscLogPLB)((PC_Patch_CreatePatches ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2521,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2522 | ||||
2523 | isNonlinear = patch->isNonlinear; | |||
2524 | if (!patch->nsubspaces) { | |||
2525 | DM dm, plex; | |||
2526 | PetscSection s; | |||
2527 | PetscInt cStart, cEnd, c, Nf, f, numGlobalBcs = 0, *globalBcs, *Nb, totNb = 0, **cellDofs; | |||
2528 | ||||
2529 | ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2529,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2530 | if (!dm) SETERRQ(PetscObjectComm((PetscObject) pc), PETSC_ERR_ARG_WRONG, "Must set DM for PCPATCH or call PCPatchSetDiscretisationInfo()")return PetscError(PetscObjectComm((PetscObject) pc),2530,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,62,PETSC_ERROR_INITIAL,"Must set DM for PCPATCH or call PCPatchSetDiscretisationInfo()" ); | |||
2531 | ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2531,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2532 | dm = plex; | |||
2533 | ierr = DMGetDefaultSection(dm, &s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2533,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2534 | ierr = PetscSectionGetNumFields(s, &Nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2534,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2535 | ierr = PetscSectionGetChart(s, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2535,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2536 | for (p = pStart; p < pEnd; ++p) { | |||
2537 | PetscInt cdof; | |||
2538 | ierr = PetscSectionGetConstraintDof(s, p, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2538,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2539 | numGlobalBcs += cdof; | |||
2540 | } | |||
2541 | ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2541,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2542 | ierr = PetscMalloc3(Nf, &Nb, Nf, &cellDofs, numGlobalBcs, &globalBcs)PetscMallocA(3,PETSC_FALSE,2542,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(Nf)*sizeof(**(&Nb)),(&Nb),(size_t)(Nf)*sizeof (**(&cellDofs)),(&cellDofs),(size_t)(numGlobalBcs)*sizeof (**(&globalBcs)),(&globalBcs));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2542,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2543 | for (f = 0; f < Nf; ++f) { | |||
2544 | PetscFE fe; | |||
2545 | PetscDualSpace sp; | |||
2546 | PetscInt cdoff = 0; | |||
2547 | ||||
2548 | ierr = DMGetField(dm, f, NULL((void*)0), (PetscObject *) &fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2548,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2549 | /* ierr = PetscFEGetNumComponents(fe, &Nc[f]);CHKERRQ(ierr); */ | |||
2550 | ierr = PetscFEGetDualSpace(fe, &sp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2550,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2551 | ierr = PetscDualSpaceGetDimension(sp, &Nb[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2551,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2552 | totNb += Nb[f]; | |||
2553 | ||||
2554 | ierr = PetscMalloc1((cEnd-cStart)*Nb[f], &cellDofs[f])PetscMallocA(1,PETSC_FALSE,2554,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)((cEnd-cStart)*Nb[f])*sizeof(**(&cellDofs[f])),( &cellDofs[f]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2554,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2555 | for (c = cStart; c < cEnd; ++c) { | |||
2556 | PetscInt *closure = NULL((void*)0); | |||
2557 | PetscInt clSize = 0, cl; | |||
2558 | ||||
2559 | ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &clSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2559,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2560 | for (cl = 0; cl < clSize*2; cl += 2) { | |||
2561 | const PetscInt p = closure[cl]; | |||
2562 | PetscInt fdof, d, foff; | |||
2563 | ||||
2564 | ierr = PetscSectionGetFieldDof(s, p, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2564,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2565 | ierr = PetscSectionGetFieldOffset(s, p, f, &foff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2565,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2566 | for (d = 0; d < fdof; ++d, ++cdoff) cellDofs[f][cdoff] = foff + d; | |||
2567 | } | |||
2568 | ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &clSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2568,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2569 | } | |||
2570 | if (cdoff != (cEnd-cStart)*Nb[f]) SETERRQ4(PetscObjectComm((PetscObject) pc), PETSC_ERR_ARG_SIZ, "Total number of cellDofs %D for field %D should be Nc (%D) * cellDof (%D)", cdoff, f, cEnd-cStart, Nb[f])return PetscError(PetscObjectComm((PetscObject) pc),2570,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,60,PETSC_ERROR_INITIAL,"Total number of cellDofs %D for field %D should be Nc (%D) * cellDof (%D)" ,cdoff,f,cEnd-cStart,Nb[f]); | |||
2571 | } | |||
2572 | numGlobalBcs = 0; | |||
2573 | for (p = pStart; p < pEnd; ++p) { | |||
2574 | const PetscInt *ind; | |||
2575 | PetscInt off, cdof, d; | |||
2576 | ||||
2577 | ierr = PetscSectionGetOffset(s, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2577,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2578 | ierr = PetscSectionGetConstraintDof(s, p, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2578,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2579 | ierr = PetscSectionGetConstraintIndices(s, p, &ind);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2579,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2580 | for (d = 0; d < cdof; ++d) globalBcs[numGlobalBcs++] = off + ind[d]; | |||
2581 | } | |||
2582 | ||||
2583 | ierr = PCPatchSetDiscretisationInfoCombined(pc, dm, Nb, (const PetscInt **) cellDofs, numGlobalBcs, globalBcs, numGlobalBcs, globalBcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2583,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2584 | for (f = 0; f < Nf; ++f) { | |||
2585 | ierr = PetscFree(cellDofs[f])((*PetscTrFree)((void*)(cellDofs[f]),2585,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((cellDofs[f]) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2585,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2586 | } | |||
2587 | ierr = PetscFree3(Nb, cellDofs, globalBcs)PetscFreeA(3,2587,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,&(Nb),&(cellDofs),&(globalBcs));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2587,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2588 | ierr = PCPatchSetComputeFunction(pc, PCPatchComputeFunction_DMPlex_Private, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2588,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2589 | ierr = PCPatchSetComputeOperator(pc, PCPatchComputeOperator_DMPlex_Private, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2589,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2590 | ierr = DMDestroy(&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2590,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2591 | } | |||
2592 | ||||
2593 | localSize = patch->subspaceOffsets[patch->nsubspaces]; | |||
2594 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001), localSize, &patch->localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2594,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2595 | ierr = VecSetUp(patch->localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2595,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2596 | ierr = VecDuplicate(patch->localRHS, &patch->localUpdate);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2596,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2597 | ierr = PCPatchCreateCellPatches(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2597,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2598 | ierr = PCPatchCreateCellPatchDiscretisationInfo(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2598,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2599 | ||||
2600 | /* OK, now build the work vectors */ | |||
2601 | ierr = PetscSectionGetChart(patch->gtolCounts, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2601,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2602 | ierr = PetscMalloc1(patch->npatch, &patch->patchRHS)PetscMallocA(1,PETSC_FALSE,2602,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->npatch)*sizeof(**(&patch->patchRHS )),(&patch->patchRHS));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2602,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2603 | ierr = PetscMalloc1(patch->npatch, &patch->patchUpdate)PetscMallocA(1,PETSC_FALSE,2603,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->npatch)*sizeof(**(&patch->patchUpdate )),(&patch->patchUpdate));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2603,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2604 | ||||
2605 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
2606 | ierr = PetscMalloc1(patch->npatch, &patch->patchRHSWithArtificial)PetscMallocA(1,PETSC_FALSE,2606,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->npatch)*sizeof(**(&patch->patchRHSWithArtificial )),(&patch->patchRHSWithArtificial));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2606,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2607 | ierr = PetscMalloc1(patch->npatch, &patch->dofMappingWithoutToWithArtificial)PetscMallocA(1,PETSC_FALSE,2607,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->npatch)*sizeof(**(&patch->dofMappingWithoutToWithArtificial )),(&patch->dofMappingWithoutToWithArtificial));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2607,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2608 | } | |||
2609 | if (isNonlinear) { | |||
2610 | ierr = PetscMalloc1(patch->npatch, &patch->dofMappingWithoutToWithAll)PetscMallocA(1,PETSC_FALSE,2610,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->npatch)*sizeof(**(&patch->dofMappingWithoutToWithAll )),(&patch->dofMappingWithoutToWithAll));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2610,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2611 | } | |||
2612 | for (p = pStart; p < pEnd; ++p) { | |||
2613 | PetscInt dof; | |||
2614 | ||||
2615 | ierr = PetscSectionGetDof(patch->gtolCounts, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2615,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2616 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001), dof, &patch->patchRHS[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2616,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2617 | ierr = VecSetUp(patch->patchRHS[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2617,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2618 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001), dof, &patch->patchUpdate[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2618,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2619 | ierr = VecSetUp(patch->patchUpdate[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2619,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2620 | if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
2621 | const PetscInt *gtolArray, *gtolArrayWithArtificial = NULL((void*)0); | |||
2622 | PetscInt numPatchDofs, offset; | |||
2623 | PetscInt numPatchDofsWithArtificial, offsetWithArtificial; | |||
2624 | PetscInt dofWithoutArtificialCounter = 0; | |||
2625 | PetscInt *patchWithoutArtificialToWithArtificialArray; | |||
2626 | ||||
2627 | ierr = PetscSectionGetDof(patch->gtolCountsWithArtificial, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2627,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2628 | ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001), dof, &patch->patchRHSWithArtificial[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2628,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2629 | ierr = VecSetUp(patch->patchRHSWithArtificial[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2629,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2630 | ||||
2631 | /* Now build the mapping that for a dof in a patch WITHOUT dofs that have artificial bcs gives the */ | |||
2632 | /* the index in the patch with all dofs */ | |||
2633 | ierr = ISGetIndices(patch->gtol, >olArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2633,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2634 | ||||
2635 | ierr = PetscSectionGetDof(patch->gtolCounts, p, &numPatchDofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2635,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2636 | if (numPatchDofs == 0) { | |||
2637 | patch->dofMappingWithoutToWithArtificial[p-pStart] = NULL((void*)0); | |||
2638 | continue; | |||
2639 | } | |||
2640 | ||||
2641 | ierr = PetscSectionGetOffset(patch->gtolCounts, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2641,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2642 | ierr = ISGetIndices(patch->gtolWithArtificial, >olArrayWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2642,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2643 | ierr = PetscSectionGetDof(patch->gtolCountsWithArtificial, p, &numPatchDofsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2643,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2644 | ierr = PetscSectionGetOffset(patch->gtolCountsWithArtificial, p, &offsetWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2644,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2645 | ||||
2646 | ierr = PetscMalloc1(numPatchDofs, &patchWithoutArtificialToWithArtificialArray)PetscMallocA(1,PETSC_FALSE,2646,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numPatchDofs)*sizeof(**(&patchWithoutArtificialToWithArtificialArray )),(&patchWithoutArtificialToWithArtificialArray));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2646,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2647 | for (i=0; i<numPatchDofsWithArtificial; i++) { | |||
2648 | if (gtolArrayWithArtificial[i+offsetWithArtificial] == gtolArray[offset+dofWithoutArtificialCounter]) { | |||
2649 | patchWithoutArtificialToWithArtificialArray[dofWithoutArtificialCounter] = i; | |||
2650 | dofWithoutArtificialCounter++; | |||
2651 | if (dofWithoutArtificialCounter == numPatchDofs) | |||
2652 | break; | |||
2653 | } | |||
2654 | } | |||
2655 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numPatchDofs, patchWithoutArtificialToWithArtificialArray, PETSC_OWN_POINTER, &patch->dofMappingWithoutToWithArtificial[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2655,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2656 | ierr = ISRestoreIndices(patch->gtol, >olArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2656,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2657 | ierr = ISRestoreIndices(patch->gtolWithArtificial, >olArrayWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2657,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2658 | } | |||
2659 | if (isNonlinear) { | |||
2660 | const PetscInt *gtolArray, *gtolArrayWithAll = NULL((void*)0); | |||
2661 | PetscInt numPatchDofs, offset; | |||
2662 | PetscInt numPatchDofsWithAll, offsetWithAll; | |||
2663 | PetscInt dofWithoutAllCounter = 0; | |||
2664 | PetscInt *patchWithoutAllToWithAllArray; | |||
2665 | ||||
2666 | /* Now build the mapping that for a dof in a patch WITHOUT dofs that have artificial bcs gives the */ | |||
2667 | /* the index in the patch with all dofs */ | |||
2668 | ierr = ISGetIndices(patch->gtol, >olArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2668,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2669 | ||||
2670 | ierr = PetscSectionGetDof(patch->gtolCounts, p, &numPatchDofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2670,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2671 | if (numPatchDofs == 0) { | |||
2672 | patch->dofMappingWithoutToWithAll[p-pStart] = NULL((void*)0); | |||
2673 | continue; | |||
2674 | } | |||
2675 | ||||
2676 | ierr = PetscSectionGetOffset(patch->gtolCounts, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2676,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2677 | ierr = ISGetIndices(patch->gtolWithAll, >olArrayWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2677,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2678 | ierr = PetscSectionGetDof(patch->gtolCountsWithAll, p, &numPatchDofsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2678,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2679 | ierr = PetscSectionGetOffset(patch->gtolCountsWithAll, p, &offsetWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2679,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2680 | ||||
2681 | ierr = PetscMalloc1(numPatchDofs, &patchWithoutAllToWithAllArray)PetscMallocA(1,PETSC_FALSE,2681,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(numPatchDofs)*sizeof(**(&patchWithoutAllToWithAllArray )),(&patchWithoutAllToWithAllArray));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2681,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2682 | ||||
2683 | for (i=0; i<numPatchDofsWithAll; i++) { | |||
2684 | if (gtolArrayWithAll[i+offsetWithAll] == gtolArray[offset+dofWithoutAllCounter]) { | |||
2685 | patchWithoutAllToWithAllArray[dofWithoutAllCounter] = i; | |||
2686 | dofWithoutAllCounter++; | |||
2687 | if (dofWithoutAllCounter == numPatchDofs) | |||
2688 | break; | |||
2689 | } | |||
2690 | } | |||
2691 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), numPatchDofs, patchWithoutAllToWithAllArray, PETSC_OWN_POINTER, &patch->dofMappingWithoutToWithAll[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2691,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2692 | ierr = ISRestoreIndices(patch->gtol, >olArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2692,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2693 | ierr = ISRestoreIndices(patch->gtolWithAll, >olArrayWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2693,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2694 | } | |||
2695 | } | |||
2696 | if (patch->save_operators) { | |||
2697 | ierr = PetscMalloc1(patch->npatch, &patch->mat)PetscMallocA(1,PETSC_FALSE,2697,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->npatch)*sizeof(**(&patch->mat)),(& patch->mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2697,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2698 | for (i = 0; i < patch->npatch; ++i) { | |||
2699 | ierr = PCPatchCreateMatrix_Private(pc, i, &patch->mat[i], PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2699,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2700 | } | |||
2701 | } | |||
2702 | ierr = PetscLogEventEnd(PC_Patch_CreatePatches, pc, 0, 0, 0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_CreatePatches].active) ? (*PetscLogPLE)((PC_Patch_CreatePatches ),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2702,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2703 | ||||
2704 | /* If desired, calculate weights for dof multiplicity */ | |||
2705 | if (patch->partition_of_unity) { | |||
2706 | PetscScalar *input = NULL((void*)0); | |||
2707 | PetscScalar *output = NULL((void*)0); | |||
2708 | Vec global; | |||
2709 | ||||
2710 | ierr = VecDuplicate(patch->localRHS, &patch->dof_weights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2710,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2711 | if(patch->local_composition_type == PC_COMPOSITE_ADDITIVE) { | |||
2712 | for (i = 0; i < patch->npatch; ++i) { | |||
2713 | PetscInt dof; | |||
2714 | ||||
2715 | ierr = PetscSectionGetDof(patch->gtolCounts, i+pStart, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2715,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2716 | if (dof <= 0) continue; | |||
2717 | ierr = VecSet(patch->patchRHS[i], 1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2717,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2718 | ierr = PCPatch_ScatterLocal_Private(pc, i+pStart, patch->patchRHS[i], patch->dof_weights, ADD_VALUES, SCATTER_REVERSE, SCATTER_INTERIOR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2718,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2719 | } | |||
2720 | } else { | |||
2721 | /* multiplicative is actually only locally multiplicative and globally additive. need the pou where the mesh decomposition overlaps */ | |||
2722 | ierr = VecSet(patch->dof_weights, 1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2722,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2723 | } | |||
2724 | ||||
2725 | VecDuplicate(patch->dof_weights, &global); | |||
2726 | VecSet(global, 0.); | |||
2727 | ||||
2728 | ierr = VecGetArray(patch->dof_weights, &input);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2728,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2729 | ierr = VecGetArray(global, &output);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2729,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2730 | ierr = PetscSFReduceBegin(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), input, output, MPI_SUM(MPI_Op)(0x58000003));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2730,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2731 | ierr = PetscSFReduceEnd(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), input, output, MPI_SUM(MPI_Op)(0x58000003));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2731,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2732 | ierr = VecRestoreArray(patch->dof_weights, &input);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2732,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2733 | ierr = VecRestoreArray(global, &output);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2733,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2734 | ||||
2735 | ierr = VecReciprocal(global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2735,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2736 | ||||
2737 | ierr = VecGetArray(patch->dof_weights, &output);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2737,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2738 | ierr = VecGetArray(global, &input);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2738,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2739 | ierr = PetscSFBcastBegin(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), input, output);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2739,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2740 | ierr = PetscSFBcastEnd(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), input, output);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2740,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2741 | ierr = VecRestoreArray(patch->dof_weights, &output);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2741,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2742 | ierr = VecRestoreArray(global, &input);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2742,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2743 | ierr = VecDestroy(&global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2743,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2744 | } | |||
2745 | if(patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE && patch->save_operators) { | |||
2746 | ierr = PetscMalloc1(patch->npatch, &patch->matWithArtificial)PetscMallocA(1,PETSC_FALSE,2746,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(patch->npatch)*sizeof(**(&patch->matWithArtificial )),(&patch->matWithArtificial));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2746,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2747 | } | |||
2748 | } | |||
2749 | ierr = (*patch->setupsolver)(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2749,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2750 | 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); | |||
2751 | } | |||
2752 | ||||
2753 | static PetscErrorCode PCApply_PATCH_Linear(PC pc, PetscInt i, Vec x, Vec y) | |||
2754 | { | |||
2755 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
2756 | KSP ksp = (KSP) patch->solver[i]; | |||
2757 | PetscErrorCode ierr; | |||
2758 | ||||
2759 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2759; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2760 | if (!patch->save_operators) { | |||
2761 | Mat mat; | |||
2762 | ||||
2763 | ierr = PCPatchCreateMatrix_Private(pc, i, &mat, PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2763,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2764 | /* Populate operator here. */ | |||
2765 | ierr = PCPatchComputeOperator_Internal(pc, NULL((void*)0), mat, i, PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2765,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2766 | ierr = KSPSetOperators(ksp, mat, mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2766,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2767 | /* Drop reference so the KSPSetOperators below will blow it away. */ | |||
2768 | ierr = MatDestroy(&mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2768,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2769 | } | |||
2770 | ierr = PetscLogEventBegin(PC_Patch_Solve, pc, 0, 0, 0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_Solve].active) ? (*PetscLogPLB)((PC_Patch_Solve),0, (PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2770,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2771 | if (!ksp->setfromoptionscalled) { | |||
2772 | ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2772,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2773 | } | |||
2774 | ierr = KSPSolve(ksp, x, y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2774,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2775 | ierr = KSPCheckSolve(ksp, pc, y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2775,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2776 | ierr = PetscLogEventEnd(PC_Patch_Solve, pc, 0, 0, 0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_Solve].active) ? (*PetscLogPLE)((PC_Patch_Solve),0, (PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2776,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2777 | if (!patch->save_operators) { | |||
2778 | PC pc; | |||
2779 | ierr = KSPSetOperators(ksp, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2779,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2780 | ierr = KSPGetPC(ksp, &pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2780,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2781 | /* Destroy PC context too, otherwise the factored matrix hangs around. */ | |||
2782 | ierr = PCReset(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2782,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2783 | } | |||
2784 | 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); | |||
2785 | } | |||
2786 | ||||
2787 | static PetscErrorCode PCUpdateMultiplicative_PATCH_Linear(PC pc, PetscInt i, PetscInt pStart) | |||
2788 | { | |||
2789 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
2790 | Mat multMat; | |||
2791 | PetscErrorCode ierr; | |||
2792 | ||||
2793 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2793; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2794 | ||||
2795 | if (patch->save_operators) { | |||
2796 | multMat = patch->matWithArtificial[i]; | |||
2797 | } else { | |||
2798 | /*Very inefficient, hopefully we can just assemble the rectangular matrix in the first place.*/ | |||
2799 | Mat matSquare; | |||
2800 | PetscInt dof; | |||
2801 | IS rowis; | |||
2802 | ierr = PCPatchCreateMatrix_Private(pc, i, &matSquare, PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2802,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2803 | ierr = PCPatchComputeOperator_Internal(pc, NULL((void*)0), matSquare, i, PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2803,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2804 | ierr = MatGetSize(matSquare, &dof, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2804,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2805 | ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001), dof, 0, 1, &rowis); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2805,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2806 | ierr = MatCreateSubMatrix(matSquare, rowis, patch->dofMappingWithoutToWithArtificial[i], MAT_INITIAL_MATRIX, &multMat); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2806,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2807 | ierr = MatDestroy(&matSquare);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2807,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2808 | ierr = ISDestroy(&rowis); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2808,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2809 | } | |||
2810 | ierr = MatMult(multMat, patch->patchUpdate[i], patch->patchRHSWithArtificial[i]); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2810,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2811 | ierr = VecScale(patch->patchRHSWithArtificial[i], -1.0); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2811,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2812 | ierr = PCPatch_ScatterLocal_Private(pc, i + pStart, patch->patchRHSWithArtificial[i], patch->localRHS, ADD_VALUES, SCATTER_REVERSE, SCATTER_WITHARTIFICIAL); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2812,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2813 | if (!patch->save_operators) { | |||
2814 | ierr = MatDestroy(&multMat); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2814,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2815 | } | |||
2816 | 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); | |||
2817 | } | |||
2818 | ||||
2819 | static PetscErrorCode PCApply_PATCH(PC pc, Vec x, Vec y) | |||
2820 | { | |||
2821 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
2822 | const PetscScalar *globalRHS = NULL((void*)0); | |||
2823 | PetscScalar *localRHS = NULL((void*)0); | |||
2824 | PetscScalar *globalUpdate = NULL((void*)0); | |||
2825 | const PetscInt *bcNodes = NULL((void*)0); | |||
2826 | PetscInt nsweep = patch->symmetrise_sweep ? 2 : 1; | |||
2827 | PetscInt start[2] = {0, 0}; | |||
2828 | PetscInt end[2] = {-1, -1}; | |||
2829 | const PetscInt inc[2] = {1, -1}; | |||
2830 | const PetscScalar *localUpdate; | |||
2831 | const PetscInt *iterationSet; | |||
2832 | PetscInt pStart, numBcs, n, sweep, bc, j; | |||
2833 | PetscErrorCode ierr; | |||
2834 | ||||
2835 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2835; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2836 | ierr = PetscLogEventBegin(PC_Patch_Apply, pc, 0, 0, 0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_Apply].active) ? (*PetscLogPLB)((PC_Patch_Apply),0, (PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2836,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2837 | ierr = PetscOptionsPushGetViewerOff(PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2837,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2838 | /* start, end, inc have 2 entries to manage a second backward sweep if we symmetrize */ | |||
2839 | end[0] = patch->npatch; | |||
2840 | start[1] = patch->npatch-1; | |||
2841 | if (patch->user_patches) { | |||
2842 | ierr = ISGetLocalSize(patch->iterationSet, &end[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2842,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2843 | start[1] = end[0] - 1; | |||
2844 | ierr = ISGetIndices(patch->iterationSet, &iterationSet);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2844,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2845 | } | |||
2846 | /* Scatter from global space into overlapped local spaces */ | |||
2847 | ierr = VecGetArrayRead(x, &globalRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2847,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2848 | ierr = VecGetArray(patch->localRHS, &localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2848,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2849 | ierr = PetscSFBcastBegin(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), globalRHS, localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2849,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2850 | ierr = PetscSFBcastEnd(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), globalRHS, localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2850,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2851 | ierr = VecRestoreArrayRead(x, &globalRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2851,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2852 | ierr = VecRestoreArray(patch->localRHS, &localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2852,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2853 | ||||
2854 | ierr = VecSet(patch->localUpdate, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2854,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2855 | ierr = PetscSectionGetChart(patch->gtolCounts, &pStart, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2855,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2856 | for (sweep = 0; sweep < nsweep; sweep++) { | |||
2857 | for (j = start[sweep]; j*inc[sweep] < end[sweep]*inc[sweep]; j += inc[sweep]) { | |||
2858 | PetscInt i = patch->user_patches ? iterationSet[j] : j; | |||
2859 | PetscInt start, len; | |||
2860 | ||||
2861 | ierr = PetscSectionGetDof(patch->gtolCounts, i+pStart, &len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2862 | ierr = PetscSectionGetOffset(patch->gtolCounts, i+pStart, &start);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2862,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2863 | /* TODO: Squash out these guys in the setup as well. */ | |||
2864 | if (len <= 0) continue; | |||
2865 | /* TODO: Do we need different scatters for X and Y? */ | |||
2866 | ierr = PCPatch_ScatterLocal_Private(pc, i+pStart, patch->localRHS, patch->patchRHS[i], INSERT_VALUES, SCATTER_FORWARD, SCATTER_INTERIOR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2866,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2867 | ierr = (*patch->applysolver)(pc, i, patch->patchRHS[i], patch->patchUpdate[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2867,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2868 | ierr = PCPatch_ScatterLocal_Private(pc, i+pStart, patch->patchUpdate[i], patch->localUpdate, ADD_VALUES, SCATTER_REVERSE, SCATTER_INTERIOR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2868,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2869 | if(patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
2870 | ierr = (*patch->updatemultiplicative)(pc, i, pStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2870,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2871 | } | |||
2872 | } | |||
2873 | } | |||
2874 | if (patch->user_patches) {ierr = ISRestoreIndices(patch->iterationSet, &iterationSet);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2874,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2875 | /* XXX: should we do this on the global vector? */ | |||
2876 | if (patch->partition_of_unity) { | |||
2877 | ierr = VecPointwiseMult(patch->localUpdate, patch->localUpdate, patch->dof_weights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2877,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2878 | } | |||
2879 | /* Now patch->localUpdate contains the solution of the patch solves, so we need to combine them all. */ | |||
2880 | ierr = VecSet(y, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2880,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2881 | ierr = VecGetArray(y, &globalUpdate);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2881,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2882 | ierr = VecGetArrayRead(patch->localUpdate, &localUpdate);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2882,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2883 | ierr = PetscSFReduceBegin(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), localUpdate, globalUpdate, MPI_SUM(MPI_Op)(0x58000003));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2883,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2884 | ierr = PetscSFReduceEnd(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), localUpdate, globalUpdate, MPI_SUM(MPI_Op)(0x58000003));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2884,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2885 | ierr = VecRestoreArrayRead(patch->localUpdate, &localUpdate);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2885,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2886 | ||||
2887 | /* Now we need to send the global BC values through */ | |||
2888 | ierr = VecGetArrayRead(x, &globalRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2888,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2889 | ierr = ISGetSize(patch->globalBcNodes, &numBcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2889,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2890 | ierr = ISGetIndices(patch->globalBcNodes, &bcNodes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2890,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2891 | ierr = VecGetLocalSize(x, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2891,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2892 | for (bc = 0; bc < numBcs; ++bc) { | |||
2893 | const PetscInt idx = bcNodes[bc]; | |||
2894 | if (idx < n) globalUpdate[idx] = globalRHS[idx]; | |||
2895 | } | |||
2896 | ||||
2897 | ierr = ISRestoreIndices(patch->globalBcNodes, &bcNodes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2897,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2898 | ierr = VecRestoreArrayRead(x, &globalRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2898,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2899 | ierr = VecRestoreArray(y, &globalUpdate);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2899,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2900 | ||||
2901 | ierr = PetscOptionsPopGetViewerOff();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2901,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2902 | ierr = PetscLogEventEnd(PC_Patch_Apply, pc, 0, 0, 0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [PC_Patch_Apply].active) ? (*PetscLogPLE)((PC_Patch_Apply),0, (PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2902,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2903 | 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); | |||
2904 | } | |||
2905 | ||||
2906 | static PetscErrorCode PCReset_PATCH_Linear(PC pc) | |||
2907 | { | |||
2908 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
2909 | PetscInt i; | |||
2910 | PetscErrorCode ierr; | |||
2911 | ||||
2912 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2912; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2913 | if (patch->solver) { | |||
2914 | for (i = 0; i < patch->npatch; ++i) {ierr = KSPReset((KSP) patch->solver[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2914,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2915 | } | |||
2916 | 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); | |||
2917 | } | |||
2918 | ||||
2919 | static PetscErrorCode PCReset_PATCH(PC pc) | |||
2920 | { | |||
2921 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
2922 | PetscInt i; | |||
2923 | PetscErrorCode ierr; | |||
2924 | ||||
2925 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 2925; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2926 | ||||
2927 | ierr = PetscSFDestroy(&patch->defaultSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2927,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2928 | ierr = PetscSectionDestroy(&patch->cellCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2928,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2929 | ierr = PetscSectionDestroy(&patch->pointCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2929,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2930 | ierr = PetscSectionDestroy(&patch->cellNumbering);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2930,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2931 | ierr = PetscSectionDestroy(&patch->gtolCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2931,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2932 | ierr = ISDestroy(&patch->gtol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2932,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2933 | ierr = ISDestroy(&patch->cells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2933,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2934 | ierr = ISDestroy(&patch->points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2934,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2935 | ierr = ISDestroy(&patch->dofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2935,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2936 | ierr = ISDestroy(&patch->offs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2936,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2937 | ierr = PetscSectionDestroy(&patch->patchSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2937,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2938 | ierr = ISDestroy(&patch->ghostBcNodes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2938,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2939 | ierr = ISDestroy(&patch->globalBcNodes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2939,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2940 | ierr = PetscSectionDestroy(&patch->gtolCountsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2940,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2941 | ierr = ISDestroy(&patch->gtolWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2941,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2942 | ierr = ISDestroy(&patch->dofsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2942,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2943 | ierr = ISDestroy(&patch->offsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2943,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2944 | ierr = PetscSectionDestroy(&patch->gtolCountsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2944,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2945 | ierr = ISDestroy(&patch->gtolWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2945,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2946 | ierr = ISDestroy(&patch->dofsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2946,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2947 | ierr = ISDestroy(&patch->offsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2947,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2948 | ierr = VecDestroy(&patch->cellMats);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2948,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2949 | ierr = VecDestroy(&patch->intFacetMats);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2949,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2950 | ierr = ISDestroy(&patch->allCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2950,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2951 | ierr = ISDestroy(&patch->intFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2951,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2952 | ierr = ISDestroy(&patch->extFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2952,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2953 | ierr = ISDestroy(&patch->intFacetsToPatchCell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2953,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2954 | ierr = PetscSectionDestroy(&patch->intFacetCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2954,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2955 | ierr = PetscSectionDestroy(&patch->extFacetCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2955,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2956 | ||||
2957 | if (patch->dofSection) for (i = 0; i < patch->nsubspaces; i++) {ierr = PetscSectionDestroy(&patch->dofSection[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2957,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2958 | ierr = PetscFree(patch->dofSection)((*PetscTrFree)((void*)(patch->dofSection),2958,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->dofSection) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2958,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2959 | ierr = PetscFree(patch->bs)((*PetscTrFree)((void*)(patch->bs),2959,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->bs) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2959,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2960 | ierr = PetscFree(patch->nodesPerCell)((*PetscTrFree)((void*)(patch->nodesPerCell),2960,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->nodesPerCell) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2960,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2961 | if (patch->cellNodeMap) for (i = 0; i < patch->nsubspaces; i++) {ierr = PetscFree(patch->cellNodeMap[i])((*PetscTrFree)((void*)(patch->cellNodeMap[i]),2961,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->cellNodeMap[i]) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2961,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2962 | ierr = PetscFree(patch->cellNodeMap)((*PetscTrFree)((void*)(patch->cellNodeMap),2962,__func__, "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->cellNodeMap) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2962,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2963 | ierr = PetscFree(patch->subspaceOffsets)((*PetscTrFree)((void*)(patch->subspaceOffsets),2963,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->subspaceOffsets) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2963,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2964 | ||||
2965 | ierr = (*patch->resetsolver)(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2965,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2966 | ||||
2967 | if (patch->subspaces_to_exclude) { | |||
2968 | PetscHSetIDestroy(&patch->subspaces_to_exclude); | |||
2969 | } | |||
2970 | ||||
2971 | ierr = VecDestroy(&patch->localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2971,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2972 | ierr = VecDestroy(&patch->localUpdate);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2972,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2973 | if (patch->patchRHS) { | |||
2974 | for (i = 0; i < patch->npatch; ++i) {ierr = VecDestroy(&patch->patchRHS[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2974,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2975 | ierr = PetscFree(patch->patchRHS)((*PetscTrFree)((void*)(patch->patchRHS),2975,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->patchRHS) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2975,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2976 | } | |||
2977 | if (patch->patchUpdate) { | |||
2978 | for (i = 0; i < patch->npatch; ++i) {ierr = VecDestroy(&patch->patchUpdate[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2978,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2979 | ierr = PetscFree(patch->patchUpdate)((*PetscTrFree)((void*)(patch->patchUpdate),2979,__func__, "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->patchUpdate) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2979,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2980 | } | |||
2981 | ierr = VecDestroy(&patch->dof_weights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2981,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2982 | if (patch->patch_dof_weights) { | |||
2983 | for (i = 0; i < patch->npatch; ++i) {ierr = VecDestroy(&patch->patch_dof_weights[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2983,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2984 | ierr = PetscFree(patch->patch_dof_weights)((*PetscTrFree)((void*)(patch->patch_dof_weights),2984,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->patch_dof_weights) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2984,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2985 | } | |||
2986 | if (patch->mat) { | |||
2987 | for (i = 0; i < patch->npatch; ++i) {ierr = MatDestroy(&patch->mat[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2987,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2988 | ierr = PetscFree(patch->mat)((*PetscTrFree)((void*)(patch->mat),2988,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->mat) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2988,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2989 | } | |||
2990 | if (patch->matWithArtificial) { | |||
2991 | for (i = 0; i < patch->npatch; ++i) {ierr = MatDestroy(&patch->matWithArtificial[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2991,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2992 | ierr = PetscFree(patch->matWithArtificial)((*PetscTrFree)((void*)(patch->matWithArtificial),2992,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->matWithArtificial) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2992,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2993 | } | |||
2994 | if (patch->patchRHSWithArtificial) { | |||
2995 | for (i = 0; i < patch->npatch; ++i) {ierr = VecDestroy(&patch->patchRHSWithArtificial[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2995,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
2996 | ierr = PetscFree(patch->patchRHSWithArtificial)((*PetscTrFree)((void*)(patch->patchRHSWithArtificial),2996 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->patchRHSWithArtificial) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2996,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2997 | } | |||
2998 | if(patch->dofMappingWithoutToWithArtificial) { | |||
2999 | for (i = 0; i < patch->npatch; ++i) {ierr = ISDestroy(&patch->dofMappingWithoutToWithArtificial[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2999,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3000 | ierr = PetscFree(patch->dofMappingWithoutToWithArtificial)((*PetscTrFree)((void*)(patch->dofMappingWithoutToWithArtificial ),3000,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->dofMappingWithoutToWithArtificial) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3000,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3001 | ||||
3002 | } | |||
3003 | if(patch->dofMappingWithoutToWithAll) { | |||
3004 | for (i = 0; i < patch->npatch; ++i) {ierr = ISDestroy(&patch->dofMappingWithoutToWithAll[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3004,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3005 | ierr = PetscFree(patch->dofMappingWithoutToWithAll)((*PetscTrFree)((void*)(patch->dofMappingWithoutToWithAll) ,3005,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->dofMappingWithoutToWithAll) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3005,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3006 | ||||
3007 | } | |||
3008 | ierr = PetscFree(patch->sub_mat_type)((*PetscTrFree)((void*)(patch->sub_mat_type),3008,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->sub_mat_type) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3008,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3009 | if (patch->userIS) { | |||
3010 | for (i = 0; i < patch->npatch; ++i) {ierr = ISDestroy(&patch->userIS[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3010,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3011 | ierr = PetscFree(patch->userIS)((*PetscTrFree)((void*)(patch->userIS),3011,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->userIS) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3011,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3012 | } | |||
3013 | ierr = PetscFree(patch->precomputedTensorLocations)((*PetscTrFree)((void*)(patch->precomputedTensorLocations) ,3013,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->precomputedTensorLocations) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3013,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3014 | ierr = PetscFree(patch->precomputedIntFacetTensorLocations)((*PetscTrFree)((void*)(patch->precomputedIntFacetTensorLocations ),3014,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->precomputedIntFacetTensorLocations) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3014,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3015 | ||||
3016 | patch->bs = 0; | |||
3017 | patch->cellNodeMap = NULL((void*)0); | |||
3018 | patch->nsubspaces = 0; | |||
3019 | ierr = ISDestroy(&patch->iterationSet);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3019,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3020 | ||||
3021 | ierr = PetscViewerDestroy(&patch->viewerSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3021,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3022 | 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); | |||
3023 | } | |||
3024 | ||||
3025 | static PetscErrorCode PCDestroy_PATCH_Linear(PC pc) | |||
3026 | { | |||
3027 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
3028 | PetscInt i; | |||
3029 | PetscErrorCode ierr; | |||
3030 | ||||
3031 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 3031; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3032 | if (patch->solver) { | |||
3033 | for (i = 0; i < patch->npatch; ++i) {ierr = KSPDestroy((KSP *) &patch->solver[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3033,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3034 | ierr = PetscFree(patch->solver)((*PetscTrFree)((void*)(patch->solver),3034,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((patch->solver) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3034,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3035 | } | |||
3036 | 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); | |||
3037 | } | |||
3038 | ||||
3039 | static PetscErrorCode PCDestroy_PATCH(PC pc) | |||
3040 | { | |||
3041 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
3042 | PetscErrorCode ierr; | |||
3043 | ||||
3044 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 3044; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3045 | ierr = PCReset_PATCH(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3045,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3046 | ierr = (*patch->destroysolver)(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3046,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3047 | ierr = PetscFree(pc->data)((*PetscTrFree)((void*)(pc->data),3047,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((pc->data) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3047,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3048 | 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); | |||
3049 | } | |||
3050 | ||||
3051 | static PetscErrorCode PCSetFromOptions_PATCH(PetscOptionItems *PetscOptionsObject, PC pc) | |||
3052 | { | |||
3053 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
3054 | PCPatchConstructType patchConstructionType = PC_PATCH_STAR; | |||
3055 | char sub_mat_type[PETSC_MAX_PATH_LEN4096]; | |||
3056 | char option[PETSC_MAX_PATH_LEN4096]; | |||
3057 | const char *prefix; | |||
3058 | PetscBool flg, dimflg, codimflg; | |||
3059 | MPI_Comm comm; | |||
3060 | PetscInt *ifields, nfields, k; | |||
3061 | PetscErrorCode ierr; | |||
3062 | PCCompositeType loctype = PC_COMPOSITE_ADDITIVE; | |||
3063 | ||||
3064 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 3064; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3065 | ierr = PetscObjectGetComm((PetscObject) pc, &comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3065,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3066 | ierr = PetscObjectGetOptionsPrefix((PetscObject) pc, &prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3066,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3067 | ierr = PetscOptionsHead(PetscOptionsObject, "Patch solver options");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3067,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3068 | ||||
3069 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_save_operators", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3069,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3070 | ierr = PetscOptionsBool(option, "Store all patch operators for lifetime of object?", "PCPatchSetSaveOperators", patch->save_operators, &patch->save_operators, &flg)PetscOptionsBool_Private(PetscOptionsObject,option,"Store all patch operators for lifetime of object?" ,"PCPatchSetSaveOperators",patch->save_operators,&patch ->save_operators,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3070,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3071 | ||||
3072 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_precompute_element_tensors", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3072,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3073 | ierr = PetscOptionsBool(option, "Compute each element tensor only once?", "PCPatchSetPrecomputeElementTensors", patch->precomputeElementTensors, &patch->precomputeElementTensors, &flg)PetscOptionsBool_Private(PetscOptionsObject,option,"Compute each element tensor only once?" ,"PCPatchSetPrecomputeElementTensors",patch->precomputeElementTensors ,&patch->precomputeElementTensors,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3073,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3074 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_partition_of_unity", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3074,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3075 | ierr = PetscOptionsBool(option, "Weight contributions by dof multiplicity?", "PCPatchSetPartitionOfUnity", patch->partition_of_unity, &patch->partition_of_unity, &flg)PetscOptionsBool_Private(PetscOptionsObject,option,"Weight contributions by dof multiplicity?" ,"PCPatchSetPartitionOfUnity",patch->partition_of_unity,& patch->partition_of_unity,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3075,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3076 | ||||
3077 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_local_type", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3077,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3078 | ierr = PetscOptionsEnum(option,"Type of local solver composition (additive or multiplicative)","PCPatchSetLocalComposition",PCCompositeTypes,(PetscEnum)loctype,(PetscEnum*)&loctype,&flg)PetscOptionsEnum_Private(PetscOptionsObject,option,"Type of local solver composition (additive or multiplicative)" ,"PCPatchSetLocalComposition",PCCompositeTypes,(PetscEnum)loctype ,(PetscEnum*)&loctype,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3078,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3079 | if(flg) { ierr = PCPatchSetLocalComposition(pc, loctype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3079,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3080 | ||||
3081 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_construct_dim", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3081,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3082 | ierr = PetscOptionsInt(option, "What dimension of mesh point to construct patches by? (0 = vertices)", "PCPATCH", patch->dim, &patch->dim, &dimflg)PetscOptionsInt_Private(PetscOptionsObject,option,"What dimension of mesh point to construct patches by? (0 = vertices)" ,"PCPATCH",patch->dim,&patch->dim,&dimflg,(-2147483647 - 1),2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3082,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3083 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_construct_codim", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3083,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3084 | ierr = PetscOptionsInt(option, "What co-dimension of mesh point to construct patches by? (0 = cells)", "PCPATCH", patch->codim, &patch->codim, &codimflg)PetscOptionsInt_Private(PetscOptionsObject,option,"What co-dimension of mesh point to construct patches by? (0 = cells)" ,"PCPATCH",patch->codim,&patch->codim,&codimflg ,(-2147483647 - 1),2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3084,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3085 | if (dimflg && codimflg) SETERRQ(comm, PETSC_ERR_ARG_WRONG, "Can only set one of dimension or co-dimension")return PetscError(comm,3085,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,62,PETSC_ERROR_INITIAL,"Can only set one of dimension or co-dimension" ); | |||
3086 | ||||
3087 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_construct_type", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3087,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3088 | ierr = PetscOptionsEnum(option, "How should the patches be constructed?", "PCPatchSetConstructType", PCPatchConstructTypes, (PetscEnum) patchConstructionType, (PetscEnum *) &patchConstructionType, &flg)PetscOptionsEnum_Private(PetscOptionsObject,option,"How should the patches be constructed?" ,"PCPatchSetConstructType",PCPatchConstructTypes,(PetscEnum) patchConstructionType ,(PetscEnum *) &patchConstructionType,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3088,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3089 | if (flg) {ierr = PCPatchSetConstructType(pc, patchConstructionType, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3089,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3090 | ||||
3091 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_vanka_dim", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3091,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3092 | ierr = PetscOptionsInt(option, "Topological dimension of entities for Vanka to ignore", "PCPATCH", patch->vankadim, &patch->vankadim, &flg)PetscOptionsInt_Private(PetscOptionsObject,option,"Topological dimension of entities for Vanka to ignore" ,"PCPATCH",patch->vankadim,&patch->vankadim,&flg ,(-2147483647 - 1),2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3092,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3093 | ||||
3094 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_ignore_dim", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3094,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3095 | ierr = PetscOptionsInt(option, "Topological dimension of entities for completion to ignore", "PCPATCH", patch->ignoredim, &patch->ignoredim, &flg)PetscOptionsInt_Private(PetscOptionsObject,option,"Topological dimension of entities for completion to ignore" ,"PCPATCH",patch->ignoredim,&patch->ignoredim,& flg,(-2147483647 - 1),2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3095,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3096 | ||||
3097 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_pardecomp_overlap", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3097,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3098 | ierr = PetscOptionsInt(option, "What overlap should we use in construct type pardecomp?", "PCPATCH", patch->pardecomp_overlap, &patch->pardecomp_overlap, &flg)PetscOptionsInt_Private(PetscOptionsObject,option,"What overlap should we use in construct type pardecomp?" ,"PCPATCH",patch->pardecomp_overlap,&patch->pardecomp_overlap ,&flg,(-2147483647 - 1),2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3098,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3099 | ||||
3100 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_sub_mat_type", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3100,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3101 | ierr = PetscOptionsFList(option, "Matrix type for patch solves", "PCPatchSetSubMatType", MatList, NULL, sub_mat_type, PETSC_MAX_PATH_LEN, &flg)PetscOptionsFList_Private(PetscOptionsObject,option,"Matrix type for patch solves" ,"PCPatchSetSubMatType",MatList,((void*)0),sub_mat_type,4096, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3101,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3102 | if (flg) {ierr = PCPatchSetSubMatType(pc, sub_mat_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3102,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3103 | ||||
3104 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_symmetrise_sweep", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3104,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3105 | ierr = PetscOptionsBool(option, "Go start->end, end->start?", "PCPATCH", patch->symmetrise_sweep, &patch->symmetrise_sweep, &flg)PetscOptionsBool_Private(PetscOptionsObject,option,"Go start->end, end->start?" ,"PCPATCH",patch->symmetrise_sweep,&patch->symmetrise_sweep ,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3105,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3106 | ||||
3107 | /* If the user has set the number of subspaces, use that for the buffer size, | |||
3108 | otherwise use a large number */ | |||
3109 | if (patch->nsubspaces <= 0) { | |||
3110 | nfields = 128; | |||
3111 | } else { | |||
3112 | nfields = patch->nsubspaces; | |||
3113 | } | |||
3114 | ierr = PetscMalloc1(nfields, &ifields)PetscMallocA(1,PETSC_FALSE,3114,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(nfields)*sizeof(**(&ifields)),(&ifields));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3114,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3115 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_exclude_subspaces", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3115,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3116 | ierr = PetscOptionsGetIntArray(((PetscObject)pc)->options,((PetscObject)pc)->prefix,option,ifields,&nfields,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3116,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3117 | if (flg && (patchConstructionType == PC_PATCH_USER)) SETERRQ(comm, PETSC_ERR_ARG_INCOMP, "We cannot support excluding a subspace with user patches because we do not index patches with a mesh point")return PetscError(comm,3117,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,75,PETSC_ERROR_INITIAL,"We cannot support excluding a subspace with user patches because we do not index patches with a mesh point" ); | |||
3118 | if (flg) { | |||
3119 | PetscHSetIClear(patch->subspaces_to_exclude); | |||
3120 | for (k = 0; k < nfields; k++) { | |||
3121 | PetscHSetIAdd(patch->subspaces_to_exclude, ifields[k]); | |||
3122 | } | |||
3123 | } | |||
3124 | ierr = PetscFree(ifields)((*PetscTrFree)((void*)(ifields),3124,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ) || ((ifields) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3124,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3125 | ||||
3126 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_patches_view", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3126,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3127 | ierr = PetscOptionsBool(option, "Print out information during patch construction", "PCPATCH", patch->viewPatches, &patch->viewPatches, &flg)PetscOptionsBool_Private(PetscOptionsObject,option,"Print out information during patch construction" ,"PCPATCH",patch->viewPatches,&patch->viewPatches,& flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3127,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3128 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_cells_view", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3128,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3129 | ierr = PetscOptionsGetViewer(comm,((PetscObject) pc)->options, prefix, option, &patch->viewerCells, &patch->formatCells, &patch->viewCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3129,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3130 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_interior_facets_view", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3130,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3131 | ierr = PetscOptionsGetViewer(comm,((PetscObject) pc)->options, prefix, option, &patch->viewerIntFacets, &patch->formatIntFacets, &patch->viewIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3131,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3132 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_exterior_facets_view", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3132,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3133 | ierr = PetscOptionsGetViewer(comm,((PetscObject) pc)->options, prefix, option, &patch->viewerExtFacets, &patch->formatExtFacets, &patch->viewExtFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3133,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3134 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_points_view", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3134,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3135 | ierr = PetscOptionsGetViewer(comm,((PetscObject) pc)->options, prefix, option, &patch->viewerPoints, &patch->formatPoints, &patch->viewPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3135,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3136 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_section_view", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3136,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3137 | ierr = PetscOptionsGetViewer(comm,((PetscObject) pc)->options, prefix, option, &patch->viewerSection, &patch->formatSection, &patch->viewSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3137,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3138 | ierr = PetscSNPrintf(option, PETSC_MAX_PATH_LEN4096, "-%s_patch_mat_view", patch->classname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3138,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3139 | ierr = PetscOptionsGetViewer(comm,((PetscObject) pc)->options, prefix, option, &patch->viewerMatrix, &patch->formatMatrix, &patch->viewMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3139,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3140 | 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),3140,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3141 | patch->optionsSet = PETSC_TRUE; | |||
3142 | 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); | |||
3143 | } | |||
3144 | ||||
3145 | static PetscErrorCode PCSetUpOnBlocks_PATCH(PC pc) | |||
3146 | { | |||
3147 | PC_PATCH *patch = (PC_PATCH*) pc->data; | |||
3148 | KSPConvergedReason reason; | |||
3149 | PetscInt i; | |||
3150 | PetscErrorCode ierr; | |||
3151 | ||||
3152 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 3152; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3153 | if (!patch->save_operators) { | |||
3154 | /* Can't do this here because the sub KSPs don't have an operator attached yet. */ | |||
3155 | 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); | |||
3156 | } | |||
3157 | for (i = 0; i < patch->npatch; ++i) { | |||
3158 | if (!((KSP) patch->solver[i])->setfromoptionscalled) { | |||
3159 | ierr = KSPSetFromOptions((KSP) patch->solver[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3159,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3160 | } | |||
3161 | ierr = KSPSetUp((KSP) patch->solver[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3161,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3162 | ierr = KSPGetConvergedReason((KSP) patch->solver[i], &reason);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3162,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3163 | if (reason == KSP_DIVERGED_PC_FAILED) pc->failedreason = PC_SUBPC_ERROR; | |||
3164 | } | |||
3165 | 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); | |||
3166 | } | |||
3167 | ||||
3168 | static PetscErrorCode PCView_PATCH(PC pc, PetscViewer viewer) | |||
3169 | { | |||
3170 | PC_PATCH *patch = (PC_PATCH *) pc->data; | |||
3171 | PetscViewer sviewer; | |||
3172 | PetscBool isascii; | |||
3173 | PetscMPIInt rank; | |||
3174 | PetscErrorCode ierr; | |||
3175 | ||||
3176 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 3176; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3177 | /* TODO Redo tabbing with set tbas in new style */ | |||
3178 | ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERASCII"ascii", &isascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3178,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3179 | if (!isascii) 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); | |||
3180 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject) pc), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3180,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3181 | ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3181,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3182 | ierr = PetscViewerASCIIPrintf(viewer, "Subspace Correction preconditioner with %d patches\n", patch->npatch);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3182,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3183 | if(patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) { | |||
3184 | ierr = PetscViewerASCIIPrintf(viewer, "Schwarz type: multiplicative\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3184,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3185 | } else { | |||
3186 | ierr = PetscViewerASCIIPrintf(viewer, "Schwarz type: additive\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3186,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3187 | } | |||
3188 | if (patch->partition_of_unity) {ierr = PetscViewerASCIIPrintf(viewer, "Weighting by partition of unity\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3188,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3189 | else {ierr = PetscViewerASCIIPrintf(viewer, "Not weighting by partition of unity\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3189,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3190 | if (patch->symmetrise_sweep) {ierr = PetscViewerASCIIPrintf(viewer, "Symmetrising sweep (start->end, then end->start)\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3190,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3191 | else {ierr = PetscViewerASCIIPrintf(viewer, "Not symmetrising sweep\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3191,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3192 | if (!patch->precomputeElementTensors) {ierr = PetscViewerASCIIPrintf(viewer, "Not precomputing element tensors (overlapping cells rebuilt in every patch assembly)\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3192,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3193 | else {ierr = PetscViewerASCIIPrintf(viewer, "Precomputing element tensors (each cell assembled only once)\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3193,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3194 | if (!patch->save_operators) {ierr = PetscViewerASCIIPrintf(viewer, "Not saving patch operators (rebuilt every PCApply)\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3194,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3195 | else {ierr = PetscViewerASCIIPrintf(viewer, "Saving patch operators (rebuilt every PCSetUp)\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3195,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3196 | if (patch->patchconstructop == PCPatchConstruct_Star) {ierr = PetscViewerASCIIPrintf(viewer, "Patch construction operator: star\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3196,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3197 | else if (patch->patchconstructop == PCPatchConstruct_Vanka) {ierr = PetscViewerASCIIPrintf(viewer, "Patch construction operator: Vanka\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3197,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3198 | else if (patch->patchconstructop == PCPatchConstruct_User) {ierr = PetscViewerASCIIPrintf(viewer, "Patch construction operator: user-specified\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3198,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3199 | else {ierr = PetscViewerASCIIPrintf(viewer, "Patch construction operator: unknown\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3199,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
3200 | ||||
3201 | if (patch->isNonlinear) { | |||
3202 | ierr = PetscViewerASCIIPrintf(viewer, "SNES on patches (all same):\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3202,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3203 | } else { | |||
3204 | ierr = PetscViewerASCIIPrintf(viewer, "KSP on patches (all same):\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3204,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3205 | } | |||
3206 | if (patch->solver) { | |||
3207 | ierr = PetscViewerGetSubViewer(viewer, PETSC_COMM_SELF((MPI_Comm)0x44000001), &sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3207,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3208 | if (!rank) { | |||
3209 | ierr = PetscViewerASCIIPushTab(sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3209,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3210 | ierr = PetscObjectView(patch->solver[0], sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3210,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3211 | ierr = PetscViewerASCIIPopTab(sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3211,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3212 | } | |||
3213 | ierr = PetscViewerRestoreSubViewer(viewer, PETSC_COMM_SELF((MPI_Comm)0x44000001), &sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3213,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3214 | } else { | |||
3215 | ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3215,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3216 | ierr = PetscViewerASCIIPrintf(viewer, "Solver not yet set.\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3216,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3217 | ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3217,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3218 | } | |||
3219 | ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3219,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3220 | 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); | |||
3221 | } | |||
3222 | ||||
3223 | /*MC | |||
3224 | PCPATCH - A PC object that encapsulates flexible definition of blocks for overlapping and non-overlapping | |||
3225 | small block additive preconditioners. Block definition is based on topology from | |||
3226 | a DM and equation numbering from a PetscSection. | |||
3227 | ||||
3228 | Options Database Keys: | |||
3229 | + -pc_patch_cells_view - Views the process local cell numbers for each patch | |||
3230 | . -pc_patch_points_view - Views the process local mesh point numbers for each patch | |||
3231 | . -pc_patch_g2l_view - Views the map between global dofs and patch local dofs for each patch | |||
3232 | . -pc_patch_patches_view - Views the global dofs associated with each patch and its boundary | |||
3233 | - -pc_patch_sub_mat_view - Views the matrix associated with each patch | |||
3234 | ||||
3235 | Level: intermediate | |||
3236 | ||||
3237 | .seealso: PCType, PCCreate(), PCSetType() | |||
3238 | M*/ | |||
3239 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PCCreate_Patch(PC pc) | |||
3240 | { | |||
3241 | PC_PATCH *patch; | |||
3242 | PetscErrorCode ierr; | |||
3243 | ||||
3244 | 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/patch/pcpatch.c" ; petscstack->line[petscstack->currentsize] = 3244; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3245 | ierr = PetscNewLog(pc, &patch)(PetscMallocA(1,PETSC_TRUE,3245,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,(size_t)(1)*sizeof(**(((&patch)))),(((&patch)))) || PetscLogObjectMemory ((PetscObject)pc,sizeof(**(&patch))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3245,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3246 | ||||
3247 | if (patch->subspaces_to_exclude) { | |||
3248 | PetscHSetIDestroy(&patch->subspaces_to_exclude); | |||
3249 | } | |||
3250 | PetscHSetICreate(&patch->subspaces_to_exclude); | |||
3251 | ||||
3252 | patch->classname = "pc"; | |||
3253 | patch->isNonlinear = PETSC_FALSE; | |||
3254 | ||||
3255 | /* Set some defaults */ | |||
3256 | patch->combined = PETSC_FALSE; | |||
3257 | patch->save_operators = PETSC_TRUE; | |||
3258 | patch->local_composition_type = PC_COMPOSITE_ADDITIVE; | |||
3259 | patch->precomputeElementTensors = PETSC_FALSE; | |||
3260 | patch->partition_of_unity = PETSC_FALSE; | |||
3261 | patch->codim = -1; | |||
3262 | patch->dim = -1; | |||
3263 | patch->vankadim = -1; | |||
3264 | patch->ignoredim = -1; | |||
3265 | patch->pardecomp_overlap = 0; | |||
3266 | patch->patchconstructop = PCPatchConstruct_Star; | |||
3267 | patch->symmetrise_sweep = PETSC_FALSE; | |||
3268 | patch->npatch = 0; | |||
3269 | patch->userIS = NULL((void*)0); | |||
3270 | patch->optionsSet = PETSC_FALSE; | |||
3271 | patch->iterationSet = NULL((void*)0); | |||
3272 | patch->user_patches = PETSC_FALSE; | |||
3273 | ierr = PetscStrallocpy(MATDENSE"dense", (char **) &patch->sub_mat_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3273,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3274 | patch->viewPatches = PETSC_FALSE; | |||
3275 | patch->viewCells = PETSC_FALSE; | |||
3276 | patch->viewPoints = PETSC_FALSE; | |||
3277 | patch->viewSection = PETSC_FALSE; | |||
3278 | patch->viewMatrix = PETSC_FALSE; | |||
3279 | patch->setupsolver = PCSetUp_PATCH_Linear; | |||
3280 | patch->applysolver = PCApply_PATCH_Linear; | |||
3281 | patch->resetsolver = PCReset_PATCH_Linear; | |||
3282 | patch->destroysolver = PCDestroy_PATCH_Linear; | |||
3283 | patch->updatemultiplicative = PCUpdateMultiplicative_PATCH_Linear; | |||
3284 | patch->dofMappingWithoutToWithArtificial = NULL((void*)0); | |||
3285 | patch->dofMappingWithoutToWithAll = NULL((void*)0); | |||
3286 | ||||
3287 | pc->data = (void *) patch; | |||
3288 | pc->ops->apply = PCApply_PATCH; | |||
3289 | pc->ops->applytranspose = 0; /* PCApplyTranspose_PATCH; */ | |||
3290 | pc->ops->setup = PCSetUp_PATCH; | |||
3291 | pc->ops->reset = PCReset_PATCH; | |||
3292 | pc->ops->destroy = PCDestroy_PATCH; | |||
3293 | pc->ops->setfromoptions = PCSetFromOptions_PATCH; | |||
3294 | pc->ops->setuponblocks = PCSetUpOnBlocks_PATCH; | |||
3295 | pc->ops->view = PCView_PATCH; | |||
3296 | pc->ops->applyrichardson = 0; | |||
3297 | ||||
3298 | 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); | |||
3299 | } |