Bug Summary

File:dm/dt/dualspace/impls/bdm/dspacebdm.c
Warning:line 708, column 48
Array access (from variable 'hsymmetries') results in a null pointer dereference

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1#include <petsc/private/petscfeimpl.h> /*I "petscfe.h" I*/
2#include <petscdmplex.h>
3
4/*
5Let's work out BDM_1:
6
7The model basis is
8 \phi(x, y) = / a + b x + c y \
9 \ d + e x + f y /
10which is a 6 dimensional space. There are also six dual basis functions,
11 \psi_0(v) = \int^1_{-1} dx v(x, -1) \cdot <0, -1> (1-x)/2
12 \psi_1(v) = \int^1_{-1} dx v(x, -1) \cdot <0, -1> (1+x)/2
13 \psi_2(v) = 1/2 \int^1_{-1} ds v(-s, s) \cdot <1, 1> (1-s)/2 TODO I think the 1/2 is wrong here
14 \psi_3(v) = 1/2 \int^1_{-1} ds v(-s, s) \cdot <1, 1> (1+s)/2
15 \psi_4(v) = -\int^1_{-1} dy v(-1, y) \cdot <-1, 0> (1+y)/2
16 \psi_5(v) = -\int^1_{-1} dy v(-1, y) \cdot <-1, 0> (1-y)/2
17So we do the integrals
18 \psi_0(\phi) = \int^1_{-1} dx (f - d - e x) (1-x)/2 = (f - d) + e/3
19 \psi_1(\phi) = \int^1_{-1} dx (f - d - e x) (1+x)/2 = (f - d) - e/3
20 \psi_2(\phi) = \int^1_{-1} ds (a - b s + c s + d - e s + f s) (1-s)/2 = (a + d)/2 - (c + f - b - e)/6
21 \psi_3(\phi) = \int^1_{-1} ds (a - b s + c s + d - e s + f s) (1+s)/2 = (a + d)/2 + (c + f - b - e)/6
22 \psi_4(\phi) = \int^1_{-1} dy (b - a - c y) (1+y)/2 = (a - b) + c/3
23 \psi_5(\phi) = \int^1_{-1} dy (b - a - c y) (1-y)/2 = (a - b) - c/3
24so the nodal basis is
25 \phi_0 = / -(1+x)/2 \
26 \ 1/2 + 3/2 x + y /
27 \phi_1 = / 1+x \
28 \ -1 - 3/2 x - 1/2 y /
29 \phi_2 = / 1+x \
30 \ -(1+y)/2 /
31 \phi_3 = / -(1+x)/2 \
32 \ (1+y) /
33 \phi_4 = / -1 - 1/2 x - 3/2 y \
34 \ (1+y) /
35 \phi_5 = / 1/2 + x + 3/2 y \
36 \ -(1+y)/2 /
37*/
38
39static PetscErrorCode PetscDualSpaceDestroy_BDM(PetscDualSpace sp)
40{
41 PetscDualSpace_BDM *bdm = (PetscDualSpace_BDM *) sp->data;
42 PetscInt i;
43 PetscErrorCode ierr;
44
45 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 45; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
46 if (bdm->symmetries) {
47 PetscInt **selfSyms = bdm->symmetries[0];
48 PetscScalar **selfFlps = bdm->flips[0];
49
50 if (selfSyms) {
51 PetscInt **fSyms = &selfSyms[-bdm->selfSymOff], i;
52 PetscScalar **fFlps = &selfFlps[-bdm->selfSymOff];
53
54 for (i = 0; i < bdm->numSelfSym; i++) {
55 ierr = PetscFree(fSyms[i])((*PetscTrFree)((void*)(fSyms[i]),55,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((fSyms[i]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),55,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
56 ierr = PetscFree(fFlps[i])((*PetscTrFree)((void*)(fFlps[i]),56,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((fFlps[i]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),56,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
57 }
58 ierr = PetscFree(fSyms)((*PetscTrFree)((void*)(fSyms),58,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((fSyms) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),58,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
59 ierr = PetscFree(fFlps)((*PetscTrFree)((void*)(fFlps),59,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((fFlps) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),59,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
60 }
61 ierr = PetscFree(bdm->symmetries)((*PetscTrFree)((void*)(bdm->symmetries),61,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((bdm->symmetries) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),61,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
62 ierr = PetscFree(bdm->flips)((*PetscTrFree)((void*)(bdm->flips),62,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((bdm->flips) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),62,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
63 }
64 for (i = 0; i < bdm->height; i++) {
65 ierr = PetscDualSpaceDestroy(&bdm->subspaces[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),65,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
66 }
67 ierr = PetscFree(bdm->subspaces)((*PetscTrFree)((void*)(bdm->subspaces),67,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((bdm->subspaces) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),67,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
68 ierr = PetscFree(bdm->numDof)((*PetscTrFree)((void*)(bdm->numDof),68,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((bdm->numDof) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),68,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
69 ierr = PetscFree(bdm)((*PetscTrFree)((void*)(bdm),69,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((bdm) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),69,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
70 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)
;
71}
72
73static PetscErrorCode PetscDualSpaceBDMView_Ascii(PetscDualSpace sp, PetscViewer viewer)
74{
75 PetscErrorCode ierr;
76
77 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 77; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
78 ierr = PetscViewerASCIIPrintf(viewer, "BDM(%D) dual space\n", sp->order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),78,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
79 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)
;
80}
81
82static PetscErrorCode PetscDualSpaceView_BDM(PetscDualSpace sp, PetscViewer viewer)
83{
84 PetscBool iascii;
85 PetscErrorCode ierr;
86
87 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 87; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
88 PetscValidHeaderSpecific(sp, PETSCDUALSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),88,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),88,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCDUALSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),88,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),88,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
89 PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),89
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(viewer,PETSC_OBJECT)) return PetscError(((
MPI_Comm)0x44000001),89,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(viewer))->classid != PETSC_VIEWER_CLASSID
) { if (((PetscObject)(viewer))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),89,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),89,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,2); } } while (0)
;
90 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERASCII"ascii", &iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),90,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
91 if (iascii) {ierr = PetscDualSpaceBDMView_Ascii(sp, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),91,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
92 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)
;
93}
94
95static PetscErrorCode PetscDualSpaceSetFromOptions_BDM(PetscOptionItems *PetscOptionsObject,PetscDualSpace sp)
96{
97 PetscErrorCode ierr;
98
99 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 99; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
100 ierr = PetscOptionsHead(PetscOptionsObject,"PetscDualSpace BDM Options");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),100,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
101 ierr = PetscOptionsTail()0; do {if (PetscOptionsObject->count != 1) do { do { ; if (
petscstack && petscstack->currentsize > 0) { petscstack
->currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0);} while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),101,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
102 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)
;
103}
104
105static PetscErrorCode PetscDualSpaceDuplicate_BDM(PetscDualSpace sp, PetscDualSpace *spNew)
106{
107 PetscInt order, Nc;
108 const char *name;
109 PetscErrorCode ierr;
110
111 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 111; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
112 ierr = PetscDualSpaceCreate(PetscObjectComm((PetscObject) sp), spNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
113 ierr = PetscObjectGetName((PetscObject) sp, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),113,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
114 ierr = PetscObjectSetName((PetscObject) *spNew, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),114,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
115 ierr = PetscDualSpaceSetType(*spNew, PETSCDUALSPACEBDM"bdm");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),115,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
116 ierr = PetscDualSpaceGetOrder(sp, &order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),116,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
117 ierr = PetscDualSpaceSetOrder(*spNew, order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),117,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
118 ierr = PetscDualSpaceGetNumComponents(sp, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),118,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
119 ierr = PetscDualSpaceSetNumComponents(*spNew, Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),119,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
120 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)
;
121}
122
123static PetscErrorCode PetscDualSpaceGetDimension_SingleCell_BDM(PetscDualSpace sp, PetscInt order, PetscInt *dim)
124{
125 PetscDualSpace_BDM *bdm = (PetscDualSpace_BDM *) sp->data;
126 PetscReal D = 1.0;
127 PetscInt n, d;
128 PetscErrorCode ierr;
129
130 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 130; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
131 *dim = -1;
132 ierr = DMGetDimension(sp->dm, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),132,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
133 if (!n) {*dim = 0; PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;}
134 if (bdm->simplexCell) {
135 for (d = 1; d <= n; ++d) {
136 D *= ((PetscReal) (order+d))/d;
137 }
138 *dim = (PetscInt) (D + 0.5);
139 } else {
140 *dim = 1;
141 for (d = 0; d < n; ++d) *dim *= (order+1);
142 }
143 if (!bdm->faceSpace) {
144 *dim *= sp->Nc;
145 }
146 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)
;
147}
148
149static PetscErrorCode PetscDualSpaceCreateHeightSubspace_BDM(PetscDualSpace sp, PetscInt height, PetscDualSpace *bdsp)
150{
151 PetscDualSpace_BDM *bdm = (PetscDualSpace_BDM *) sp->data;
152 PetscInt order;
153 PetscErrorCode ierr;
154
155 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 155; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
156 ierr = PetscDualSpaceGetOrder(sp, &order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),156,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
157 if (!height) {
158 ierr = PetscObjectReference((PetscObject) sp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),158,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
159 *bdsp = sp;
160 } else if (!order) {
161 *bdsp = NULL((void*)0);
162 } else if (height == 1) {
163 DM dm, K;
164 PetscInt dim;
165
166 ierr = PetscDualSpaceGetDM(sp, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),166,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
167 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),167,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
168 if (height > dim || height < 0) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Asked for dual space at height %d for dimension %d reference element\n", height, dim)return PetscError(((MPI_Comm)0x44000001),168,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,63,PETSC_ERROR_INITIAL,"Asked for dual space at height %d for dimension %d reference element\n"
,height,dim)
;
169 ierr = PetscDualSpaceDuplicate(sp, bdsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),169,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
170 ierr = PetscDualSpaceCreateReferenceCell(*bdsp, dim-height, bdm->simplexCell, &K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),170,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
171 ierr = PetscDualSpaceSetDM(*bdsp, K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),171,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
172 ierr = DMDestroy(&K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),172,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
173 ((PetscDualSpace_BDM *) (*bdsp)->data)->faceSpace = PETSC_TRUE;
174 ierr = PetscDualSpaceSetUp(*bdsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),174,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
175 } else {
176 *bdsp = NULL((void*)0);
177 }
178 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)
;
179}
180
181static PetscErrorCode PetscDualSpaceBDMCreateFaceFE(PetscDualSpace sp, PetscBool tensor, PetscInt faceDim, PetscInt order, PetscFE *fe)
182{
183 DM K;
184 PetscSpace P;
185 PetscDualSpace Q;
186 PetscQuadrature q;
187 const PetscInt Nc = 1;
188 PetscInt quadPointsPerEdge;
189 PetscErrorCode ierr;
190
191 /* Create space */
192 ierr = PetscSpaceCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),192,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
193 ierr = PetscSpaceSetType(P, PETSCSPACEPOLYNOMIAL"poly");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),193,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
194 ierr = PetscSpacePolynomialSetTensor(P, tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),194,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
195 ierr = PetscSpaceSetNumComponents(P, Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
196 ierr = PetscSpaceSetNumVariables(P, faceDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),196,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
197 ierr = PetscSpaceSetDegree(P, order, order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),197,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
198 ierr = PetscSpaceSetUp(P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),198,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
199 /* Create dual space */
200 ierr = PetscDualSpaceCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),200,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
201 ierr = PetscDualSpaceSetType(Q, PETSCDUALSPACELAGRANGE"lagrange");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),201,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
202 ierr = PetscDualSpaceCreateReferenceCell(Q, faceDim, tensor ? PETSC_FALSE : PETSC_TRUE, &K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),202,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
203 ierr = PetscDualSpaceSetDM(Q, K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),203,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
204 ierr = DMDestroy(&K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),204,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
205 ierr = PetscDualSpaceSetNumComponents(Q, Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),205,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
206 ierr = PetscDualSpaceSetOrder(Q, order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),206,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
207 ierr = PetscDualSpaceLagrangeSetTensor(Q, tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),207,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
208 ierr = PetscDualSpaceSetUp(Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),208,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
209 /* Create element */
210 ierr = PetscFECreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),210,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
211 ierr = PetscFESetType(*fe, PETSCFEBASIC"basic");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),211,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
212 ierr = PetscFESetBasisSpace(*fe, P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),212,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
213 ierr = PetscFESetDualSpace(*fe, Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),213,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
214 ierr = PetscFESetNumComponents(*fe, Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),214,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
215 ierr = PetscFESetUp(*fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),215,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
216 ierr = PetscSpaceDestroy(&P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),216,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
217 ierr = PetscDualSpaceDestroy(&Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),217,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
218 /* Create quadrature (with specified order if given) */
219 quadPointsPerEdge = PetscMax(order + 1, 1)(((order + 1)<(1)) ? (1) : (order + 1));
220 if (tensor) {ierr = PetscDTGaussTensorQuadrature(faceDim, 1, quadPointsPerEdge, -1.0, 1.0, &q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),220,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
221 else {ierr = PetscDTGaussJacobiQuadrature(faceDim, 1, quadPointsPerEdge, -1.0, 1.0, &q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),221,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
222 ierr = PetscFESetQuadrature(*fe, q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),222,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
223 ierr = PetscQuadratureDestroy(&q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),223,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
224 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)
;
225}
226
227static PetscErrorCode PetscDualSpaceBDMCreateCellFE(PetscDualSpace sp, PetscBool tensor, PetscInt dim, PetscInt Nc, PetscInt order, PetscFE *fe)
228{
229 DM K;
230 PetscSpace P;
231 PetscDualSpace Q;
232 PetscQuadrature q;
233 PetscInt quadPointsPerEdge;
234 PetscErrorCode ierr;
235
236 /* Create space */
237 ierr = PetscSpaceCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),237,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
238 ierr = PetscSpaceSetType(P, PETSCSPACEPOLYNOMIAL"poly");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),238,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
239 ierr = PetscSpacePolynomialSetTensor(P, tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),239,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
240 ierr = PetscSpaceSetNumComponents(P, Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),240,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
241 ierr = PetscSpaceSetNumVariables(P, dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),241,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
242 ierr = PetscSpaceSetDegree(P, order, order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),242,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
243 ierr = PetscSpaceSetUp(P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),243,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
244 /* Create dual space */
245 /* TODO Needs NED1 dual space */
246 ierr = PetscDualSpaceCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),246,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
247 ierr = PetscDualSpaceSetType(Q, PETSCDUALSPACELAGRANGE"lagrange");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),247,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
248 ierr = PetscDualSpaceCreateReferenceCell(Q, dim, tensor ? PETSC_FALSE : PETSC_TRUE, &K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),248,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
249 ierr = PetscDualSpaceSetDM(Q, K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),249,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
250 ierr = DMDestroy(&K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),250,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
251 ierr = PetscDualSpaceSetNumComponents(Q, Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),251,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
252 ierr = PetscDualSpaceSetOrder(Q, order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),252,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
253 ierr = PetscDualSpaceLagrangeSetTensor(Q, tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),253,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
254 ierr = PetscDualSpaceSetUp(Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),254,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
255 /* Create element */
256 ierr = PetscFECreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),256,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
257 ierr = PetscFESetBasisSpace(*fe, P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),257,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
258 ierr = PetscFESetDualSpace(*fe, Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),258,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
259 ierr = PetscFESetNumComponents(*fe, Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),259,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
260 ierr = PetscFESetUp(*fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),260,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
261 ierr = PetscSpaceDestroy(&P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),261,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
262 ierr = PetscDualSpaceDestroy(&Q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),262,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
263 /* Create quadrature (with specified order if given) */
264 quadPointsPerEdge = PetscMax(order + 1, 1)(((order + 1)<(1)) ? (1) : (order + 1));
265 if (tensor) {ierr = PetscDTGaussTensorQuadrature(dim, 1, quadPointsPerEdge, -1.0, 1.0, &q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),265,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
266 else {ierr = PetscDTGaussJacobiQuadrature(dim, 1, quadPointsPerEdge, -1.0, 1.0, &q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),266,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
267 ierr = PetscFESetQuadrature(*fe, q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
268 ierr = PetscQuadratureDestroy(&q);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),268,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
269 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)
;
270}
271
272static PetscErrorCode PetscDualSpaceSetUp_BDM(PetscDualSpace sp)
273{
274 PetscDualSpace_BDM *bdm = (PetscDualSpace_BDM *) sp->data;
275 DM dm = sp->dm;
276 PetscInt order = sp->order;
277 PetscInt Nc = sp->Nc;
278 PetscBool faceSp = bdm->faceSpace;
279 MPI_Comm comm;
280 PetscSection csection;
281 Vec coordinates;
282 PetscInt depth, dim, cdim, pdimMax, pStart, pEnd, p, *pStratStart, *pStratEnd, coneSize, d, f = 0, c;
283 PetscBool simplex;
284 PetscErrorCode ierr;
285
286 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 286; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
287 ierr = PetscObjectGetComm((PetscObject) sp, &comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),287,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
288 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),288,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
289 ierr = DMGetCoordinateDim(dm, &cdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),289,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
290 ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),290,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
291 ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),291,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
292 if (depth != dim) SETERRQ2(comm, PETSC_ERR_ARG_WRONG, "BDM element requires interpolated meshes, but depth %D != topological dimension %D", depth, dim)return PetscError(comm,292,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,62,PETSC_ERROR_INITIAL,"BDM element requires interpolated meshes, but depth %D != topological dimension %D"
,depth,dim)
;
293 if (!order) SETERRQ(comm, PETSC_ERR_ARG_WRONG, "BDM elements not defined for order 0")return PetscError(comm,293,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,62,PETSC_ERROR_INITIAL,"BDM elements not defined for order 0"
)
;
294 if (!faceSp && Nc != cdim) SETERRQ2(comm, PETSC_ERR_ARG_WRONG, "BDM element has %D components != %D space dimension", Nc, cdim)return PetscError(comm,294,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,62,PETSC_ERROR_INITIAL,"BDM element has %D components != %D space dimension"
,Nc,cdim)
;
295 ierr = PetscCalloc1(dim+1, &bdm->numDof)PetscMallocA(1,PETSC_TRUE,295,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(dim+1)*sizeof(**(&bdm->numDof)),(&bdm->
numDof))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
296 ierr = PetscMalloc2(depth+1, &pStratStart, depth+1, &pStratEnd)PetscMallocA(2,PETSC_FALSE,296,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(depth+1)*sizeof(**(&pStratStart)),(&pStratStart
),(size_t)(depth+1)*sizeof(**(&pStratEnd)),(&pStratEnd
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
297 for (d = 0; d <= depth; ++d) {ierr = DMPlexGetDepthStratum(dm, d, &pStratStart[d], &pStratEnd[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),297,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
298 ierr = DMPlexGetConeSize(dm, pStratStart[depth], &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),298,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
299 ierr = DMGetCoordinateSection(dm, &csection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),299,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
300 ierr = DMGetCoordinatesLocal(dm, &coordinates);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),300,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
301 if (coneSize == dim+1) simplex = PETSC_TRUE;
302 else if (coneSize == 2 * dim) simplex = PETSC_FALSE;
303 else SETERRQ(comm, PETSC_ERR_SUP, "Only support simplices and tensor product cells")return PetscError(comm,303,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,56,PETSC_ERROR_INITIAL,"Only support simplices and tensor product cells"
)
;
304 bdm->simplexCell = simplex;
305 bdm->height = 0;
306 bdm->subspaces = NULL((void*)0);
307 /* Create the height 1 subspace for every dimension */
308 if (order > 0 && dim > 0) {
309 PetscInt i;
310
311 bdm->height = dim;
312 ierr = PetscMalloc1(dim, &bdm->subspaces)PetscMallocA(1,PETSC_FALSE,312,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(dim)*sizeof(**(&bdm->subspaces)),(&bdm->
subspaces))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),312,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
313 ierr = PetscDualSpaceCreateHeightSubspace_BDM(sp, 1, &bdm->subspaces[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),313,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
314 ierr = PetscDualSpaceSetUp(bdm->subspaces[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),314,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
315 for (i = 1; i < dim; i++) {
316 ierr = PetscDualSpaceGetHeightSubspace(bdm->subspaces[i-1], 1, &bdm->subspaces[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),316,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
317 ierr = PetscObjectReference((PetscObject) bdm->subspaces[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),317,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
318 }
319 }
320 ierr = PetscDualSpaceGetDimension_SingleCell_BDM(sp, sp->order, &pdimMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),320,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
321 pdimMax *= (pStratEnd[depth] - pStratStart[depth]);
322 ierr = PetscMalloc1(pdimMax, &sp->functional)PetscMallocA(1,PETSC_FALSE,322,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(pdimMax)*sizeof(**(&sp->functional)),(&sp
->functional))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),322,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
323 if (!dim) {
324 bdm->numDof[0] = 0;
325 } else {
326 PetscFE faceFE, cellFE;
327 PetscSection section;
328 CellRefiner cellRefiner;
329 PetscInt faceDim = PetscMax(dim-1, 1)(((dim-1)<(1)) ? (1) : (dim-1)), faceNum = 0;
330 PetscReal *v0 = NULL((void*)0), *J = NULL((void*)0), *detJ = NULL((void*)0);
331
332 ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),332,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
333 ierr = PetscSectionSetChart(section, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),333,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
334 if (!faceSp) {
335 ierr = DMPlexGetCellRefiner_Internal(dm, &cellRefiner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),335,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
336 ierr = CellRefinerGetAffineFaceTransforms_Internal(cellRefiner, NULL((void*)0), &v0, &J, NULL((void*)0), &detJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),336,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
337 }
338 /* Create P_q(f) */
339 ierr = PetscDualSpaceBDMCreateFaceFE(sp, simplex ? PETSC_FALSE : PETSC_TRUE, faceDim, order, &faceFE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),339,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
340 /* Create NED^1_{q-1}(T) = P^d_{q-2} + S_{q-1}(T) */
341 ierr = PetscDualSpaceBDMCreateCellFE(sp, simplex ? PETSC_FALSE : PETSC_TRUE, faceDim, Nc, order-1, &cellFE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),341,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
342 for (p = pStart; p < pEnd; p++) {
343 PetscBool isFace, isCell;
344 PetscInt d;
345
346 for (d = 0; d < depth; d++) {if (p >= pStratStart[d] && p < pStratEnd[d]) break;}
347 isFace = ((d == dim) && faceSp) || ((d == dim-1) && !faceSp) ? PETSC_TRUE : PETSC_FALSE;
348 isCell = ((d == dim) && !faceSp) ? PETSC_TRUE : PETSC_FALSE;
349 if (isFace) {
350 PetscQuadrature fq;
351 PetscReal *B, n[3];
352 const PetscReal *fqpoints, *fqweights;
353 PetscInt faceDim = PetscMax(dim-1, 1)(((dim-1)<(1)) ? (1) : (dim-1)), Nq, q, fdim, fb;
354
355 if (cdim == 1) {n[0] = 0.; n[1] = 1.;}
356 else {ierr = DMPlexComputeCellGeometryFVM(dm, p, NULL((void*)0), NULL((void*)0), n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),356,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
357 ierr = PetscFEGetDefaultTabulation(faceFE, &B, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),357,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
358 ierr = PetscFEGetQuadrature(faceFE, &fq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),358,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
359 ierr = PetscQuadratureGetData(fq, NULL((void*)0), NULL((void*)0), &Nq, &fqpoints, &fqweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),359,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
360 /* Create a dual basis vector for each basis function */
361 ierr = PetscFEGetDimension(faceFE, &fdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),361,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
362 for (fb = 0; fb < fdim; ++fb, ++f) {
363 PetscReal *qpoints, *qweights;
364
365 ierr = PetscQuadratureCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &sp->functional[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),365,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
366 ierr = PetscMalloc1(Nq*dim, &qpoints)PetscMallocA(1,PETSC_FALSE,366,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(Nq*dim)*sizeof(**(&qpoints)),(&qpoints))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),366,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
367 ierr = PetscCalloc1(Nq*Nc, &qweights)PetscMallocA(1,PETSC_TRUE,367,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(Nq*Nc)*sizeof(**(&qweights)),(&qweights))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),367,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
368 ierr = PetscQuadratureSetOrder(sp->functional[f], order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),368,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
369 ierr = PetscQuadratureSetData(sp->functional[f], dim, Nc, Nq, qpoints, qweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),369,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
370 for (q = 0; q < Nq; ++q) {
371 PetscInt g, h;
372
373 if (faceDim < dim) {
374 /* Transform quadrature points from face coordinates to cell coordinates */
375 for (g = 0; g < dim; ++g) {
376 qpoints[q*dim+g] = v0[faceNum*dim+g];
377 for (h = 0; h < faceDim; ++h) qpoints[q*dim+g] += J[faceNum*dim*faceDim+g*faceDim+h] * fqpoints[q*faceDim+h];
378 }
379 } else {
380 for (g = 0; g < dim; ++g) qpoints[q*dim+g] = fqpoints[q*faceDim+g];
381 }
382 /* Make Radon measure for integral \hat n p ds */
383 for (c = 0; c < Nc; ++c) qweights[q*Nc+c] = B[q*fdim+fb]*n[c]*fqweights[q]*(detJ ? detJ[faceNum] : 1.0);
384 }
385 }
386 bdm->numDof[d] = fdim;
387 ierr = PetscSectionSetDof(section, p, bdm->numDof[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),387,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
388 ++faceNum;
389 }
390 if (order < 2) continue;
391 if (isCell) {
392 PetscSpace csp;
393 PetscQuadrature cq;
394 PetscReal *B;
395 const PetscReal *cqpoints, *cqweights;
396 PetscInt Nq, q, cdim, cb;
397
398 ierr = PetscFEGetBasisSpace(cellFE, &csp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),398,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
399 ierr = PetscFEGetQuadrature(cellFE, &cq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),399,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
400 ierr = PetscQuadratureGetData(cq, NULL((void*)0), NULL((void*)0), &Nq, &cqpoints, &cqweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),400,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
401 /* Create a dual basis vector for each basis function */
402 ierr = PetscSpaceGetDimension(csp, &cdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),402,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
403 ierr = PetscMalloc1(Nq*cdim*Nc, &B)PetscMallocA(1,PETSC_FALSE,403,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(Nq*cdim*Nc)*sizeof(**(&B)),(&B))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),403,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
404 ierr = PetscSpaceEvaluate(csp, Nq, cqpoints, B, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),404,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
405 for (cb = 0; cb < cdim; ++cb, ++f) {
406 PetscReal *qpoints, *qweights;
407
408 ierr = PetscQuadratureCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &sp->functional[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),408,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
409 ierr = PetscMalloc1(Nq*dim, &qpoints)PetscMallocA(1,PETSC_FALSE,409,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(Nq*dim)*sizeof(**(&qpoints)),(&qpoints))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),409,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
410 ierr = PetscCalloc1(Nq*Nc, &qweights)PetscMallocA(1,PETSC_TRUE,410,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(Nq*Nc)*sizeof(**(&qweights)),(&qweights))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),410,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
411 ierr = PetscQuadratureSetOrder(sp->functional[f], order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),411,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
412 ierr = PetscQuadratureSetData(sp->functional[f], dim, Nc, Nq, qpoints, qweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),412,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
413 ierr = PetscArraycpy(qpoints, cqpoints, Nq*dim)((sizeof(*(qpoints)) != sizeof(*(cqpoints))) || PetscMemcpy(qpoints
,cqpoints,(Nq*dim)*sizeof(*(qpoints))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),413,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
414 for (q = 0; q < Nq; ++q) {
415 /* Make Radon measure for integral p dx */
416 for (c = 0; c < Nc; ++c) qweights[q*Nc+c] = B[(q*cdim+cb)*Nc+c]*cqweights[q*Nc+c];
417 }
418 }
419 ierr = PetscFree(B)((*PetscTrFree)((void*)(B),419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((B) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
420 bdm->numDof[d] = cdim;
421 ierr = PetscSectionSetDof(section, p, bdm->numDof[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),421,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
422 }
423 }
424 ierr = PetscFEDestroy(&faceFE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),424,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
425 ierr = PetscFEDestroy(&cellFE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),425,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
426 ierr = PetscFree(v0)((*PetscTrFree)((void*)(v0),426,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((v0) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),426,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
427 ierr = PetscFree(J)((*PetscTrFree)((void*)(J),427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((J) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
428 ierr = PetscFree(detJ)((*PetscTrFree)((void*)(detJ),428,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((detJ) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),428,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
429 ierr = PetscSectionSetUp(section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),429,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
430 { /* reorder to closure order */
431 PetscQuadrature *reorder = NULL((void*)0);
432 PetscInt *key, count;
433
434 ierr = PetscCalloc1(f, &key)PetscMallocA(1,PETSC_TRUE,434,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(f)*sizeof(**(&key)),(&key))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),434,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
435 ierr = PetscMalloc1(f, &reorder)PetscMallocA(1,PETSC_FALSE,435,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(f)*sizeof(**(&reorder)),(&reorder))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),435,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
436 for (p = pStratStart[depth], count = 0; p < pStratEnd[depth]; p++) {
437 PetscInt *closure = NULL((void*)0), closureSize, c;
438
439 ierr = DMPlexGetTransitiveClosure(dm, p, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),439,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
440 for (c = 0; c < closureSize*2; c += 2) {
441 PetscInt point = closure[c], dof, off, i;
442
443 ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),443,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
444 ierr = PetscSectionGetOffset(section, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),444,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
445 for (i = 0; i < dof; ++i) {
446 PetscInt fi = off + i;
447
448 if (!key[fi]) {
449 key[fi] = 1;
450 reorder[count++] = sp->functional[fi];
451 }
452 }
453 }
454 ierr = DMPlexRestoreTransitiveClosure(dm, p, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),454,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
455 }
456 ierr = PetscFree(key)((*PetscTrFree)((void*)(key),456,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((key) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),456,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
457 ierr = PetscFree(sp->functional)((*PetscTrFree)((void*)(sp->functional),457,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((sp->functional) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),457,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
458 sp->functional = reorder;
459 }
460 ierr = PetscSectionDestroy(&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),460,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
461 }
462 if (pStratEnd[depth] == 1 && f != pdimMax) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Number of dual basis vectors %D not equal to dimension %D", f, pdimMax)return PetscError(((MPI_Comm)0x44000001),462,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,77,PETSC_ERROR_INITIAL,"Number of dual basis vectors %D not equal to dimension %D"
,f,pdimMax)
;
463 if (f > pdimMax) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Number of dual basis vectors %D is greater than max size %D", f, pdimMax)return PetscError(((MPI_Comm)0x44000001),463,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,77,PETSC_ERROR_INITIAL,"Number of dual basis vectors %D is greater than max size %D"
,f,pdimMax)
;
464 ierr = PetscFree2(pStratStart, pStratEnd)PetscFreeA(2,464,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,&(pStratStart),&(pStratEnd))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),464,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
465 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)
;
466}
467
468static PetscErrorCode PetscDualSpaceGetDimension_BDM(PetscDualSpace sp, PetscInt *dim)
469{
470 DM K;
471 const PetscInt *numDof;
472 PetscInt spatialDim, cEnd, size = 0, d;
473 PetscErrorCode ierr;
474
475 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 475; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
476 ierr = PetscDualSpaceGetDM(sp, &K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),476,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
477 ierr = PetscDualSpaceGetNumDof(sp, &numDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
478 ierr = DMGetDimension(K, &spatialDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),478,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
479 ierr = DMPlexGetHeightStratum(K, 0, NULL((void*)0), &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
480 if (cEnd == 1) {ierr = PetscDualSpaceGetDimension_SingleCell_BDM(sp, sp->order, dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),480,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;}
481 for (d = 0; d <= spatialDim; ++d) {
482 PetscInt pStart, pEnd;
483
484 ierr = DMPlexGetDepthStratum(K, d, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),484,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
485 size += (pEnd-pStart)*numDof[d];
486 }
487 *dim = size;
488 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)
;
489}
490
491static PetscErrorCode PetscDualSpaceGetNumDof_BDM(PetscDualSpace sp, const PetscInt **numDof)
492{
493 PetscDualSpace_BDM *bdm = (PetscDualSpace_BDM *) sp->data;
494
495 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 495; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
496 *numDof = bdm->numDof;
497 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)
;
498}
499
500static PetscErrorCode PetscDualSpaceGetHeightSubspace_BDM(PetscDualSpace sp, PetscInt height, PetscDualSpace *bdsp)
501{
502 PetscDualSpace_BDM *bdm = (PetscDualSpace_BDM *) sp->data;
503 PetscErrorCode ierr;
504
505 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 505; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
506 PetscValidHeaderSpecific(sp, PETSCDUALSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),506,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),506,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCDUALSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),506,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),506,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
507 PetscValidPointer(bdsp, 2)do { if (!bdsp) return PetscError(((MPI_Comm)0x44000001),507,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(bdsp,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),507,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
508 if (height == 0) {
509 *bdsp = sp;
510 } else {
511 DM dm;
512 PetscInt dim;
513
514 ierr = PetscDualSpaceGetDM(sp, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),514,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
515 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),515,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
516 if (height > dim || height < 0) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Asked for dual space at height %D for dimension %D reference element\n", height, dim)return PetscError(((MPI_Comm)0x44000001),516,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,63,PETSC_ERROR_INITIAL,"Asked for dual space at height %D for dimension %D reference element\n"
,height,dim)
;
517 if (height <= bdm->height) {*bdsp = bdm->subspaces[height-1];}
518 else {*bdsp = NULL((void*)0);}
519 }
520 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)
;
521}
522
523#define BaryIndex(perEdge,a,b,c)(((b)*(2*perEdge+1-(b)))/2)+(c) (((b)*(2*perEdge+1-(b)))/2)+(c)
524
525#define CartIndex(perEdge,a,b)(perEdge*(a)+b) (perEdge*(a)+b)
526
527static PetscErrorCode PetscDualSpaceGetSymmetries_BDM(PetscDualSpace sp, const PetscInt ****perms, const PetscScalar ****rots)
528{
529
530 PetscDualSpace_BDM *bdm = (PetscDualSpace_BDM *) sp->data;
531 PetscInt dim, order, p, Nc;
532 PetscErrorCode ierr;
533
534 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 534; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
535 ierr = PetscDualSpaceGetOrder(sp, &order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),535,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
536 ierr = PetscDualSpaceGetNumComponents(sp, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),536,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
537 ierr = DMGetDimension(sp->dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),537,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
538 if (dim < 1) 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)
;
1
Assuming 'dim' is >= 1
2
Taking false branch
539 if (dim > 3) SETERRQ1(PetscObjectComm((PetscObject) sp), PETSC_ERR_SUP, "BDM symmetries not implemented for dim = %D > 3", dim)return PetscError(PetscObjectComm((PetscObject) sp),539,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,56,PETSC_ERROR_INITIAL,"BDM symmetries not implemented for dim = %D > 3"
,dim)
;
3
Assuming 'dim' is <= 3
4
Taking false branch
540 if (!bdm->symmetries) { /* store symmetries */
5
Assuming the condition is true
6
Taking true branch
541 PetscInt ***symmetries, **cellSymmetries;
542 PetscScalar ***flips, **cellFlips;
543 PetscInt numPoints, numFaces, d;
544
545 if (bdm->simplexCell) {
7
Assuming the condition is false
8
Taking false branch
546 numPoints = 1;
547 for (d = 0; d < dim; d++) numPoints = numPoints * 2 + 1;
548 numFaces = 1 + dim;
549 } else {
550 numPoints = PetscPowInt(3,dim);
551 numFaces = 2 * dim;
552 }
553 ierr = PetscCalloc1(numPoints, &symmetries)PetscMallocA(1,PETSC_TRUE,553,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(numPoints)*sizeof(**(&symmetries)),(&symmetries
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),553,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
554 ierr = PetscCalloc1(numPoints, &flips)PetscMallocA(1,PETSC_TRUE,554,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(numPoints)*sizeof(**(&flips)),(&flips))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),554,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
555 /* compute self symmetries */
556 bdm->numSelfSym = 2 * numFaces;
557 bdm->selfSymOff = numFaces;
558 ierr = PetscCalloc1(2*numFaces, &cellSymmetries)PetscMallocA(1,PETSC_TRUE,558,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(2*numFaces)*sizeof(**(&cellSymmetries)),(&cellSymmetries
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),558,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
559 ierr = PetscCalloc1(2*numFaces, &cellFlips)PetscMallocA(1,PETSC_TRUE,559,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(2*numFaces)*sizeof(**(&cellFlips)),(&cellFlips
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),559,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
560 /* we want to be able to index symmetries directly with the orientations, which range from [-numFaces,numFaces) */
561 symmetries[0] = &cellSymmetries[bdm->selfSymOff];
562 flips[0] = &cellFlips[bdm->selfSymOff];
563 switch (dim) {
9
Control jumps to 'case 2:' at line 594
564 case 1: /* Edge symmetries */
565 {
566 PetscScalar *invert;
567 PetscInt *reverse;
568 PetscInt dofPerEdge = order+1, eNc = 1 /* ??? */, i, j;
569
570 ierr = PetscMalloc1(dofPerEdge*eNc, &reverse)PetscMallocA(1,PETSC_FALSE,570,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(dofPerEdge*eNc)*sizeof(**(&reverse)),(&reverse
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),570,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
571 ierr = PetscMalloc1(dofPerEdge*eNc, &invert)PetscMallocA(1,PETSC_FALSE,571,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(dofPerEdge*eNc)*sizeof(**(&invert)),(&invert
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),571,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
572 for (i = 0; i < dofPerEdge; ++i) {
573 for (j = 0; j < eNc; ++j) {
574 reverse[i*eNc + j] = eNc * (dofPerEdge - 1 - i) + j;
575 invert[i*eNc + j] = -1.0;
576 }
577 }
578 symmetries[0][-2] = reverse;
579 flips[0][-2] = invert;
580
581 /* yes, this is redundant, but it makes it easier to cleanup if I don't have to worry about what not to free */
582 ierr = PetscMalloc1(dofPerEdge*eNc, &reverse)PetscMallocA(1,PETSC_FALSE,582,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(dofPerEdge*eNc)*sizeof(**(&reverse)),(&reverse
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),582,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
583 ierr = PetscMalloc1(dofPerEdge*eNc, &invert)PetscMallocA(1,PETSC_FALSE,583,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(dofPerEdge*eNc)*sizeof(**(&invert)),(&invert
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),583,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
584 for (i = 0; i < dofPerEdge; i++) {
585 for (j = 0; j < eNc; j++) {
586 reverse[i*eNc + j] = eNc * (dofPerEdge - 1 - i) + j;
587 invert[i*eNc + j] = -1.0;
588 }
589 }
590 symmetries[0][1] = reverse;
591 flips[0][1] = invert;
592 break;
593 }
594 case 2: /* Face symmetries */
595 {
596 PetscInt dofPerEdge = bdm->simplexCell ? (order - 2) : (order - 1), s;
10
'?' condition is false
597 PetscInt dofPerFace;
598
599 for (s = -numFaces; s < numFaces; s++) {
11
Loop condition is false. Execution continues on line 674
600 PetscScalar *flp;
601 PetscInt *sym, fNc = 1, i, j, k, l;
602
603 if (!s) continue;
604 if (bdm->simplexCell) {
605 dofPerFace = (dofPerEdge * (dofPerEdge + 1))/2;
606 ierr = PetscMalloc1(fNc*dofPerFace,&sym)PetscMallocA(1,PETSC_FALSE,606,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(fNc*dofPerFace)*sizeof(**(&sym)),(&sym))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),606,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
607 ierr = PetscMalloc1(fNc*dofPerFace,&flp)PetscMallocA(1,PETSC_FALSE,607,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(fNc*dofPerFace)*sizeof(**(&flp)),(&flp))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),607,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
608 for (j = 0, l = 0; j < dofPerEdge; j++) {
609 for (k = 0; k < dofPerEdge - j; k++, l++) {
610 i = dofPerEdge - 1 - j - k;
611 switch (s) {
612 case -3:
613 sym[fNc*l] = BaryIndex(dofPerEdge,i,k,j)(((k)*(2*dofPerEdge+1-(k)))/2)+(j);
614 break;
615 case -2:
616 sym[fNc*l] = BaryIndex(dofPerEdge,j,i,k)(((i)*(2*dofPerEdge+1-(i)))/2)+(k);
617 break;
618 case -1:
619 sym[fNc*l] = BaryIndex(dofPerEdge,k,j,i)(((j)*(2*dofPerEdge+1-(j)))/2)+(i);
620 break;
621 case 1:
622 sym[fNc*l] = BaryIndex(dofPerEdge,k,i,j)(((i)*(2*dofPerEdge+1-(i)))/2)+(j);
623 break;
624 case 2:
625 sym[fNc*l] = BaryIndex(dofPerEdge,j,k,i)(((k)*(2*dofPerEdge+1-(k)))/2)+(i);
626 break;
627 }
628 flp[fNc*l] = s < 0 ? -1.0 : 1.0;
629 }
630 }
631 } else {
632 dofPerFace = dofPerEdge * dofPerEdge;
633 ierr = PetscMalloc1(fNc*dofPerFace,&sym)PetscMallocA(1,PETSC_FALSE,633,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(fNc*dofPerFace)*sizeof(**(&sym)),(&sym))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),633,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
634 ierr = PetscMalloc1(fNc*dofPerFace,&flp)PetscMallocA(1,PETSC_FALSE,634,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(fNc*dofPerFace)*sizeof(**(&flp)),(&flp))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),634,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
635 for (j = 0, l = 0; j < dofPerEdge; j++) {
636 for (k = 0; k < dofPerEdge; k++, l++) {
637 switch (s) {
638 case -4:
639 sym[fNc*l] = CartIndex(dofPerEdge,k,j)(dofPerEdge*(k)+j);
640 break;
641 case -3:
642 sym[fNc*l] = CartIndex(dofPerEdge,(dofPerEdge - 1 - j),k)(dofPerEdge*((dofPerEdge - 1 - j))+k);
643 break;
644 case -2:
645 sym[fNc*l] = CartIndex(dofPerEdge,(dofPerEdge - 1 - k),(dofPerEdge - 1 - j))(dofPerEdge*((dofPerEdge - 1 - k))+(dofPerEdge - 1 - j));
646 break;
647 case -1:
648 sym[fNc*l] = CartIndex(dofPerEdge,j,(dofPerEdge - 1 - k))(dofPerEdge*(j)+(dofPerEdge - 1 - k));
649 break;
650 case 1:
651 sym[fNc*l] = CartIndex(dofPerEdge,(dofPerEdge - 1 - k),j)(dofPerEdge*((dofPerEdge - 1 - k))+j);
652 break;
653 case 2:
654 sym[fNc*l] = CartIndex(dofPerEdge,(dofPerEdge - 1 - j),(dofPerEdge - 1 - k))(dofPerEdge*((dofPerEdge - 1 - j))+(dofPerEdge - 1 - k));
655 break;
656 case 3:
657 sym[fNc*l] = CartIndex(dofPerEdge,k,(dofPerEdge - 1 - j))(dofPerEdge*(k)+(dofPerEdge - 1 - j));
658 break;
659 }
660 flp[fNc*l] = s < 0 ? -1.0 : 1.0;
661 }
662 }
663 }
664 for (i = 0; i < dofPerFace; i++) {
665 sym[fNc*i] *= fNc;
666 for (j = 1; j < fNc; j++) {
667 sym[fNc*i+j] = sym[fNc*i] + j;
668 flp[fNc*i+j] = flp[fNc*i];
669 }
670 }
671 symmetries[0][s] = sym;
672 flips[0][s] = flp;
673 }
674 break;
12
Execution continues on line 680
675 }
676 default: SETERRQ1(PetscObjectComm((PetscObject) sp), PETSC_ERR_SUP, "No symmetries for point of dimension %D", dim)return PetscError(PetscObjectComm((PetscObject) sp),676,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,56,PETSC_ERROR_INITIAL,"No symmetries for point of dimension %D"
,dim)
;
677 }
678 /* Copy subspace symmetries */
679 {
680 PetscDualSpace hsp;
681 DM K;
682 const PetscInt ***hsymmetries;
683 const PetscScalar ***hflips;
684
685 ierr = PetscDualSpaceGetHeightSubspace(sp, 1, &hsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),685,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
686 ierr = PetscDualSpaceGetSymmetries(hsp, &hsymmetries, &hflips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),686,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
13
Value assigned to 'hsymmetries'
687 if (hsymmetries || hflips) {
14
Assuming 'hsymmetries' is null
15
Assuming 'hflips' is non-null
16
Taking true branch
688 PetscBool *seen;
689 const PetscInt *cone;
690 PetscInt KclosureSize, *Kclosure = NULL((void*)0);
691
692 ierr = PetscDualSpaceGetDM(sp, &K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),692,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
693 ierr = PetscCalloc1(numPoints, &seen)PetscMallocA(1,PETSC_TRUE,693,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(numPoints)*sizeof(**(&seen)),(&seen))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),693,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
694 ierr = DMPlexGetCone(K, 0, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),694,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
695 ierr = DMPlexGetTransitiveClosure(K, 0, PETSC_TRUE, &KclosureSize, &Kclosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),695,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
696 for (p = 0; p < numFaces; ++p) {
17
Assuming 'p' is < 'numFaces'
18
Loop condition is true. Entering loop body
697 PetscInt closureSize, *closure = NULL((void*)0), q;
698
699 ierr = DMPlexGetTransitiveClosure(K, cone[p], PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),699,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
700 for (q = 0; q < closureSize; ++q) {
19
Assuming 'q' is < 'closureSize'
20
Loop condition is true. Entering loop body
701 PetscInt point = closure[q*2], r;
702
703 if (!seen[point]) {
21
Taking true branch
704 for (r = 0; r < KclosureSize; ++r) {
22
Assuming 'r' is >= 'KclosureSize'
23
Loop condition is false. Execution continues on line 707
705 if (Kclosure[r*2] == point) break;
706 }
707 seen[point] = PETSC_TRUE;
708 symmetries[r] = (PetscInt **) hsymmetries[q];
24
Array access (from variable 'hsymmetries') results in a null pointer dereference
709 flips[r] = (PetscScalar **) hflips[q];
710 }
711 }
712 ierr = DMPlexRestoreTransitiveClosure(K, cone[p], PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),712,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
713 }
714 ierr = DMPlexRestoreTransitiveClosure(K, 0, PETSC_TRUE, &KclosureSize, &Kclosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),714,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
715 ierr = PetscFree(seen)((*PetscTrFree)((void*)(seen),715,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
) || ((seen) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),715,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
716 }
717 }
718 bdm->symmetries = symmetries;
719 bdm->flips = flips;
720 }
721 if (perms) *perms = (const PetscInt ***) bdm->symmetries;
722 if (rots) *rots = (const PetscScalar ***) bdm->flips;
723 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)
;
724}
725
726static PetscErrorCode PetscDualSpaceInitialize_BDM(PetscDualSpace sp)
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/dt/dualspace/impls/bdm/dspacebdm.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 sp->ops->destroy = PetscDualSpaceDestroy_BDM;
730 sp->ops->view = PetscDualSpaceView_BDM;
731 sp->ops->setfromoptions = PetscDualSpaceSetFromOptions_BDM;
732 sp->ops->duplicate = PetscDualSpaceDuplicate_BDM;
733 sp->ops->setup = PetscDualSpaceSetUp_BDM;
734 sp->ops->getdimension = PetscDualSpaceGetDimension_BDM;
735 sp->ops->getnumdof = PetscDualSpaceGetNumDof_BDM;
736 sp->ops->getheightsubspace = PetscDualSpaceGetHeightSubspace_BDM;
737 sp->ops->getsymmetries = PetscDualSpaceGetSymmetries_BDM;
738 sp->ops->apply = PetscDualSpaceApplyDefault;
739 sp->ops->applyall = PetscDualSpaceApplyAllDefault;
740 sp->ops->createallpoints = PetscDualSpaceCreateAllPointsDefault;
741 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)
;
742}
743/*MC
744 PETSCDUALSPACEBDM = "bdm" - A PetscDualSpace object that encapsulates a dual space for Brezzi-Douglas-Marini elements
745
746 Level: intermediate
747
748.seealso: PetscDualSpaceType, PetscDualSpaceCreate(), PetscDualSpaceSetType()
749M*/
750
751PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDualSpaceCreate_BDM(PetscDualSpace sp)
752{
753 PetscDualSpace_BDM *bdm;
754 PetscErrorCode ierr;
755
756 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
; petscstack->line[petscstack->currentsize] = 756; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
757 PetscValidHeaderSpecific(sp, PETSCDUALSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),757,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),757,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCDUALSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),757,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),757,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
758 ierr = PetscNewLog(sp, &bdm)(PetscMallocA(1,PETSC_TRUE,758,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,(size_t)(1)*sizeof(**(((&bdm)))),(((&bdm)))) || PetscLogObjectMemory
((PetscObject)sp,sizeof(**(&bdm))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),758,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
759 sp->data = bdm;
760 sp->k = 3;
761
762 bdm->numDof = NULL((void*)0);
763 bdm->simplexCell = PETSC_TRUE;
764
765 ierr = PetscDualSpaceInitialize_BDM(sp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),765,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/bdm/dspacebdm.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
766 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)
;
767}