Bug Summary

File:dm/field/impls/ds/dmfieldds.c
Warning:line 184, column 37
The right operand of '-' is a garbage value due to array index out of bounds

Annotated Source Code

[?] Use j/k keys for keyboard navigation

/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c

1#include <petsc/private/dmfieldimpl.h> /*I "petscdmfield.h" I*/
2#include <petsc/private/petscfeimpl.h> /*I "petscdmfield.h" I*/
3#include <petscfe.h>
4#include <petscdmplex.h>
5#include <petscds.h>
6
7typedef struct _n_DMField_DS
8{
9 PetscInt fieldNum;
10 Vec vec;
11 PetscInt height;
12 PetscObject *disc;
13 PetscBool multifieldVec;
14}
15DMField_DS;
16
17static PetscErrorCode DMFieldDestroy_DS(DMField field)
18{
19 DMField_DS *dsfield;
20 PetscInt i;
21 PetscErrorCode ierr;
22
23 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
; petscstack->line[petscstack->currentsize] = 23; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
24 dsfield = (DMField_DS *) field->data;
25 ierr = VecDestroy(&dsfield->vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),25,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
26 for (i = 0; i < dsfield->height; i++) {
27 ierr = PetscObjectDereference(dsfield->disc[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),27,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
28 }
29 ierr = PetscFree(dsfield->disc)((*PetscTrFree)((void*)(dsfield->disc),29,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
) || ((dsfield->disc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),29,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
30 ierr = PetscFree(dsfield)((*PetscTrFree)((void*)(dsfield),30,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
) || ((dsfield) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),30,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
31 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)
;
32}
33
34static PetscErrorCode DMFieldView_DS(DMField field,PetscViewer viewer)
35{
36 DMField_DS *dsfield = (DMField_DS *) field->data;
37 PetscBool iascii;
38 PetscObject disc;
39 PetscErrorCode ierr;
40
41 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
; petscstack->line[petscstack->currentsize] = 41; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
42 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),42,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
43 disc = dsfield->disc[0];
44 if (iascii) {
45 PetscViewerASCIIPrintf(viewer, "PetscDS field %D\n",dsfield->fieldNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),45,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
46 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),46,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
47 ierr = PetscObjectView(disc,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),47,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
48 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),48,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
49 }
50 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),50,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
51 if (dsfield->multifieldVec) {
52 SETERRQ(PetscObjectComm((PetscObject)field),PETSC_ERR_SUP,"View of subfield not implemented yet")return PetscError(PetscObjectComm((PetscObject)field),52,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,56,PETSC_ERROR_INITIAL,"View of subfield not implemented yet"
)
;
53 } else {
54 ierr = VecView(dsfield->vec,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),54,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
55 }
56 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),56,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
57 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)
;
58}
59
60static PetscErrorCode DMFieldDSGetHeightDisc(DMField field, PetscInt height, PetscObject *disc)
61{
62 DMField_DS *dsfield = (DMField_DS *) field->data;
63 PetscErrorCode ierr;
64
65 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
; petscstack->line[petscstack->currentsize] = 65; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
66 if (!dsfield->disc[height]) {
67 PetscClassId id;
68
69 ierr = PetscObjectGetClassId(dsfield->disc[0],&id);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),69,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
70 if (id == PETSCFE_CLASSID) {
71 PetscFE fe = (PetscFE) dsfield->disc[0];
72
73 ierr = PetscFECreateHeightTrace(fe,height,(PetscFE *)&dsfield->disc[height]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),73,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
74 }
75 }
76 *disc = dsfield->disc[height];
77 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)
;
78}
79
80#define DMFieldDSdot(y,A,b,m,n,c,cast)do { PetscInt _i, _j, _k; for (_i = 0; _i < (m); _i++) { for
(_k = 0; _k < (c); _k++) { (y)[_i * (c) + _k] = 0.; } for
(_j = 0; _j < (n); _j++) { for (_k = 0; _k < (c); _k++
) { (y)[_i * (c) + _k] += (A)[(_i * (n) + _j) * (c) + _k] * cast
((b)[_j]); } } } } while (0)
\
81 do { \
82 PetscInt _i, _j, _k; \
83 for (_i = 0; _i < (m); _i++) { \
84 for (_k = 0; _k < (c); _k++) { \
85 (y)[_i * (c) + _k] = 0.; \
86 } \
87 for (_j = 0; _j < (n); _j++) { \
88 for (_k = 0; _k < (c); _k++) { \
89 (y)[_i * (c) + _k] += (A)[(_i * (n) + _j) * (c) + _k] * cast((b)[_j]); \
90 } \
91 } \
92 } \
93 } while (0)
94
95static PetscErrorCode DMFieldEvaluateFE_DS(DMField field, IS pointIS, PetscQuadrature quad, PetscDataType type, void *B, void *D, void *H)
96{
97 DMField_DS *dsfield = (DMField_DS *) field->data;
98 DM dm;
99 PetscObject disc;
100 PetscClassId classid;
101 PetscInt nq, nc, dim, meshDim, numCells;
102 PetscSection section;
103 const PetscReal *qpoints;
104 PetscBool isStride;
105 const PetscInt *points = NULL((void*)0);
106 PetscInt sfirst = -1, stride = -1;
107 PetscErrorCode ierr;
108
109 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
; petscstack->line[petscstack->currentsize] = 109; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
110 dm = field->dm;
111 nc = field->numComponents;
112 ierr = PetscQuadratureGetData(quad,&dim,NULL((void*)0),&nq,&qpoints,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
113 ierr = DMFieldDSGetHeightDisc(field,dsfield->height - 1 - dim,&disc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),113,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
114 ierr = DMGetDimension(dm,&meshDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),114,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
115 ierr = DMGetDefaultSection(dm,&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),115,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
116 ierr = PetscSectionGetField(section,dsfield->fieldNum,&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),116,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
117 ierr = PetscObjectGetClassId(disc,&classid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),117,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
118 /* TODO: batch */
119 ierr = PetscObjectTypeCompare((PetscObject)pointIS,ISSTRIDE"stride",&isStride);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),119,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
120 ierr = ISGetLocalSize(pointIS,&numCells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),120,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
121 if (isStride) {
122 ierr = ISStrideGetInfo(pointIS,&sfirst,&stride);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),122,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
123 } else {
124 ierr = ISGetIndices(pointIS,&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),124,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
125 }
126 if (classid == PETSCFE_CLASSID) {
127 PetscFE fe = (PetscFE) disc;
128 PetscInt feDim, i;
129 PetscReal *fB = NULL((void*)0), *fD = NULL((void*)0), *fH = NULL((void*)0);
130
131 ierr = PetscFEGetDimension(fe,&feDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),131,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
132 ierr = PetscFEGetTabulation(fe,nq,qpoints,B ? &fB : NULL((void*)0),D ? &fD : NULL((void*)0),H ? &fH : NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),132,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
133 for (i = 0; i < numCells; i++) {
134 PetscInt c = isStride ? (sfirst + i * stride) : points[i];
135 PetscInt closureSize;
136 PetscScalar *elem = NULL((void*)0);
137
138 ierr = DMPlexVecGetClosure(dm,section,dsfield->vec,c,&closureSize,&elem);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),138,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
139 if (B) {
140 if (type == PETSC_SCALARPETSC_DOUBLE) {
141 PetscScalar *cB = &((PetscScalar *) B)[nc * nq * i];
142
143 DMFieldDSdot(cB,fB,elem,nq,feDim,nc,(PetscScalar))do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < (nc); _k++) { (cB)[_i * (nc) + _k] = 0.; } for
(_j = 0; _j < (feDim); _j++) { for (_k = 0; _k < (nc);
_k++) { (cB)[_i * (nc) + _k] += (fB)[(_i * (feDim) + _j) * (
nc) + _k] * (PetscScalar)((elem)[_j]); } } } } while (0)
;
144 } else {
145 PetscReal *cB = &((PetscReal *) B)[nc * nq * i];
146
147 DMFieldDSdot(cB,fB,elem,nq,feDim,nc,PetscRealPart)do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < (nc); _k++) { (cB)[_i * (nc) + _k] = 0.; } for
(_j = 0; _j < (feDim); _j++) { for (_k = 0; _k < (nc);
_k++) { (cB)[_i * (nc) + _k] += (fB)[(_i * (feDim) + _j) * (
nc) + _k] * ((elem)[_j]); } } } } while (0)
;
148 }
149 }
150 if (D) {
151 if (type == PETSC_SCALARPETSC_DOUBLE) {
152 PetscScalar *cD = &((PetscScalar *) D)[nc * nq * dim * i];
153
154 DMFieldDSdot(cD,fD,elem,nq,feDim,(nc * dim),(PetscScalar))do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < ((nc * dim)); _k++) { (cD)[_i * ((nc * dim)
) + _k] = 0.; } for (_j = 0; _j < (feDim); _j++) { for (_k
= 0; _k < ((nc * dim)); _k++) { (cD)[_i * ((nc * dim)) + _k
] += (fD)[(_i * (feDim) + _j) * ((nc * dim)) + _k] * (PetscScalar
)((elem)[_j]); } } } } while (0)
;
155 } else {
156 PetscReal *cD = &((PetscReal *) D)[nc * nq * dim * i];
157
158 DMFieldDSdot(cD,fD,elem,nq,feDim,(nc * dim),PetscRealPart)do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < ((nc * dim)); _k++) { (cD)[_i * ((nc * dim)
) + _k] = 0.; } for (_j = 0; _j < (feDim); _j++) { for (_k
= 0; _k < ((nc * dim)); _k++) { (cD)[_i * ((nc * dim)) + _k
] += (fD)[(_i * (feDim) + _j) * ((nc * dim)) + _k] * ((elem)[
_j]); } } } } while (0)
;
159 }
160 }
161 if (H) {
162 if (type == PETSC_SCALARPETSC_DOUBLE) {
163 PetscScalar *cH = &((PetscScalar *) H)[nc * nq * dim * dim * i];
164
165 DMFieldDSdot(cH,fH,elem,nq,feDim,(nc * dim * dim),(PetscScalar))do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < ((nc * dim * dim)); _k++) { (cH)[_i * ((nc *
dim * dim)) + _k] = 0.; } for (_j = 0; _j < (feDim); _j++
) { for (_k = 0; _k < ((nc * dim * dim)); _k++) { (cH)[_i *
((nc * dim * dim)) + _k] += (fH)[(_i * (feDim) + _j) * ((nc *
dim * dim)) + _k] * (PetscScalar)((elem)[_j]); } } } } while
(0)
;
166 } else {
167 PetscReal *cH = &((PetscReal *) H)[nc * nq * dim * dim * i];
168
169 DMFieldDSdot(cH,fH,elem,nq,feDim,(nc * dim * dim),PetscRealPart)do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < ((nc * dim * dim)); _k++) { (cH)[_i * ((nc *
dim * dim)) + _k] = 0.; } for (_j = 0; _j < (feDim); _j++
) { for (_k = 0; _k < ((nc * dim * dim)); _k++) { (cH)[_i *
((nc * dim * dim)) + _k] += (fH)[(_i * (feDim) + _j) * ((nc *
dim * dim)) + _k] * ((elem)[_j]); } } } } while (0)
;
170 }
171 }
172 ierr = DMPlexVecRestoreClosure(dm,section,dsfield->vec,c,&closureSize,&elem);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),172,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
173 }
174 ierr = PetscFERestoreTabulation(fe,nq,qpoints,B ? &fB : NULL((void*)0),D ? &fD : NULL((void*)0),H ? &fH : NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),174,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
175 } else {SETERRQ(PetscObjectComm((PetscObject)field),PETSC_ERR_SUP,"Not implemented")return PetscError(PetscObjectComm((PetscObject)field),175,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,56,PETSC_ERROR_INITIAL,"Not implemented")
;}
176 if (!isStride) {
177 ierr = ISRestoreIndices(pointIS,&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),177,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
178 }
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 DMFieldEvaluate_DS(DMField field, Vec points, PetscDataType datatype, void *B, void *D, void *H)
183{
184 DMField_DS *dsfield = (DMField_DS *) field->data;
185 PetscSF cellSF = NULL((void*)0);
186 const PetscSFNode *cells;
187 PetscInt c, nFound, numCells, feDim, nc;
188 const PetscInt *cellDegrees;
189 const PetscScalar *pointsArray;
190 PetscScalar *cellPoints;
191 PetscInt gatherSize, gatherMax;
192 PetscInt dim, dimR, offset;
193 MPI_Datatype pointType;
194 PetscObject cellDisc;
195 PetscFE cellFE;
196 PetscClassId discID;
197 PetscReal *coordsReal, *coordsRef;
198 PetscSection section;
199 PetscScalar *cellBs = NULL((void*)0), *cellDs = NULL((void*)0), *cellHs = NULL((void*)0);
200 PetscReal *cellBr = NULL((void*)0), *cellDr = NULL((void*)0), *cellHr = NULL((void*)0);
201 PetscReal *v, *J, *invJ, *detJ;
202 PetscErrorCode ierr;
203
204 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
; petscstack->line[petscstack->currentsize] = 204; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
205 nc = field->numComponents;
206 ierr = DMGetDefaultSection(field->dm,&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),206,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
207 ierr = DMFieldDSGetHeightDisc(field,0,&cellDisc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),207,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
208 ierr = PetscObjectGetClassId(cellDisc, &discID);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),208,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
209 if (discID != PETSCFE_CLASSID) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB, "Discretization type not supported\n")return PetscError(((MPI_Comm)0x44000001),209,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,77,PETSC_ERROR_INITIAL,"Discretization type not supported\n"
)
;
210 cellFE = (PetscFE) cellDisc;
211 ierr = PetscFEGetDimension(cellFE,&feDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),211,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
212 ierr = DMGetCoordinateDim(field->dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),212,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
213 ierr = DMGetDimension(field->dm, &dimR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),213,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
214 ierr = DMLocatePoints(field->dm, points, DM_POINTLOCATION_NONE, &cellSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),214,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
215 ierr = PetscSFGetGraph(cellSF, &numCells, &nFound, NULL((void*)0), &cells);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),215,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
216 for (c = 0; c < nFound; c++) {
217 if (cells[c].index < 0) SETERRQ1(PetscObjectComm((PetscObject)points),PETSC_ERR_ARG_WRONG, "Point %D could not be located\n", c)return PetscError(PetscObjectComm((PetscObject)points),217,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,62,PETSC_ERROR_INITIAL,"Point %D could not be located\n",c)
;
218 }
219 ierr = PetscSFComputeDegreeBegin(cellSF,&cellDegrees);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),219,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
220 ierr = PetscSFComputeDegreeEnd(cellSF,&cellDegrees);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),220,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
221 for (c = 0, gatherSize = 0, gatherMax = 0; c < numCells; c++) {
222 gatherMax = PetscMax(gatherMax,cellDegrees[c])(((gatherMax)<(cellDegrees[c])) ? (cellDegrees[c]) : (gatherMax
))
;
223 gatherSize += cellDegrees[c];
224 }
225 ierr = PetscMalloc3(gatherSize*dim,&cellPoints,gatherMax*dim,&coordsReal,gatherMax*dimR,&coordsRef)PetscMallocA(3,PETSC_FALSE,225,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(gatherSize*dim)*sizeof(**(&cellPoints)),(&cellPoints
),(size_t)(gatherMax*dim)*sizeof(**(&coordsReal)),(&coordsReal
),(size_t)(gatherMax*dimR)*sizeof(**(&coordsRef)),(&coordsRef
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),225,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
226 ierr = PetscMalloc4(gatherMax*dimR,&v,gatherMax*dimR*dimR,&J,gatherMax*dimR*dimR,&invJ,gatherMax,&detJ)PetscMallocA(4,PETSC_FALSE,226,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(gatherMax*dimR)*sizeof(**(&v)),(&v),(size_t
)(gatherMax*dimR*dimR)*sizeof(**(&J)),(&J),(size_t)(gatherMax
*dimR*dimR)*sizeof(**(&invJ)),(&invJ),(size_t)(gatherMax
)*sizeof(**(&detJ)),(&detJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),226,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
227 if (datatype == PETSC_SCALARPETSC_DOUBLE) {
228 ierr = PetscMalloc3(B ? nc * gatherSize : 0, &cellBs, D ? nc * dim * gatherSize : 0, &cellDs, H ? nc * dim * dim * gatherSize : 0, &cellHs)PetscMallocA(3,PETSC_FALSE,228,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(B ? nc * gatherSize : 0)*sizeof(**(&cellBs)),(&
cellBs),(size_t)(D ? nc * dim * gatherSize : 0)*sizeof(**(&
cellDs)),(&cellDs),(size_t)(H ? nc * dim * dim * gatherSize
: 0)*sizeof(**(&cellHs)),(&cellHs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),228,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
229 } else {
230 ierr = PetscMalloc3(B ? nc * gatherSize : 0, &cellBr, D ? nc * dim * gatherSize : 0, &cellDr, H ? nc * dim * dim * gatherSize : 0, &cellHr)PetscMallocA(3,PETSC_FALSE,230,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(B ? nc * gatherSize : 0)*sizeof(**(&cellBr)),(&
cellBr),(size_t)(D ? nc * dim * gatherSize : 0)*sizeof(**(&
cellDr)),(&cellDr),(size_t)(H ? nc * dim * dim * gatherSize
: 0)*sizeof(**(&cellHr)),(&cellHr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),230,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
231 }
232
233 ierr = MPI_Type_contiguous(dim,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&pointType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),233,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
234 ierr = MPI_Type_commit(&pointType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),234,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
235 ierr = VecGetArrayRead(points,&pointsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),235,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
236 ierr = PetscSFGatherBegin(cellSF, pointType, pointsArray, cellPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),236,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
237 ierr = PetscSFGatherEnd(cellSF, pointType, pointsArray, cellPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),237,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
238 ierr = VecRestoreArrayRead(points,&pointsArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),238,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
239 for (c = 0, offset = 0; c < numCells; c++) {
240 PetscInt nq = cellDegrees[c], p;
241
242 if (nq) {
243 PetscReal *fB, *fD, *fH;
244 PetscInt closureSize;
245 PetscScalar *elem = NULL((void*)0);
246 PetscReal *quadPoints;
247 PetscQuadrature quad;
248 PetscInt d, e, f, g;
249
250 for (p = 0; p < dim * nq; p++) coordsReal[p] = PetscRealPart(cellPoints[dim * offset + p])(cellPoints[dim * offset + p]);
251 ierr = DMPlexCoordinatesToReference(field->dm, c, nq, coordsReal, coordsRef);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),251,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
252 ierr = PetscFEGetTabulation(cellFE,nq,coordsRef,B ? &fB : NULL((void*)0),D ? &fD : NULL((void*)0),H ? &fH : NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),252,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
253 ierr = PetscQuadratureCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &quad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),253,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
254 ierr = PetscMalloc1(dimR * nq, &quadPoints)PetscMallocA(1,PETSC_FALSE,254,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(dimR * nq)*sizeof(**(&quadPoints)),(&quadPoints
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),254,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
255 for (p = 0; p < dimR * nq; p++) quadPoints[p] = coordsRef[p];
256 ierr = PetscQuadratureSetData(quad, dimR, 0, nq, quadPoints, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),256,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
257 ierr = DMPlexComputeCellGeometryFEM(field->dm, c, quad, v, J, invJ, detJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),257,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
258 ierr = PetscQuadratureDestroy(&quad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),258,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
259 ierr = DMPlexVecGetClosure(field->dm,section,dsfield->vec,c,&closureSize,&elem);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),259,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
260 if (B) {
261 if (datatype == PETSC_SCALARPETSC_DOUBLE) {
262 PetscScalar *cB = &cellBs[nc * offset];
263
264 DMFieldDSdot(cB,fB,elem,nq,feDim,nc,(PetscScalar))do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < (nc); _k++) { (cB)[_i * (nc) + _k] = 0.; } for
(_j = 0; _j < (feDim); _j++) { for (_k = 0; _k < (nc);
_k++) { (cB)[_i * (nc) + _k] += (fB)[(_i * (feDim) + _j) * (
nc) + _k] * (PetscScalar)((elem)[_j]); } } } } while (0)
;
265 } else {
266 PetscReal *cB = &cellBr[nc * offset];
267
268 DMFieldDSdot(cB,fB,elem,nq,feDim,nc,PetscRealPart)do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < (nc); _k++) { (cB)[_i * (nc) + _k] = 0.; } for
(_j = 0; _j < (feDim); _j++) { for (_k = 0; _k < (nc);
_k++) { (cB)[_i * (nc) + _k] += (fB)[(_i * (feDim) + _j) * (
nc) + _k] * ((elem)[_j]); } } } } while (0)
;
269 }
270 }
271 if (D) {
272 if (datatype == PETSC_SCALARPETSC_DOUBLE) {
273 PetscScalar *cD = &cellDs[nc * dim * offset];
274
275 DMFieldDSdot(cD,fD,elem,nq,feDim,(nc * dim),(PetscScalar))do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < ((nc * dim)); _k++) { (cD)[_i * ((nc * dim)
) + _k] = 0.; } for (_j = 0; _j < (feDim); _j++) { for (_k
= 0; _k < ((nc * dim)); _k++) { (cD)[_i * ((nc * dim)) + _k
] += (fD)[(_i * (feDim) + _j) * ((nc * dim)) + _k] * (PetscScalar
)((elem)[_j]); } } } } while (0)
;
276 for (p = 0; p < nq; p++) {
277 for (g = 0; g < nc; g++) {
278 PetscScalar vs[3];
279
280 for (d = 0; d < dimR; d++) {
281 vs[d] = 0.;
282 for (e = 0; e < dimR; e++) {
283 vs[d] += invJ[dimR * dimR * p + e * dimR + d] * cD[(nc * p + g) * dimR + e];
284 }
285 }
286 for (d = 0; d < dimR; d++) {
287 cD[(nc * p + g) * dimR + d] = vs[d];
288 }
289 }
290 }
291 } else {
292 PetscReal *cD = &cellDr[nc * dim * offset];
293
294 DMFieldDSdot(cD,fD,elem,nq,feDim,(nc * dim),PetscRealPart)do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < ((nc * dim)); _k++) { (cD)[_i * ((nc * dim)
) + _k] = 0.; } for (_j = 0; _j < (feDim); _j++) { for (_k
= 0; _k < ((nc * dim)); _k++) { (cD)[_i * ((nc * dim)) + _k
] += (fD)[(_i * (feDim) + _j) * ((nc * dim)) + _k] * ((elem)[
_j]); } } } } while (0)
;
295 for (p = 0; p < nq; p++) {
296 for (g = 0; g < nc; g++) {
297 for (d = 0; d < dimR; d++) {
298 v[d] = 0.;
299 for (e = 0; e < dimR; e++) {
300 v[d] += invJ[dimR * dimR * p + e * dimR + d] * cD[(nc * p + g) * dimR + e];
301 }
302 }
303 for (d = 0; d < dimR; d++) {
304 cD[(nc * p + g) * dimR + d] = v[d];
305 }
306 }
307 }
308 }
309 }
310 if (H) {
311 if (datatype == PETSC_SCALARPETSC_DOUBLE) {
312 PetscScalar *cH = &cellHs[nc * dim * dim * offset];
313
314 DMFieldDSdot(cH,fH,elem,nq,feDim,(nc * dim * dim),(PetscScalar))do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < ((nc * dim * dim)); _k++) { (cH)[_i * ((nc *
dim * dim)) + _k] = 0.; } for (_j = 0; _j < (feDim); _j++
) { for (_k = 0; _k < ((nc * dim * dim)); _k++) { (cH)[_i *
((nc * dim * dim)) + _k] += (fH)[(_i * (feDim) + _j) * ((nc *
dim * dim)) + _k] * (PetscScalar)((elem)[_j]); } } } } while
(0)
;
315 for (p = 0; p < nq; p++) {
316 for (g = 0; g < nc * dimR; g++) {
317 PetscScalar vs[3];
318
319 for (d = 0; d < dimR; d++) {
320 vs[d] = 0.;
321 for (e = 0; e < dimR; e++) {
322 vs[d] += invJ[dimR * dimR * p + e * dimR + d] * cH[(nc * dimR * p + g) * dimR + e];
323 }
324 }
325 for (d = 0; d < dimR; d++) {
326 cH[(nc * dimR * p + g) * dimR + d] = vs[d];
327 }
328 }
329 for (g = 0; g < nc; g++) {
330 for (f = 0; f < dimR; f++) {
331 PetscScalar vs[3];
332
333 for (d = 0; d < dimR; d++) {
334 vs[d] = 0.;
335 for (e = 0; e < dimR; e++) {
336 vs[d] += invJ[dimR * dimR * p + e * dimR + d] * cH[((nc * p + g) * dimR + e) * dimR + f];
337 }
338 }
339 for (d = 0; d < dimR; d++) {
340 cH[((nc * p + g) * dimR + d) * dimR + f] = vs[d];
341 }
342 }
343 }
344 }
345 } else {
346 PetscReal *cH = &cellHr[nc * dim * dim * offset];
347
348 DMFieldDSdot(cH,fH,elem,nq,feDim,(nc * dim * dim),PetscRealPart)do { PetscInt _i, _j, _k; for (_i = 0; _i < (nq); _i++) { for
(_k = 0; _k < ((nc * dim * dim)); _k++) { (cH)[_i * ((nc *
dim * dim)) + _k] = 0.; } for (_j = 0; _j < (feDim); _j++
) { for (_k = 0; _k < ((nc * dim * dim)); _k++) { (cH)[_i *
((nc * dim * dim)) + _k] += (fH)[(_i * (feDim) + _j) * ((nc *
dim * dim)) + _k] * ((elem)[_j]); } } } } while (0)
;
349 for (p = 0; p < nq; p++) {
350 for (g = 0; g < nc * dimR; g++) {
351 for (d = 0; d < dimR; d++) {
352 v[d] = 0.;
353 for (e = 0; e < dimR; e++) {
354 v[d] += invJ[dimR * dimR * p + e * dimR + d] * cH[(nc * dimR * p + g) * dimR + e];
355 }
356 }
357 for (d = 0; d < dimR; d++) {
358 cH[(nc * dimR * p + g) * dimR + d] = v[d];
359 }
360 }
361 for (g = 0; g < nc; g++) {
362 for (f = 0; f < dimR; f++) {
363 for (d = 0; d < dimR; d++) {
364 v[d] = 0.;
365 for (e = 0; e < dimR; e++) {
366 v[d] += invJ[dimR * dimR * p + e * dimR + d] * cH[((nc * p + g) * dimR + e) * dimR + f];
367 }
368 }
369 for (d = 0; d < dimR; d++) {
370 cH[((nc * p + g) * dimR + d) * dimR + f] = v[d];
371 }
372 }
373 }
374 }
375 }
376 }
377 ierr = DMPlexVecRestoreClosure(field->dm,section,dsfield->vec,c,&closureSize,&elem);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),377,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
378 ierr = PetscFERestoreTabulation(cellFE,nq,coordsRef,B ? &fB : NULL((void*)0),D ? &fD : NULL((void*)0),H ? &fH : NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),378,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
379 }
380 offset += nq;
381 }
382 {
383 MPI_Datatype origtype;
384
385 if (datatype == PETSC_SCALARPETSC_DOUBLE) {
386 origtype = MPIU_SCALAR((MPI_Datatype)0x4c00080b);
387 } else {
388 origtype = MPIU_REAL((MPI_Datatype)0x4c00080b);
389 }
390 if (B) {
391 MPI_Datatype Btype;
392
393 ierr = MPI_Type_contiguous(nc, origtype, &Btype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),393,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
394 ierr = MPI_Type_commit(&Btype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),394,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
395 ierr = PetscSFScatterBegin(cellSF,Btype,(datatype == PETSC_SCALARPETSC_DOUBLE) ? (void *) cellBs : (void *) cellBr, B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),395,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
396 ierr = PetscSFScatterEnd(cellSF,Btype,(datatype == PETSC_SCALARPETSC_DOUBLE) ? (void *) cellBs : (void *) cellBr, B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),396,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
397 ierr = MPI_Type_free(&Btype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),397,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
398 }
399 if (D) {
400 MPI_Datatype Dtype;
401
402 ierr = MPI_Type_contiguous(nc * dim, origtype, &Dtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),402,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
403 ierr = MPI_Type_commit(&Dtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),403,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
404 ierr = PetscSFScatterBegin(cellSF,Dtype,(datatype == PETSC_SCALARPETSC_DOUBLE) ? (void *) cellDs : (void *) cellDr, D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),404,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
405 ierr = PetscSFScatterEnd(cellSF,Dtype,(datatype == PETSC_SCALARPETSC_DOUBLE) ? (void *) cellDs : (void *) cellDr, D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),405,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
406 ierr = MPI_Type_free(&Dtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),406,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
407 }
408 if (H) {
409 MPI_Datatype Htype;
410
411 ierr = MPI_Type_contiguous(nc * dim * dim, origtype, &Htype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),411,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
412 ierr = MPI_Type_commit(&Htype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),412,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
413 ierr = PetscSFScatterBegin(cellSF,Htype,(datatype == PETSC_SCALARPETSC_DOUBLE) ? (void *) cellHs : (void *) cellHr, H);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),413,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
414 ierr = PetscSFScatterEnd(cellSF,Htype,(datatype == PETSC_SCALARPETSC_DOUBLE) ? (void *) cellHs : (void *) cellHr, H);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),414,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
415 ierr = MPI_Type_free(&Htype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),415,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
416 }
417 }
418 ierr = PetscFree4(v,J,invJ,detJ)PetscFreeA(4,418,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,&(v),&(J),&(invJ),&(detJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),418,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
419 ierr = PetscFree3(cellBr, cellDr, cellHr)PetscFreeA(3,419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,&(cellBr),&(cellDr),&(cellHr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
420 ierr = PetscFree3(cellBs, cellDs, cellHs)PetscFreeA(3,420,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,&(cellBs),&(cellDs),&(cellHs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),420,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
421 ierr = PetscFree3(cellPoints,coordsReal,coordsRef)PetscFreeA(3,421,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,&(cellPoints),&(coordsReal),&(coordsRef))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),421,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
422 ierr = MPI_Type_free(&pointType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),422,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
423 ierr = PetscSFDestroy(&cellSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),423,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
424 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)
;
425}
426
427static PetscErrorCode DMFieldEvaluateFV_DS(DMField field, IS pointIS, PetscDataType type, void *B, void *D, void *H)
428{
429 DMField_DS *dsfield = (DMField_DS *) field->data;
430 PetscInt h, imin;
431 PetscInt dim;
432 PetscClassId id;
433 PetscQuadrature quad = NULL((void*)0);
434 PetscInt maxDegree;
435 PetscFEGeom *geom;
436 PetscInt Nq, Nc, dimC, qNc, N;
437 PetscInt numPoints;
438 void *qB = NULL((void*)0), *qD = NULL((void*)0), *qH = NULL((void*)0);
439 const PetscReal *weights;
440 MPI_Datatype mpitype = type == PETSC_SCALARPETSC_DOUBLE ? MPIU_SCALAR((MPI_Datatype)0x4c00080b) : MPIU_REAL((MPI_Datatype)0x4c00080b);
441 PetscObject disc;
442 DMField coordField;
443 PetscErrorCode ierr;
444
445 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.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 Nc = field->numComponents;
447 ierr = DMGetCoordinateDim(field->dm, &dimC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),447,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
448 ierr = DMGetDimension(field->dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),448,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
449 ierr = ISGetLocalSize(pointIS, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),449,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
450 ierr = ISGetMinMax(pointIS,&imin,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),450,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
451 for (h = 0; h < dsfield->height; h++) {
452 PetscInt hEnd;
453
454 ierr = DMPlexGetHeightStratum(field->dm,h,NULL((void*)0),&hEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),454,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
455 if (imin < hEnd) break;
456 }
457 dim -= h;
458 ierr = DMFieldDSGetHeightDisc(field,h,&disc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),458,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
459 ierr = PetscObjectGetClassId(disc,&id);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),459,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
460 if (id != PETSCFE_CLASSID) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Discretization not supported\n")return PetscError(((MPI_Comm)0x44000001),460,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,77,PETSC_ERROR_INITIAL,"Discretization not supported\n")
;
461 ierr = DMGetCoordinateField(field->dm, &coordField);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),461,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
462 ierr = DMFieldGetDegree(coordField, pointIS, NULL((void*)0), &maxDegree);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),462,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
463 if (maxDegree <= 1) {
464 ierr = DMFieldCreateDefaultQuadrature(coordField, pointIS, &quad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),464,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
465 }
466 if (!quad) {ierr = DMFieldCreateDefaultQuadrature(field, pointIS, &quad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),466,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
467 if (!quad) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Could not determine quadrature for cell averages\n")return PetscError(((MPI_Comm)0x44000001),467,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,77,PETSC_ERROR_INITIAL,"Could not determine quadrature for cell averages\n"
)
;
468 ierr = DMFieldCreateFEGeom(coordField,pointIS,quad,PETSC_FALSE,&geom);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),468,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
469 ierr = PetscQuadratureGetData(quad, NULL((void*)0), &qNc, &Nq, NULL((void*)0), &weights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),469,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
470 if (qNc != 1) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Expected scalar quadrature components\n")return PetscError(((MPI_Comm)0x44000001),470,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,77,PETSC_ERROR_INITIAL,"Expected scalar quadrature components\n"
)
;
471 N = numPoints * Nq * Nc;
472 if (B) ierr = DMGetWorkArray(field->dm, N, mpitype, &qB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),472,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
473 if (D) ierr = DMGetWorkArray(field->dm, N * dimC, mpitype, &qD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),473,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
474 if (H) ierr = DMGetWorkArray(field->dm, N * dimC * dimC, mpitype, &qH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),474,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
475 ierr = DMFieldEvaluateFE(field,pointIS,quad,type,qB,qD,qH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),475,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
476 if (B) {
477 PetscInt i, j, k;
478
479 if (type == PETSC_SCALARPETSC_DOUBLE) {
480 PetscScalar * sB = (PetscScalar *) B;
481 PetscScalar * sqB = (PetscScalar *) qB;
482
483 for (i = 0; i < numPoints; i++) {
484 PetscReal vol = 0.;
485
486 for (j = 0; j < Nc; j++) {sB[i * Nc + j] = 0.;}
487 for (k = 0; k < Nq; k++) {
488 vol += geom->detJ[i * Nq + k] * weights[k];
489 for (j = 0; j < Nc; j++) {
490 sB[i * Nc + j] += geom->detJ[i * Nq + k] * weights[k] * sqB[ (i * Nq + k) * Nc + j];
491 }
492 }
493 for (k = 0; k < Nq * Nc; k++) sB[i * Nq * Nc + k] /= vol;
494 }
495 } else {
496 PetscReal * rB = (PetscReal *) B;
497 PetscReal * rqB = (PetscReal *) qB;
498
499 for (i = 0; i < numPoints; i++) {
500 PetscReal vol = 0.;
501
502 for (j = 0; j < Nc; j++) {rB[i * Nc + j] = 0.;}
503 for (k = 0; k < Nq; k++) {
504 vol += geom->detJ[i * Nq + k] * weights[k];
505 for (j = 0; j < Nc; j++) {
506 rB[i * Nc + j] += weights[k] * rqB[ (i * Nq + k) * Nc + j];
507 }
508 }
509 for (k = 0; k < Nc; k++) rB[i * Nc + k] /= vol;
510 }
511 }
512 }
513 if (D) {
514 PetscInt i, j, k, l, m;
515
516 if (type == PETSC_SCALARPETSC_DOUBLE) {
517 PetscScalar * sD = (PetscScalar *) D;
518 PetscScalar * sqD = (PetscScalar *) qD;
519
520 for (i = 0; i < numPoints; i++) {
521 PetscReal vol = 0.;
522
523 for (j = 0; j < Nc * dimC; j++) {sD[i * Nc * dimC + j] = 0.;}
524 for (k = 0; k < Nq; k++) {
525 vol += geom->detJ[i * Nq + k] * weights[k];
526 for (j = 0; j < Nc; j++) {
527 PetscScalar pD[3] = {0.,0.,0.};
528
529 for (l = 0; l < dimC; l++) {
530 for (m = 0; m < dim; m++) {
531 pD[l] += geom->invJ[((i * Nq + k) * dimC + m) * dimC + l] * sqD[((i * Nq + k) * Nc + j) * dim + m];
532 }
533 }
534 for (l = 0; l < dimC; l++) {
535 sD[(i * Nc + j) * dimC + l] += geom->detJ[i * Nq + k] * weights[k] * pD[l];
536 }
537 }
538 }
539 for (k = 0; k < Nc * dimC; k++) sD[i * Nc * dimC + k] /= vol;
540 }
541 } else {
542 PetscReal * rD = (PetscReal *) D;
543 PetscReal * rqD = (PetscReal *) qD;
544
545 for (i = 0; i < numPoints; i++) {
546 PetscReal vol = 0.;
547
548 for (j = 0; j < Nc * dimC; j++) {rD[i * Nc * dimC + j] = 0.;}
549 for (k = 0; k < Nq; k++) {
550 vol += geom->detJ[i * Nq + k] * weights[k];
551 for (j = 0; j < Nc; j++) {
552 PetscReal pD[3] = {0.,0.,0.};
553
554 for (l = 0; l < dimC; l++) {
555 for (m = 0; m < dim; m++) {
556 pD[l] += geom->invJ[((i * Nq + k) * dimC + m) * dimC + l] * rqD[((i * Nq + k) * Nc + j) * dim + m];
557 }
558 }
559 for (l = 0; l < dimC; l++) {
560 rD[(i * Nc + j) * dimC + l] += geom->detJ[i * Nq + k] * weights[k] * pD[l];
561 }
562 }
563 }
564 for (k = 0; k < Nc * dimC; k++) rD[i * Nc * dimC + k] /= vol;
565 }
566 }
567 }
568 if (H) {
569 PetscInt i, j, k, l, m, q, r;
570
571 if (type == PETSC_SCALARPETSC_DOUBLE) {
572 PetscScalar * sH = (PetscScalar *) H;
573 PetscScalar * sqH = (PetscScalar *) qH;
574
575 for (i = 0; i < numPoints; i++) {
576 PetscReal vol = 0.;
577
578 for (j = 0; j < Nc * dimC * dimC; j++) {sH[i * Nc * dimC * dimC + j] = 0.;}
579 for (k = 0; k < Nq; k++) {
580 const PetscReal *invJ = &geom->invJ[(i * Nq + k) * dimC * dimC];
581
582 vol += geom->detJ[i * Nq + k] * weights[k];
583 for (j = 0; j < Nc; j++) {
584 PetscScalar pH[3][3] = {{0.,0.,0.},{0.,0.,0.},{0.,0.,0.}};
585 const PetscScalar *spH = &sqH[((i * Nq + k) * Nc + j) * dimC * dimC];
586
587 for (l = 0; l < dimC; l++) {
588 for (m = 0; m < dimC; m++) {
589 for (q = 0; q < dim; q++) {
590 for (r = 0; r < dim; r++) {
591 pH[l][m] += invJ[q * dimC + l] * invJ[r * dimC + m] * spH[q * dim + r];
592 }
593 }
594 }
595 }
596 for (l = 0; l < dimC; l++) {
597 for (m = 0; m < dimC; m++) {
598 sH[(i * Nc + j) * dimC * dimC + l * dimC + m] += geom->detJ[i * Nq + k] * weights[k] * pH[l][m];
599 }
600 }
601 }
602 }
603 for (k = 0; k < Nc * dimC * dimC; k++) sH[i * Nc * dimC * dimC + k] /= vol;
604 }
605 } else {
606 PetscReal * rH = (PetscReal *) H;
607 PetscReal * rqH = (PetscReal *) qH;
608
609 for (i = 0; i < numPoints; i++) {
610 PetscReal vol = 0.;
611
612 for (j = 0; j < Nc * dimC * dimC; j++) {rH[i * Nc * dimC * dimC + j] = 0.;}
613 for (k = 0; k < Nq; k++) {
614 const PetscReal *invJ = &geom->invJ[(i * Nq + k) * dimC * dimC];
615
616 vol += geom->detJ[i * Nq + k] * weights[k];
617 for (j = 0; j < Nc; j++) {
618 PetscReal pH[3][3] = {{0.,0.,0.},{0.,0.,0.},{0.,0.,0.}};
619 const PetscReal *rpH = &rqH[((i * Nq + k) * Nc + j) * dimC * dimC];
620
621 for (l = 0; l < dimC; l++) {
622 for (m = 0; m < dimC; m++) {
623 for (q = 0; q < dim; q++) {
624 for (r = 0; r < dim; r++) {
625 pH[l][m] += invJ[q * dimC + l] * invJ[r * dimC + m] * rpH[q * dim + r];
626 }
627 }
628 }
629 }
630 for (l = 0; l < dimC; l++) {
631 for (m = 0; m < dimC; m++) {
632 rH[(i * Nc + j) * dimC * dimC + l * dimC + m] += geom->detJ[i * Nq + k] * weights[k] * pH[l][m];
633 }
634 }
635 }
636 }
637 for (k = 0; k < Nc * dimC * dimC; k++) rH[i * Nc * dimC * dimC + k] /= vol;
638 }
639 }
640 }
641 if (B) ierr = DMRestoreWorkArray(field->dm, N, mpitype, &qB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),641,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
642 if (D) ierr = DMRestoreWorkArray(field->dm, N * dimC, mpitype, &qD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),642,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
643 if (H) ierr = DMRestoreWorkArray(field->dm, N * dimC * dimC, mpitype, &qH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),643,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
644 ierr = PetscFEGeomDestroy(&geom);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),644,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
645 ierr = PetscQuadratureDestroy(&quad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),645,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
646 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)
;
647}
648
649static PetscErrorCode DMFieldGetDegree_DS(DMField field, IS pointIS, PetscInt *minDegree, PetscInt *maxDegree)
650{
651 DMField_DS *dsfield;
652 PetscObject disc;
653 PetscInt h, imin, imax;
654 PetscClassId id;
655 PetscErrorCode ierr;
656
657 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
; petscstack->line[petscstack->currentsize] = 657; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
658 dsfield = (DMField_DS *) field->data;
659 ierr = ISGetMinMax(pointIS,&imin,&imax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),659,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
660 if (imin >= imax) {
661 h = 0;
662 } else {
663 for (h = 0; h < dsfield->height; h++) {
664 PetscInt hEnd;
665
666 ierr = DMPlexGetHeightStratum(field->dm,h,NULL((void*)0),&hEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),666,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
667 if (imin < hEnd) break;
668 }
669 }
670 ierr = DMFieldDSGetHeightDisc(field,h,&disc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),670,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
671 ierr = PetscObjectGetClassId(disc,&id);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),671,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
672 if (id == PETSCFE_CLASSID) {
673 PetscFE fe = (PetscFE) disc;
674 PetscSpace sp;
675
676 ierr = PetscFEGetBasisSpace(fe, &sp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),676,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
677 ierr = PetscSpaceGetDegree(sp, minDegree, maxDegree);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),677,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
678 }
679 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)
;
680}
681
682static PetscErrorCode DMFieldCreateDefaultQuadrature_DS(DMField field, IS pointIS, PetscQuadrature *quad)
683{
684 PetscInt h, dim, imax, imin, cellHeight;
685 DM dm;
686 DMField_DS *dsfield;
687 PetscObject disc;
688 PetscFE fe;
689 PetscClassId id;
690 PetscErrorCode ierr;
691
692
693 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
; petscstack->line[petscstack->currentsize] = 693; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
694 dm = field->dm;
695 dsfield = (DMField_DS *) field->data;
696 ierr = ISGetMinMax(pointIS,&imin,&imax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),696,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
697 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),697,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
698 for (h = 0; h <= dim; h++) {
699 PetscInt hStart, hEnd;
700
701 ierr = DMPlexGetHeightStratum(dm,h,&hStart,&hEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),701,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
702 if (imax >= hStart && imin < hEnd) break;
703 }
704 ierr = DMPlexGetVTKCellHeight(dm, &cellHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),704,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
705 h -= cellHeight;
706 *quad = NULL((void*)0);
707 if (h < dsfield->height) {
708 ierr = DMFieldDSGetHeightDisc(field,h,&disc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),708,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
709 ierr = PetscObjectGetClassId(disc,&id);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),709,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
710 if (id != PETSCFE_CLASSID) 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)
;
711 fe = (PetscFE) disc;
712 ierr = PetscFEGetQuadrature(fe,quad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),712,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
713 ierr = PetscObjectReference((PetscObject)*quad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),713,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
714 }
715 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)
;
716}
717
718static PetscErrorCode DMFieldComputeFaceData_DS(DMField field, IS pointIS, PetscQuadrature quad, PetscFEGeom *geom)
719{
720 const PetscInt *points;
721 PetscInt p, dim, dE, numFaces, Nq;
722 PetscInt maxDegree;
723 DMLabel depthLabel;
724 IS cellIS;
725 DM dm = field->dm;
726 PetscErrorCode ierr;
727
728 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
; petscstack->line[petscstack->currentsize] = 728; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
729 dim = geom->dim;
730 dE = geom->dimEmbed;
731 ierr = DMPlexGetDepthLabel(dm, &depthLabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),731,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
732 ierr = DMLabelGetStratumIS(depthLabel, dim + 1, &cellIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),732,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
733 ierr = DMFieldGetDegree(field,cellIS,NULL((void*)0),&maxDegree);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),733,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
734 ierr = ISGetIndices(pointIS, &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),734,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
735 numFaces = geom->numCells;
736 Nq = geom->numPoints;
737 if (maxDegree <= 1) {
1
Assuming 'maxDegree' is > 1
2
Taking false branch
738 PetscInt numCells, offset, *cells;
739 PetscFEGeom *cellGeom;
740 IS suppIS;
741 PetscQuadrature cellQuad = NULL((void*)0);
742
743 ierr = DMFieldCreateDefaultQuadrature(field,cellIS,&cellQuad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),743,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
744 for (p = 0, numCells = 0; p < numFaces; p++) {
745 PetscInt point = points[p];
746 PetscInt numSupp, numChildren;
747
748 ierr = DMPlexGetTreeChildren(dm, point, &numChildren, NULL((void*)0)); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),748,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
749 if (numChildren) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Face data not valid for facets with children")return PetscError(((MPI_Comm)0x44000001),749,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,77,PETSC_ERROR_INITIAL,"Face data not valid for facets with children"
)
;
750 ierr = DMPlexGetSupportSize(dm, point,&numSupp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),750,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
751 if (numSupp > 2) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Point %D has %D support, expected at most 2\n", point, numSupp)return PetscError(((MPI_Comm)0x44000001),751,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,77,PETSC_ERROR_INITIAL,"Point %D has %D support, expected at most 2\n"
,point,numSupp)
;
752 numCells += numSupp;
753 }
754 ierr = PetscMalloc1(numCells, &cells)PetscMallocA(1,PETSC_FALSE,754,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(numCells)*sizeof(**(&cells)),(&cells))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),754,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
755 for (p = 0, offset = 0; p < numFaces; p++) {
756 PetscInt point = points[p];
757 PetscInt numSupp, s;
758 const PetscInt *supp;
759
760 ierr = DMPlexGetSupportSize(dm, point,&numSupp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),760,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
761 ierr = DMPlexGetSupport(dm, point, &supp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),761,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
762 for (s = 0; s < numSupp; s++, offset++) {
763 cells[offset] = supp[s];
764 }
765 }
766 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),numCells,cells,PETSC_USE_POINTER, &suppIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),766,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
767 ierr = DMFieldCreateFEGeom(field,suppIS,cellQuad,PETSC_FALSE,&cellGeom);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),767,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
768 for (p = 0, offset = 0; p < numFaces; p++) {
769 PetscInt point = points[p];
770 PetscInt numSupp, s, q;
771 const PetscInt *supp;
772
773 ierr = DMPlexGetSupportSize(dm, point,&numSupp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),773,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
774 ierr = DMPlexGetSupport(dm, point, &supp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),774,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
775 for (s = 0; s < numSupp; s++, offset++) {
776 for (q = 0; q < Nq * dE * dE; q++) {
777 geom->suppInvJ[s][p * Nq * dE * dE + q] = cellGeom->invJ[offset * Nq * dE * dE + q];
778 }
779 }
780 }
781 ierr = PetscFEGeomDestroy(&cellGeom);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),781,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
782 ierr = ISDestroy(&suppIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),782,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
783 ierr = PetscFree(cells)((*PetscTrFree)((void*)(cells),783,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
) || ((cells) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),783,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
784 ierr = PetscQuadratureDestroy(&cellQuad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),784,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
785 } else {
786 PetscObject faceDisc, cellDisc;
787 PetscClassId faceId, cellId;
788 PetscDualSpace dsp;
789 DM K;
790 PetscInt (*co)[2][3];
791 PetscInt coneSize;
792 PetscInt **counts;
793 PetscInt f, i, o, q, s;
794 const PetscInt *coneK;
795 PetscInt minOrient, maxOrient, numOrient;
796 PetscInt *orients;
797 PetscReal **orientPoints;
798 PetscReal *cellPoints;
799 PetscReal *dummyWeights;
800 PetscQuadrature cellQuad = NULL((void*)0);
801
802 ierr = DMFieldDSGetHeightDisc(field, 1, &faceDisc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),802,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
803 ierr = DMFieldDSGetHeightDisc(field, 0, &cellDisc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),803,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
804 ierr = PetscObjectGetClassId(faceDisc,&faceId);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),804,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
805 ierr = PetscObjectGetClassId(cellDisc,&cellId);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),805,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
806 if (faceId != PETSCFE_CLASSID || cellId != PETSCFE_CLASSID) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Not supported\n")return PetscError(((MPI_Comm)0x44000001),806,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,77,PETSC_ERROR_INITIAL,"Not supported\n")
;
3
Taking false branch
807 ierr = PetscFEGetDualSpace((PetscFE)cellDisc, &dsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),807,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
808 ierr = PetscDualSpaceGetDM(dsp, &K); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),808,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
809 ierr = DMPlexGetConeSize(K,0,&coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),809,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
810 ierr = DMPlexGetCone(K,0,&coneK);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),810,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
811 ierr = PetscMalloc2(numFaces, &co, coneSize, &counts)PetscMallocA(2,PETSC_FALSE,811,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(numFaces)*sizeof(**(&co)),(&co),(size_t)(coneSize
)*sizeof(**(&counts)),(&counts))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),811,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
812 ierr = PetscMalloc1(dE*Nq, &cellPoints)PetscMallocA(1,PETSC_FALSE,812,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(dE*Nq)*sizeof(**(&cellPoints)),(&cellPoints
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),812,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
813 ierr = PetscMalloc1(Nq, &dummyWeights)PetscMallocA(1,PETSC_FALSE,813,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(Nq)*sizeof(**(&dummyWeights)),(&dummyWeights
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),813,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
814 ierr = PetscQuadratureCreate(PetscObjectComm((PetscObject)field), &cellQuad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),814,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
815 ierr = PetscQuadratureSetData(cellQuad, dE, 1, Nq, cellPoints, dummyWeights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),815,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
816 minOrient = PETSC_MAX_INT2147483647;
817 maxOrient = PETSC_MIN_INT(-2147483647 - 1);
818 for (p = 0; p < numFaces; p++) { /* record the orientation of the facet wrt the support cells */
4
Assuming 'p' is >= 'numFaces'
5
Loop condition is false. Execution continues on line 852
819 PetscInt point = points[p];
820 PetscInt numSupp, numChildren;
821 const PetscInt *supp;
822
823 ierr = DMPlexGetTreeChildren(dm, point, &numChildren, NULL((void*)0)); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),823,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
824 if (numChildren) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Face data not valid for facets with children")return PetscError(((MPI_Comm)0x44000001),824,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,77,PETSC_ERROR_INITIAL,"Face data not valid for facets with children"
)
;
825 ierr = DMPlexGetSupportSize(dm, point,&numSupp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),825,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
826 if (numSupp > 2) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Point %D has %D support, expected at most 2\n", point, numSupp)return PetscError(((MPI_Comm)0x44000001),826,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,77,PETSC_ERROR_INITIAL,"Point %D has %D support, expected at most 2\n"
,point,numSupp)
;
827 ierr = DMPlexGetSupport(dm, point, &supp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),827,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
828 for (s = 0; s < numSupp; s++) {
829 PetscInt cell = supp[s];
830 PetscInt numCone;
831 const PetscInt *cone, *orient;
832
833 ierr = DMPlexGetConeSize(dm, cell, &numCone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),833,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
834 if (numCone != coneSize) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Support point does not match reference element")return PetscError(((MPI_Comm)0x44000001),834,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,77,PETSC_ERROR_INITIAL,"Support point does not match reference element"
)
;
835 ierr = DMPlexGetCone(dm, cell, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),835,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
836 ierr = DMPlexGetConeOrientation(dm, cell, &orient);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),836,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
837 for (f = 0; f < coneSize; f++) {
838 if (cone[f] == point) break;
839 }
840 co[p][s][0] = f;
841 co[p][s][1] = orient[f];
842 co[p][s][2] = cell;
843 minOrient = PetscMin(minOrient, orient[f])(((minOrient)<(orient[f])) ? (minOrient) : (orient[f]));
844 maxOrient = PetscMax(maxOrient, orient[f])(((maxOrient)<(orient[f])) ? (orient[f]) : (maxOrient));
845 }
846 for (; s < 2; s++) {
847 co[p][s][0] = -1;
848 co[p][s][1] = -1;
849 co[p][s][2] = -1;
850 }
851 }
852 numOrient = maxOrient + 1 - minOrient;
853 ierr = DMPlexGetCone(K,0,&coneK);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),853,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
854 /* count all (face,orientation) doubles that appear */
855 ierr = PetscCalloc2(numOrient,&orients,numOrient,&orientPoints)PetscMallocA(2,PETSC_TRUE,855,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(numOrient)*sizeof(**(&orients)),(&orients),
(size_t)(numOrient)*sizeof(**(&orientPoints)),(&orientPoints
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),855,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
856 for (f = 0; f < coneSize; f++) {ierr = PetscCalloc1(numOrient+1, &counts[f])PetscMallocA(1,PETSC_TRUE,856,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(numOrient+1)*sizeof(**(&counts[f])),(&counts
[f]))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),856,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6
Assuming 'f' is < 'coneSize'
7
Loop condition is true. Entering loop body
8
Assuming 'f' is >= 'coneSize'
9
Loop condition is false. Execution continues on line 857
857 for (p = 0; p < numFaces; p++) {
10
Loop condition is false. Execution continues on line 865
858 for (s = 0; s < 2; s++) {
859 if (co[p][s][0] >= 0) {
860 counts[co[p][s][0]][co[p][s][1] - minOrient]++;
861 orients[co[p][s][1] - minOrient]++;
862 }
863 }
864 }
865 for (o = 0; o < numOrient; o++) {
11
Loop condition is true. Entering loop body
14
Loop condition is true. Entering loop body
17
Loop condition is false. Execution continues on line 950
866 if (orients[o]) {
12
Assuming the condition is false
13
Taking false branch
15
Assuming the condition is false
16
Taking false branch
867 PetscInt orient = o + minOrient;
868 PetscInt q;
869
870 ierr = PetscMalloc1(Nq * dim, &orientPoints[o])PetscMallocA(1,PETSC_FALSE,870,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(Nq * dim)*sizeof(**(&orientPoints[o])),(&orientPoints
[o]))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),870,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
871 /* rotate the quadrature points appropriately */
872 switch (dim) {
873 case 0:
874 break;
875 case 1:
876 if (orient == -2 || orient == 1) {
877 for (q = 0; q < Nq; q++) {
878 orientPoints[o][q] = -geom->xi[q];
879 }
880 } else {
881 for (q = 0; q < Nq; q++) {
882 orientPoints[o][q] = geom->xi[q];
883 }
884 }
885 break;
886 case 2:
887 switch (coneSize) {
888 case 3:
889 for (q = 0; q < Nq; q++) {
890 PetscReal lambda[3];
891 PetscReal lambdao[3];
892
893 /* convert to barycentric */
894 lambda[0] = - (geom->xi[2 * q] + geom->xi[2 * q + 1]) / 2.;
895 lambda[1] = (geom->xi[2 * q] + 1.) / 2.;
896 lambda[2] = (geom->xi[2 * q + 1] + 1.) / 2.;
897 if (orient >= 0) {
898 for (i = 0; i < 3; i++) {
899 lambdao[i] = lambda[(orient + i) % 3];
900 }
901 } else {
902 for (i = 0; i < 3; i++) {
903 lambdao[i] = lambda[(-(orient + i) + 3) % 3];
904 }
905 }
906 /* convert to coordinates */
907 orientPoints[o][2 * q + 0] = -(lambdao[0] + lambdao[2]) + lambdao[1];
908 orientPoints[o][2 * q + 1] = -(lambdao[0] + lambdao[1]) + lambdao[2];
909 }
910 break;
911 case 4:
912 for (q = 0; q < Nq; q++) {
913 PetscReal xi[2], xio[2];
914 PetscInt oabs = (orient >= 0) ? orient : -(orient + 1);
915
916 xi[0] = geom->xi[2 * q];
917 xi[1] = geom->xi[2 * q + 1];
918 switch (oabs) {
919 case 1:
920 xio[0] = xi[1];
921 xio[1] = -xi[0];
922 break;
923 case 2:
924 xio[0] = -xi[0];
925 xio[1] = -xi[1];
926 case 3:
927 xio[0] = -xi[1];
928 xio[1] = xi[0];
929 case 0:
930 default:
931 xio[0] = xi[0];
932 xio[1] = xi[1];
933 break;
934 }
935 if (orient < 0) {
936 xio[0] = -xio[0];
937 }
938 orientPoints[o][2 * q + 0] = xio[0];
939 orientPoints[o][2 * q + 1] = xio[1];
940 }
941 break;
942 default:
943 SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Cone size %D not yet supported\n", coneSize)return PetscError(((MPI_Comm)0x44000001),943,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,56,PETSC_ERROR_INITIAL,"Cone size %D not yet supported\n",coneSize
)
;
944 }
945 default:
946 SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Dimension %D not yet supported\n", dim)return PetscError(((MPI_Comm)0x44000001),946,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,56,PETSC_ERROR_INITIAL,"Dimension %D not yet supported\n",dim
)
;
947 }
948 }
949 }
950 for (f = 0; f < coneSize; f++) {
18
Loop condition is true. Entering loop body
951 PetscInt face = coneK[f];
952 PetscReal v0[3];
953 PetscReal J[9], detJ;
954 PetscInt numCells, offset;
955 PetscInt *cells;
956 IS suppIS;
957
958 ierr = DMPlexComputeCellGeometryFEM(K, face, NULL((void*)0), v0, J, NULL((void*)0), &detJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),958,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
959 for (o = 0; o <= numOrient; o++) {
19
Loop condition is true. Entering loop body
960 PetscFEGeom *cellGeom;
961
962 if (!counts[f][o]) continue;
20
Assuming the condition is false
21
Taking false branch
963 /* If this (face,orientation) double appears,
964 * convert the face quadrature points into volume quadrature points */
965 for (q = 0; q < Nq; q++) {
22
Assuming 'q' is < 'Nq'
23
Loop condition is true. Entering loop body
966 PetscReal xi0[3] = {-1., -1., -1.};
967
968 CoordinatesRefToReal(dE, dim, xi0, v0, J, &orientPoints[o][dim * q + 0], &cellPoints[dE * q + 0]);
24
Calling 'CoordinatesRefToReal'
969 }
970 for (p = 0, numCells = 0; p < numFaces; p++) {
971 for (s = 0; s < 2; s++) {
972 if (co[p][s][0] == f && co[p][s][1] == o + minOrient) numCells++;
973 }
974 }
975 ierr = PetscMalloc1(numCells, &cells)PetscMallocA(1,PETSC_FALSE,975,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(numCells)*sizeof(**(&cells)),(&cells))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),975,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
976 for (p = 0, offset = 0; p < numFaces; p++) {
977 for (s = 0; s < 2; s++) {
978 if (co[p][s][0] == f && co[p][s][1] == o + minOrient) {
979 cells[offset++] = co[p][s][2];
980 }
981 }
982 }
983 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),numCells,cells,PETSC_USE_POINTER, &suppIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),983,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
984 ierr = DMFieldCreateFEGeom(field,suppIS,cellQuad,PETSC_FALSE,&cellGeom);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),984,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
985 for (p = 0, offset = 0; p < numFaces; p++) {
986 for (s = 0; s < 2; s++) {
987 if (co[p][s][0] == f && co[p][s][1] == o + minOrient) {
988 for (q = 0; q < Nq * dE * dE; q++) {
989 geom->suppInvJ[s][p * Nq * dE * dE + q] = cellGeom->invJ[offset * Nq * dE * dE + q];
990 }
991 offset++;
992 }
993 }
994 }
995 ierr = PetscFEGeomDestroy(&cellGeom);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),995,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
996 ierr = ISDestroy(&suppIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),996,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
997 ierr = PetscFree(cells)((*PetscTrFree)((void*)(cells),997,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
) || ((cells) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),997,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
998 }
999 }
1000 for (o = 0; o < numOrient; o++) {
1001 if (orients[o]) {
1002 ierr = PetscFree(orientPoints[o])((*PetscTrFree)((void*)(orientPoints[o]),1002,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
) || ((orientPoints[o]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1002,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1003 }
1004 }
1005 ierr = PetscFree2(orients,orientPoints)PetscFreeA(2,1005,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,&(orients),&(orientPoints))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1005,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1006 ierr = PetscQuadratureDestroy(&cellQuad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1006,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1007 ierr = PetscFree2(co,counts)PetscFreeA(2,1007,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,&(co),&(counts))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1007,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1008 }
1009 ierr = ISRestoreIndices(pointIS, &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1009,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1010 ierr = ISDestroy(&cellIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1010,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1011 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)
;
1012}
1013
1014static PetscErrorCode DMFieldInitialize_DS(DMField field)
1015{
1016 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
; petscstack->line[petscstack->currentsize] = 1016; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1017 field->ops->destroy = DMFieldDestroy_DS;
1018 field->ops->evaluate = DMFieldEvaluate_DS;
1019 field->ops->evaluateFE = DMFieldEvaluateFE_DS;
1020 field->ops->evaluateFV = DMFieldEvaluateFV_DS;
1021 field->ops->getDegree = DMFieldGetDegree_DS;
1022 field->ops->createDefaultQuadrature = DMFieldCreateDefaultQuadrature_DS;
1023 field->ops->view = DMFieldView_DS;
1024 field->ops->computeFaceData = DMFieldComputeFaceData_DS;
1025 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)
;
1026}
1027
1028PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode DMFieldCreate_DS(DMField field)
1029{
1030 DMField_DS *dsfield;
1031 PetscErrorCode ierr;
1032
1033 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
; petscstack->line[petscstack->currentsize] = 1033; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1034 ierr = PetscNewLog(field,&dsfield)(PetscMallocA(1,PETSC_TRUE,1034,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(1)*sizeof(**(((&dsfield)))),(((&dsfield))))
|| PetscLogObjectMemory((PetscObject)field,sizeof(**(&dsfield
))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1034,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1035 field->data = dsfield;
1036 ierr = DMFieldInitialize_DS(field);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1036,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1037 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)
;
1038}
1039
1040PetscErrorCode DMFieldCreateDS(DM dm, PetscInt fieldNum, Vec vec,DMField *field)
1041{
1042 DMField b;
1043 DMField_DS *dsfield;
1044 PetscObject disc = NULL((void*)0);
1045 PetscBool isContainer = PETSC_FALSE;
1046 PetscClassId id = -1;
1047 PetscInt numComponents = -1, dsNumFields;
1048 PetscSection section;
1049 PetscErrorCode ierr;
1050
1051 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
; petscstack->line[petscstack->currentsize] = 1051; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1052 ierr = DMGetDefaultSection(dm,&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1052,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1053 ierr = PetscSectionGetFieldComponents(section,fieldNum,&numComponents);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1053,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1054 ierr = DMGetNumFields(dm,&dsNumFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1054,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1055 if (dsNumFields) {ierr = DMGetField(dm,fieldNum,NULL((void*)0),&disc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1055,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1056 if (disc) {
1057 ierr = PetscObjectGetClassId(disc,&id);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1057,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1058 isContainer = (id == PETSC_CONTAINER_CLASSID) ? PETSC_TRUE : PETSC_FALSE;
1059 }
1060 if (!disc || isContainer) {
1061 MPI_Comm comm = PetscObjectComm((PetscObject) dm);
1062 PetscInt cStart, cEnd, dim, cellHeight;
1063 PetscInt localConeSize = 0, coneSize;
1064 PetscFE fe;
1065 PetscDualSpace Q;
1066 PetscSpace P;
1067 DM K;
1068 PetscQuadrature quad, fquad;
1069 PetscBool isSimplex;
1070
1071 ierr = DMPlexGetVTKCellHeight(dm, &cellHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1071,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1072 ierr = DMPlexGetHeightStratum(dm, cellHeight, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1072,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1073 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1073,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1074 if (cEnd > cStart) {
1075 ierr = DMPlexGetConeSize(dm, cStart, &localConeSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1075,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1076 }
1077 ierr = MPI_Allreduce(&localConeSize,&coneSize,1,MPIU_INT,MPI_MAX,comm)((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) || MPI_Allreduce
((&localConeSize),(&coneSize),(1),(((MPI_Datatype)0x4c000405
)),((MPI_Op)(0x58000001)),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1077,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1078 isSimplex = (coneSize == (dim + 1)) ? PETSC_TRUE : PETSC_FALSE;
1079 ierr = PetscSpaceCreate(comm, &P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1079,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1080 ierr = PetscSpaceSetType(P,PETSCSPACEPOLYNOMIAL"poly");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1080,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1081 ierr = PetscSpaceSetDegree(P, 1, PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1081,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1082 ierr = PetscSpaceSetNumComponents(P, numComponents);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1082,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1083 ierr = PetscSpaceSetNumVariables(P, dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1083,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1084 ierr = PetscSpacePolynomialSetTensor(P, isSimplex ? PETSC_FALSE : PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1084,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1085 ierr = PetscSpaceSetUp(P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1085,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1086 ierr = PetscDualSpaceCreate(comm, &Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1086,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1087 ierr = PetscDualSpaceSetType(Q,PETSCDUALSPACELAGRANGE"lagrange");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1087,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1088 ierr = PetscDualSpaceCreateReferenceCell(Q, dim, isSimplex, &K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1088,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1089 ierr = PetscDualSpaceSetDM(Q, K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1089,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1090 ierr = DMDestroy(&K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1090,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1091 ierr = PetscDualSpaceSetNumComponents(Q, numComponents);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1091,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1092 ierr = PetscDualSpaceSetOrder(Q, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1092,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1093 ierr = PetscDualSpaceLagrangeSetTensor(Q, isSimplex ? PETSC_FALSE : PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1093,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1094 ierr = PetscDualSpaceSetUp(Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1094,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1095 ierr = PetscFECreate(comm, &fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1095,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1096 ierr = PetscFESetType(fe,PETSCFEBASIC"basic");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1096,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1097 ierr = PetscFESetBasisSpace(fe, P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1097,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1098 ierr = PetscFESetDualSpace(fe, Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1098,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1099 ierr = PetscFESetNumComponents(fe, numComponents);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1099,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1100 ierr = PetscFESetUp(fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1100,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1101 ierr = PetscSpaceDestroy(&P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1101,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1102 ierr = PetscDualSpaceDestroy(&Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1102,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1103 if (isSimplex) {
1104 ierr = PetscDTGaussJacobiQuadrature(dim, 1, 1, -1.0, 1.0, &quad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1104,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1105 ierr = PetscDTGaussJacobiQuadrature(dim-1, 1, 1, -1.0, 1.0, &fquad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1105,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1106 }
1107 else {
1108 ierr = PetscDTGaussTensorQuadrature(dim, 1, 1, -1.0, 1.0, &quad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1108,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1109 ierr = PetscDTGaussTensorQuadrature(dim-1, 1, 1, -1.0, 1.0, &fquad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1109,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1110 }
1111 ierr = PetscFESetQuadrature(fe, quad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1111,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1112 ierr = PetscFESetFaceQuadrature(fe, fquad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1113 ierr = PetscQuadratureDestroy(&quad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1113,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1114 ierr = PetscQuadratureDestroy(&fquad);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1114,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1115 disc = (PetscObject) fe;
1116 } else {
1117 ierr = PetscObjectReference(disc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1117,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1118 }
1119 ierr = PetscObjectGetClassId(disc,&id);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1119,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1120 if (id == PETSCFE_CLASSID) {
1121 PetscFE fe = (PetscFE) disc;
1122
1123 ierr = PetscFEGetNumComponents(fe,&numComponents);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1123,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1124 } else {SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Not implemented")return PetscError(PetscObjectComm((PetscObject)dm),1124,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,56,PETSC_ERROR_INITIAL,"Not implemented")
;}
1125 ierr = DMFieldCreate(dm,numComponents,DMFIELD_VERTEX,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1125,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1126 ierr = DMFieldSetType(b,DMFIELDDS"ds");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1126,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1127 dsfield = (DMField_DS *) b->data;
1128 dsfield->fieldNum = fieldNum;
1129 ierr = DMGetDimension(dm,&dsfield->height);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1129,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1130 dsfield->height++;
1131 ierr = PetscCalloc1(dsfield->height,&dsfield->disc)PetscMallocA(1,PETSC_TRUE,1131,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,(size_t)(dsfield->height)*sizeof(**(&dsfield->disc
)),(&dsfield->disc))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1131,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1132 dsfield->disc[0] = disc;
1133 ierr = PetscObjectReference((PetscObject)vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1133,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/field/impls/ds/dmfieldds.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1134 dsfield->vec = vec;
1135 *field = b;
1136
1137 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)
;
1138}

/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h

1#if !defined(PETSCFEIMPL_H)
2#define PETSCFEIMPL_H
3
4#include <petscfe.h>
5#include <petscds.h>
6#include <petsc/private/petscimpl.h>
7#include <petsc/private/dmpleximpl.h>
8
9PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscBool PetscSpaceRegisterAllCalled;
10PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscBool PetscDualSpaceRegisterAllCalled;
11PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscBool PetscFERegisterAllCalled;
12PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSpaceRegisterAll(void);
13PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDualSpaceRegisterAll(void);
14PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFERegisterAll(void);
15
16PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscBool FEcite;
17PETSC_EXTERNextern __attribute__((visibility ("default"))) const char FECitation[];
18
19typedef struct _PetscSpaceOps *PetscSpaceOps;
20struct _PetscSpaceOps {
21 PetscErrorCode (*setfromoptions)(PetscOptionItems*,PetscSpace);
22 PetscErrorCode (*setup)(PetscSpace);
23 PetscErrorCode (*view)(PetscSpace,PetscViewer);
24 PetscErrorCode (*destroy)(PetscSpace);
25
26 PetscErrorCode (*getdimension)(PetscSpace,PetscInt*);
27 PetscErrorCode (*evaluate)(PetscSpace,PetscInt,const PetscReal*,PetscReal*,PetscReal*,PetscReal*);
28 PetscErrorCode (*getheightsubspace)(PetscSpace,PetscInt,PetscSpace *);
29};
30
31struct _p_PetscSpace {
32 PETSCHEADER(struct _PetscSpaceOps)_p_PetscObject hdr; struct _PetscSpaceOps ops[1];
33 void *data; /* Implementation object */
34 PetscInt degree; /* The approximation order of the space */
35 PetscInt maxDegree; /* The containing approximation order of the space */
36 PetscInt Nc; /* The number of components */
37 PetscInt Nv; /* The number of variables in the space, e.g. x and y */
38 PetscInt dim; /* The dimension of the space */
39 DM dm; /* Shell to use for temp allocation */
40};
41
42typedef struct {
43 PetscBool symmetric; /* Use only symmetric polynomials */
44 PetscBool tensor; /* Flag for tensor product */
45 PetscInt *degrees; /* Degrees of single variable which we need to compute */
46 PetscBool setupCalled;
47 PetscSpace *subspaces; /* Subspaces for each dimension */
48} PetscSpace_Poly;
49
50typedef struct {
51 PetscSpace *tensspaces;
52 PetscInt numTensSpaces;
53 PetscInt dim;
54 PetscBool uniform;
55 PetscBool setupCalled;
56 PetscSpace *heightsubspaces; /* Height subspaces */
57} PetscSpace_Tensor;
58
59typedef struct {
60 PetscQuadrature quad; /* The points defining the space */
61} PetscSpace_Point;
62
63typedef struct _PetscDualSpaceOps *PetscDualSpaceOps;
64struct _PetscDualSpaceOps {
65 PetscErrorCode (*setfromoptions)(PetscOptionItems*,PetscDualSpace);
66 PetscErrorCode (*setup)(PetscDualSpace);
67 PetscErrorCode (*view)(PetscDualSpace,PetscViewer);
68 PetscErrorCode (*destroy)(PetscDualSpace);
69
70 PetscErrorCode (*duplicate)(PetscDualSpace,PetscDualSpace*);
71 PetscErrorCode (*getdimension)(PetscDualSpace,PetscInt*);
72 PetscErrorCode (*getnumdof)(PetscDualSpace,const PetscInt**);
73 PetscErrorCode (*getheightsubspace)(PetscDualSpace,PetscInt,PetscDualSpace *);
74 PetscErrorCode (*getpointsubspace)(PetscDualSpace,PetscInt,PetscDualSpace *);
75 PetscErrorCode (*getsymmetries)(PetscDualSpace,const PetscInt****,const PetscScalar****);
76 PetscErrorCode (*apply)(PetscDualSpace, PetscInt, PetscReal, PetscFEGeom *, PetscInt, PetscErrorCode (*)(PetscInt, PetscReal, const PetscReal [], PetscInt, PetscScalar *, void *), void *, PetscScalar *);
77 PetscErrorCode (*applyall)(PetscDualSpace, const PetscScalar *, PetscScalar *);
78 PetscErrorCode (*createallpoints)(PetscDualSpace, PetscQuadrature *);
79};
80
81struct _p_PetscDualSpace {
82 PETSCHEADER(struct _PetscDualSpaceOps)_p_PetscObject hdr; struct _PetscDualSpaceOps ops[1];
83 void *data; /* Implementation object */
84 DM dm; /* The integration region K */
85 PetscInt order; /* The approximation order of the space */
86 PetscInt Nc; /* The number of components */
87 PetscQuadrature *functional; /* The basis of functionals for this space */
88 PetscQuadrature allPoints;
89 PetscBool setupcalled;
90};
91
92typedef struct {
93 PetscInt *numDof;
94 PetscBool simplexCell;
95 PetscBool tensorSpace;
96 PetscBool continuous;
97 PetscInt height;
98 PetscDualSpace *subspaces;
99 PetscInt ***symmetries;
100 PetscInt numSelfSym;
101 PetscInt selfSymOff;
102} PetscDualSpace_Lag;
103
104typedef struct {
105 PetscInt dim;
106 PetscInt *numDof;
107} PetscDualSpace_Simple;
108
109typedef struct _PetscFEOps *PetscFEOps;
110struct _PetscFEOps {
111 PetscErrorCode (*setfromoptions)(PetscOptionItems*,PetscFE);
112 PetscErrorCode (*setup)(PetscFE);
113 PetscErrorCode (*view)(PetscFE,PetscViewer);
114 PetscErrorCode (*destroy)(PetscFE);
115 PetscErrorCode (*getdimension)(PetscFE,PetscInt*);
116 PetscErrorCode (*gettabulation)(PetscFE,PetscInt,const PetscReal*,PetscReal*,PetscReal*,PetscReal*);
117 /* Element integration */
118 PetscErrorCode (*integrate)(PetscFE, PetscDS, PetscInt, PetscInt, PetscFEGeom *, const PetscScalar[], PetscDS, const PetscScalar[], PetscScalar[]);
119 PetscErrorCode (*integratebd)(PetscFE, PetscDS, PetscInt, PetscBdPointFunc, PetscInt, PetscFEGeom *, const PetscScalar[], PetscDS, const PetscScalar[], PetscScalar[]);
120 PetscErrorCode (*integrateresidual)(PetscFE, PetscDS, PetscInt, PetscInt, PetscFEGeom *, const PetscScalar[], const PetscScalar[], PetscDS, const PetscScalar[], PetscReal, PetscScalar[]);
121 PetscErrorCode (*integratebdresidual)(PetscFE, PetscDS, PetscInt, PetscInt, PetscFEGeom *, const PetscScalar[], const PetscScalar[], PetscDS, const PetscScalar[], PetscReal, PetscScalar[]);
122 PetscErrorCode (*integratejacobianaction)(PetscFE, PetscDS, PetscInt, PetscInt, PetscFEGeom *, const PetscScalar[], const PetscScalar[], PetscDS, const PetscScalar[], PetscReal, PetscReal, PetscScalar[]);
123 PetscErrorCode (*integratejacobian)(PetscFE, PetscDS, PetscFEJacobianType, PetscInt, PetscInt, PetscInt, PetscFEGeom *, const PetscScalar[], const PetscScalar[], PetscDS, const PetscScalar[], PetscReal, PetscReal, PetscScalar[]);
124 PetscErrorCode (*integratebdjacobian)(PetscFE, PetscDS, PetscInt, PetscInt, PetscInt, PetscFEGeom *, const PetscScalar[], const PetscScalar[], PetscDS, const PetscScalar[], PetscReal, PetscReal, PetscScalar[]);
125};
126
127struct _p_PetscFE {
128 PETSCHEADER(struct _PetscFEOps)_p_PetscObject hdr; struct _PetscFEOps ops[1];
129 void *data; /* Implementation object */
130 PetscSpace basisSpace; /* The basis space P */
131 PetscDualSpace dualSpace; /* The dual space P' */
132 PetscInt numComponents; /* The number of field components */
133 PetscQuadrature quadrature; /* Suitable quadrature on K */
134 PetscQuadrature faceQuadrature; /* Suitable face quadrature on \partial K */
135 PetscFE *subspaces; /* Subspaces for each dimension */
136 PetscReal *invV; /* Change of basis matrix, from prime to nodal basis set */
137 PetscReal *B, *D, *H; /* Tabulation of basis and derivatives at quadrature points */
138 PetscReal *Bf, *Df, *Hf; /* Tabulation of basis and derivatives at quadrature points on each face */
139 PetscReal *F; /* Tabulation of basis at face centroids */
140 PetscInt blockSize, numBlocks; /* Blocks are processed concurrently */
141 PetscInt batchSize, numBatches; /* A batch is made up of blocks, Batches are processed in serial */
142 PetscBool setupcalled;
143};
144
145typedef struct {
146 PetscInt cellType;
147} PetscFE_Basic;
148
149#ifdef PETSC_HAVE_OPENCL
150
151#ifdef __APPLE__
152#include <OpenCL/cl.h>
153#else
154#include <CL/cl.h>
155#endif
156
157typedef struct {
158 cl_platform_id pf_id;
159 cl_device_id dev_id;
160 cl_context ctx_id;
161 cl_command_queue queue_id;
162 PetscDataType realType;
163 PetscLogEvent residualEvent;
164 PetscInt op; /* ANDY: Stand-in for real equation code generation */
165} PetscFE_OpenCL;
166#endif
167
168typedef struct {
169 CellRefiner cellRefiner; /* The cell refiner defining the cell division */
170 PetscInt numSubelements; /* The number of subelements */
171 PetscReal *v0; /* The affine transformation for each subelement */
172 PetscReal *jac, *invjac;
173 PetscInt *embedding; /* Map from subelements dofs to element dofs */
174} PetscFE_Composite;
175
176/* Utility functions */
177PETSC_STATIC_INLINEstatic inline void CoordinatesRefToReal(PetscInt dimReal, PetscInt dimRef, const PetscReal xi0[], const PetscReal v0[], const PetscReal J[], const PetscReal xi[], PetscReal x[])
178{
179 PetscInt d, e;
180
181 for (d = 0; d < dimReal; ++d) {
25
Assuming 'd' is < 'dimReal'
26
Loop condition is true. Entering loop body
182 x[d] = v0[d];
183 for (e = 0; e < dimRef; ++e) {
27
Assuming 'e' is < 'dimRef'
28
Loop condition is true. Entering loop body
29
Assuming 'e' is < 'dimRef'
30
Loop condition is true. Entering loop body
31
Assuming 'e' is < 'dimRef'
32
Loop condition is true. Entering loop body
33
Assuming 'e' is < 'dimRef'
34
Loop condition is true. Entering loop body
184 x[d] += J[d*dimReal+e]*(xi[e] - xi0[e]);
35
The right operand of '-' is a garbage value due to array index out of bounds
185 }
186 }
187}
188
189PETSC_STATIC_INLINEstatic inline void CoordinatesRealToRef(PetscInt dimReal, PetscInt dimRef, const PetscReal xi0[], const PetscReal v0[], const PetscReal invJ[], const PetscReal x[], PetscReal xi[])
190{
191 PetscInt d, e;
192
193 for (d = 0; d < dimRef; ++d) {
194 xi[d] = xi0[d];
195 for (e = 0; e < dimReal; ++e) {
196 xi[d] += invJ[d*dimReal+e]*(x[e] - v0[e]);
197 }
198 }
199}
200
201PETSC_STATIC_INLINEstatic inline void EvaluateFieldJets(PetscInt dim, PetscInt Nf, const PetscInt Nb[], const PetscInt Nc[], PetscInt q, PetscReal *basisField[], PetscReal *basisFieldDer[], PetscScalar refSpaceDer[], const PetscReal invJ[], const PetscScalar coefficients[], const PetscScalar coefficients_t[], PetscScalar u[], PetscScalar u_x[], PetscScalar u_t[])
202{
203 PetscInt dOffset = 0, fOffset = 0, f;
204
205 for (f = 0; f < Nf; ++f) {
206 const PetscInt Nbf = Nb[f], Ncf = Nc[f];
207 const PetscReal *Bq = &basisField[f][q*Nbf*Ncf];
208 const PetscReal *Dq = &basisFieldDer[f][q*Nbf*Ncf*dim];
209 PetscInt b, c, d, e;
210
211 for (c = 0; c < Ncf; ++c) u[fOffset+c] = 0.0;
212 for (d = 0; d < dim*Ncf; ++d) refSpaceDer[d] = 0.0;
213 for (b = 0; b < Nbf; ++b) {
214 for (c = 0; c < Ncf; ++c) {
215 const PetscInt cidx = b*Ncf+c;
216
217 u[fOffset+c] += Bq[cidx]*coefficients[dOffset+b];
218 for (d = 0; d < dim; ++d) refSpaceDer[c*dim+d] += Dq[cidx*dim+d]*coefficients[dOffset+b];
219 }
220 }
221 for (c = 0; c < Ncf; ++c) for (d = 0; d < dim; ++d) for (e = 0, u_x[(fOffset+c)*dim+d] = 0.0; e < dim; ++e) u_x[(fOffset+c)*dim+d] += invJ[e*dim+d]*refSpaceDer[c*dim+e];
222 if (u_t) {
223 for (c = 0; c < Ncf; ++c) u_t[fOffset+c] = 0.0;
224 for (b = 0; b < Nbf; ++b) {
225 for (c = 0; c < Ncf; ++c) {
226 const PetscInt cidx = b*Ncf+c;
227
228 u_t[fOffset+c] += Bq[cidx]*coefficients_t[dOffset+b];
229 }
230 }
231 }
232#if 0
233 for (c = 0; c < Ncf; ++c) {
234 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), " u[%d,%d]: %g\n", f, c, PetscRealPart(u[fOffset+c])(u[fOffset+c]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),234,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
235 if (u_t) {ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), " u_t[%d,%d]: %g\n", f, c, PetscRealPart(u_t[fOffset+c])(u_t[fOffset+c]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),235,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
236 for (d = 0; d < dim; ++d) {
237 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), " gradU[%d,%d]_%c: %g\n", f, c, 'x'+d, PetscRealPart(u_x[(fOffset+c)*dim+d])(u_x[(fOffset+c)*dim+d]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),237,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
238 }
239 }
240#endif
241 fOffset += Ncf;
242 dOffset += Nbf;
243 }
244}
245
246PETSC_STATIC_INLINEstatic inline PetscErrorCode EvaluateFaceFields(PetscDS prob, PetscInt field, PetscInt faceLoc, const PetscScalar coefficients[], PetscScalar u[])
247{
248 PetscFE fe;
249 PetscReal *faceBasis;
250 PetscInt Nb, Nc, b, c;
251 PetscErrorCode ierr;
252
253 if (!prob) return 0;
254 ierr = PetscDSGetDiscretization(prob, field, (PetscObject *) &fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),254,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
255 ierr = PetscFEGetDimension(fe, &Nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),255,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
256 ierr = PetscFEGetNumComponents(fe, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),256,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
257 ierr = PetscFEGetFaceCentroidTabulation(fe, &faceBasis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),257,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
258 for (c = 0; c < Nc; ++c) {u[c] = 0.0;}
259 for (b = 0; b < Nb; ++b) {
260 for (c = 0; c < Nc; ++c) {
261 const PetscInt cidx = b*Nc+c;
262
263 u[c] += coefficients[cidx]*faceBasis[faceLoc*Nb*Nc+cidx];
264 }
265 }
266 return 0;
267}
268
269PETSC_STATIC_INLINEstatic inline void TransformF(PetscInt dim, PetscInt Nc, PetscInt q, const PetscReal invJ[], PetscReal detJ, const PetscReal quadWeights[], PetscScalar refSpaceDer[], PetscScalar f0[], PetscScalar f1[])
270{
271 const PetscReal w = detJ*quadWeights[q];
272 PetscInt c, d, e;
273
274 if (f0) for (c = 0; c < Nc; ++c) f0[q*Nc+c] *= w;
275 if (f1) {
276 for (c = 0; c < Nc; ++c) {
277 for (d = 0; d < dim; ++d) {
278 f1[(q*Nc + c)*dim+d] = 0.0;
279 for (e = 0; e < dim; ++e) f1[(q*Nc + c)*dim+d] += invJ[d*dim+e]*refSpaceDer[c*dim+e];
280 f1[(q*Nc + c)*dim+d] *= w;
281 }
282 }
283 }
284#if 0
285 if (debug > 1) {
286 for (c = 0; c < Nc; ++c) {
287 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), " f0[%d]: %g\n", c, PetscRealPart(f0[q*Nc+c])(f0[q*Nc+c]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),287,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
288 for (d = 0; d < dim; ++d) {
289 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), " f1[%d]_%c: %g\n", c, 'x'+d, PetscRealPart(f1[(q*Nc + c)*dim+d])(f1[(q*Nc + c)*dim+d]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),289,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
290 }
291 }
292 }
293#endif
294}
295
296PETSC_STATIC_INLINEstatic inline void UpdateElementVec(PetscInt dim, PetscInt Nq, PetscInt Nb, PetscInt Nc, PetscReal basis[], PetscReal basisDer[], PetscScalar f0[], PetscScalar f1[], PetscScalar elemVec[])
297{
298 PetscInt b, c;
299
300 for (b = 0; b < Nb; ++b) {
301 elemVec[b] = 0.0;
302
303 for (c = 0; c < Nc; ++c) {
304 const PetscInt cidx = b*Nc+c;
305 PetscInt q;
306
307 for (q = 0; q < Nq; ++q) {
308 PetscInt d;
309
310 elemVec[b] += basis[q*Nb*Nc+cidx]*f0[q*Nc+c];
311 for (d = 0; d < dim; ++d) elemVec[b] += basisDer[(q*Nb*Nc+cidx)*dim+d]*f1[(q*Nc+c)*dim+d];
312 }
313 }
314 }
315#if 0
316 if (debug > 1) {
317 for (b = 0; b < Nb/Nc; ++b) {
318 for (c = 0; c < Nc; ++c) {
319 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), " elemVec[%d,%d]: %g\n", b, c, PetscRealPart(elemVec[b*Nc+c])(elemVec[b*Nc+c]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),319,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
320 }
321 }
322 }
323#endif
324}
325
326PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscFEInterpolate_Static(PetscFE fe, const PetscScalar x[], PetscInt q, PetscScalar interpolant[])
327{
328 PetscReal *basis;
329 PetscInt Nb, Nc, fc, f;
330 PetscErrorCode ierr;
331
332 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
; petscstack->line[petscstack->currentsize] = 332; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
333 ierr = PetscFEGetDimension(fe, &Nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),333,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
334 ierr = PetscFEGetNumComponents(fe, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),334,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
335 ierr = PetscFEGetDefaultTabulation(fe, &basis, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),335,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
336 for (fc = 0; fc < Nc; ++fc) {
337 interpolant[fc] = 0.0;
338 for (f = 0; f < Nb; ++f) {
339 interpolant[fc] += x[f]*basis[(q*Nb + f)*Nc + fc];
340 }
341 }
342 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)
;
343}
344
345PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscFEInterpolateGradient_Static(PetscFE fe, const PetscScalar x[], PetscInt dim, const PetscReal invJ[], const PetscReal n[], PetscInt q, PetscScalar interpolant[])
346{
347 PetscReal *basisDer;
348 PetscReal realSpaceDer[3];
349 PetscScalar compGradient[3];
350 PetscInt Nb, Nc, fc, f, d, g;
351 PetscErrorCode ierr;
352
353 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
; petscstack->line[petscstack->currentsize] = 353; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
354 ierr = PetscFEGetDimension(fe, &Nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),354,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
355 ierr = PetscFEGetNumComponents(fe, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),355,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
356 ierr = PetscFEGetDefaultTabulation(fe, NULL((void*)0), &basisDer, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),356,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
357 for (fc = 0; fc < Nc; ++fc) {
358 interpolant[fc] = 0.0;
359 for (d = 0; d < dim; ++d) compGradient[d] = 0.0;
360 for (f = 0; f < Nb; ++f) {
361
362 for (d = 0; d < dim; ++d) {
363 realSpaceDer[d] = 0.0;
364 for (g = 0; g < dim; ++g) {
365 realSpaceDer[d] += invJ[dim*dim*q + g*dim+d]*basisDer[((q*Nb + f)*Nc + fc)*dim + g];
366 }
367 compGradient[d] += x[f]*realSpaceDer[d];
368 }
369 }
370 if (n) {
371 for (d = 0; d < dim; ++d) interpolant[fc] += compGradient[d]*n[d];
372 } else {
373 for (d = 0; d < dim; ++d) interpolant[fc*dim+d] = compGradient[d];
374 }
375 }
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
379PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscFEInterpolateFieldAndGradient_Static(PetscFE fe, const PetscScalar x[], PetscInt dim, const PetscReal invJ[], PetscInt q, PetscScalar interpolant[], PetscScalar interpolantGrad[])
380{
381 PetscReal *basis, *basisDer;
382 PetscReal realSpaceDer[3];
383 PetscInt Nb, Nc, fc, f, d, g;
384 PetscErrorCode ierr;
385
386 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
; petscstack->line[petscstack->currentsize] = 386; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
387 ierr = PetscFEGetDimension(fe, &Nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),387,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
388 ierr = PetscFEGetNumComponents(fe, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),388,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
389 ierr = PetscFEGetDefaultTabulation(fe, &basis, &basisDer, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),389,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/petscfeimpl.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
390 for (fc = 0; fc < Nc; ++fc) {
391 interpolant[fc] = 0.0;
392 for (d = 0; d < dim; ++d) interpolantGrad[fc*dim+d] = 0.0;
393 for (f = 0; f < Nb; ++f) {
394 interpolant[fc] += x[f]*basis[(q*Nb + f)*Nc + fc];
395 for (d = 0; d < dim; ++d) {
396 realSpaceDer[d] = 0.0;
397 for (g = 0; g < dim; ++g) {
398 realSpaceDer[d] += invJ[dim*dim*q + g*dim+d]*basisDer[((q*Nb + f)*Nc + fc)*dim + g];
399 }
400 interpolantGrad[fc*dim+d] += x[f]*realSpaceDer[d];
401 }
402 }
403 }
404 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)
;
405}
406
407PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFEGetDimension_Basic(PetscFE, PetscInt *);
408PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFEIntegrateResidual_Basic(PetscFE, PetscDS, PetscInt, PetscInt, PetscFEGeom *, const PetscScalar [], const PetscScalar [], PetscDS, const PetscScalar [], PetscReal, PetscScalar []);
409PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFEIntegrateBdResidual_Basic(PetscFE, PetscDS, PetscInt, PetscInt, PetscFEGeom *, const PetscScalar [], const PetscScalar [], PetscDS, const PetscScalar [], PetscReal, PetscScalar[]);
410PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscFEIntegrateJacobian_Basic(PetscFE, PetscDS, PetscFEJacobianType, PetscInt, PetscInt, PetscInt, PetscFEGeom *, const PetscScalar [], const PetscScalar [], PetscDS, const PetscScalar [], PetscReal, PetscReal, PetscScalar []);
411#endif