Bug Summary

File:ksp/pc/impls/patch/pcpatch.c
Warning:line 112, column 24
2nd function call argument is an uninitialized value

Annotated Source Code

[?] 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
8PetscLogEvent PC_Patch_CreatePatches, PC_Patch_ComputeOp, PC_Patch_Solve, PC_Patch_Scatter, PC_Patch_Apply, PC_Patch_Prealloc;
9
10PETSC_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
20static 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
37static 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
79static 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;
1
'nleaves' declared without an initial value
85 PetscBool isFiredrake;
86 DM plex;
87 PetscBool flg;
88 PetscInt starSize;
89 PetscInt *star = NULL((void*)0);
90 PetscInt opoint, overlapi;
91 PetscErrorCode ierr;
92
93 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] = 93; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
94 PetscHSetIClear(ht);
95
96 ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),96,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
97 ierr = DMPlexGetChart(plex, &pStart, &pEnd);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
99 ierr = DMHasLabel(dm, "pyop2_ghost", &isFiredrake);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 if (isFiredrake) {
2
Assuming 'isFiredrake' is not equal to 0
3
Taking true branch
101 ierr = DMGetLabel(dm, "pyop2_ghost", &ghost);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),101,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
102 ierr = DMLabelCreateIndex(ghost, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),102,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
103 } else {
104 PetscSF sf;
105 ierr = DMGetPointSF(dm, &sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),105,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
106 ierr = PetscSFGetGraph(sf, NULL((void*)0), &nleaves, &leaves, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),106,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
107 nleaves = PetscMax(nleaves, 0)(((nleaves)<(0)) ? (0) : (nleaves));
108 }
109
110 for (opoint = pStart; opoint < pEnd; ++opoint) {
4
Loop condition is true. Entering loop body
111 if (ghost) {ierr = DMLabelHasPoint(ghost, opoint, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),111,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5
Assuming 'ghost' is null
6
Taking false branch
112 else {ierr = PetscFindInt(opoint, nleaves, leaves, &loc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),112,__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;}
7
2nd function call argument is an uninitialized value
113 /* Not an owned entity, don't make a cell patch. */
114 if (flg) continue;
115 ierr = PetscHSetIAdd(ht, opoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),115,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
116 }
117
118 /* Now build the overlap for the patch */
119 for (overlapi = 0; overlapi < patch->pardecomp_overlap; ++overlapi) {
120 PetscInt index = 0;
121 PetscInt *htpoints = NULL((void*)0);
122 PetscInt htsize;
123 PetscInt i;
124
125 ierr = PetscHSetIGetSize(ht, &htsize);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 ierr = PetscMalloc1(htsize, &htpoints)PetscMallocA(1,PETSC_FALSE,126,__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),126,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
127 ierr = PetscHSetIGetElems(ht, &index, htpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
128
129 for (i = 0; i < htsize; ++i) {
130 PetscInt hpoint = htpoints[i];
131 PetscInt si;
132
133 ierr = DMPlexGetTransitiveClosure(dm, hpoint, PETSC_FALSE, &starSize, &star);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),133,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
134 for (si = 0; si < starSize*2; si += 2) {
135 const PetscInt starp = star[si];
136 PetscInt closureSize;
137 PetscInt *closure = NULL((void*)0), ci;
138
139 /* now loop over all entities in the closure of starp */
140 ierr = DMPlexGetTransitiveClosure(dm, starp, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),140,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
141 for (ci = 0; ci < closureSize*2; ci += 2) {
142 const PetscInt closstarp = closure[ci];
143 ierr = PetscHSetIAdd(ht, closstarp);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, starp, PETSC_TRUE, &closureSize, &closure);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 = DMPlexRestoreTransitiveClosure(dm, hpoint, PETSC_FALSE, &starSize, &star);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 ierr = PetscFree(htpoints)((*PetscTrFree)((void*)(htpoints),149,__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),149,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
150 }
151
152 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)
;
153}
154
155/* The user's already set the patches in patch->userIS. Build the hash tables */
156static PetscErrorCode PCPatchConstruct_User(void *vpatch, DM dm, PetscInt point, PetscHSetI ht)
157{
158 PC_PATCH *patch = (PC_PATCH *) vpatch;
159 IS patchis = patch->userIS[point];
160 PetscInt n;
161 const PetscInt *patchdata;
162 PetscInt pStart, pEnd, i;
163 PetscErrorCode ierr;
164
165 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] = 165; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
166 ierr = PetscHSetIClear(ht);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 = DMPlexGetChart(dm, &pStart, &pEnd);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 ierr = ISGetLocalSize(patchis, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),168,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
169 ierr = ISGetIndices(patchis, &patchdata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),169,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
170 for (i = 0; i < n; ++i) {
171 const PetscInt ownedpoint = patchdata[i];
172
173 if (ownedpoint < pStart || ownedpoint >= pEnd) {
174 SETERRQ3(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_OUTOFRANGE, "Mesh point %D was not in [%D, %D)", ownedpoint, pStart, pEnd)return PetscError(PetscObjectComm((PetscObject) dm),174,__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)
;
175 }
176 ierr = PetscHSetIAdd(ht, ownedpoint);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 }
178 ierr = ISRestoreIndices(patchis, &patchdata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),178,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
179 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)
;
180}
181
182static PetscErrorCode PCPatchCreateDefaultSF_Private(PC pc, PetscInt n, const PetscSF *sf, const PetscInt *bs)
183{
184 PC_PATCH *patch = (PC_PATCH *) pc->data;
185 PetscInt i;
186 PetscErrorCode ierr;
187
188 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] = 188; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
189 if (n == 1 && bs[0] == 1) {
190 patch->defaultSF = sf[0];
191 ierr = PetscObjectReference((PetscObject) patch->defaultSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),191,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
192 } else {
193 PetscInt allRoots = 0, allLeaves = 0;
194 PetscInt leafOffset = 0;
195 PetscInt *ilocal = NULL((void*)0);
196 PetscSFNode *iremote = NULL((void*)0);
197 PetscInt *remoteOffsets = NULL((void*)0);
198 PetscInt index = 0;
199 PetscHMapI rankToIndex;
200 PetscInt numRanks = 0;
201 PetscSFNode *remote = NULL((void*)0);
202 PetscSF rankSF;
203 PetscInt *ranks = NULL((void*)0);
204 PetscInt *offsets = NULL((void*)0);
205 MPI_Datatype contig;
206 PetscHSetI ranksUniq;
207
208 /* First figure out how many dofs there are in the concatenated numbering.
209 * allRoots: number of owned global dofs;
210 * allLeaves: number of visible dofs (global + ghosted).
211 */
212 for (i = 0; i < n; ++i) {
213 PetscInt nroots, nleaves;
214
215 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),215,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
216 allRoots += nroots * bs[i];
217 allLeaves += nleaves * bs[i];
218 }
219 ierr = PetscMalloc1(allLeaves, &ilocal)PetscMallocA(1,PETSC_FALSE,219,__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),219,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
220 ierr = PetscMalloc1(allLeaves, &iremote)PetscMallocA(1,PETSC_FALSE,220,__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),220,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
221 /* Now build an SF that just contains process connectivity. */
222 ierr = PetscHSetICreate(&ranksUniq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),222,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
223 for (i = 0; i < n; ++i) {
224 const PetscMPIInt *ranks = NULL((void*)0);
225 PetscInt nranks, j;
226
227 ierr = PetscSFSetUp(sf[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),227,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
228 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),228,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
229 /* These are all the ranks who communicate with me. */
230 for (j = 0; j < nranks; ++j) {
231 ierr = PetscHSetIAdd(ranksUniq, (PetscInt) ranks[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),231,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
232 }
233 }
234 ierr = PetscHSetIGetSize(ranksUniq, &numRanks);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 = PetscMalloc1(numRanks, &remote)PetscMallocA(1,PETSC_FALSE,235,__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),235,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
236 ierr = PetscMalloc1(numRanks, &ranks)PetscMallocA(1,PETSC_FALSE,236,__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),236,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
237 ierr = PetscHSetIGetElems(ranksUniq, &index, ranks);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
239 ierr = PetscHMapICreate(&rankToIndex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),239,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
240 for (i = 0; i < numRanks; ++i) {
241 remote[i].rank = ranks[i];
242 remote[i].index = 0;
243 ierr = PetscHMapISet(rankToIndex, ranks[i], i);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 }
245 ierr = PetscFree(ranks)((*PetscTrFree)((void*)(ranks),245,__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),245,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
246 ierr = PetscHSetIDestroy(&ranksUniq);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 = PetscSFCreate(PetscObjectComm((PetscObject) pc), &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 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),248,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
249 ierr = PetscSFSetUp(rankSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
250 /* OK, use it to communicate the root offset on the remote
251 * processes for each subspace. */
252 ierr = PetscMalloc1(n, &offsets)PetscMallocA(1,PETSC_FALSE,252,__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),252,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
253 ierr = PetscMalloc1(n*numRanks, &remoteOffsets)PetscMallocA(1,PETSC_FALSE,253,__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),253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
254
255 offsets[0] = 0;
256 for (i = 1; i < n; ++i) {
257 PetscInt nroots;
258
259 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),259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
260 offsets[i] = offsets[i-1] + nroots*bs[i-1];
261 }
262 /* Offsets are the offsets on the current process of the
263 * global dof numbering for the subspaces. */
264 ierr = MPI_Type_contiguous(n, MPIU_INT((MPI_Datatype)0x4c000405), &contig);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
265 ierr = MPI_Type_commit(&contig);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
267 ierr = PetscSFBcastBegin(rankSF, contig, offsets, remoteOffsets);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 = PetscSFBcastEnd(rankSF, contig, offsets, remoteOffsets);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 = MPI_Type_free(&contig);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 ierr = PetscFree(offsets)((*PetscTrFree)((void*)(offsets),270,__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),270,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
271 ierr = PetscSFDestroy(&rankSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),271,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
272 /* Now remoteOffsets contains the offsets on the remote
273 * processes who communicate with me. So now we can
274 * concatenate the list of SFs into a single one. */
275 index = 0;
276 for (i = 0; i < n; ++i) {
277 const PetscSFNode *remote = NULL((void*)0);
278 const PetscInt *local = NULL((void*)0);
279 PetscInt nroots, nleaves, j;
280
281 ierr = PetscSFGetGraph(sf[i], &nroots, &nleaves, &local, &remote);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),281,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
282 for (j = 0; j < nleaves; ++j) {
283 PetscInt rank = remote[j].rank;
284 PetscInt idx, rootOffset, k;
285
286 ierr = PetscHMapIGet(rankToIndex, rank, &idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
287 if (idx == -1) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "Didn't find rank, huh?")return PetscError(((MPI_Comm)0x44000001),287,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,73,PETSC_ERROR_INITIAL,"Didn't find rank, huh?")
;
288 /* Offset on given rank for ith subspace */
289 rootOffset = remoteOffsets[n*idx + i];
290 for (k = 0; k < bs[i]; ++k) {
291 ilocal[index] = (local ? local[j] : j)*bs[i] + k + leafOffset;
292 iremote[index].rank = remote[j].rank;
293 iremote[index].index = remote[j].index*bs[i] + k + rootOffset;
294 ++index;
295 }
296 }
297 leafOffset += nleaves * bs[i];
298 }
299 ierr = PetscHMapIDestroy(&rankToIndex);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 = PetscFree(remoteOffsets)((*PetscTrFree)((void*)(remoteOffsets),300,__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),300,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
301 ierr = PetscSFCreate(PetscObjectComm((PetscObject)pc), &patch->defaultSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),301,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
302 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),302,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
303 }
304 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)
;
305}
306
307/* TODO: Docs */
308PetscErrorCode PCPatchSetIgnoreDim(PC pc, PetscInt dim)
309{
310 PC_PATCH *patch = (PC_PATCH *) pc->data;
311 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] = 311; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
312 patch->ignoredim = dim;
313 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)
;
314}
315
316/* TODO: Docs */
317PetscErrorCode PCPatchGetIgnoreDim(PC pc, PetscInt *dim)
318{
319 PC_PATCH *patch = (PC_PATCH *) pc->data;
320 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] = 320; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
321 *dim = patch->ignoredim;
322 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)
;
323}
324
325/* TODO: Docs */
326PetscErrorCode PCPatchSetSaveOperators(PC pc, PetscBool flg)
327{
328 PC_PATCH *patch = (PC_PATCH *) pc->data;
329 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] = 329; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
330 patch->save_operators = flg;
331 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)
;
332}
333
334/* TODO: Docs */
335PetscErrorCode PCPatchGetSaveOperators(PC pc, PetscBool *flg)
336{
337 PC_PATCH *patch = (PC_PATCH *) pc->data;
338 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] = 338; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
339 *flg = patch->save_operators;
340 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)
;
341}
342
343/* TODO: Docs */
344PetscErrorCode PCPatchSetPrecomputeElementTensors(PC pc, PetscBool flg)
345{
346 PC_PATCH *patch = (PC_PATCH *) pc->data;
347 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] = 347; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
348 patch->precomputeElementTensors = flg;
349 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)
;
350}
351
352/* TODO: Docs */
353PetscErrorCode PCPatchGetPrecomputeElementTensors(PC pc, PetscBool *flg)
354{
355 PC_PATCH *patch = (PC_PATCH *) pc->data;
356 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] = 356; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
357 *flg = patch->precomputeElementTensors;
358 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)
;
359}
360
361/* TODO: Docs */
362PetscErrorCode PCPatchSetPartitionOfUnity(PC pc, PetscBool flg)
363{
364 PC_PATCH *patch = (PC_PATCH *) pc->data;
365 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] = 365; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
366 patch->partition_of_unity = flg;
367 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)
;
368}
369
370/* TODO: Docs */
371PetscErrorCode PCPatchGetPartitionOfUnity(PC pc, PetscBool *flg)
372{
373 PC_PATCH *patch = (PC_PATCH *) pc->data;
374 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] = 374; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
375 *flg = patch->partition_of_unity;
376 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)
;
377}
378
379/* TODO: Docs */
380PetscErrorCode PCPatchSetLocalComposition(PC pc, PCCompositeType type)
381{
382 PC_PATCH *patch = (PC_PATCH *) pc->data;
383 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] = 383; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
384 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),384,__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"
)
;
385 patch->local_composition_type = type;
386 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)
;
387}
388
389/* TODO: Docs */
390PetscErrorCode PCPatchGetLocalComposition(PC pc, PCCompositeType *type)
391{
392 PC_PATCH *patch = (PC_PATCH *) pc->data;
393 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] = 393; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
394 *type = patch->local_composition_type;
395 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)
;
396}
397
398/* TODO: Docs */
399PetscErrorCode PCPatchSetSubMatType(PC pc, MatType sub_mat_type)
400{
401 PC_PATCH *patch = (PC_PATCH *) pc->data;
402 PetscErrorCode ierr;
403
404 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] = 404; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
405 if (patch->sub_mat_type) {ierr = PetscFree(patch->sub_mat_type)((*PetscTrFree)((void*)(patch->sub_mat_type),405,__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),405,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
406 ierr = PetscStrallocpy(sub_mat_type, (char **) &patch->sub_mat_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),406,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
407 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)
;
408}
409
410/* TODO: Docs */
411PetscErrorCode PCPatchGetSubMatType(PC pc, MatType *sub_mat_type)
412{
413 PC_PATCH *patch = (PC_PATCH *) pc->data;
414 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] = 414; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
415 *sub_mat_type = patch->sub_mat_type;
416 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)
;
417}
418
419/* TODO: Docs */
420PetscErrorCode PCPatchSetCellNumbering(PC pc, PetscSection cellNumbering)
421{
422 PC_PATCH *patch = (PC_PATCH *) pc->data;
423 PetscErrorCode ierr;
424
425 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] = 425; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
426 patch->cellNumbering = cellNumbering;
427 ierr = PetscObjectReference((PetscObject) cellNumbering);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),427,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
428 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)
;
429}
430
431/* TODO: Docs */
432PetscErrorCode PCPatchGetCellNumbering(PC pc, PetscSection *cellNumbering)
433{
434 PC_PATCH *patch = (PC_PATCH *) pc->data;
435 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] = 435; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
436 *cellNumbering = patch->cellNumbering;
437 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)
;
438}
439
440/* TODO: Docs */
441PetscErrorCode PCPatchSetConstructType(PC pc, PCPatchConstructType ctype, PetscErrorCode (*func)(PC, PetscInt *, IS **, IS *, void *), void *ctx)
442{
443 PC_PATCH *patch = (PC_PATCH *) pc->data;
444
445 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] = 445; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
446 patch->ctype = ctype;
447 switch (ctype) {
448 case PC_PATCH_STAR:
449 patch->user_patches = PETSC_FALSE;
450 patch->patchconstructop = PCPatchConstruct_Star;
451 break;
452 case PC_PATCH_VANKA:
453 patch->user_patches = PETSC_FALSE;
454 patch->patchconstructop = PCPatchConstruct_Vanka;
455 break;
456 case PC_PATCH_PARDECOMP:
457 patch->user_patches = PETSC_FALSE;
458 patch->patchconstructop = PCPatchConstruct_Pardecomp;
459 break;
460 case PC_PATCH_USER:
461 case PC_PATCH_PYTHON:
462 patch->user_patches = PETSC_TRUE;
463 patch->patchconstructop = PCPatchConstruct_User;
464 if (func) {
465 patch->userpatchconstructionop = func;
466 patch->userpatchconstructctx = ctx;
467 }
468 break;
469 default:
470 SETERRQ1(PetscObjectComm((PetscObject) pc), PETSC_ERR_USER, "Unknown patch construction type %D", (PetscInt) patch->ctype)return PetscError(PetscObjectComm((PetscObject) pc),470,__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)
;
471 }
472 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)
;
473}
474
475/* TODO: Docs */
476PetscErrorCode PCPatchGetConstructType(PC pc, PCPatchConstructType *ctype, PetscErrorCode (**func)(PC, PetscInt *, IS **, IS *, void *), void **ctx)
477{
478 PC_PATCH *patch = (PC_PATCH *) pc->data;
479
480 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] = 480; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
481 *ctype = patch->ctype;
482 switch (patch->ctype) {
483 case PC_PATCH_STAR:
484 case PC_PATCH_VANKA:
485 case PC_PATCH_PARDECOMP:
486 break;
487 case PC_PATCH_USER:
488 case PC_PATCH_PYTHON:
489 *func = patch->userpatchconstructionop;
490 *ctx = patch->userpatchconstructctx;
491 break;
492 default:
493 SETERRQ1(PetscObjectComm((PetscObject) pc), PETSC_ERR_USER, "Unknown patch construction type %D", (PetscInt) patch->ctype)return PetscError(PetscObjectComm((PetscObject) pc),493,__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)
;
494 }
495 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)
;
496}
497
498/* TODO: Docs */
499PetscErrorCode PCPatchSetDiscretisationInfo(PC pc, PetscInt nsubspaces, DM *dms, PetscInt *bs, PetscInt *nodesPerCell, const PetscInt **cellNodeMap,
500 const PetscInt *subspaceOffsets, PetscInt numGhostBcs, const PetscInt *ghostBcNodes, PetscInt numGlobalBcs, const PetscInt *globalBcNodes)
501{
502 PC_PATCH *patch = (PC_PATCH *) pc->data;
503 DM dm;
504 PetscSF *sfs;
505 PetscInt cStart, cEnd, i, j;
506 PetscErrorCode ierr;
507
508 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] = 508; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
509 ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),509,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
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 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)
;
538}
539
540/* TODO: Docs */
541PetscErrorCode PCPatchSetDiscretisationInfoCombined(PC pc, DM dm, PetscInt *nodesPerCell, const PetscInt **cellNodeMap, PetscInt numGhostBcs, const PetscInt *ghostBcNodes, PetscInt numGlobalBcs, const PetscInt *globalBcNodes)
542{
543 PC_PATCH *patch = (PC_PATCH *) pc->data;
544 PetscInt cStart, cEnd, i, j;
545 PetscErrorCode ierr;
546
547 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] = 547; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
548 patch->combined = PETSC_TRUE;
549 ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),549,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
550 ierr = DMGetNumFields(dm, &patch->nsubspaces);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 = PetscCalloc1(patch->nsubspaces, &patch->dofSection)PetscMallocA(1,PETSC_TRUE,551,__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),551,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
552 ierr = PetscMalloc1(patch->nsubspaces, &patch->bs)PetscMallocA(1,PETSC_FALSE,552,__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),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->nodesPerCell)PetscMallocA(1,PETSC_FALSE,553,__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),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->cellNodeMap)PetscMallocA(1,PETSC_FALSE,554,__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),554,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
555 ierr = PetscCalloc1(patch->nsubspaces+1, &patch->subspaceOffsets)PetscMallocA(1,PETSC_TRUE,555,__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),555,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
556 ierr = DMGetDefaultSection(dm, &patch->dofSection[0]);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 = PetscObjectReference((PetscObject) 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 = PetscSectionGetStorageSize(patch->dofSection[0], &patch->subspaceOffsets[patch->nsubspaces]);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 patch->totalDofsPerCell = 0;
560 for (i = 0; i < patch->nsubspaces; ++i) {
561 patch->bs[i] = 1;
562 patch->nodesPerCell[i] = nodesPerCell[i];
563 patch->totalDofsPerCell += nodesPerCell[i];
564 ierr = PetscMalloc1((cEnd-cStart)*nodesPerCell[i], &patch->cellNodeMap[i])PetscMallocA(1,PETSC_FALSE,564,__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),564,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
565 for (j = 0; j < (cEnd-cStart)*nodesPerCell[i]; ++j) patch->cellNodeMap[i][j] = cellNodeMap[i][j];
566 }
567 ierr = DMGetDefaultSF(dm, &patch->defaultSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),567,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
568 ierr = PetscObjectReference((PetscObject) 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 = 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),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), numGlobalBcs, globalBcNodes, PETSC_COPY_VALUES, &patch->globalBcNodes);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 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)
;
572}
573
574/*@C
575
576 PCPatchSetComputeFunction - Set the callback used to compute patch residuals
577
578 Logically collective on PC
579
580 Input Parameters:
581+ pc - The PC
582. func - The callback
583- ctx - The user context
584
585 Calling sequence of func:
586$ func (PC pc,PetscInt point,Vec x,Vec f,IS cellIS,PetscInt n,const PetscInt* dofsArray,const PetscInt* dofsArrayWithAll,void* ctx)
587
588+ pc - The PC
589. point - The point
590. x - The input solution (not used in linear problems)
591. f - The patch residual vector
592. cellIS - An array of the cell numbers
593. n - The size of dofsArray
594. dofsArray - The dofmap for the dofs to be solved for
595. dofsArrayWithAll - The dofmap for all dofs on the patch
596- ctx - The user context
597
598 Level: advanced
599
600 Notes:
601 The entries of F (the output residual vector) have been set to zero before the call.
602
603.seealso: PCPatchSetComputeOperator(), PCPatchGetComputeOperator(), PCPatchSetDiscretisationInfo(), PCPatchSetComputeFunctionInteriorFacets()
604@*/
605PetscErrorCode PCPatchSetComputeFunction(PC pc, PetscErrorCode (*func)(PC, PetscInt, Vec, Vec, IS, PetscInt, const PetscInt *, const PetscInt *, void *), void *ctx)
606{
607 PC_PATCH *patch = (PC_PATCH *) pc->data;
608
609 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] = 609; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
610 patch->usercomputef = func;
611 patch->usercomputefctx = ctx;
612 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)
;
613}
614
615/*@C
616
617 PCPatchSetComputeFunctionInteriorFacets - Set the callback used to compute facet integrals for patch residuals
618
619 Logically collective on PC
620
621 Input Parameters:
622+ pc - The PC
623. func - The callback
624- ctx - The user context
625
626 Calling sequence of func:
627$ func (PC pc,PetscInt point,Vec x,Vec f,IS facetIS,PetscInt n,const PetscInt* dofsArray,const PetscInt* dofsArrayWithAll,void* ctx)
628
629+ pc - The PC
630. point - The point
631. x - The input solution (not used in linear problems)
632. f - The patch residual vector
633. facetIS - An array of the facet numbers
634. n - The size of dofsArray
635. dofsArray - The dofmap for the dofs to be solved for
636. dofsArrayWithAll - The dofmap for all dofs on the patch
637- ctx - The user context
638
639 Level: advanced
640
641 Notes:
642 The entries of F (the output residual vector) have been set to zero before the call.
643
644.seealso: PCPatchSetComputeOperator(), PCPatchGetComputeOperator(), PCPatchSetDiscretisationInfo(), PCPatchSetComputeFunction()
645@*/
646PetscErrorCode PCPatchSetComputeFunctionInteriorFacets(PC pc, PetscErrorCode (*func)(PC, PetscInt, Vec, Vec, IS, PetscInt, const PetscInt *, const PetscInt *, void *), void *ctx)
647{
648 PC_PATCH *patch = (PC_PATCH *) pc->data;
649
650 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] = 650; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
651 patch->usercomputefintfacet = func;
652 patch->usercomputefintfacetctx = ctx;
653 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)
;
654}
655
656/*@C
657
658 PCPatchSetComputeOperator - Set the callback used to compute patch matrices
659
660 Logically collective on PC
661
662 Input Parameters:
663+ pc - The PC
664. func - The callback
665- ctx - The user context
666
667 Calling sequence of func:
668$ func (PC pc,PetscInt point,Vec x,Mat mat,IS facetIS,PetscInt n,const PetscInt* dofsArray,const PetscInt* dofsArrayWithAll,void* ctx)
669
670+ pc - The PC
671. point - The point
672. x - The input solution (not used in linear problems)
673. mat - The patch matrix
674. cellIS - An array of the cell numbers
675. n - The size of dofsArray
676. dofsArray - The dofmap for the dofs to be solved for
677. dofsArrayWithAll - The dofmap for all dofs on the patch
678- ctx - The user context
679
680 Level: advanced
681
682 Notes:
683 The matrix entries have been set to zero before the call.
684
685.seealso: PCPatchGetComputeOperator(), PCPatchSetComputeFunction(), PCPatchSetDiscretisationInfo()
686@*/
687PetscErrorCode PCPatchSetComputeOperator(PC pc, PetscErrorCode (*func)(PC, PetscInt, Vec, Mat, IS, PetscInt, const PetscInt *, const PetscInt *, void *), void *ctx)
688{
689 PC_PATCH *patch = (PC_PATCH *) pc->data;
690
691 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] = 691; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
692 patch->usercomputeop = func;
693 patch->usercomputeopctx = ctx;
694 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)
;
695}
696
697/*@C
698
699 PCPatchSetComputeOperatorInteriorFacets - Set the callback used to compute facet integrals for patch matrices
700
701 Logically collective on PC
702
703 Input Parameters:
704+ pc - The PC
705. func - The callback
706- ctx - The user context
707
708 Calling sequence of func:
709$ func (PC pc,PetscInt point,Vec x,Mat mat,IS facetIS,PetscInt n,const PetscInt* dofsArray,const PetscInt* dofsArrayWithAll,void* ctx)
710
711+ pc - The PC
712. point - The point
713. x - The input solution (not used in linear problems)
714. mat - The patch matrix
715. facetIS - An array of the facet numbers
716. n - The size of dofsArray
717. dofsArray - The dofmap for the dofs to be solved for
718. dofsArrayWithAll - The dofmap for all dofs on the patch
719- ctx - The user context
720
721 Level: advanced
722
723 Notes:
724 The matrix entries have been set to zero before the call.
725
726.seealso: PCPatchGetComputeOperator(), PCPatchSetComputeFunction(), PCPatchSetDiscretisationInfo()
727@*/
728PetscErrorCode PCPatchSetComputeOperatorInteriorFacets(PC pc, PetscErrorCode (*func)(PC, PetscInt, Vec, Mat, IS, PetscInt, const PetscInt *, const PetscInt *, void *), void *ctx)
729{
730 PC_PATCH *patch = (PC_PATCH *) pc->data;
731
732 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] = 732; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
733 patch->usercomputeopintfacet = func;
734 patch->usercomputeopintfacetctx = ctx;
735 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)
;
736}
737
738/* On entry, ht contains the topological entities whose dofs we are responsible for solving for;
739 on exit, cht contains all the topological entities we need to compute their residuals.
740 In full generality this should incorporate knowledge of the sparsity pattern of the matrix;
741 here we assume a standard FE sparsity pattern.*/
742/* TODO: Use DMPlexGetAdjacency() */
743static PetscErrorCode PCPatchCompleteCellPatch(PC pc, PetscHSetI ht, PetscHSetI cht)
744{
745 DM dm;
746 PC_PATCH *patch = (PC_PATCH *) pc->data;
747 PetscHashIter hi;
748 PetscInt point;
749 PetscInt *star = NULL((void*)0), *closure = NULL((void*)0);
750 PetscInt ignoredim, iStart = 0, iEnd = -1, starSize, closureSize, si, ci;
751 PetscInt *fStar = NULL((void*)0), *fClosure = NULL((void*)0);
752 PetscInt fBegin, fEnd, fsi, fci, fStarSize, fClosureSize;
753 PetscErrorCode ierr;
754
755 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] = 755; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
756 ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),756,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
757 ierr = DMPlexGetHeightStratum(dm, 1, &fBegin, &fEnd);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 = PCPatchGetIgnoreDim(pc, &ignoredim);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 if (ignoredim >= 0) {ierr = DMPlexGetDepthStratum(dm, ignoredim, &iStart, &iEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),759,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
760 ierr = PetscHSetIClear(cht);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 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)
;
762 while (!PetscHashIterAtEnd(ht, hi)((hi) == (((ht))->n_buckets))) {
763
764 PetscHashIterGetKey(ht, hi, point)((point) = (((ht))->keys[(hi)]));
765 PetscHashIterNext(ht, hi)do { ++(hi); } while ((hi) != (((ht))->n_buckets) &&
!(!((((ht))->flags[((hi))>>4]>>((((hi))&0xfU
)<<1))&3)))
;
766
767 /* Loop over all the cells that this point connects to */
768 ierr = DMPlexGetTransitiveClosure(dm, point, PETSC_FALSE, &starSize, &star);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),768,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
769 for (si = 0; si < starSize*2; si += 2) {
770 const PetscInt ownedpoint = star[si];
771 /* TODO Check for point in cht before running through closure again */
772 /* now loop over all entities in the closure of that cell */
773 ierr = DMPlexGetTransitiveClosure(dm, ownedpoint, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),773,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
774 for (ci = 0; ci < closureSize*2; ci += 2) {
775 const PetscInt seenpoint = closure[ci];
776 if (ignoredim >= 0 && seenpoint >= iStart && seenpoint < iEnd) continue;
777 ierr = PetscHSetIAdd(cht, seenpoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),777,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
778 /* Facet integrals couple dofs across facets, so in that case for each of
779 * the facets we need to add all dofs on the other side of the facet to
780 * the seen dofs. */
781 if(patch->usercomputeopintfacet){
782 if(fBegin <= seenpoint && seenpoint < fEnd){
783 ierr = DMPlexGetTransitiveClosure(dm, seenpoint, PETSC_FALSE, &fStarSize, &fStar);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),783,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
784 for (fsi = 0; fsi < fStarSize*2; fsi += 2) {
785 ierr = DMPlexGetTransitiveClosure(dm, fStar[fsi], PETSC_TRUE, &fClosureSize, &fClosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),785,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
786 for (fci = 0; fci < fClosureSize*2; fci += 2) {
787 ierr = PetscHSetIAdd(cht, fClosure[fci]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),787,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
788 }
789 ierr = DMPlexRestoreTransitiveClosure(dm, fStar[fsi], PETSC_TRUE, NULL((void*)0), &fClosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),789,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
790 }
791 ierr = DMPlexRestoreTransitiveClosure(dm, seenpoint, PETSC_FALSE, NULL((void*)0), &fStar);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),791,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
792 }
793 }
794 }
795 ierr = DMPlexRestoreTransitiveClosure(dm, ownedpoint, PETSC_TRUE, NULL((void*)0), &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),795,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
796 }
797 ierr = DMPlexRestoreTransitiveClosure(dm, point, PETSC_FALSE, NULL((void*)0), &star);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),797,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
798 }
799 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)
;
800}
801
802static PetscErrorCode PCPatchGetGlobalDofs(PC pc, PetscSection dofSection[], PetscInt f, PetscBool combined, PetscInt p, PetscInt *dof, PetscInt *off)
803{
804 PetscErrorCode ierr;
805
806 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] = 806; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
807 if (combined) {
808 if (f < 0) {
809 if (dof) {ierr = PetscSectionGetDof(dofSection[0], p, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),809,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
810 if (off) {ierr = PetscSectionGetOffset(dofSection[0], p, off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),810,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
811 } else {
812 if (dof) {ierr = PetscSectionGetFieldDof(dofSection[0], p, f, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),812,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
813 if (off) {ierr = PetscSectionGetFieldOffset(dofSection[0], p, f, off);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 }
815 } else {
816 if (f < 0) {
817 PC_PATCH *patch = (PC_PATCH *) pc->data;
818 PetscInt fdof, g;
819
820 if (dof) {
821 *dof = 0;
822 for (g = 0; g < patch->nsubspaces; ++g) {
823 ierr = PetscSectionGetDof(dofSection[g], p, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),823,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
824 *dof += fdof;
825 }
826 }
827 if (off) {
828 *off = 0;
829 for (g = 0; g < patch->nsubspaces; ++g) {
830 ierr = PetscSectionGetOffset(dofSection[g], p, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),830,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
831 *off += fdof;
832 }
833 }
834 } else {
835 if (dof) {ierr = PetscSectionGetDof(dofSection[f], p, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),835,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
836 if (off) {ierr = PetscSectionGetOffset(dofSection[f], p, off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),836,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
837 }
838 }
839 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)
;
840}
841
842/* Given a hash table with a set of topological entities (pts), compute the degrees of
843 freedom in global concatenated numbering on those entities.
844 For Vanka smoothing, this needs to do something special: ignore dofs of the
845 constraint subspace on entities that aren't the base entity we're building the patch
846 around. */
847static PetscErrorCode PCPatchGetPointDofs(PC pc, PetscHSetI pts, PetscHSetI dofs, PetscInt base, PetscHSetI* subspaces_to_exclude)
848{
849 PC_PATCH *patch = (PC_PATCH *) pc->data;
850 PetscHashIter hi;
851 PetscInt ldof, loff;
852 PetscInt k, p;
853 PetscErrorCode ierr;
854
855 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] = 855; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
856 ierr = PetscHSetIClear(dofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),856,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
857 for (k = 0; k < patch->nsubspaces; ++k) {
858 PetscInt subspaceOffset = patch->subspaceOffsets[k];
859 PetscInt bs = patch->bs[k];
860 PetscInt j, l;
861
862 if (subspaces_to_exclude != NULL((void*)0)) {
863 PetscBool should_exclude_k = PETSC_FALSE;
864 PetscHSetIHas(*subspaces_to_exclude, k, &should_exclude_k);
865 if (should_exclude_k) {
866 /* only get this subspace dofs at the base entity, not any others */
867 ierr = PCPatchGetGlobalDofs(pc, patch->dofSection, k, patch->combined, base, &ldof, &loff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),867,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
868 if (0 == ldof) continue;
869 for (j = loff; j < ldof + loff; ++j) {
870 for (l = 0; l < bs; ++l) {
871 PetscInt dof = bs*j + l + subspaceOffset;
872 ierr = PetscHSetIAdd(dofs, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),872,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
873 }
874 }
875 continue; /* skip the other dofs of this subspace */
876 }
877 }
878
879 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)
;
880 while (!PetscHashIterAtEnd(pts, hi)((hi) == (((pts))->n_buckets))) {
881 PetscHashIterGetKey(pts, hi, p)((p) = (((pts))->keys[(hi)]));
882 PetscHashIterNext(pts, hi)do { ++(hi); } while ((hi) != (((pts))->n_buckets) &&
!(!((((pts))->flags[((hi))>>4]>>((((hi))&
0xfU)<<1))&3)))
;
883 ierr = PCPatchGetGlobalDofs(pc, patch->dofSection, k, patch->combined, p, &ldof, &loff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),883,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
884 if (0 == ldof) continue;
885 for (j = loff; j < ldof + loff; ++j) {
886 for (l = 0; l < bs; ++l) {
887 PetscInt dof = bs*j + l + subspaceOffset;
888 ierr = PetscHSetIAdd(dofs, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),888,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
889 }
890 }
891 }
892 }
893 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)
;
894}
895
896/* Given two hash tables A and B, compute the keys in B that are not in A, and put them in C */
897static PetscErrorCode PCPatchComputeSetDifference_Private(PetscHSetI A, PetscHSetI B, PetscHSetI C)
898{
899 PetscHashIter hi;
900 PetscInt key;
901 PetscBool flg;
902 PetscErrorCode ierr;
903
904 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] = 904; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
905 ierr = PetscHSetIClear(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),905,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
906 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)
;
907 while (!PetscHashIterAtEnd(B, hi)((hi) == (((B))->n_buckets))) {
908 PetscHashIterGetKey(B, hi, key)((key) = (((B))->keys[(hi)]));
909 PetscHashIterNext(B, hi)do { ++(hi); } while ((hi) != (((B))->n_buckets) &&
!(!((((B))->flags[((hi))>>4]>>((((hi))&0xfU
)<<1))&3)))
;
910 ierr = PetscHSetIHas(A, key, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),910,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
911 if (!flg) {ierr = PetscHSetIAdd(C, key);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),911,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
912 }
913 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)
;
914}
915
916/*
917 * PCPatchCreateCellPatches - create patches.
918 *
919 * Input Parameters:
920 * + dm - The DMPlex object defining the mesh
921 *
922 * Output Parameters:
923 * + cellCounts - Section with counts of cells around each vertex
924 * . cells - IS of the cell point indices of cells in each patch
925 * . pointCounts - Section with counts of cells around each vertex
926 * - point - IS of the cell point indices of cells in each patch
927 */
928static PetscErrorCode PCPatchCreateCellPatches(PC pc)
929{
930 PC_PATCH *patch = (PC_PATCH *) pc->data;
931 DMLabel ghost = NULL((void*)0);
932 DM dm, plex;
933 PetscHSetI ht, cht;
934 PetscSection cellCounts, pointCounts, intFacetCounts, extFacetCounts;
935 PetscInt *cellsArray, *pointsArray, *intFacetsArray, *extFacetsArray, *intFacetsToPatchCell;
936 PetscInt numCells, numPoints, numIntFacets, numExtFacets;
937 const PetscInt *leaves;
938 PetscInt nleaves, pStart, pEnd, cStart, cEnd, vStart, vEnd, fStart, fEnd, v;
939 PetscBool isFiredrake;
940 PetscErrorCode ierr;
941
942 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] = 942; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
943 /* Used to keep track of the cells in the patch. */
944 ierr = PetscHSetICreate(&ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),944,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
945 ierr = PetscHSetICreate(&cht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),945,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
946
947 ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),947,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
948 if (!dm) SETERRQ(PetscObjectComm((PetscObject) pc), PETSC_ERR_ARG_WRONGSTATE, "DM not yet set on patch PC\n")return PetscError(PetscObjectComm((PetscObject) pc),948,__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")
;
949 ierr = DMConvert(dm, DMPLEX"plex", &plex);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 ierr = DMPlexGetChart(plex, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
951 ierr = DMPlexGetHeightStratum(plex, 0, &cStart, &cEnd);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
953 if (patch->user_patches) {
954 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),954,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
955 vStart = 0; vEnd = patch->npatch;
956 } else if (patch->ctype == PC_PATCH_PARDECOMP) {
957 vStart = 0; vEnd = 1;
958 } else if (patch->codim < 0) {
959 if (patch->dim < 0) {ierr = DMPlexGetDepthStratum(plex, 0, &vStart, &vEnd);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 else {ierr = DMPlexGetDepthStratum(plex, patch->dim, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),960,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
961 } else {ierr = DMPlexGetHeightStratum(plex, patch->codim, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),961,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
962 patch->npatch = vEnd - vStart;
963
964 /* These labels mark the owned points. We only create patches around points that this process owns. */
965 ierr = DMHasLabel(dm, "pyop2_ghost", &isFiredrake);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 if (isFiredrake) {
967 ierr = DMGetLabel(dm, "pyop2_ghost", &ghost);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),967,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
968 ierr = DMLabelCreateIndex(ghost, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),968,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
969 } else {
970 PetscSF sf;
971
972 ierr = DMGetPointSF(dm, &sf);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 = PetscSFGetGraph(sf, NULL((void*)0), &nleaves, &leaves, NULL((void*)0));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 nleaves = PetscMax(nleaves, 0)(((nleaves)<(0)) ? (0) : (nleaves));
975 }
976
977 ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->cellCounts);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 = PetscObjectSetName((PetscObject) patch->cellCounts, "Patch Cell Layout");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 cellCounts = patch->cellCounts;
980 ierr = PetscSectionSetChart(cellCounts, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),980,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
981 ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->pointCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),981,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
982 ierr = PetscObjectSetName((PetscObject) patch->pointCounts, "Patch Point Layout");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 pointCounts = patch->pointCounts;
984 ierr = PetscSectionSetChart(pointCounts, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),984,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
985 ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->extFacetCounts);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 = PetscObjectSetName((PetscObject) patch->extFacetCounts, "Patch Exterior Facet Layout");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 extFacetCounts = patch->extFacetCounts;
988 ierr = PetscSectionSetChart(extFacetCounts, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),988,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
989 ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->intFacetCounts);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 = PetscObjectSetName((PetscObject) patch->intFacetCounts, "Patch Interior Facet Layout");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 intFacetCounts = patch->intFacetCounts;
992 ierr = PetscSectionSetChart(intFacetCounts, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),992,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
993 /* Count cells and points in the patch surrounding each entity */
994 ierr = DMPlexGetHeightStratum(dm, 1, &fStart, &fEnd);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 for (v = vStart; v < vEnd; ++v) {
996 PetscHashIter hi;
997 PetscInt chtSize, loc = -1;
998 PetscBool flg;
999
1000 if (!patch->user_patches && patch->ctype != PC_PATCH_PARDECOMP) {
1001 if (ghost) {ierr = DMLabelHasPoint(ghost, v, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1001,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1002 else {ierr = PetscFindInt(v, nleaves, leaves, &loc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1002,__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;}
1003 /* Not an owned entity, don't make a cell patch. */
1004 if (flg) continue;
1005 }
1006
1007 ierr = patch->patchconstructop((void *) patch, dm, v, ht);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)
;
1008 ierr = PCPatchCompleteCellPatch(pc, ht, cht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1008,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1009 ierr = PetscHSetIGetSize(cht, &chtSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1009,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1010 /* empty patch, continue */
1011 if (chtSize == 0) continue;
1012
1013 /* safe because size(cht) > 0 from above */
1014 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)
;
1015 while (!PetscHashIterAtEnd(cht, hi)((hi) == (((cht))->n_buckets))) {
1016 PetscInt point, pdof;
1017
1018 PetscHashIterGetKey(cht, hi, point)((point) = (((cht))->keys[(hi)]));
1019 if (fStart <= point && point < fEnd) {
1020 const PetscInt *support;
1021 PetscInt supportSize, p;
1022 PetscBool interior = PETSC_TRUE;
1023 ierr = DMPlexGetSupport(dm, point, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1023,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1024 ierr = DMPlexGetSupportSize(dm, point, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1024,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1025 if (supportSize == 1) {
1026 interior = PETSC_FALSE;
1027 } else {
1028 for (p = 0; p < supportSize; p++) {
1029 PetscBool found;
1030 /* FIXME: can I do this while iterating over cht? */
1031 PetscHSetIHas(cht, support[p], &found);
1032 if (!found) {
1033 interior = PETSC_FALSE;
1034 break;
1035 }
1036 }
1037 }
1038 if (interior) {
1039 ierr = PetscSectionAddDof(intFacetCounts, v, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1039,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1040 } else {
1041 ierr = PetscSectionAddDof(extFacetCounts, v, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1041,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1042 }
1043 }
1044 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),1044,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1045 if (pdof) {ierr = PetscSectionAddDof(pointCounts, v, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1045,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1046 if (point >= cStart && point < cEnd) {ierr = PetscSectionAddDof(cellCounts, 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 PetscHashIterNext(cht, hi)do { ++(hi); } while ((hi) != (((cht))->n_buckets) &&
!(!((((cht))->flags[((hi))>>4]>>((((hi))&
0xfU)<<1))&3)))
;
1048 }
1049 }
1050 if (isFiredrake) {ierr = DMLabelDestroyIndex(ghost);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
1052 ierr = PetscSectionSetUp(cellCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1052,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1053 ierr = PetscSectionGetStorageSize(cellCounts, &numCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1053,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1054 ierr = PetscMalloc1(numCells, &cellsArray)PetscMallocA(1,PETSC_FALSE,1054,__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),1054,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1055 ierr = PetscSectionSetUp(pointCounts);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 ierr = PetscSectionGetStorageSize(pointCounts, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1056,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1057 ierr = PetscMalloc1(numPoints, &pointsArray)PetscMallocA(1,PETSC_FALSE,1057,__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),1057,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1058
1059 ierr = PetscSectionSetUp(intFacetCounts);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(extFacetCounts);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(intFacetCounts, &numIntFacets);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 = PetscSectionGetStorageSize(extFacetCounts, &numExtFacets);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 ierr = PetscMalloc1(numIntFacets, &intFacetsArray)PetscMallocA(1,PETSC_FALSE,1063,__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),1063,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1064 ierr = PetscMalloc1(numIntFacets*2, &intFacetsToPatchCell)PetscMallocA(1,PETSC_FALSE,1064,__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),1064,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1065 ierr = PetscMalloc1(numExtFacets, &extFacetsArray)PetscMallocA(1,PETSC_FALSE,1065,__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),1065,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1066
1067
1068 /* Now that we know how much space we need, run through again and actually remember the cells. */
1069 for (v = vStart; v < vEnd; v++ ) {
1070 PetscHashIter hi;
1071 PetscInt dof, off, cdof, coff, efdof, efoff, ifdof, ifoff, pdof, n = 0, cn = 0, ifn = 0, efn = 0;
1072
1073 ierr = PetscSectionGetDof(pointCounts, v, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1073,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1074 ierr = PetscSectionGetOffset(pointCounts, v, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1074,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1075 ierr = PetscSectionGetDof(cellCounts, v, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1075,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1076 ierr = PetscSectionGetOffset(cellCounts, v, &coff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1076,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1077 ierr = PetscSectionGetDof(intFacetCounts, v, &ifdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1077,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1078 ierr = PetscSectionGetOffset(intFacetCounts, v, &ifoff);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 = PetscSectionGetDof(extFacetCounts, v, &efdof);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 = PetscSectionGetOffset(extFacetCounts, v, &efoff);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 if (dof <= 0) continue;
1082 ierr = patch->patchconstructop((void *) patch, dm, v, ht);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 = PCPatchCompleteCellPatch(pc, ht, cht);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 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)
;
1085 while (!PetscHashIterAtEnd(cht, hi)((hi) == (((cht))->n_buckets))) {
1086 PetscInt point;
1087
1088 PetscHashIterGetKey(cht, hi, point)((point) = (((cht))->keys[(hi)]));
1089 if (fStart <= point && point < fEnd) {
1090 const PetscInt *support;
1091 PetscInt supportSize, p;
1092 PetscBool interior = PETSC_TRUE;
1093 ierr = DMPlexGetSupport(dm, point, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1093,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1094 ierr = DMPlexGetSupportSize(dm, point, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1094,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1095 if (supportSize == 1) {
1096 interior = PETSC_FALSE;
1097 } else {
1098 for (p = 0; p < supportSize; p++) {
1099 PetscBool found;
1100 /* FIXME: can I do this while iterating over cht? */
1101 PetscHSetIHas(cht, support[p], &found);
1102 if (!found) {
1103 interior = PETSC_FALSE;
1104 break;
1105 }
1106 }
1107 }
1108 if (interior) {
1109 intFacetsToPatchCell[2*(ifoff + ifn)] = support[0];
1110 intFacetsToPatchCell[2*(ifoff + ifn) + 1] = support[1];
1111 intFacetsArray[ifoff + ifn++] = point;
1112 } else {
1113 extFacetsArray[efoff + efn++] = point;
1114 }
1115 }
1116 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),1116,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1117 if (pdof) {pointsArray[off + n++] = point;}
1118 if (point >= cStart && point < cEnd) {cellsArray[coff + cn++] = point;}
1119 PetscHashIterNext(cht, hi)do { ++(hi); } while ((hi) != (((cht))->n_buckets) &&
!(!((((cht))->flags[((hi))>>4]>>((((hi))&
0xfU)<<1))&3)))
;
1120 }
1121 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),1121,__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)
;
1122 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),1122,__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)
;
1123 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),1123,__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)
;
1124 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),1124,__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)
;
1125
1126 for (ifn = 0; ifn < ifdof; ifn++) {
1127 PetscInt cell0 = intFacetsToPatchCell[2*(ifoff + ifn)];
1128 PetscInt cell1 = intFacetsToPatchCell[2*(ifoff + ifn) + 1];
1129 PetscBool found0 = PETSC_FALSE, found1 = PETSC_FALSE;
1130 for (n = 0; n < cdof; n++) {
1131 if (!found0 && cell0 == cellsArray[coff + n]) {
1132 intFacetsToPatchCell[2*(ifoff + ifn)] = n;
1133 found0 = PETSC_TRUE;
1134 }
1135 if (!found1 && cell1 == cellsArray[coff + n]) {
1136 intFacetsToPatchCell[2*(ifoff + ifn) + 1] = n;
1137 found1 = PETSC_TRUE;
1138 }
1139 if (found0 && found1) break;
1140 }
1141 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),1141,__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"
)
;
1142 }
1143 }
1144 ierr = PetscHSetIDestroy(&ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1144,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1145 ierr = PetscHSetIDestroy(&cht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1145,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1146 ierr = DMDestroy(&plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1146,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1147
1148 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),1148,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1149 ierr = PetscObjectSetName((PetscObject) patch->cells, "Patch Cells");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 if (patch->viewCells) {
1151 ierr = ObjectView((PetscObject) patch->cellCounts, patch->viewerCells, patch->formatCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1151,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1152 ierr = ObjectView((PetscObject) patch->cells, patch->viewerCells, patch->formatCells);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 }
1154 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),1154,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1155 ierr = PetscObjectSetName((PetscObject) patch->intFacets, "Patch Interior Facets");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 = 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),1156,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1157 ierr = PetscObjectSetName((PetscObject) patch->intFacetsToPatchCell, "Patch Interior Facets local support");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1157,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1158 if (patch->viewIntFacets) {
1159 ierr = ObjectView((PetscObject) patch->intFacetCounts, patch->viewerIntFacets, patch->formatIntFacets);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 = ObjectView((PetscObject) patch->intFacets, patch->viewerIntFacets, patch->formatIntFacets);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 = ObjectView((PetscObject) patch->intFacetsToPatchCell, patch->viewerIntFacets, patch->formatIntFacets);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 }
1163 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),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1164 ierr = PetscObjectSetName((PetscObject) patch->extFacets, "Patch Exterior Facets");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 if (patch->viewExtFacets) {
1166 ierr = ObjectView((PetscObject) patch->extFacetCounts, patch->viewerExtFacets, patch->formatExtFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1166,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1167 ierr = ObjectView((PetscObject) patch->extFacets, patch->viewerExtFacets, patch->formatExtFacets);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 }
1169 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),1169,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1170 ierr = PetscObjectSetName((PetscObject) patch->points, "Patch Points");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 if (patch->viewPoints) {
1172 ierr = ObjectView((PetscObject) patch->pointCounts, patch->viewerPoints, patch->formatPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1172,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1173 ierr = ObjectView((PetscObject) patch->points, patch->viewerPoints, patch->formatPoints);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 }
1175 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)
;
1176}
1177
1178/*
1179 * PCPatchCreateCellPatchDiscretisationInfo - Build the dof maps for cell patches
1180 *
1181 * Input Parameters:
1182 * + dm - The DMPlex object defining the mesh
1183 * . cellCounts - Section with counts of cells around each vertex
1184 * . cells - IS of the cell point indices of cells in each patch
1185 * . cellNumbering - Section mapping plex cell points to Firedrake cell indices.
1186 * . nodesPerCell - number of nodes per cell.
1187 * - cellNodeMap - map from cells to node indices (nodesPerCell * numCells)
1188 *
1189 * Output Parameters:
1190 * + dofs - IS of local dof numbers of each cell in the patch, where local is a patch local numbering
1191 * . gtolCounts - Section with counts of dofs per cell patch
1192 * - gtol - IS mapping from global dofs to local dofs for each patch.
1193 */
1194static PetscErrorCode PCPatchCreateCellPatchDiscretisationInfo(PC pc)
1195{
1196 PC_PATCH *patch = (PC_PATCH *) pc->data;
1197 PetscSection cellCounts = patch->cellCounts;
1198 PetscSection pointCounts = patch->pointCounts;
1199 PetscSection gtolCounts, gtolCountsWithArtificial = NULL((void*)0), gtolCountsWithAll = NULL((void*)0);
1200 IS cells = patch->cells;
1201 IS points = patch->points;
1202 PetscSection cellNumbering = patch->cellNumbering;
1203 PetscInt Nf = patch->nsubspaces;
1204 PetscInt numCells, numPoints;
1205 PetscInt numDofs;
1206 PetscInt numGlobalDofs, numGlobalDofsWithArtificial, numGlobalDofsWithAll;
1207 PetscInt totalDofsPerCell = patch->totalDofsPerCell;
1208 PetscInt vStart, vEnd, v;
1209 const PetscInt *cellsArray, *pointsArray;
1210 PetscInt *newCellsArray = NULL((void*)0);
1211 PetscInt *dofsArray = NULL((void*)0);
1212 PetscInt *dofsArrayWithArtificial = NULL((void*)0);
1213 PetscInt *dofsArrayWithAll = NULL((void*)0);
1214 PetscInt *offsArray = NULL((void*)0);
1215 PetscInt *offsArrayWithArtificial = NULL((void*)0);
1216 PetscInt *offsArrayWithAll = NULL((void*)0);
1217 PetscInt *asmArray = NULL((void*)0);
1218 PetscInt *asmArrayWithArtificial = NULL((void*)0);
1219 PetscInt *asmArrayWithAll = NULL((void*)0);
1220 PetscInt *globalDofsArray = NULL((void*)0);
1221 PetscInt *globalDofsArrayWithArtificial = NULL((void*)0);
1222 PetscInt *globalDofsArrayWithAll = NULL((void*)0);
1223 PetscInt globalIndex = 0;
1224 PetscInt key = 0;
1225 PetscInt asmKey = 0;
1226 DM dm = NULL((void*)0);
1227 const PetscInt *bcNodes = NULL((void*)0);
1228 PetscHMapI ht;
1229 PetscHMapI htWithArtificial;
1230 PetscHMapI htWithAll;
1231 PetscHSetI globalBcs;
1232 PetscInt numBcs;
1233 PetscHSetI ownedpts, seenpts, owneddofs, seendofs, artificialbcs;
1234 PetscInt pStart, pEnd, p, i;
1235 char option[PETSC_MAX_PATH_LEN4096];
1236 PetscBool isNonlinear;
1237 PetscErrorCode ierr;
1238
1239 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] = 1239; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1240
1241 ierr = PCGetDM(pc, &dm); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1241,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1242 /* dofcounts section is cellcounts section * dofPerCell */
1243 ierr = PetscSectionGetStorageSize(cellCounts, &numCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1243,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1244 ierr = PetscSectionGetStorageSize(patch->pointCounts, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1244,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1245 numDofs = numCells * totalDofsPerCell;
1246 ierr = PetscMalloc1(numDofs, &dofsArray)PetscMallocA(1,PETSC_FALSE,1246,__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),1246,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1247 ierr = PetscMalloc1(numPoints*Nf, &offsArray)PetscMallocA(1,PETSC_FALSE,1247,__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),1247,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1248 ierr = PetscMalloc1(numDofs, &asmArray)PetscMallocA(1,PETSC_FALSE,1248,__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),1248,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1249 ierr = PetscMalloc1(numCells, &newCellsArray)PetscMallocA(1,PETSC_FALSE,1249,__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),1249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1250 ierr = PetscSectionGetChart(cellCounts, &vStart, &vEnd);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 = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->gtolCounts);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 gtolCounts = patch->gtolCounts;
1253 ierr = PetscSectionSetChart(gtolCounts, vStart, vEnd);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 = PetscObjectSetName((PetscObject) patch->gtolCounts, "Patch Global Index Section");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
1256 if(patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE)
1257 {
1258 ierr = PetscMalloc1(numPoints*Nf, &offsArrayWithArtificial)PetscMallocA(1,PETSC_FALSE,1258,__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),1258,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1259 ierr = PetscMalloc1(numDofs, &asmArrayWithArtificial)PetscMallocA(1,PETSC_FALSE,1259,__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),1259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1260 ierr = PetscMalloc1(numDofs, &dofsArrayWithArtificial)PetscMallocA(1,PETSC_FALSE,1260,__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),1260,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1261 ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->gtolCountsWithArtificial);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 gtolCountsWithArtificial = patch->gtolCountsWithArtificial;
1263 ierr = PetscSectionSetChart(gtolCountsWithArtificial, vStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1263,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1264 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),1264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1265 }
1266
1267 isNonlinear = patch->isNonlinear;
1268 if(isNonlinear)
1269 {
1270 ierr = PetscMalloc1(numPoints*Nf, &offsArrayWithAll)PetscMallocA(1,PETSC_FALSE,1270,__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),1270,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1271 ierr = PetscMalloc1(numDofs, &asmArrayWithAll)PetscMallocA(1,PETSC_FALSE,1271,__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),1271,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1272 ierr = PetscMalloc1(numDofs, &dofsArrayWithAll)PetscMallocA(1,PETSC_FALSE,1272,__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),1272,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1273 ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->gtolCountsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1273,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1274 gtolCountsWithAll = patch->gtolCountsWithAll;
1275 ierr = PetscSectionSetChart(gtolCountsWithAll, vStart, vEnd);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 = PetscObjectSetName((PetscObject) patch->gtolCountsWithAll, "Patch Global Index Section Including All BCs");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 }
1278
1279 /* Outside the patch loop, get the dofs that are globally-enforced Dirichlet
1280 conditions */
1281 ierr = PetscHSetICreate(&globalBcs);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 ierr = ISGetIndices(patch->ghostBcNodes, &bcNodes); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1282,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1283 ierr = ISGetSize(patch->ghostBcNodes, &numBcs); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1283,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1284 for (i = 0; i < numBcs; ++i) {
1285 ierr = PetscHSetIAdd(globalBcs, bcNodes[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1285,__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 */
1286 }
1287 ierr = ISRestoreIndices(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 = ISDestroy(&patch->ghostBcNodes); 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)
; /* memory optimisation */
1289
1290 /* Hash tables for artificial BC construction */
1291 ierr = PetscHSetICreate(&ownedpts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1291,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1292 ierr = PetscHSetICreate(&seenpts);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 = PetscHSetICreate(&owneddofs);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)
;
1294 ierr = PetscHSetICreate(&seendofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1294,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1295 ierr = PetscHSetICreate(&artificialbcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1295,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1296
1297 ierr = ISGetIndices(cells, &cellsArray);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 = ISGetIndices(points, &pointsArray);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 = PetscHMapICreate(&ht);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 = PetscHMapICreate(&htWithArtificial);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 ierr = PetscHMapICreate(&htWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1301,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1302 for (v = vStart; v < vEnd; ++v) {
1303 PetscInt localIndex = 0;
1304 PetscInt localIndexWithArtificial = 0;
1305 PetscInt localIndexWithAll = 0;
1306 PetscInt dof, off, i, j, k, l;
1307
1308 ierr = PetscHMapIClear(ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1308,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1309 ierr = PetscHMapIClear(htWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1309,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1310 ierr = PetscHMapIClear(htWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1310,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1311 ierr = PetscSectionGetDof(cellCounts, v, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1311,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1312 ierr = PetscSectionGetOffset(cellCounts, v, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1312,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1313 if (dof <= 0) continue;
1314
1315 /* Calculate the global numbers of the artificial BC dofs here first */
1316 ierr = patch->patchconstructop((void*)patch, dm, v, ownedpts); 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 = PCPatchCompleteCellPatch(pc, ownedpts, seenpts); 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 ierr = PCPatchGetPointDofs(pc, ownedpts, owneddofs, v, &patch->subspaces_to_exclude); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1318,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1319 ierr = PCPatchGetPointDofs(pc, seenpts, seendofs, v, NULL((void*)0)); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1319,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1320 ierr = PCPatchComputeSetDifference_Private(owneddofs, seendofs, artificialbcs); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1320,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1321 if (patch->viewPatches) {
1322 PetscHSetI globalbcdofs;
1323 PetscHashIter hi;
1324 MPI_Comm comm = PetscObjectComm((PetscObject)pc);
1325
1326 ierr = PetscHSetICreate(&globalbcdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1326,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1327 ierr = PetscSynchronizedPrintf(comm, "Patch %d: owned dofs:\n", v); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1327,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1328 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)
;
1329 while (!PetscHashIterAtEnd(owneddofs, hi)((hi) == (((owneddofs))->n_buckets))) {
1330 PetscInt globalDof;
1331
1332 PetscHashIterGetKey(owneddofs, hi, globalDof)((globalDof) = (((owneddofs))->keys[(hi)]));
1333 PetscHashIterNext(owneddofs, hi)do { ++(hi); } while ((hi) != (((owneddofs))->n_buckets) &&
!(!((((owneddofs))->flags[((hi))>>4]>>((((hi)
)&0xfU)<<1))&3)))
;
1334 ierr = PetscSynchronizedPrintf(comm, "%d ", globalDof); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1334,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1335 }
1336 ierr = PetscSynchronizedPrintf(comm, "\n"); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1336,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1337 ierr = PetscSynchronizedPrintf(comm, "Patch %d: seen dofs:\n", v); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1337,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1338 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)
;
1339 while (!PetscHashIterAtEnd(seendofs, hi)((hi) == (((seendofs))->n_buckets))) {
1340 PetscInt globalDof;
1341 PetscBool flg;
1342
1343 PetscHashIterGetKey(seendofs, hi, globalDof)((globalDof) = (((seendofs))->keys[(hi)]));
1344 PetscHashIterNext(seendofs, hi)do { ++(hi); } while ((hi) != (((seendofs))->n_buckets) &&
!(!((((seendofs))->flags[((hi))>>4]>>((((hi))
&0xfU)<<1))&3)))
;
1345 ierr = PetscSynchronizedPrintf(comm, "%d ", globalDof); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1345,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1346
1347 ierr = PetscHSetIHas(globalBcs, globalDof, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1347,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1348 if (flg) {ierr = PetscHSetIAdd(globalbcdofs, globalDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1348,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1349 }
1350 ierr = PetscSynchronizedPrintf(comm, "\n"); 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 ierr = PetscSynchronizedPrintf(comm, "Patch %d: global BCs:\n", v); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1351,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1352 ierr = PetscHSetIGetSize(globalbcdofs, &numBcs);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 (numBcs > 0) {
1354 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)
;
1355 while (!PetscHashIterAtEnd(globalbcdofs, hi)((hi) == (((globalbcdofs))->n_buckets))) {
1356 PetscInt globalDof;
1357 PetscHashIterGetKey(globalbcdofs, hi, globalDof)((globalDof) = (((globalbcdofs))->keys[(hi)]));
1358 PetscHashIterNext(globalbcdofs, hi)do { ++(hi); } while ((hi) != (((globalbcdofs))->n_buckets
) && !(!((((globalbcdofs))->flags[((hi))>>4]
>>((((hi))&0xfU)<<1))&3)))
;
1359 ierr = PetscSynchronizedPrintf(comm, "%d ", globalDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1359,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1360 }
1361 }
1362 ierr = PetscSynchronizedPrintf(comm, "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1362,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1363 ierr = PetscSynchronizedPrintf(comm, "Patch %d: artificial BCs:\n", v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1363,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1364 ierr = PetscHSetIGetSize(artificialbcs, &numBcs);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 if (numBcs > 0) {
1366 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)
;
1367 while (!PetscHashIterAtEnd(artificialbcs, hi)((hi) == (((artificialbcs))->n_buckets))) {
1368 PetscInt globalDof;
1369 PetscHashIterGetKey(artificialbcs, hi, globalDof)((globalDof) = (((artificialbcs))->keys[(hi)]));
1370 PetscHashIterNext(artificialbcs, hi)do { ++(hi); } while ((hi) != (((artificialbcs))->n_buckets
) && !(!((((artificialbcs))->flags[((hi))>>4
]>>((((hi))&0xfU)<<1))&3)))
;
1371 ierr = PetscSynchronizedPrintf(comm, "%d ", globalDof); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1371,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1372 }
1373 }
1374 ierr = PetscSynchronizedPrintf(comm, "\n\n"); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1374,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1375 ierr = PetscHSetIDestroy(&globalbcdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1375,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1376 }
1377 for (k = 0; k < patch->nsubspaces; ++k) {
1378 const PetscInt *cellNodeMap = patch->cellNodeMap[k];
1379 PetscInt nodesPerCell = patch->nodesPerCell[k];
1380 PetscInt subspaceOffset = patch->subspaceOffsets[k];
1381 PetscInt bs = patch->bs[k];
1382
1383 for (i = off; i < off + dof; ++i) {
1384 /* Walk over the cells in this patch. */
1385 const PetscInt c = cellsArray[i];
1386 PetscInt cell = c;
1387
1388 /* TODO Change this to an IS */
1389 if (cellNumbering) {
1390 ierr = PetscSectionGetDof(cellNumbering, c, &cell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1390,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1391 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),1391,__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)
;
1392 ierr = PetscSectionGetOffset(cellNumbering, c, &cell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1392,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1393 }
1394 newCellsArray[i] = cell;
1395 for (j = 0; j < nodesPerCell; ++j) {
1396 /* For each global dof, map it into contiguous local storage. */
1397 const PetscInt globalDof = cellNodeMap[cell*nodesPerCell + j]*bs + subspaceOffset;
1398 /* finally, loop over block size */
1399 for (l = 0; l < bs; ++l) {
1400 PetscInt localDof;
1401 PetscBool isGlobalBcDof, isArtificialBcDof;
1402
1403 /* first, check if this is either a globally enforced or locally enforced BC dof */
1404 ierr = PetscHSetIHas(globalBcs, globalDof + l, &isGlobalBcDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1404,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1405 ierr = PetscHSetIHas(artificialbcs, globalDof + l, &isArtificialBcDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1405,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1406
1407 /* if it's either, don't ever give it a local dof number */
1408 if (isGlobalBcDof || isArtificialBcDof) {
1409 dofsArray[globalIndex] = -1; /* don't use this in assembly in this patch */
1410 } else {
1411 ierr = PetscHMapIGet(ht, globalDof + l, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1411,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1412 if (localDof == -1) {
1413 localDof = localIndex++;
1414 ierr = PetscHMapISet(ht, globalDof + l, localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1414,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1415 }
1416 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,1416,__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)
;
1417 /* And store. */
1418 dofsArray[globalIndex] = localDof;
1419 }
1420
1421 if(patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
1422 if (isGlobalBcDof) {
1423 dofsArrayWithArtificial[globalIndex] = -1; /* don't use this in assembly in this patch */
1424 } else {
1425 ierr = PetscHMapIGet(htWithArtificial, globalDof + l, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1425,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1426 if (localDof == -1) {
1427 localDof = localIndexWithArtificial++;
1428 ierr = PetscHMapISet(htWithArtificial, globalDof + l, localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1428,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1429 }
1430 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,1430,__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)
;
1431 /* And store.*/
1432 dofsArrayWithArtificial[globalIndex] = localDof;
1433 }
1434 }
1435
1436 if(isNonlinear) {
1437 /* Build the dofmap for the function space with _all_ dofs,
1438 including those in any kind of boundary condition */
1439 ierr = PetscHMapIGet(htWithAll, globalDof + l, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1439,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1440 if (localDof == -1) {
1441 localDof = localIndexWithAll++;
1442 ierr = PetscHMapISet(htWithAll, globalDof + l, localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1442,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1443 }
1444 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,1444,__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)
;
1445 /* And store.*/
1446 dofsArrayWithAll[globalIndex] = localDof;
1447 }
1448 globalIndex++;
1449 }
1450 }
1451 }
1452 }
1453 /*How many local dofs in this patch? */
1454 if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
1455 ierr = PetscHMapIGetSize(htWithArtificial, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1455,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1456 ierr = PetscSectionSetDof(gtolCountsWithArtificial, v, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1456,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1457 }
1458 if (isNonlinear) {
1459 ierr = PetscHMapIGetSize(htWithAll, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1459,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1460 ierr = PetscSectionSetDof(gtolCountsWithAll, v, 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 }
1462 ierr = PetscHMapIGetSize(ht, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1462,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1463 ierr = PetscSectionSetDof(gtolCounts, v, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1463,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1464 }
1465 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),1465,__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)
;
1466 ierr = PetscSectionSetUp(gtolCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1466,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1467 ierr = PetscSectionGetStorageSize(gtolCounts, &numGlobalDofs);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 = PetscMalloc1(numGlobalDofs, &globalDofsArray)PetscMallocA(1,PETSC_FALSE,1468,__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),1468,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1469
1470 if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
1471 ierr = PetscSectionSetUp(gtolCountsWithArtificial);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 ierr = PetscSectionGetStorageSize(gtolCountsWithArtificial, &numGlobalDofsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1472,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1473 ierr = PetscMalloc1(numGlobalDofsWithArtificial, &globalDofsArrayWithArtificial)PetscMallocA(1,PETSC_FALSE,1473,__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),1473,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1474 }
1475 if (isNonlinear) {
1476 ierr = PetscSectionSetUp(gtolCountsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1476,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1477 ierr = PetscSectionGetStorageSize(gtolCountsWithAll, &numGlobalDofsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1477,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1478 ierr = PetscMalloc1(numGlobalDofsWithAll, &globalDofsArrayWithAll)PetscMallocA(1,PETSC_FALSE,1478,__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),1478,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1479 }
1480 /* Now populate the global to local map. This could be merged into the above loop if we were willing to deal with reallocs. */
1481 for (v = vStart; v < vEnd; ++v) {
1482 PetscHashIter hi;
1483 PetscInt dof, off, Np, ooff, i, j, k, l;
1484
1485 ierr = PetscHMapIClear(ht);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 ierr = PetscHMapIClear(htWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1486,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1487 ierr = PetscHMapIClear(htWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1487,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1488 ierr = PetscSectionGetDof(cellCounts, v, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1488,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1489 ierr = PetscSectionGetOffset(cellCounts, v, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1489,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1490 ierr = PetscSectionGetDof(pointCounts, v, &Np);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1490,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1491 ierr = PetscSectionGetOffset(pointCounts, v, &ooff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1491,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1492 if (dof <= 0) continue;
1493
1494 for (k = 0; k < patch->nsubspaces; ++k) {
1495 const PetscInt *cellNodeMap = patch->cellNodeMap[k];
1496 PetscInt nodesPerCell = patch->nodesPerCell[k];
1497 PetscInt subspaceOffset = patch->subspaceOffsets[k];
1498 PetscInt bs = patch->bs[k];
1499 PetscInt goff;
1500
1501 for (i = off; i < off + dof; ++i) {
1502 /* Reconstruct mapping of global-to-local on this patch. */
1503 const PetscInt c = cellsArray[i];
1504 PetscInt cell = c;
1505
1506 if (cellNumbering) {ierr = PetscSectionGetOffset(cellNumbering, c, &cell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1506,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1507 for (j = 0; j < nodesPerCell; ++j) {
1508 for (l = 0; l < bs; ++l) {
1509 const PetscInt globalDof = cellNodeMap[cell*nodesPerCell + j]*bs + l + subspaceOffset;
1510 const PetscInt localDof = dofsArray[key];
1511 if (localDof >= 0) {ierr = PetscHMapISet(ht, globalDof, localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1511,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1512 if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
1513 const PetscInt localDofWithArtificial = dofsArrayWithArtificial[key];
1514 if (localDofWithArtificial >= 0) {
1515 ierr = PetscHMapISet(htWithArtificial, globalDof, localDofWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1515,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1516 }
1517 }
1518 if (isNonlinear) {
1519 const PetscInt localDofWithAll = dofsArrayWithAll[key];
1520 if (localDofWithAll >= 0) {
1521 ierr = PetscHMapISet(htWithAll, globalDof, localDofWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1521,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1522 }
1523 }
1524 key++;
1525 }
1526 }
1527 }
1528
1529 /* Shove it in the output data structure. */
1530 ierr = PetscSectionGetOffset(gtolCounts, v, &goff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1530,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1531 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)
;
1532 while (!PetscHashIterAtEnd(ht, hi)((hi) == (((ht))->n_buckets))) {
1533 PetscInt globalDof, localDof;
1534
1535 PetscHashIterGetKey(ht, hi, globalDof)((globalDof) = (((ht))->keys[(hi)]));
1536 PetscHashIterGetVal(ht, hi, localDof)((localDof) = (((ht))->vals[(hi)]));
1537 if (globalDof >= 0) globalDofsArray[goff + localDof] = globalDof;
1538 PetscHashIterNext(ht, hi)do { ++(hi); } while ((hi) != (((ht))->n_buckets) &&
!(!((((ht))->flags[((hi))>>4]>>((((hi))&0xfU
)<<1))&3)))
;
1539 }
1540
1541 if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
1542 ierr = PetscSectionGetOffset(gtolCountsWithArtificial, v, &goff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1542,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1543 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)
;
1544 while (!PetscHashIterAtEnd(htWithArtificial, hi)((hi) == (((htWithArtificial))->n_buckets))) {
1545 PetscInt globalDof, localDof;
1546 PetscHashIterGetKey(htWithArtificial, hi, globalDof)((globalDof) = (((htWithArtificial))->keys[(hi)]));
1547 PetscHashIterGetVal(htWithArtificial, hi, localDof)((localDof) = (((htWithArtificial))->vals[(hi)]));
1548 if (globalDof >= 0) globalDofsArrayWithArtificial[goff + localDof] = globalDof;
1549 PetscHashIterNext(htWithArtificial, hi)do { ++(hi); } while ((hi) != (((htWithArtificial))->n_buckets
) && !(!((((htWithArtificial))->flags[((hi))>>
4]>>((((hi))&0xfU)<<1))&3)))
;
1550 }
1551 }
1552 if (isNonlinear) {
1553 ierr = PetscSectionGetOffset(gtolCountsWithAll, v, &goff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1553,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1554 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)
;
1555 while (!PetscHashIterAtEnd(htWithAll, hi)((hi) == (((htWithAll))->n_buckets))) {
1556 PetscInt globalDof, localDof;
1557 PetscHashIterGetKey(htWithAll, hi, globalDof)((globalDof) = (((htWithAll))->keys[(hi)]));
1558 PetscHashIterGetVal(htWithAll, hi, localDof)((localDof) = (((htWithAll))->vals[(hi)]));
1559 if (globalDof >= 0) globalDofsArrayWithAll[goff + localDof] = globalDof;
1560 PetscHashIterNext(htWithAll, hi)do { ++(hi); } while ((hi) != (((htWithAll))->n_buckets) &&
!(!((((htWithAll))->flags[((hi))>>4]>>((((hi)
)&0xfU)<<1))&3)))
;
1561 }
1562 }
1563
1564 for (p = 0; p < Np; ++p) {
1565 const PetscInt point = pointsArray[ooff + p];
1566 PetscInt globalDof, localDof;
1567
1568 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),1568,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1569 ierr = PetscHMapIGet(ht, globalDof, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1569,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1570 offsArray[(ooff + p)*Nf + k] = localDof;
1571 if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
1572 ierr = PetscHMapIGet(htWithArtificial, globalDof, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1572,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1573 offsArrayWithArtificial[(ooff + p)*Nf + k] = localDof;
1574 }
1575 if (isNonlinear) {
1576 ierr = PetscHMapIGet(htWithAll, 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 offsArrayWithAll[(ooff + p)*Nf + k] = localDof;
1578 }
1579 }
1580 }
1581
1582 ierr = PetscHSetIDestroy(&globalBcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1582,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1583 ierr = PetscHSetIDestroy(&ownedpts);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 ierr = PetscHSetIDestroy(&seenpts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1584,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1585 ierr = PetscHSetIDestroy(&owneddofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1585,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1586 ierr = PetscHSetIDestroy(&seendofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1586,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1587 ierr = PetscHSetIDestroy(&artificialbcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1587,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1588
1589 /* At this point, we have a hash table ht built that maps globalDof -> localDof.
1590 We need to create the dof table laid out cellwise first, then by subspace,
1591 as the assembler assembles cell-wise and we need to stuff the different
1592 contributions of the different function spaces to the right places. So we loop
1593 over cells, then over subspaces. */
1594 if (patch->nsubspaces > 1) { /* for nsubspaces = 1, data we need is already in dofsArray */
1595 for (i = off; i < off + dof; ++i) {
1596 const PetscInt c = cellsArray[i];
1597 PetscInt cell = c;
1598
1599 if (cellNumbering) {ierr = PetscSectionGetOffset(cellNumbering, c, &cell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1599,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1600 for (k = 0; k < patch->nsubspaces; ++k) {
1601 const PetscInt *cellNodeMap = patch->cellNodeMap[k];
1602 PetscInt nodesPerCell = patch->nodesPerCell[k];
1603 PetscInt subspaceOffset = patch->subspaceOffsets[k];
1604 PetscInt bs = patch->bs[k];
1605
1606 for (j = 0; j < nodesPerCell; ++j) {
1607 for (l = 0; l < bs; ++l) {
1608 const PetscInt globalDof = cellNodeMap[cell*nodesPerCell + j]*bs + l + subspaceOffset;
1609 PetscInt localDof;
1610
1611 ierr = PetscHMapIGet(ht, globalDof, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1611,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1612 /* If it's not in the hash table, i.e. is a BC dof,
1613 then the PetscHSetIMap above gives -1, which matches
1614 exactly the convention for PETSc's matrix assembly to
1615 ignore the dof. So we don't need to do anything here */
1616 asmArray[asmKey] = localDof;
1617 if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
1618 ierr = PetscHMapIGet(htWithArtificial, 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 asmArrayWithArtificial[asmKey] = localDof;
1620 }
1621 if (isNonlinear) {
1622 ierr = PetscHMapIGet(htWithAll, globalDof, &localDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1622,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1623 asmArrayWithAll[asmKey] = localDof;
1624 }
1625 asmKey++;
1626 }
1627 }
1628 }
1629 }
1630 }
1631 }
1632 if (1 == patch->nsubspaces) {
1633 ierr = PetscMemcpy(asmArray, dofsArray, numDofs * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1633,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1634 if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
1635 ierr = PetscMemcpy(asmArrayWithArtificial, dofsArrayWithArtificial, numDofs * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1635,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1636 }
1637 if (isNonlinear) {
1638 ierr = PetscMemcpy(asmArrayWithAll, dofsArrayWithAll, numDofs * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1638,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1639 }
1640 }
1641
1642 ierr = PetscHMapIDestroy(&ht);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 ierr = PetscHMapIDestroy(&htWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1643,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1644 ierr = PetscHMapIDestroy(&htWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1644,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1645 ierr = ISRestoreIndices(cells, &cellsArray);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 ierr = ISRestoreIndices(points, &pointsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1646,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1647 ierr = PetscFree(dofsArray)((*PetscTrFree)((void*)(dofsArray),1647,__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),1647,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1648 if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
1649 ierr = PetscFree(dofsArrayWithArtificial)((*PetscTrFree)((void*)(dofsArrayWithArtificial),1649,__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),1649,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1650 }
1651 if (isNonlinear) {
1652 ierr = PetscFree(dofsArrayWithAll)((*PetscTrFree)((void*)(dofsArrayWithAll),1652,__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),1652,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1653 }
1654 /* Create placeholder section for map from points to patch dofs */
1655 ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &patch->patchSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1655,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1656 ierr = PetscSectionSetNumFields(patch->patchSection, patch->nsubspaces);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 if (patch->combined) {
1658 PetscInt numFields;
1659 ierr = PetscSectionGetNumFields(patch->dofSection[0], &numFields);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 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),1660,__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)
;
1661 ierr = PetscSectionGetChart(patch->dofSection[0], &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1661,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1662 ierr = PetscSectionSetChart(patch->patchSection, pStart, pEnd);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 for (p = pStart; p < pEnd; ++p) {
1664 PetscInt dof, fdof, f;
1665
1666 ierr = PetscSectionGetDof(patch->dofSection[0], p, &dof);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 ierr = PetscSectionSetDof(patch->patchSection, p, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1667,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1668 for (f = 0; f < patch->nsubspaces; ++f) {
1669 ierr = PetscSectionGetFieldDof(patch->dofSection[0], p, f, &fdof);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 ierr = PetscSectionSetFieldDof(patch->patchSection, p, f, fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1670,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1671 }
1672 }
1673 } else {
1674 PetscInt pStartf, pEndf, f;
1675 pStart = PETSC_MAX_INT2147483647;
1676 pEnd = PETSC_MIN_INT(-2147483647 - 1);
1677 for (f = 0; f < patch->nsubspaces; ++f) {
1678 ierr = PetscSectionGetChart(patch->dofSection[f], &pStartf, &pEndf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1678,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1679 pStart = PetscMin(pStart, pStartf)(((pStart)<(pStartf)) ? (pStart) : (pStartf));
1680 pEnd = PetscMax(pEnd, pEndf)(((pEnd)<(pEndf)) ? (pEndf) : (pEnd));
1681 }
1682 ierr = PetscSectionSetChart(patch->patchSection, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1682,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1683 for (f = 0; f < patch->nsubspaces; ++f) {
1684 ierr = PetscSectionGetChart(patch->dofSection[f], &pStartf, &pEndf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1684,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1685 for (p = pStartf; p < pEndf; ++p) {
1686 PetscInt fdof;
1687 ierr = PetscSectionGetDof(patch->dofSection[f], p, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1687,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1688 ierr = PetscSectionAddDof(patch->patchSection, p, fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1688,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1689 ierr = PetscSectionSetFieldDof(patch->patchSection, p, f, fdof);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 }
1691 }
1692 }
1693 ierr = PetscSectionSetUp(patch->patchSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1693,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1694 ierr = PetscSectionSetUseFieldOffsets(patch->patchSection, PETSC_TRUE);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 /* Replace cell indices with firedrake-numbered ones. */
1696 ierr = ISGeneralSetIndices(cells, numCells, (const PetscInt *) newCellsArray, PETSC_OWN_POINTER);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 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),1697,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1698 ierr = PetscObjectSetName((PetscObject) patch->gtol, "Global Indices");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1698,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1699 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),1699,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1700 ierr = PetscSectionViewFromOptions(patch->gtolCounts, (PetscObject) pc, option);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 = ISViewFromOptions(patch->gtol, (PetscObject) pc, option);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 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),1702,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1703 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),1703,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1704 if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
1705 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),1705,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1706 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),1706,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1707 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),1707,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1708 }
1709 if (isNonlinear) {
1710 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),1710,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1711 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),1711,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1712 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),1712,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1713 }
1714 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)
;
1715}
1716
1717static PetscErrorCode PCPatchCreateMatrix_Private(PC pc, PetscInt point, Mat *mat, PetscBool withArtificial)
1718{
1719 PC_PATCH *patch = (PC_PATCH *) pc->data;
1720 Vec x, y;
1721 PetscBool flg;
1722 PetscInt csize, rsize;
1723 const char *prefix = NULL((void*)0);
1724 PetscErrorCode ierr;
1725
1726 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] = 1726; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1727 if(withArtificial) {
1728 /* would be nice if we could create a rectangular matrix of size numDofsWithArtificial x numDofs here */
1729 x = patch->patchRHSWithArtificial[point];
1730 y = patch->patchRHSWithArtificial[point];
1731 } else {
1732 x = patch->patchRHS[point];
1733 y = patch->patchUpdate[point];
1734 }
1735
1736 ierr = VecGetSize(x, &csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1736,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1737 ierr = VecGetSize(y, &rsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1737,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1738 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1738,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1739 ierr = PCGetOptionsPrefix(pc, &prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1739,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1740 ierr = MatSetOptionsPrefix(*mat, prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1740,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1741 ierr = MatAppendOptionsPrefix(*mat, "pc_patch_sub_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1741,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1742 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),1742,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1743 else if (!patch->sub_mat_type) {ierr = MatSetType(*mat, MATDENSE"dense");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 = MatSetSizes(*mat, rsize, csize, rsize, csize);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 = PetscObjectTypeCompare((PetscObject) *mat, MATDENSE"dense", &flg);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 if (!flg) {ierr = PetscObjectTypeCompare((PetscObject)*mat, MATSEQDENSE"seqdense", &flg);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 /* Sparse patch matrices */
1748 if (!flg) {
1749 PetscBT bt;
1750 PetscInt *dnnz = NULL((void*)0);
1751 const PetscInt *dofsArray = NULL((void*)0);
1752 PetscInt pStart, pEnd, ncell, offset, c, i, j;
1753
1754 if(withArtificial) {
1755 ierr = ISGetIndices(patch->dofsWithArtificial, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1755,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1756 } else {
1757 ierr = ISGetIndices(patch->dofs, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1757,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1758 }
1759 ierr = PetscSectionGetChart(patch->cellCounts, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1759,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1760 point += pStart;
1761 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),1761,__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),1761,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1762 ierr = PetscSectionGetDof(patch->cellCounts, point, &ncell);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 ierr = PetscSectionGetOffset(patch->cellCounts, point, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1763,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1764 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),1764,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1765 /* A PetscBT uses N^2 bits to store the sparsity pattern on a
1766 * patch. This is probably OK if the patches are not too big,
1767 * but uses too much memory. We therefore switch based on rsize. */
1768 if (rsize < 3000) { /* FIXME: I picked this switch value out of my hat */
1769 PetscScalar *zeroes;
1770 PetscInt rows;
1771
1772 ierr = PetscCalloc1(rsize, &dnnz)PetscMallocA(1,PETSC_TRUE,1772,__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),1772,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1773 ierr = PetscBTCreate(rsize*rsize, &bt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1773,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1774 for (c = 0; c < ncell; ++c) {
1775 const PetscInt *idx = dofsArray + (offset + c)*patch->totalDofsPerCell;
1776 for (i = 0; i < patch->totalDofsPerCell; ++i) {
1777 const PetscInt row = idx[i];
1778 if (row < 0) continue;
1779 for (j = 0; j < patch->totalDofsPerCell; ++j) {
1780 const PetscInt col = idx[j];
1781 const PetscInt key = row*rsize + col;
1782 if (col < 0) continue;
1783 if (!PetscBTLookupSet(bt, key)) ++dnnz[row];
1784 }
1785 }
1786 }
1787
1788 if (patch->usercomputeopintfacet) {
1789 const PetscInt *intFacetsArray = NULL((void*)0);
1790 PetscInt i, numIntFacets, intFacetOffset;
1791 const PetscInt *facetCells = NULL((void*)0);
1792
1793 ierr = PetscSectionGetDof(patch->intFacetCounts, point, &numIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1793,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1794 ierr = PetscSectionGetOffset(patch->intFacetCounts, point, &intFacetOffset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1794,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1795 ierr = ISGetIndices(patch->intFacetsToPatchCell, &facetCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1795,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1796 ierr = ISGetIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1796,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1797 for (i = 0; i < numIntFacets; i++) {
1798 const PetscInt cell0 = facetCells[2*(intFacetOffset + i) + 0];
1799 const PetscInt cell1 = facetCells[2*(intFacetOffset + i) + 1];
1800 PetscInt celli, cellj;
1801
1802 for (celli = 0; celli < patch->totalDofsPerCell; celli++) {
1803 const PetscInt row = dofsArray[(offset + cell0)*patch->totalDofsPerCell + celli];
1804 if (row < 0) continue;
1805 for (cellj = 0; cellj < patch->totalDofsPerCell; cellj++) {
1806 const PetscInt col = dofsArray[(offset + cell1)*patch->totalDofsPerCell + cellj];
1807 const PetscInt key = row*rsize + col;
1808 if (col < 0) continue;
1809 if (!PetscBTLookupSet(bt, key)) ++dnnz[row];
1810 }
1811 }
1812
1813 for (celli = 0; celli < patch->totalDofsPerCell; celli++) {
1814 const PetscInt row = dofsArray[(offset + cell1)*patch->totalDofsPerCell + celli];
1815 if (row < 0) continue;
1816 for (cellj = 0; cellj < patch->totalDofsPerCell; cellj++) {
1817 const PetscInt col = dofsArray[(offset + cell0)*patch->totalDofsPerCell + cellj];
1818 const PetscInt key = row*rsize + col;
1819 if (col < 0) continue;
1820 if (!PetscBTLookupSet(bt, key)) ++dnnz[row];
1821 }
1822 }
1823 }
1824 }
1825 ierr = PetscBTDestroy(&bt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1825,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1826 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),1826,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1827 ierr = PetscFree(dnnz)((*PetscTrFree)((void*)(dnnz),1827,__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),1827,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1828
1829 ierr = PetscCalloc1(patch->totalDofsPerCell*patch->totalDofsPerCell, &zeroes)PetscMallocA(1,PETSC_TRUE,1829,__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),1829,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1830 for (c = 0; c < ncell; ++c) {
1831 const PetscInt *idx = &dofsArray[(offset + c)*patch->totalDofsPerCell];
1832 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),1832,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1833 }
1834 ierr = MatGetLocalSize(*mat, &rows, NULL((void*)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 for (i = 0; i < rows; ++i) {
1836 ierr = MatSetValues(*mat, 1, &i, 1, &i, zeroes, INSERT_VALUES);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 }
1838
1839 if (patch->usercomputeopintfacet) {
1840 const PetscInt *intFacetsArray = NULL((void*)0);
1841 PetscInt i, numIntFacets, intFacetOffset;
1842 const PetscInt *facetCells = NULL((void*)0);
1843
1844 ierr = PetscSectionGetDof(patch->intFacetCounts, point, &numIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1844,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1845 ierr = PetscSectionGetOffset(patch->intFacetCounts, point, &intFacetOffset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1845,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1846 ierr = ISGetIndices(patch->intFacetsToPatchCell, &facetCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1846,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1847 ierr = ISGetIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1847,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1848 for (i = 0; i < numIntFacets; i++) {
1849 const PetscInt cell0 = facetCells[2*(intFacetOffset + i) + 0];
1850 const PetscInt cell1 = facetCells[2*(intFacetOffset + i) + 1];
1851 const PetscInt *cell0idx = &dofsArray[(offset + cell0)*patch->totalDofsPerCell];
1852 const PetscInt *cell1idx = &dofsArray[(offset + cell1)*patch->totalDofsPerCell];
1853 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),1853,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1854 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),1854,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1855 }
1856 }
1857
1858 ierr = MatAssemblyBegin(*mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1858,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1859 ierr = MatAssemblyEnd(*mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1859,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1860
1861 ierr = PetscFree(zeroes)((*PetscTrFree)((void*)(zeroes),1861,__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),1861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1862
1863 } else { /* rsize too big, use MATPREALLOCATOR */
1864 Mat preallocator;
1865 PetscScalar* vals;
1866
1867 ierr = PetscCalloc1(patch->totalDofsPerCell*patch->totalDofsPerCell, &vals)PetscMallocA(1,PETSC_TRUE,1867,__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),1867,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1868 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &preallocator);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 ierr = MatSetType(preallocator, MATPREALLOCATOR"preallocator");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1869,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1870 ierr = MatSetSizes(preallocator, rsize, rsize, rsize, rsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1870,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1871 ierr = MatSetUp(preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1871,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1872
1873 for (c = 0; c < ncell; ++c) {
1874 const PetscInt *idx = dofsArray + (offset + c)*patch->totalDofsPerCell;
1875 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),1875,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1876 }
1877
1878 if (patch->usercomputeopintfacet) {
1879 const PetscInt *intFacetsArray = NULL((void*)0);
1880 PetscInt i, numIntFacets, intFacetOffset;
1881 const PetscInt *facetCells = NULL((void*)0);
1882
1883 ierr = PetscSectionGetDof(patch->intFacetCounts, point, &numIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1883,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1884 ierr = PetscSectionGetOffset(patch->intFacetCounts, point, &intFacetOffset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1884,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1885 ierr = ISGetIndices(patch->intFacetsToPatchCell, &facetCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1885,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1886 ierr = ISGetIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1886,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1887 for (i = 0; i < numIntFacets; i++) {
1888 const PetscInt cell0 = facetCells[2*(intFacetOffset + i) + 0];
1889 const PetscInt cell1 = facetCells[2*(intFacetOffset + i) + 1];
1890 const PetscInt *cell0idx = &dofsArray[(offset + cell0)*patch->totalDofsPerCell];
1891 const PetscInt *cell1idx = &dofsArray[(offset + cell1)*patch->totalDofsPerCell];
1892 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),1892,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1893 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),1893,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1894 }
1895 }
1896
1897 ierr = PetscFree(vals)((*PetscTrFree)((void*)(vals),1897,__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),1897,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1898 ierr = MatAssemblyBegin(preallocator, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1898,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1899 ierr = MatAssemblyEnd(preallocator, MAT_FINAL_ASSEMBLY);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 = MatPreallocatorPreallocate(preallocator, PETSC_TRUE, *mat);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 ierr = MatDestroy(&preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1901,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1902 }
1903 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),1903,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1904 if(withArtificial) {
1905 ierr = ISRestoreIndices(patch->dofsWithArtificial, &dofsArray);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 } else {
1907 ierr = ISRestoreIndices(patch->dofs, &dofsArray);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 }
1909 }
1910 ierr = MatSetUp(*mat);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 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)
;
1912}
1913
1914static PetscErrorCode PCPatchComputeFunction_DMPlex_Private(PC pc, PetscInt patchNum, Vec x, Vec F, IS cellIS, PetscInt n, const PetscInt *l2p, const PetscInt *l2pWithAll, void *ctx)
1915{
1916 PC_PATCH *patch = (PC_PATCH *) pc->data;
1917 DM dm;
1918 PetscSection s;
1919 const PetscInt *parray, *oarray;
1920 PetscInt Nf = patch->nsubspaces, Np, poff, p, f;
1921 PetscErrorCode ierr;
1922
1923 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] = 1923; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1924 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),1924,__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"
)
;
1925 ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1925,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1926 ierr = DMGetDefaultSection(dm, &s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1926,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1927 /* Set offset into patch */
1928 ierr = PetscSectionGetDof(patch->pointCounts, patchNum, &Np);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1928,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1929 ierr = PetscSectionGetOffset(patch->pointCounts, patchNum, &poff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1929,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1930 ierr = ISGetIndices(patch->points, &parray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1930,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1931 ierr = ISGetIndices(patch->offs, &oarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1931,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1932 for (f = 0; f < Nf; ++f) {
1933 for (p = 0; p < Np; ++p) {
1934 const PetscInt point = parray[poff+p];
1935 PetscInt dof;
1936
1937 ierr = PetscSectionGetFieldDof(patch->patchSection, point, f, &dof);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 = PetscSectionSetFieldOffset(patch->patchSection, point, f, oarray[(poff+p)*Nf+f]);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 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),1939,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1940 else {ierr = PetscSectionSetOffset(patch->patchSection, point, -1);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 }
1942 }
1943 ierr = ISRestoreIndices(patch->points, &parray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1943,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1944 ierr = ISRestoreIndices(patch->offs, &oarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1944,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1945 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),1945,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1946 ierr = DMPlexComputeResidual_Patch_Internal(pc->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),1946,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1947 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)
;
1948}
1949
1950PetscErrorCode PCPatchComputeFunction_Internal(PC pc, Vec x, Vec F, PetscInt point)
1951{
1952 PC_PATCH *patch = (PC_PATCH *) pc->data;
1953 const PetscInt *dofsArray;
1954 const PetscInt *dofsArrayWithAll;
1955 const PetscInt *cellsArray;
1956 PetscInt ncell, offset, pStart, pEnd;
1957 PetscErrorCode ierr;
1958
1959 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] = 1959; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1960 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),1960,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1961 if (!patch->usercomputeop) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "Must call PCPatchSetComputeOperator() to set user callback\n")return PetscError(((MPI_Comm)0x44000001),1961,__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"
)
;
1962 ierr = ISGetIndices(patch->dofs, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1962,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1963 ierr = ISGetIndices(patch->dofsWithAll, &dofsArrayWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1963,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1964 ierr = ISGetIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1964,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1965 ierr = PetscSectionGetChart(patch->cellCounts, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1965,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1966
1967 point += pStart;
1968 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),1968,__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),1968,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1969
1970 ierr = PetscSectionGetDof(patch->cellCounts, point, &ncell);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 ierr = PetscSectionGetOffset(patch->cellCounts, point, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1971,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1972 if (ncell <= 0) {
1973 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),1973,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1974 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)
;
1975 }
1976 ierr = VecSet(F, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1976,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1977 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] = 1977; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; do {PetscErrorCode _7_ierr = PetscMallocValidate(1977,__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),1977,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while
(0)
;
1978 /* Cannot reuse the same IS because the geometry info is being cached in it */
1979 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),1979,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1980 ierr = patch->usercomputef(pc, point, x, F, patch->cellIS, ncell*patch->totalDofsPerCell, dofsArray + offset*patch->totalDofsPerCell,
1981 dofsArrayWithAll + offset*patch->totalDofsPerCell,
1982 patch->usercomputefctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1982,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1983 PetscStackPopdo { do {PetscErrorCode _7_ierr = PetscMallocValidate(1983,__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),1983,__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)
;
1984 ierr = ISDestroy(&patch->cellIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1984,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1985 ierr = ISRestoreIndices(patch->dofs, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1985,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1986 ierr = ISRestoreIndices(patch->dofsWithAll, &dofsArrayWithAll);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 ierr = ISRestoreIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1987,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1988 if (patch->viewMatrix) {
1989 char name[PETSC_MAX_PATH_LEN4096];
1990
1991 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),1991,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1992 ierr = PetscObjectSetName((PetscObject) F, name);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 ierr = ObjectView((PetscObject) F, patch->viewerMatrix, patch->formatMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1993,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1994 }
1995 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),1995,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1996 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)
;
1997}
1998
1999static PetscErrorCode PCPatchComputeOperator_DMPlex_Private(PC pc, PetscInt patchNum, Vec x, Mat J, IS cellIS, PetscInt n, const PetscInt *l2p, const PetscInt *l2pWithAll, void *ctx)
2000{
2001 PC_PATCH *patch = (PC_PATCH *) pc->data;
2002 DM dm;
2003 PetscSection s;
2004 const PetscInt *parray, *oarray;
2005 PetscInt Nf = patch->nsubspaces, Np, poff, p, f;
2006 PetscErrorCode ierr;
2007
2008 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] = 2008; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2009 ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2009,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2010 ierr = DMGetDefaultSection(dm, &s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2010,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2011 /* Set offset into patch */
2012 ierr = PetscSectionGetDof(patch->pointCounts, patchNum, &Np);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2012,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2013 ierr = PetscSectionGetOffset(patch->pointCounts, patchNum, &poff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2013,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2014 ierr = ISGetIndices(patch->points, &parray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2014,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2015 ierr = ISGetIndices(patch->offs, &oarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2015,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2016 for (f = 0; f < Nf; ++f) {
2017 for (p = 0; p < Np; ++p) {
2018 const PetscInt point = parray[poff+p];
2019 PetscInt dof;
2020
2021 ierr = PetscSectionGetFieldDof(patch->patchSection, point, f, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2021,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2022 ierr = PetscSectionSetFieldOffset(patch->patchSection, point, f, oarray[(poff+p)*Nf+f]);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 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),2023,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2024 else {ierr = PetscSectionSetOffset(patch->patchSection, point, -1);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 }
2026 }
2027 ierr = ISRestoreIndices(patch->points, &parray);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 ierr = ISRestoreIndices(patch->offs, &oarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2028,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2029 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),2029,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2030 /* TODO Shut off MatViewFromOptions() in MatAssemblyEnd() here */
2031 ierr = DMPlexComputeJacobian_Patch_Internal(pc->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),2031,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2032 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)
;
2033}
2034
2035/* This function zeros mat on entry */
2036PetscErrorCode PCPatchComputeOperator_Internal(PC pc, Vec x, Mat mat, PetscInt point, PetscBool withArtificial)
2037{
2038 PC_PATCH *patch = (PC_PATCH *) pc->data;
2039 const PetscInt *dofsArray;
2040 const PetscInt *dofsArrayWithAll = NULL((void*)0);
2041 const PetscInt *cellsArray;
2042 PetscInt ncell, offset, pStart, pEnd, numIntFacets, intFacetOffset;
2043 PetscBool isNonlinear;
2044 PetscErrorCode ierr;
2045
2046 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] = 2046; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2047 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),2047,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2048 isNonlinear = patch->isNonlinear;
2049 if (!patch->usercomputeop) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "Must call PCPatchSetComputeOperator() to set user callback\n")return PetscError(((MPI_Comm)0x44000001),2049,__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"
)
;
2050 if(withArtificial) {
2051 ierr = ISGetIndices(patch->dofsWithArtificial, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2051,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2052 } else {
2053 ierr = ISGetIndices(patch->dofs, &dofsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2053,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2054 }
2055 if (isNonlinear) {
2056 ierr = ISGetIndices(patch->dofsWithAll, &dofsArrayWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2056,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2057 }
2058 ierr = ISGetIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2058,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2059 ierr = PetscSectionGetChart(patch->cellCounts, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2059,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2060
2061 point += pStart;
2062 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),2062,__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),2062,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2063
2064 ierr = PetscSectionGetDof(patch->cellCounts, point, &ncell);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 ierr = PetscSectionGetOffset(patch->cellCounts, point, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2065,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2066 if (ncell <= 0) {
2067 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),2067,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2068 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)
;
2069 }
2070 ierr = MatZeroEntries(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2070,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2071 if (patch->precomputeElementTensors) {
2072 PetscInt i;
2073 PetscInt ndof = patch->totalDofsPerCell;
2074 const PetscScalar *elementTensors;
2075
2076 ierr = VecGetArrayRead(patch->cellMats, &elementTensors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2076,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2077 for (i = 0; i < ncell; i++) {
2078 const PetscInt cell = cellsArray[i + offset];
2079 const PetscInt *idx = dofsArray + (offset + i)*ndof;
2080 const PetscScalar *v = elementTensors + patch->precomputedTensorLocations[cell]*ndof*ndof;
2081 ierr = MatSetValues(mat, ndof, idx, ndof, idx, v, ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2081,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2082 }
2083 ierr = VecRestoreArrayRead(patch->cellMats, &elementTensors);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 ierr = MatAssemblyBegin(mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2084,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2085 ierr = MatAssemblyEnd(mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2085,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2086 } else {
2087 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] = 2087; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; do {PetscErrorCode _7_ierr = PetscMallocValidate(2087,__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),2087,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while
(0)
;
2088 /* Cannot reuse the same IS because the geometry info is being cached in it */
2089 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),2089,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2090 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),2090,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2091 }
2092 if (patch->usercomputeopintfacet) {
2093 ierr = PetscSectionGetDof(patch->intFacetCounts, point, &numIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2093,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2094 ierr = PetscSectionGetOffset(patch->intFacetCounts, point, &intFacetOffset);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 if (numIntFacets > 0) {
2096 /* For each interior facet, grab the two cells (in local numbering, and concatenate dof numberings for those cells) */
2097 PetscInt *facetDofs = NULL((void*)0), *facetDofsWithAll = NULL((void*)0);
2098 const PetscInt *intFacetsArray = NULL((void*)0);
2099 PetscInt idx = 0;
2100 PetscInt i, c, d;
2101 PetscInt fStart;
2102 DM dm;
2103 IS facetIS = NULL((void*)0);
2104 const PetscInt *facetCells = NULL((void*)0);
2105
2106 ierr = ISGetIndices(patch->intFacetsToPatchCell, &facetCells);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 = ISGetIndices(patch->intFacets, &intFacetsArray);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 ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2108,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2109 ierr = DMPlexGetHeightStratum(dm, 1, &fStart, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2109,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2110 /* FIXME: Pull this malloc out. */
2111 ierr = PetscMalloc1(2 * patch->totalDofsPerCell * numIntFacets, &facetDofs)PetscMallocA(1,PETSC_FALSE,2111,__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),2111,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2112 if (dofsArrayWithAll) {
2113 ierr = PetscMalloc1(2 * patch->totalDofsPerCell * numIntFacets, &facetDofsWithAll)PetscMallocA(1,PETSC_FALSE,2113,__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),2113,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2114 }
2115 if (patch->precomputeElementTensors) {
2116 PetscInt nFacetDof = 2*patch->totalDofsPerCell;
2117 const PetscScalar *elementTensors;
2118
2119 ierr = VecGetArrayRead(patch->intFacetMats, &elementTensors);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
2121 for (i = 0; i < numIntFacets; i++) {
2122 const PetscInt facet = intFacetsArray[i + intFacetOffset];
2123 const PetscScalar *v = elementTensors + patch->precomputedIntFacetTensorLocations[facet - fStart]*nFacetDof*nFacetDof;
2124 idx = 0;
2125 /*
2126 * 0--1
2127 * |\-|
2128 * |+\|
2129 * 2--3
2130 * [0, 2, 3, 0, 1, 3]
2131 */
2132 for (c = 0; c < 2; c++) {
2133 const PetscInt cell = facetCells[2*(intFacetOffset + i) + c];
2134 for (d = 0; d < patch->totalDofsPerCell; d++) {
2135 facetDofs[idx] = dofsArray[(offset + cell)*patch->totalDofsPerCell + d];
2136 idx++;
2137 }
2138 }
2139 ierr = MatSetValues(mat, nFacetDof, facetDofs, nFacetDof, facetDofs, v, ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2139,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2140 }
2141 ierr = VecRestoreArrayRead(patch->intFacetMats, &elementTensors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2141,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2142 } else {
2143 /*
2144 * 0--1
2145 * |\-|
2146 * |+\|
2147 * 2--3
2148 * [0, 2, 3, 0, 1, 3]
2149 */
2150 for (i = 0; i < numIntFacets; i++) {
2151 for (c = 0; c < 2; c++) {
2152 const PetscInt cell = facetCells[2*(intFacetOffset + i) + c];
2153 for (d = 0; d < patch->totalDofsPerCell; d++) {
2154 facetDofs[idx] = dofsArray[(offset + cell)*patch->totalDofsPerCell + d];
2155 if (dofsArrayWithAll) {
2156 facetDofsWithAll[idx] = dofsArrayWithAll[(offset + cell)*patch->totalDofsPerCell + d];
2157 }
2158 idx++;
2159 }
2160 }
2161 }
2162 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),2162,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2163 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),2163,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2164 ierr = ISDestroy(&facetIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2164,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2165 }
2166 ierr = ISRestoreIndices(patch->intFacetsToPatchCell, &facetCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2166,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2167 ierr = ISRestoreIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2167,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2168 ierr = PetscFree(facetDofs)((*PetscTrFree)((void*)(facetDofs),2168,__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),2168,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2169 ierr = PetscFree(facetDofsWithAll)((*PetscTrFree)((void*)(facetDofsWithAll),2169,__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),2169,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2170 }
2171 }
2172
2173 ierr = MatAssemblyBegin(mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2173,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2174 ierr = MatAssemblyEnd(mat, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2174,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2175
2176 PetscStackPopdo { do {PetscErrorCode _7_ierr = PetscMallocValidate(2176,__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),2176,__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)
;
2177 ierr = ISDestroy(&patch->cellIS);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 if(withArtificial) {
2179 ierr = ISRestoreIndices(patch->dofsWithArtificial, &dofsArray);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 } else {
2181 ierr = ISRestoreIndices(patch->dofs, &dofsArray);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 }
2183 if (isNonlinear) {
2184 ierr = ISRestoreIndices(patch->dofsWithAll, &dofsArrayWithAll);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 }
2186 ierr = ISRestoreIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2186,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2187 if (patch->viewMatrix) {
2188 char name[PETSC_MAX_PATH_LEN4096];
2189
2190 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),2190,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2191 ierr = PetscObjectSetName((PetscObject) mat, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2191,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2192 ierr = ObjectView((PetscObject) mat, patch->viewerMatrix, patch->formatMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2192,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2193 }
2194 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),2194,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2195 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)
;
2196}
2197
2198static PetscErrorCode MatSetValues_PCPatch_Private(Mat mat, PetscInt m, const PetscInt idxm[],
2199 PetscInt n, const PetscInt idxn[], const PetscScalar *v, InsertMode addv)
2200{
2201 Vec data;
2202 PetscScalar *array;
2203 PetscInt bs, nz, i, j, cell;
2204 PetscErrorCode ierr;
2205
2206 ierr = MatShellGetContext(mat, &data);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 = VecGetBlockSize(data, &bs);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 = VecGetSize(data, &nz);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 ierr = VecGetArray(data, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2209,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2210 if (m != n) SETERRQ(PetscObjectComm((PetscObject)mat), PETSC_ERR_ARG_WRONG, "Only for square insertion")return PetscError(PetscObjectComm((PetscObject)mat),2210,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,62,PETSC_ERROR_INITIAL,"Only for square insertion")
;
2211 cell = (PetscInt)(idxm[0]/bs); /* use the fact that this is called once per cell */
2212 for (i = 0; i < m; i++) {
2213 if (idxm[i] != idxn[i]) SETERRQ(PetscObjectComm((PetscObject)mat), PETSC_ERR_ARG_WRONG, "Row and column indices must match!")return PetscError(PetscObjectComm((PetscObject)mat),2213,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,62,PETSC_ERROR_INITIAL,"Row and column indices must match!")
;
2214 for (j = 0; j < n; j++) {
2215 const PetscScalar v_ = v[i*bs + j];
2216 /* Indexing is special to the data structure we have! */
2217 if (addv == INSERT_VALUES) {
2218 array[cell*bs*bs + i*bs + j] = v_;
2219 } else {
2220 array[cell*bs*bs + i*bs + j] += v_;
2221 }
2222 }
2223 }
2224 ierr = VecRestoreArray(data, &array);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 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)
;
2226}
2227
2228static PetscErrorCode PCPatchPrecomputePatchTensors_Private(PC pc)
2229{
2230 PC_PATCH *patch = (PC_PATCH *)pc->data;
2231 const PetscInt *cellsArray;
2232 PetscInt ncell, offset;
2233 const PetscInt *dofMapArray;
2234 PetscInt i, j;
2235 IS dofMap;
2236 IS cellIS;
2237 const PetscInt ndof = patch->totalDofsPerCell;
2238 PetscErrorCode ierr;
2239 Mat vecMat;
2240 PetscInt cStart, cEnd;
2241 DM dm, plex;
2242
2243
2244 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),2244,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2245
2246 if (!patch->allCells) {
2247 PetscHSetI cells;
2248 PetscHashIter hi;
2249 PetscInt pStart, pEnd;
2250 PetscInt *allCells = NULL((void*)0);
2251 ierr = PetscHSetICreate(&cells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2251,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2252 ierr = ISGetIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2252,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2253 ierr = PetscSectionGetChart(patch->cellCounts, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2254 for (i = pStart; i < pEnd; i++) {
2255 ierr = PetscSectionGetDof(patch->cellCounts, i, &ncell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2255,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2256 ierr = PetscSectionGetOffset(patch->cellCounts, i, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2256,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2257 if (ncell <= 0) continue;
2258 for (j = 0; j < ncell; j++) {
2259 PetscHSetIAdd(cells, cellsArray[offset + j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2260 }
2261 }
2262 ierr = ISRestoreIndices(patch->cells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2262,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2263 ierr = PetscHSetIGetSize(cells, &ncell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2263,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2264 ierr = PetscMalloc1(ncell, &allCells)PetscMallocA(1,PETSC_FALSE,2264,__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),2264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2265 ierr = PCGetDM(pc, &dm);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 ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2266,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2267 ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);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 = PetscMalloc1(cEnd-cStart, &patch->precomputedTensorLocations)PetscMallocA(1,PETSC_FALSE,2268,__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),2268,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2269 i = 0;
2270 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)
;
2271 while (!PetscHashIterAtEnd(cells, hi)((hi) == (((cells))->n_buckets))) {
2272 PetscHashIterGetKey(cells, hi, allCells[i])((allCells[i]) = (((cells))->keys[(hi)]));
2273 patch->precomputedTensorLocations[allCells[i]] = i;
2274 PetscHashIterNext(cells, hi)do { ++(hi); } while ((hi) != (((cells))->n_buckets) &&
!(!((((cells))->flags[((hi))>>4]>>((((hi))&
0xfU)<<1))&3)))
;
2275 i++;
2276 }
2277 ierr = PetscHSetIDestroy(&cells);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 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),2278,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2279 }
2280 ierr = ISGetSize(patch->allCells, &ncell);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 (!patch->cellMats) {
2282 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),2282,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2283 ierr = VecSetBlockSize(patch->cellMats, ndof);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 ierr = VecSet(patch->cellMats, 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2285,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2286
2287 ierr = MatCreateShell(PETSC_COMM_SELF((MPI_Comm)0x44000001), ncell*ndof, ncell*ndof, ncell*ndof, ncell*ndof,
2288 (void*)patch->cellMats, &vecMat);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 = MatShellSetOperation(vecMat, MATOP_SET_VALUES, (void(*)(void))&MatSetValues_PCPatch_Private);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 = ISGetSize(patch->allCells, &ncell);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 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),2291,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2292 ierr = ISGetIndices(dofMap, &dofMapArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2292,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2293 ierr = ISGetIndices(patch->allCells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2293,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2294 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),2294,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2295 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] = 2295; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; do {PetscErrorCode _7_ierr = PetscMallocValidate(2295,__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),2295,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while
(0)
;
2296 /* TODO: Fix for DMPlex compute op, this bypasses a lot of the machinery and just assembles every element tensor. */
2297 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),2297,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2298 PetscStackPopdo { do {PetscErrorCode _7_ierr = PetscMallocValidate(2298,__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),2298,__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)
;
2299 ierr = ISDestroy(&cellIS);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 = MatDestroy(&vecMat);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 ierr = ISRestoreIndices(patch->allCells, &cellsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2301,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2302 ierr = ISRestoreIndices(dofMap, &dofMapArray);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 ierr = ISDestroy(&dofMap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2303,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2304
2305 if (patch->usercomputeopintfacet) {
2306 PetscInt nIntFacets;
2307 IS intFacetsIS;
2308 const PetscInt *intFacetsArray = NULL((void*)0);
2309 if (!patch->allIntFacets) {
2310 PetscHSetI facets;
2311 PetscHashIter hi;
2312 PetscInt pStart, pEnd, fStart, fEnd;
2313 PetscInt *allIntFacets = NULL((void*)0);
2314 ierr = PetscHSetICreate(&facets);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->intFacets, &intFacetsArray);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 = PetscSectionGetChart(patch->intFacetCounts, &pStart, &pEnd);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 ierr = DMPlexGetHeightStratum(dm, 1, &fStart, &fEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2317,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2318 for (i = pStart; i < pEnd; i++) {
2319 ierr = PetscSectionGetDof(patch->intFacetCounts, i, &nIntFacets);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 ierr = PetscSectionGetOffset(patch->intFacetCounts, i, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2320,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2321 if (nIntFacets <= 0) continue;
2322 for (j = 0; j < nIntFacets; j++) {
2323 PetscHSetIAdd(facets, intFacetsArray[offset + j]);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 }
2325 }
2326 ierr = ISRestoreIndices(patch->intFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2326,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2327 ierr = PetscHSetIGetSize(facets, &nIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2327,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2328 ierr = PetscMalloc1(nIntFacets, &allIntFacets)PetscMallocA(1,PETSC_FALSE,2328,__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),2328,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2329 ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2329,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2330 ierr = DMConvert(dm, DMPLEX"plex", &plex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2330,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2331 ierr = PetscMalloc1(fEnd-fStart, &patch->precomputedIntFacetTensorLocations)PetscMallocA(1,PETSC_FALSE,2331,__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),2331,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2332 i = 0;
2333 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)
;
2334 while (!PetscHashIterAtEnd(facets, hi)((hi) == (((facets))->n_buckets))) {
2335 PetscHashIterGetKey(facets, hi, allIntFacets[i])((allIntFacets[i]) = (((facets))->keys[(hi)]));
2336 patch->precomputedIntFacetTensorLocations[allIntFacets[i] - fStart] = i;
2337 PetscHashIterNext(facets, hi)do { ++(hi); } while ((hi) != (((facets))->n_buckets) &&
!(!((((facets))->flags[((hi))>>4]>>((((hi))&
0xfU)<<1))&3)))
;
2338 i++;
2339 }
2340 ierr = PetscHSetIDestroy(&facets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2340,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2341 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),2341,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2342 }
2343 ierr = ISGetSize(patch->allIntFacets, &nIntFacets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2343,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2344 if (!patch->intFacetMats) {
2345 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),2345,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2346 ierr = VecSetBlockSize(patch->intFacetMats, ndof*2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2346,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2347 }
2348 ierr = VecSet(patch->intFacetMats, 0);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
2350 ierr = MatCreateShell(PETSC_COMM_SELF((MPI_Comm)0x44000001), nIntFacets*ndof*2, nIntFacets*ndof*2, nIntFacets*ndof*2, nIntFacets*ndof*2,
2351 (void*)patch->intFacetMats, &vecMat);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 ierr = MatShellSetOperation(vecMat, MATOP_SET_VALUES, (void(*)(void))&MatSetValues_PCPatch_Private);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2352,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2353 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),2353,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2354 ierr = ISGetIndices(dofMap, &dofMapArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2354,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2355 ierr = ISGetIndices(patch->allIntFacets, &intFacetsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2355,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2356 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),2356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2357 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] = 2357; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; do {PetscErrorCode _7_ierr = PetscMallocValidate(2357,__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),2357,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while
(0)
;
2358 /* TODO: Fix for DMPlex compute op, this bypasses a lot of the machinery and just assembles every element tensor. */
2359 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),2359,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2360 PetscStackPopdo { do {PetscErrorCode _7_ierr = PetscMallocValidate(2360,__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),2360,__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)
;
2361 ierr = ISDestroy(&intFacetsIS);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 ierr = MatDestroy(&vecMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2362,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2363 ierr = ISRestoreIndices(patch->allIntFacets, &intFacetsArray);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 ierr = ISRestoreIndices(dofMap, &dofMapArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2364,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2365 ierr = ISDestroy(&dofMap);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 }
2367 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),2367,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2368
2369 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)
;
2370}
2371
2372PetscErrorCode PCPatch_ScatterLocal_Private(PC pc, PetscInt p, Vec x, Vec y, InsertMode mode, ScatterMode scat, PatchScatterType scattertype)
2373{
2374 PC_PATCH *patch = (PC_PATCH *) pc->data;
2375 const PetscScalar *xArray = NULL((void*)0);
2376 PetscScalar *yArray = NULL((void*)0);
2377 const PetscInt *gtolArray = NULL((void*)0);
2378 PetscInt dof, offset, lidx;
2379 PetscErrorCode ierr;
2380
2381 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] = 2381; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
2382 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),2382,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2383 ierr = VecGetArrayRead(x, &xArray);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 = VecGetArray(y, &yArray);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 if (scattertype == SCATTER_WITHARTIFICIAL) {
2386 ierr = PetscSectionGetDof(patch->gtolCountsWithArtificial, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2386,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2387 ierr = PetscSectionGetOffset(patch->gtolCountsWithArtificial, p, &offset);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 = ISGetIndices(patch->gtolWithArtificial, &gtolArray);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 } else if (scattertype == SCATTER_WITHALL) {
2390 ierr = PetscSectionGetDof(patch->gtolCountsWithAll, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2390,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2391 ierr = PetscSectionGetOffset(patch->gtolCountsWithAll, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2391,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2392 ierr = ISGetIndices(patch->gtolWithAll, &gtolArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2392,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2393 } else {
2394 ierr = PetscSectionGetDof(patch->gtolCounts, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2394,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2395 ierr = PetscSectionGetOffset(patch->gtolCounts, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2395,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2396 ierr = ISGetIndices(patch->gtol, &gtolArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2396,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2397 }
2398 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),2398,__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"
)
;
2399 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),2399,__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"
)
;
2400 for (lidx = 0; lidx < dof; ++lidx) {
2401 const PetscInt gidx = gtolArray[offset+lidx];
2402
2403 if (mode == INSERT_VALUES) yArray[lidx] = xArray[gidx]; /* Forward */
2404 else yArray[gidx] += xArray[lidx]; /* Reverse */
2405 }
2406 if (scattertype == SCATTER_WITHARTIFICIAL) {
2407 ierr = ISRestoreIndices(patch->gtolWithArtificial, &gtolArray);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 } else if (scattertype == SCATTER_WITHALL) {
2409 ierr = ISRestoreIndices(patch->gtolWithAll, &gtolArray);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 {
2411 ierr = ISRestoreIndices(patch->gtol, &gtolArray);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 }
2413 ierr = VecRestoreArrayRead(x, &xArray);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 ierr = VecRestoreArray(y, &yArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2414,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2415 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),2415,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2416 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)
;
2417}
2418
2419static PetscErrorCode PCSetUp_PATCH_Linear(PC pc)
2420{
2421 PC_PATCH *patch = (PC_PATCH *) pc->data;
2422 const char *prefix;
2423 PetscInt i;
2424 PetscErrorCode ierr;
2425
2426 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] = 2426; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2427 if (!pc->setupcalled) {
2428 ierr = PetscMalloc1(patch->npatch, &patch->solver)PetscMallocA(1,PETSC_FALSE,2428,__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),2428,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2429 ierr = PCGetOptionsPrefix(pc, &prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2429,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2430 for (i = 0; i < patch->npatch; ++i) {
2431 KSP ksp;
2432 PC subpc;
2433
2434 ierr = KSPCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &ksp);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 = KSPSetErrorIfNotConverged(ksp, pc->erroriffailure);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 = KSPSetOptionsPrefix(ksp, prefix);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 ierr = KSPAppendOptionsPrefix(ksp, "sub_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2437,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2438 ierr = PetscObjectIncrementTabLevel((PetscObject) ksp, (PetscObject) pc, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2438,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2439 ierr = KSPGetPC(ksp, &subpc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2439,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2440 ierr = PetscObjectIncrementTabLevel((PetscObject) subpc, (PetscObject) pc, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2440,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2441 ierr = PetscLogObjectParent((PetscObject) pc, (PetscObject) ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2441,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2442 patch->solver[i] = (PetscObject) ksp;
2443 }
2444 }
2445 if (patch->save_operators) {
2446 if (patch->precomputeElementTensors) {
2447 ierr = PCPatchPrecomputePatchTensors_Private(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2447,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2448 }
2449 for (i = 0; i < patch->npatch; ++i) {
2450 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),2450,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2451 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),2451,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2452 }
2453 }
2454 if(patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
2455 for (i = 0; i < patch->npatch; ++i) {
2456 /* Instead of padding patch->patchUpdate with zeros to get */
2457 /* patch->patchUpdateWithArtificial and then multiplying with the matrix, */
2458 /* just get rid of the columns that correspond to the dofs with */
2459 /* artificial bcs. That's of course fairly inefficient, hopefully we */
2460 /* can just assemble the rectangular matrix in the first place. */
2461 Mat matSquare;
2462 IS rowis;
2463 PetscInt dof;
2464
2465 ierr = MatGetSize(patch->mat[i], &dof, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2465,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2466 if (dof == 0) {
2467 patch->matWithArtificial[i] = NULL((void*)0);
2468 continue;
2469 }
2470
2471 ierr = PCPatchCreateMatrix_Private(pc, i, &matSquare, PETSC_TRUE);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 = PCPatchComputeOperator_Internal(pc, NULL((void*)0), matSquare, i, PETSC_TRUE);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 ierr = MatGetSize(matSquare, &dof, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2474,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2475 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),2475,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2476 if(pc->setupcalled) {
2477 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),2477,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2478 } else {
2479 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),2479,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2480 }
2481 ierr = ISDestroy(&rowis); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2481,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2482 ierr = MatDestroy(&matSquare);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2482,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2483 }
2484 }
2485 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)
;
2486}
2487
2488static PetscErrorCode PCSetUp_PATCH(PC pc)
2489{
2490 PC_PATCH *patch = (PC_PATCH *) pc->data;
2491 PetscInt i;
2492 PetscBool isNonlinear;
2493 PetscErrorCode ierr;
2494
2495 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] = 2495; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2496 if (!pc->setupcalled) {
2497 PetscInt pStart, pEnd, p;
2498 PetscInt localSize;
2499
2500 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),2500,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2501
2502 isNonlinear = patch->isNonlinear;
2503 if (!patch->nsubspaces) {
2504 DM dm;
2505 PetscSection s;
2506 PetscInt cStart, cEnd, c, Nf, f, numGlobalBcs = 0, *globalBcs, *Nb, totNb = 0, **cellDofs;
2507
2508 ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2508,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2509 if (!dm) SETERRQ(PetscObjectComm((PetscObject) pc), PETSC_ERR_ARG_WRONG, "Must set DM for PCPATCH or call PCPatchSetDiscretisationInfo()")return PetscError(PetscObjectComm((PetscObject) pc),2509,__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()"
)
;
2510 ierr = DMGetDefaultSection(dm, &s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2510,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2511 ierr = PetscSectionGetNumFields(s, &Nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2511,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2512 ierr = PetscSectionGetChart(s, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2512,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2513 for (p = pStart; p < pEnd; ++p) {
2514 PetscInt cdof;
2515 ierr = PetscSectionGetConstraintDof(s, p, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2515,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2516 numGlobalBcs += cdof;
2517 }
2518 ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2518,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2519 ierr = PetscMalloc3(Nf, &Nb, Nf, &cellDofs, numGlobalBcs, &globalBcs)PetscMallocA(3,PETSC_FALSE,2519,__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),2519,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2520 for (f = 0; f < Nf; ++f) {
2521 PetscFE fe;
2522 PetscDualSpace sp;
2523 PetscInt cdoff = 0;
2524
2525 ierr = DMGetField(dm, f, NULL((void*)0), (PetscObject *) &fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2525,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2526 /* ierr = PetscFEGetNumComponents(fe, &Nc[f]);CHKERRQ(ierr); */
2527 ierr = PetscFEGetDualSpace(fe, &sp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2527,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2528 ierr = PetscDualSpaceGetDimension(sp, &Nb[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2528,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2529 totNb += Nb[f];
2530
2531 ierr = PetscMalloc1((cEnd-cStart)*Nb[f], &cellDofs[f])PetscMallocA(1,PETSC_FALSE,2531,__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),2531,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2532 for (c = cStart; c < cEnd; ++c) {
2533 PetscInt *closure = NULL((void*)0);
2534 PetscInt clSize = 0, cl;
2535
2536 ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &clSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2536,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2537 for (cl = 0; cl < clSize*2; cl += 2) {
2538 const PetscInt p = closure[cl];
2539 PetscInt fdof, d, foff;
2540
2541 ierr = PetscSectionGetFieldDof(s, p, f, &fdof);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 = PetscSectionGetFieldOffset(s, p, f, &foff);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 (d = 0; d < fdof; ++d, ++cdoff) cellDofs[f][cdoff] = foff + d;
2544 }
2545 ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &clSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2545,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2546 }
2547 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),2547,__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])
;
2548 }
2549 numGlobalBcs = 0;
2550 for (p = pStart; p < pEnd; ++p) {
2551 const PetscInt *ind;
2552 PetscInt off, cdof, d;
2553
2554 ierr = PetscSectionGetOffset(s, p, &off);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 ierr = PetscSectionGetConstraintDof(s, p, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2555,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2556 ierr = PetscSectionGetConstraintIndices(s, p, &ind);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2556,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2557 for (d = 0; d < cdof; ++d) globalBcs[numGlobalBcs++] = off + ind[d];
2558 }
2559
2560 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),2560,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2561 for (f = 0; f < Nf; ++f) {
2562 ierr = PetscFree(cellDofs[f])((*PetscTrFree)((void*)(cellDofs[f]),2562,__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),2562,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2563 }
2564 ierr = PetscFree3(Nb, cellDofs, globalBcs)PetscFreeA(3,2564,__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),2564,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2565 ierr = PCPatchSetComputeFunction(pc, PCPatchComputeFunction_DMPlex_Private, NULL((void*)0));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 ierr = PCPatchSetComputeOperator(pc, PCPatchComputeOperator_DMPlex_Private, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2566,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2567 }
2568
2569 localSize = patch->subspaceOffsets[patch->nsubspaces];
2570 ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001), localSize, &patch->localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2570,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2571 ierr = VecSetUp(patch->localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2571,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2572 ierr = VecDuplicate(patch->localRHS, &patch->localUpdate);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2572,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2573 ierr = PCPatchCreateCellPatches(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2573,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2574 ierr = PCPatchCreateCellPatchDiscretisationInfo(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2574,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2575
2576 /* OK, now build the work vectors */
2577 ierr = PetscSectionGetChart(patch->gtolCounts, &pStart, &pEnd);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 = PetscMalloc1(patch->npatch, &patch->patchRHS)PetscMallocA(1,PETSC_FALSE,2578,__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),2578,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2579 ierr = PetscMalloc1(patch->npatch, &patch->patchUpdate)PetscMallocA(1,PETSC_FALSE,2579,__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),2579,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2580
2581 if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
2582 ierr = PetscMalloc1(patch->npatch, &patch->patchRHSWithArtificial)PetscMallocA(1,PETSC_FALSE,2582,__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),2582,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2583 ierr = PetscMalloc1(patch->npatch, &patch->dofMappingWithoutToWithArtificial)PetscMallocA(1,PETSC_FALSE,2583,__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),2583,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2584 }
2585 if (isNonlinear) {
2586 ierr = PetscMalloc1(patch->npatch, &patch->dofMappingWithoutToWithAll)PetscMallocA(1,PETSC_FALSE,2586,__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),2586,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2587 }
2588 for (p = pStart; p < pEnd; ++p) {
2589 PetscInt dof;
2590
2591 ierr = PetscSectionGetDof(patch->gtolCounts, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2591,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2592 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),2592,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2593 ierr = VecSetUp(patch->patchRHS[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2593,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2594 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),2594,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2595 ierr = VecSetUp(patch->patchUpdate[p-pStart]);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 if (patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
2597 const PetscInt *gtolArray, *gtolArrayWithArtificial = NULL((void*)0);
2598 PetscInt numPatchDofs, offset;
2599 PetscInt numPatchDofsWithArtificial, offsetWithArtificial;
2600 PetscInt dofWithoutArtificialCounter = 0;
2601 PetscInt *patchWithoutArtificialToWithArtificialArray;
2602
2603 ierr = PetscSectionGetDof(patch->gtolCountsWithArtificial, p, &dof);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 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),2604,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2605 ierr = VecSetUp(patch->patchRHSWithArtificial[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2605,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2606
2607 /* Now build the mapping that for a dof in a patch WITHOUT dofs that have artificial bcs gives the */
2608 /* the index in the patch with all dofs */
2609 ierr = ISGetIndices(patch->gtol, &gtolArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2609,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2610
2611 ierr = PetscSectionGetDof(patch->gtolCounts, p, &numPatchDofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2611,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2612 if (numPatchDofs == 0) {
2613 patch->dofMappingWithoutToWithArtificial[p-pStart] = NULL((void*)0);
2614 continue;
2615 }
2616
2617 ierr = PetscSectionGetOffset(patch->gtolCounts, p, &offset);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 = ISGetIndices(patch->gtolWithArtificial, &gtolArrayWithArtificial);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 = PetscSectionGetDof(patch->gtolCountsWithArtificial, p, &numPatchDofsWithArtificial);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 ierr = PetscSectionGetOffset(patch->gtolCountsWithArtificial, p, &offsetWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2620,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2621
2622 ierr = PetscMalloc1(numPatchDofs, &patchWithoutArtificialToWithArtificialArray)PetscMallocA(1,PETSC_FALSE,2622,__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),2622,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2623 for (i=0; i<numPatchDofsWithArtificial; i++) {
2624 if (gtolArrayWithArtificial[i+offsetWithArtificial] == gtolArray[offset+dofWithoutArtificialCounter]) {
2625 patchWithoutArtificialToWithArtificialArray[dofWithoutArtificialCounter] = i;
2626 dofWithoutArtificialCounter++;
2627 if (dofWithoutArtificialCounter == numPatchDofs)
2628 break;
2629 }
2630 }
2631 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),2631,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2632 ierr = ISRestoreIndices(patch->gtol, &gtolArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2632,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2633 ierr = ISRestoreIndices(patch->gtolWithArtificial, &gtolArrayWithArtificial);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 if (isNonlinear) {
2636 const PetscInt *gtolArray, *gtolArrayWithAll = NULL((void*)0);
2637 PetscInt numPatchDofs, offset;
2638 PetscInt numPatchDofsWithAll, offsetWithAll;
2639 PetscInt dofWithoutAllCounter = 0;
2640 PetscInt *patchWithoutAllToWithAllArray;
2641
2642 /* Now build the mapping that for a dof in a patch WITHOUT dofs that have artificial bcs gives the */
2643 /* the index in the patch with all dofs */
2644 ierr = ISGetIndices(patch->gtol, &gtolArray);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 = PetscSectionGetDof(patch->gtolCounts, p, &numPatchDofs);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 if (numPatchDofs == 0) {
2648 patch->dofMappingWithoutToWithAll[p-pStart] = NULL((void*)0);
2649 continue;
2650 }
2651
2652 ierr = PetscSectionGetOffset(patch->gtolCounts, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2652,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2653 ierr = ISGetIndices(patch->gtolWithAll, &gtolArrayWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2653,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2654 ierr = PetscSectionGetDof(patch->gtolCountsWithAll, p, &numPatchDofsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2654,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2655 ierr = PetscSectionGetOffset(patch->gtolCountsWithAll, p, &offsetWithAll);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
2657 ierr = PetscMalloc1(numPatchDofs, &patchWithoutAllToWithAllArray)PetscMallocA(1,PETSC_FALSE,2657,__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),2657,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2658
2659 for (i=0; i<numPatchDofsWithAll; i++) {
2660 if (gtolArrayWithAll[i+offsetWithAll] == gtolArray[offset+dofWithoutAllCounter]) {
2661 patchWithoutAllToWithAllArray[dofWithoutAllCounter] = i;
2662 dofWithoutAllCounter++;
2663 if (dofWithoutAllCounter == numPatchDofs)
2664 break;
2665 }
2666 }
2667 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),2667,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2668 ierr = ISRestoreIndices(patch->gtol, &gtolArray);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 ierr = ISRestoreIndices(patch->gtolWithAll, &gtolArrayWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2669,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2670 }
2671 }
2672 if (patch->save_operators) {
2673 ierr = PetscMalloc1(patch->npatch, &patch->mat)PetscMallocA(1,PETSC_FALSE,2673,__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),2673,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2674 for (i = 0; i < patch->npatch; ++i) {
2675 ierr = PCPatchCreateMatrix_Private(pc, i, &patch->mat[i], PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2675,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2676 }
2677 }
2678 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),2678,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2679
2680 /* If desired, calculate weights for dof multiplicity */
2681 if (patch->partition_of_unity) {
2682 PetscScalar *input = NULL((void*)0);
2683 PetscScalar *output = NULL((void*)0);
2684 Vec global;
2685
2686 ierr = VecDuplicate(patch->localRHS, &patch->dof_weights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2686,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2687 if(patch->local_composition_type == PC_COMPOSITE_ADDITIVE) {
2688 for (i = 0; i < patch->npatch; ++i) {
2689 PetscInt dof;
2690
2691 ierr = PetscSectionGetDof(patch->gtolCounts, i+pStart, &dof);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 if (dof <= 0) continue;
2693 ierr = VecSet(patch->patchRHS[i], 1.0);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 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),2694,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2695 }
2696 } else {
2697 /* multiplicative is actually only locally multiplicative and globally additive. need the pou where the mesh decomposition overlaps */
2698 ierr = VecSet(patch->dof_weights, 1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2698,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2699 }
2700
2701 VecDuplicate(patch->dof_weights, &global);
2702 VecSet(global, 0.);
2703
2704 ierr = VecGetArray(patch->dof_weights, &input);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2704,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2705 ierr = VecGetArray(global, &output);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2705,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2706 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),2706,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2707 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),2707,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2708 ierr = VecRestoreArray(patch->dof_weights, &input);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2708,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2709 ierr = VecRestoreArray(global, &output);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2709,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2710
2711 ierr = VecReciprocal(global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2711,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2712
2713 ierr = VecGetArray(patch->dof_weights, &output);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2713,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2714 ierr = VecGetArray(global, &input);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2714,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2715 ierr = PetscSFBcastBegin(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), input, output);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 ierr = PetscSFBcastEnd(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), input, output);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2716,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2717 ierr = VecRestoreArray(patch->dof_weights, &output);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 = VecRestoreArray(global, &input);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 ierr = VecDestroy(&global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2719,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2720 }
2721 if(patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE && patch->save_operators) {
2722 ierr = PetscMalloc1(patch->npatch, &patch->matWithArtificial)PetscMallocA(1,PETSC_FALSE,2722,__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),2722,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2723 }
2724 }
2725 ierr = (*patch->setupsolver)(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2725,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2726 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)
;
2727}
2728
2729static PetscErrorCode PCApply_PATCH_Linear(PC pc, PetscInt i, Vec x, Vec y)
2730{
2731 PC_PATCH *patch = (PC_PATCH *) pc->data;
2732 KSP ksp = (KSP) patch->solver[i];
2733 PetscErrorCode ierr;
2734
2735 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] = 2735; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2736 if (!patch->save_operators) {
2737 Mat mat;
2738
2739 ierr = PCPatchCreateMatrix_Private(pc, i, &mat, PETSC_FALSE);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 /* Populate operator here. */
2741 ierr = PCPatchComputeOperator_Internal(pc, NULL((void*)0), mat, i, PETSC_FALSE);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 = KSPSetOperators(ksp, mat, mat);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 /* Drop reference so the KSPSetOperators below will blow it away. */
2744 ierr = MatDestroy(&mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2744,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2745 }
2746 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),2746,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2747 if (!ksp->setfromoptionscalled) {
2748 ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2748,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2749 }
2750 ierr = KSPSolve(ksp, x, y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2750,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2751 ierr = KSPCheckSolve(ksp, pc, y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2751,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2752 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),2752,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2753 if (!patch->save_operators) {
2754 PC pc;
2755 ierr = KSPSetOperators(ksp, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2755,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2756 ierr = KSPGetPC(ksp, &pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2756,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2757 /* Destroy PC context too, otherwise the factored matrix hangs around. */
2758 ierr = PCReset(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2758,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2759 }
2760 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)
;
2761}
2762
2763static PetscErrorCode PCUpdateMultiplicative_PATCH_Linear(PC pc, PetscInt i, PetscInt pStart)
2764{
2765 PC_PATCH *patch = (PC_PATCH *) pc->data;
2766 Mat multMat;
2767 PetscErrorCode ierr;
2768
2769 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] = 2769; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2770
2771 if (patch->save_operators) {
2772 multMat = patch->matWithArtificial[i];
2773 } else {
2774 /*Very inefficient, hopefully we can just assemble the rectangular matrix in the first place.*/
2775 Mat matSquare;
2776 PetscInt dof;
2777 IS rowis;
2778 ierr = PCPatchCreateMatrix_Private(pc, i, &matSquare, PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2778,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2779 ierr = PCPatchComputeOperator_Internal(pc, NULL((void*)0), matSquare, i, PETSC_TRUE);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 = MatGetSize(matSquare, &dof, NULL((void*)0));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 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),2781,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2782 ierr = MatCreateSubMatrix(matSquare, rowis, patch->dofMappingWithoutToWithArtificial[i], MAT_INITIAL_MATRIX, &multMat); 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 ierr = MatDestroy(&matSquare);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2783,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2784 ierr = ISDestroy(&rowis); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2784,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2785 }
2786 ierr = MatMult(multMat, patch->patchUpdate[i], patch->patchRHSWithArtificial[i]); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2786,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2787 ierr = VecScale(patch->patchRHSWithArtificial[i], -1.0); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2787,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2788 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),2788,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2789 if (!patch->save_operators) {
2790 ierr = MatDestroy(&multMat); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2790,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2791 }
2792 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)
;
2793}
2794
2795static PetscErrorCode PCApply_PATCH(PC pc, Vec x, Vec y)
2796{
2797 PC_PATCH *patch = (PC_PATCH *) pc->data;
2798 const PetscScalar *globalRHS = NULL((void*)0);
2799 PetscScalar *localRHS = NULL((void*)0);
2800 PetscScalar *globalUpdate = NULL((void*)0);
2801 const PetscInt *bcNodes = NULL((void*)0);
2802 PetscInt nsweep = patch->symmetrise_sweep ? 2 : 1;
2803 PetscInt start[2] = {0, 0};
2804 PetscInt end[2] = {-1, -1};
2805 const PetscInt inc[2] = {1, -1};
2806 const PetscScalar *localUpdate;
2807 const PetscInt *iterationSet;
2808 PetscInt pStart, numBcs, n, sweep, bc, j;
2809 PetscErrorCode ierr;
2810
2811 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] = 2811; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2812 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),2812,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2813 ierr = PetscOptionsPushGetViewerOff(PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2813,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2814 /* start, end, inc have 2 entries to manage a second backward sweep if we symmetrize */
2815 end[0] = patch->npatch;
2816 start[1] = patch->npatch-1;
2817 if (patch->user_patches) {
2818 ierr = ISGetLocalSize(patch->iterationSet, &end[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2818,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2819 start[1] = end[0] - 1;
2820 ierr = ISGetIndices(patch->iterationSet, &iterationSet);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2820,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2821 }
2822 /* Scatter from global space into overlapped local spaces */
2823 ierr = VecGetArrayRead(x, &globalRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2823,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2824 ierr = VecGetArray(patch->localRHS, &localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2824,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2825 ierr = PetscSFBcastBegin(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), globalRHS, localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2825,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2826 ierr = PetscSFBcastEnd(patch->defaultSF, MPIU_SCALAR((MPI_Datatype)0x4c00080b), globalRHS, localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2826,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2827 ierr = VecRestoreArrayRead(x, &globalRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2827,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2828 ierr = VecRestoreArray(patch->localRHS, &localRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2828,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2829
2830 ierr = VecSet(patch->localUpdate, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2830,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2831 ierr = PetscSectionGetChart(patch->gtolCounts, &pStart, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2831,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2832 for (sweep = 0; sweep < nsweep; sweep++) {
2833 for (j = start[sweep]; j*inc[sweep] < end[sweep]*inc[sweep]; j += inc[sweep]) {
2834 PetscInt i = patch->user_patches ? iterationSet[j] : j;
2835 PetscInt start, len;
2836
2837 ierr = PetscSectionGetDof(patch->gtolCounts, i+pStart, &len);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 ierr = PetscSectionGetOffset(patch->gtolCounts, i+pStart, &start);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2838,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2839 /* TODO: Squash out these guys in the setup as well. */
2840 if (len <= 0) continue;
2841 /* TODO: Do we need different scatters for X and Y? */
2842 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),2842,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2843 ierr = (*patch->applysolver)(pc, i, patch->patchRHS[i], patch->patchUpdate[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2843,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2844 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),2844,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2845 if(patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
2846 ierr = (*patch->updatemultiplicative)(pc, i, pStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2846,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2847 }
2848 }
2849 }
2850 if (patch->user_patches) {ierr = ISRestoreIndices(patch->iterationSet, &iterationSet);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 /* XXX: should we do this on the global vector? */
2852 if (patch->partition_of_unity) {
2853 ierr = VecPointwiseMult(patch->localUpdate, patch->localUpdate, patch->dof_weights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2853,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2854 }
2855 /* Now patch->localUpdate contains the solution of the patch solves, so we need to combine them all. */
2856 ierr = VecSet(y, 0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2856,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2857 ierr = VecGetArray(y, &globalUpdate);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2857,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2858 ierr = VecGetArrayRead(patch->localUpdate, &localUpdate);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2858,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2859 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),2859,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2860 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),2860,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2861 ierr = VecRestoreArrayRead(patch->localUpdate, &localUpdate);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
2863 /* Now we need to send the global BC values through */
2864 ierr = VecGetArrayRead(x, &globalRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2864,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2865 ierr = ISGetSize(patch->globalBcNodes, &numBcs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2865,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2866 ierr = ISGetIndices(patch->globalBcNodes, &bcNodes);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 = VecGetLocalSize(x, &n);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 for (bc = 0; bc < numBcs; ++bc) {
2869 const PetscInt idx = bcNodes[bc];
2870 if (idx < n) globalUpdate[idx] = globalRHS[idx];
2871 }
2872
2873 ierr = ISRestoreIndices(patch->globalBcNodes, &bcNodes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2873,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2874 ierr = VecRestoreArrayRead(x, &globalRHS);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 ierr = VecRestoreArray(y, &globalUpdate);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2875,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2876
2877 ierr = PetscOptionsPopGetViewerOff();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 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),2878,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2879 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)
;
2880}
2881
2882static PetscErrorCode PCReset_PATCH_Linear(PC pc)
2883{
2884 PC_PATCH *patch = (PC_PATCH *) pc->data;
2885 PetscInt i;
2886 PetscErrorCode ierr;
2887
2888 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] = 2888; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2889 if (patch->solver) {
2890 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),2890,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2891 }
2892 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)
;
2893}
2894
2895static PetscErrorCode PCReset_PATCH(PC pc)
2896{
2897 PC_PATCH *patch = (PC_PATCH *) pc->data;
2898 PetscInt i;
2899 PetscErrorCode ierr;
2900
2901 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] = 2901; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2902
2903 ierr = PetscSFDestroy(&patch->defaultSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2903,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2904 ierr = PetscSectionDestroy(&patch->cellCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2904,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2905 ierr = PetscSectionDestroy(&patch->pointCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2905,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2906 ierr = PetscSectionDestroy(&patch->cellNumbering);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2906,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2907 ierr = PetscSectionDestroy(&patch->gtolCounts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2907,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2908 ierr = ISDestroy(&patch->gtol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2908,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2909 ierr = ISDestroy(&patch->cells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2909,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2910 ierr = ISDestroy(&patch->points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2910,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2911 ierr = ISDestroy(&patch->dofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2911,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2912 ierr = ISDestroy(&patch->offs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2912,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2913 ierr = PetscSectionDestroy(&patch->patchSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2913,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2914 ierr = ISDestroy(&patch->ghostBcNodes);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 ierr = ISDestroy(&patch->globalBcNodes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2915,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2916 ierr = PetscSectionDestroy(&patch->gtolCountsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2916,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2917 ierr = ISDestroy(&patch->gtolWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2917,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2918 ierr = ISDestroy(&patch->dofsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2918,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2919 ierr = ISDestroy(&patch->offsWithArtificial);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2919,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2920 ierr = PetscSectionDestroy(&patch->gtolCountsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2920,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2921 ierr = ISDestroy(&patch->gtolWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2921,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2922 ierr = ISDestroy(&patch->dofsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2922,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2923 ierr = ISDestroy(&patch->offsWithAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2923,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2924 ierr = VecDestroy(&patch->cellMats);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2924,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2925 ierr = VecDestroy(&patch->intFacetMats);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2925,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2926 ierr = ISDestroy(&patch->allCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2926,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2927 ierr = ISDestroy(&patch->intFacets);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 = ISDestroy(&patch->extFacets);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 = ISDestroy(&patch->intFacetsToPatchCell);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->intFacetCounts);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->extFacetCounts);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
2933 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),2933,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2934 ierr = PetscFree(patch->dofSection)((*PetscTrFree)((void*)(patch->dofSection),2934,__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),2934,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2935 ierr = PetscFree(patch->bs)((*PetscTrFree)((void*)(patch->bs),2935,__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),2935,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2936 ierr = PetscFree(patch->nodesPerCell)((*PetscTrFree)((void*)(patch->nodesPerCell),2936,__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),2936,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2937 if (patch->cellNodeMap) for (i = 0; i < patch->nsubspaces; i++) {ierr = PetscFree(patch->cellNodeMap[i])((*PetscTrFree)((void*)(patch->cellNodeMap[i]),2937,__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),2937,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2938 ierr = PetscFree(patch->cellNodeMap)((*PetscTrFree)((void*)(patch->cellNodeMap),2938,__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),2938,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2939 ierr = PetscFree(patch->subspaceOffsets)((*PetscTrFree)((void*)(patch->subspaceOffsets),2939,__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),2939,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2940
2941 ierr = (*patch->resetsolver)(pc);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
2943 if (patch->subspaces_to_exclude) {
2944 PetscHSetIDestroy(&patch->subspaces_to_exclude);
2945 }
2946
2947 ierr = VecDestroy(&patch->localRHS);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->localUpdate);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 if (patch->patchRHS) {
2950 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),2950,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2951 ierr = PetscFree(patch->patchRHS)((*PetscTrFree)((void*)(patch->patchRHS),2951,__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),2951,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2952 }
2953 if (patch->patchUpdate) {
2954 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),2954,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2955 ierr = PetscFree(patch->patchUpdate)((*PetscTrFree)((void*)(patch->patchUpdate),2955,__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),2955,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2956 }
2957 ierr = VecDestroy(&patch->dof_weights);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 if (patch->patch_dof_weights) {
2959 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),2959,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2960 ierr = PetscFree(patch->patch_dof_weights)((*PetscTrFree)((void*)(patch->patch_dof_weights),2960,__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),2960,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2961 }
2962 if (patch->mat) {
2963 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),2963,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2964 ierr = PetscFree(patch->mat)((*PetscTrFree)((void*)(patch->mat),2964,__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),2964,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2965 }
2966 if (patch->matWithArtificial) {
2967 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),2967,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2968 ierr = PetscFree(patch->matWithArtificial)((*PetscTrFree)((void*)(patch->matWithArtificial),2968,__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),2968,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2969 }
2970 if (patch->patchRHSWithArtificial) {
2971 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),2971,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2972 ierr = PetscFree(patch->patchRHSWithArtificial)((*PetscTrFree)((void*)(patch->patchRHSWithArtificial),2972
,__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),2972,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2973 }
2974 if(patch->dofMappingWithoutToWithArtificial) {
2975 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),2975,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2976 ierr = PetscFree(patch->dofMappingWithoutToWithArtificial)((*PetscTrFree)((void*)(patch->dofMappingWithoutToWithArtificial
),2976,__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),2976,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2977
2978 }
2979 if(patch->dofMappingWithoutToWithAll) {
2980 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),2980,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2981 ierr = PetscFree(patch->dofMappingWithoutToWithAll)((*PetscTrFree)((void*)(patch->dofMappingWithoutToWithAll)
,2981,__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),2981,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2982
2983 }
2984 ierr = PetscFree(patch->sub_mat_type)((*PetscTrFree)((void*)(patch->sub_mat_type),2984,__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),2984,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2985 if (patch->userIS) {
2986 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),2986,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2987 ierr = PetscFree(patch->userIS)((*PetscTrFree)((void*)(patch->userIS),2987,__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),2987,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2988 }
2989 ierr = PetscFree(patch->precomputedTensorLocations)((*PetscTrFree)((void*)(patch->precomputedTensorLocations)
,2989,__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),2989,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2990 ierr = PetscFree(patch->precomputedIntFacetTensorLocations)((*PetscTrFree)((void*)(patch->precomputedIntFacetTensorLocations
),2990,__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),2990,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2991
2992 patch->bs = 0;
2993 patch->cellNodeMap = NULL((void*)0);
2994 patch->nsubspaces = 0;
2995 ierr = ISDestroy(&patch->iterationSet);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
2997 ierr = PetscViewerDestroy(&patch->viewerSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2997,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2998 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)
;
2999}
3000
3001static PetscErrorCode PCDestroy_PATCH_Linear(PC pc)
3002{
3003 PC_PATCH *patch = (PC_PATCH *) pc->data;
3004 PetscInt i;
3005 PetscErrorCode ierr;
3006
3007 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] = 3007; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3008 if (patch->solver) {
3009 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),3009,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3010 ierr = PetscFree(patch->solver)((*PetscTrFree)((void*)(patch->solver),3010,__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),3010,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3011 }
3012 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)
;
3013}
3014
3015static PetscErrorCode PCDestroy_PATCH(PC pc)
3016{
3017 PC_PATCH *patch = (PC_PATCH *) pc->data;
3018 PetscErrorCode ierr;
3019
3020 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] = 3020; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3021 ierr = PCReset_PATCH(pc);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 ierr = (*patch->destroysolver)(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3022,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3023 ierr = PetscFree(pc->data)((*PetscTrFree)((void*)(pc->data),3023,__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),3023,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3024 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)
;
3025}
3026
3027static PetscErrorCode PCSetFromOptions_PATCH(PetscOptionItems *PetscOptionsObject, PC pc)
3028{
3029 PC_PATCH *patch = (PC_PATCH *) pc->data;
3030 PCPatchConstructType patchConstructionType = PC_PATCH_STAR;
3031 char sub_mat_type[PETSC_MAX_PATH_LEN4096];
3032 char option[PETSC_MAX_PATH_LEN4096];
3033 const char *prefix;
3034 PetscBool flg, dimflg, codimflg;
3035 MPI_Comm comm;
3036 PetscInt *ifields, nfields, k;
3037 PetscErrorCode ierr;
3038 PCCompositeType loctype = PC_COMPOSITE_ADDITIVE;
3039
3040 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] = 3040; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3041 ierr = PetscObjectGetComm((PetscObject) pc, &comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3041,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3042 ierr = PetscObjectGetOptionsPrefix((PetscObject) pc, &prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3042,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3043 ierr = PetscOptionsHead(PetscOptionsObject, "Patch solver options");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3043,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3044
3045 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),3045,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3046 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),3046,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3047
3048 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),3048,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3049 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),3049,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3050 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),3050,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3051 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),3051,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3052
3053 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),3053,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3054 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),3054,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3055 if(flg) { ierr = PCPatchSetLocalComposition(pc, loctype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3055,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3056
3057 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),3057,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3058 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)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3058,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3059 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),3059,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3060 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
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3060,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3061 if (dimflg && codimflg) SETERRQ(comm, PETSC_ERR_ARG_WRONG, "Can only set one of dimension or co-dimension")return PetscError(comm,3061,__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"
)
;
3062
3063 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),3063,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3064 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),3064,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3065 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),3065,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3066
3067 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),3067,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3068 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
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3068,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3069
3070 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),3070,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3071 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)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3071,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3072
3073 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),3073,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3074 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)
;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
3076 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),3076,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3077 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),3077,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3078 if (flg) {ierr = PCPatchSetSubMatType(pc, sub_mat_type);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
3080 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),3080,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3081 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),3081,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3082
3083 /* If the user has set the number of subspaces, use that for the buffer size,
3084 otherwise use a large number */
3085 if (patch->nsubspaces <= 0) {
3086 nfields = 128;
3087 } else {
3088 nfields = patch->nsubspaces;
3089 }
3090 ierr = PetscMalloc1(nfields, &ifields)PetscMallocA(1,PETSC_FALSE,3090,__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),3090,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3091 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),3091,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3092 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),3092,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3093 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,3093,__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"
)
;
3094 if (flg) {
3095 PetscHSetIClear(patch->subspaces_to_exclude);
3096 for (k = 0; k < nfields; k++) {
3097 PetscHSetIAdd(patch->subspaces_to_exclude, ifields[k]);
3098 }
3099 }
3100 ierr = PetscFree(ifields)((*PetscTrFree)((void*)(ifields),3100,__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),3100,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3101
3102 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),3102,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3103 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),3103,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3104 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),3104,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3105 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),3105,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3106 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),3106,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3107 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),3107,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3108 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),3108,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3109 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),3109,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3110 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),3110,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3111 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),3111,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3112 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),3112,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3113 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),3113,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3114 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),3114,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3115 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),3115,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3116 ierr = PetscOptionsTail()0; {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);}
;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 patch->optionsSet = PETSC_TRUE;
3118 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)
;
3119}
3120
3121static PetscErrorCode PCSetUpOnBlocks_PATCH(PC pc)
3122{
3123 PC_PATCH *patch = (PC_PATCH*) pc->data;
3124 KSPConvergedReason reason;
3125 PetscInt i;
3126 PetscErrorCode ierr;
3127
3128 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] = 3128; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3129 if (!patch->save_operators) {
3130 /* Can't do this here because the sub KSPs don't have an operator attached yet. */
3131 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)
;
3132 }
3133 for (i = 0; i < patch->npatch; ++i) {
3134 if (!((KSP) patch->solver[i])->setfromoptionscalled) {
3135 ierr = KSPSetFromOptions((KSP) patch->solver[i]);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 }
3137 ierr = KSPSetUp((KSP) patch->solver[i]);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 = KSPGetConvergedReason((KSP) patch->solver[i], &reason);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 if (reason == KSP_DIVERGED_PC_FAILED) pc->failedreason = PC_SUBPC_ERROR;
3140 }
3141 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)
;
3142}
3143
3144static PetscErrorCode PCView_PATCH(PC pc, PetscViewer viewer)
3145{
3146 PC_PATCH *patch = (PC_PATCH *) pc->data;
3147 PetscViewer sviewer;
3148 PetscBool isascii;
3149 PetscMPIInt rank;
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 /* TODO Redo tabbing with set tbas in new style */
3154 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERASCII"ascii", &isascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3154,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3155 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)
;
3156 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject) pc), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3156,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3157 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3157,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3158 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),3158,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3159 if(patch->local_composition_type == PC_COMPOSITE_MULTIPLICATIVE) {
3160 ierr = PetscViewerASCIIPrintf(viewer, "Schwarz type: multiplicative\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3160,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3161 } else {
3162 ierr = PetscViewerASCIIPrintf(viewer, "Schwarz type: additive\n");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 }
3164 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),3164,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3165 else {ierr = PetscViewerASCIIPrintf(viewer, "Not weighting by partition of unity\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3165,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3166 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),3166,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3167 else {ierr = PetscViewerASCIIPrintf(viewer, "Not symmetrising sweep\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3167,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3168 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),3168,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3169 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),3169,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3170 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),3170,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3171 else {ierr = PetscViewerASCIIPrintf(viewer, "Saving patch operators (rebuilt every PCSetUp)\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3171,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3172 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),3172,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3173 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),3173,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3174 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),3174,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3175 else {ierr = PetscViewerASCIIPrintf(viewer, "Patch construction operator: unknown\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3175,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3176
3177 if (patch->isNonlinear) {
3178 ierr = PetscViewerASCIIPrintf(viewer, "SNES on patches (all same):\n");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 } else {
3180 ierr = PetscViewerASCIIPrintf(viewer, "KSP on patches (all same):\n");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 }
3182 if (patch->solver) {
3183 ierr = PetscViewerGetSubViewer(viewer, PETSC_COMM_SELF((MPI_Comm)0x44000001), &sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3183,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3184 if (!rank) {
3185 ierr = PetscViewerASCIIPushTab(sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3185,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3186 ierr = PetscObjectView(patch->solver[0], sviewer);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 ierr = PetscViewerASCIIPopTab(sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3187,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3188 }
3189 ierr = PetscViewerRestoreSubViewer(viewer, PETSC_COMM_SELF((MPI_Comm)0x44000001), &sviewer);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 } else {
3191 ierr = PetscViewerASCIIPushTab(viewer);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 ierr = PetscViewerASCIIPrintf(viewer, "Solver not yet set.\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 ierr = PetscViewerASCIIPopTab(viewer);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 }
3195 ierr = PetscViewerASCIIPopTab(viewer);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 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)
;
3197}
3198
3199/*MC
3200 PCPATCH - A PC object that encapsulates flexible definition of blocks for overlapping and non-overlapping
3201 small block additive preconditioners. Block definition is based on topology from
3202 a DM and equation numbering from a PetscSection.
3203
3204 Options Database Keys:
3205+ -pc_patch_cells_view - Views the process local cell numbers for each patch
3206. -pc_patch_points_view - Views the process local mesh point numbers for each patch
3207. -pc_patch_g2l_view - Views the map between global dofs and patch local dofs for each patch
3208. -pc_patch_patches_view - Views the global dofs associated with each patch and its boundary
3209- -pc_patch_sub_mat_view - Views the matrix associated with each patch
3210
3211 Level: intermediate
3212
3213.seealso: PCType, PCCreate(), PCSetType()
3214M*/
3215PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PCCreate_Patch(PC pc)
3216{
3217 PC_PATCH *patch;
3218 PetscErrorCode ierr;
3219
3220 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] = 3220; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3221 ierr = PetscNewLog(pc, &patch)(PetscMallocA(1,PETSC_TRUE,3221,__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),3221,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3222
3223 if (patch->subspaces_to_exclude) {
3224 PetscHSetIDestroy(&patch->subspaces_to_exclude);
3225 }
3226 PetscHSetICreate(&patch->subspaces_to_exclude);
3227
3228 patch->classname = "pc";
3229 patch->isNonlinear = PETSC_FALSE;
3230
3231 /* Set some defaults */
3232 patch->combined = PETSC_FALSE;
3233 patch->save_operators = PETSC_TRUE;
3234 patch->local_composition_type = PC_COMPOSITE_ADDITIVE;
3235 patch->precomputeElementTensors = PETSC_FALSE;
3236 patch->partition_of_unity = PETSC_FALSE;
3237 patch->codim = -1;
3238 patch->dim = -1;
3239 patch->vankadim = -1;
3240 patch->ignoredim = -1;
3241 patch->pardecomp_overlap = 0;
3242 patch->patchconstructop = PCPatchConstruct_Star;
3243 patch->symmetrise_sweep = PETSC_FALSE;
3244 patch->npatch = 0;
3245 patch->userIS = NULL((void*)0);
3246 patch->optionsSet = PETSC_FALSE;
3247 patch->iterationSet = NULL((void*)0);
3248 patch->user_patches = PETSC_FALSE;
3249 ierr = PetscStrallocpy(MATDENSE"dense", (char **) &patch->sub_mat_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/patch/pcpatch.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3250 patch->viewPatches = PETSC_FALSE;
3251 patch->viewCells = PETSC_FALSE;
3252 patch->viewPoints = PETSC_FALSE;
3253 patch->viewSection = PETSC_FALSE;
3254 patch->viewMatrix = PETSC_FALSE;
3255 patch->setupsolver = PCSetUp_PATCH_Linear;
3256 patch->applysolver = PCApply_PATCH_Linear;
3257 patch->resetsolver = PCReset_PATCH_Linear;
3258 patch->destroysolver = PCDestroy_PATCH_Linear;
3259 patch->updatemultiplicative = PCUpdateMultiplicative_PATCH_Linear;
3260 patch->dofMappingWithoutToWithArtificial = NULL((void*)0);
3261 patch->dofMappingWithoutToWithAll = NULL((void*)0);
3262
3263 pc->data = (void *) patch;
3264 pc->ops->apply = PCApply_PATCH;
3265 pc->ops->applytranspose = 0; /* PCApplyTranspose_PATCH; */
3266 pc->ops->setup = PCSetUp_PATCH;
3267 pc->ops->reset = PCReset_PATCH;
3268 pc->ops->destroy = PCDestroy_PATCH;
3269 pc->ops->setfromoptions = PCSetFromOptions_PATCH;
3270 pc->ops->setuponblocks = PCSetUpOnBlocks_PATCH;
3271 pc->ops->view = PCView_PATCH;
3272 pc->ops->applyrichardson = 0;
3273
3274 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)
;
3275}