Bug Summary

File:dm/dt/space/impls/poly/spacepoly.c
Warning:line 503, column 14
2nd function call argument is an uninitialized value

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1#include <petsc/private/petscfeimpl.h> /*I "petscfe.h" I*/
2
3PetscErrorCode PetscSpaceSetFromOptions_Polynomial(PetscOptionItems *PetscOptionsObject,PetscSpace sp)
4{
5 PetscSpace_Poly *poly = (PetscSpace_Poly *) sp->data;
6 PetscErrorCode ierr;
7
8 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 8; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
9 ierr = PetscOptionsHead(PetscOptionsObject,"PetscSpace polynomial options");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
10 ierr = PetscOptionsBool("-petscspace_poly_sym", "Use only symmetric polynomials", "PetscSpacePolynomialSetSymmetric", poly->symmetric, &poly->symmetric, NULL)PetscOptionsBool_Private(PetscOptionsObject,"-petscspace_poly_sym"
,"Use only symmetric polynomials","PetscSpacePolynomialSetSymmetric"
,poly->symmetric,&poly->symmetric,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),10,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
11 ierr = PetscOptionsBool("-petscspace_poly_tensor", "Use the tensor product polynomials", "PetscSpacePolynomialSetTensor", poly->tensor, &poly->tensor, NULL)PetscOptionsBool_Private(PetscOptionsObject,"-petscspace_poly_tensor"
,"Use the tensor product polynomials","PetscSpacePolynomialSetTensor"
,poly->tensor,&poly->tensor,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),11,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
12 ierr = PetscOptionsTail()0; {if (PetscOptionsObject->count != 1) do { do { ; if (petscstack
&& petscstack->currentsize > 0) { petscstack->
currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0);}
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),12,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
13 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)
;
14}
15
16static PetscErrorCode PetscSpacePolynomialView_Ascii(PetscSpace sp, PetscViewer v)
17{
18 PetscSpace_Poly *poly = (PetscSpace_Poly *) sp->data;
19 PetscErrorCode ierr;
20
21 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 21; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
22 ierr = PetscViewerASCIIPrintf(v, "%s space of degree %D\n", poly->tensor ? "Tensor polynomial" : "Polynomial", sp->degree);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),22,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
23 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)
;
24}
25
26PetscErrorCode PetscSpaceView_Polynomial(PetscSpace sp, PetscViewer viewer)
27{
28 PetscBool iascii;
29 PetscErrorCode ierr;
30
31 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 31; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
32 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),32,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),32,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),32,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),32,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
33 PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),33
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(viewer,PETSC_OBJECT)) return PetscError(((
MPI_Comm)0x44000001),33,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.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),33,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),33,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,2); } } while (0)
;
34 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERASCII"ascii", &iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),34,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
35 if (iascii) {ierr = PetscSpacePolynomialView_Ascii(sp, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),35,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
36 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)
;
37}
38
39PetscErrorCode PetscSpaceSetUp_Polynomial(PetscSpace sp)
40{
41 PetscSpace_Poly *poly = (PetscSpace_Poly *) sp->data;
42 PetscInt ndegree = sp->degree+1;
43 PetscInt deg;
44 PetscErrorCode ierr;
45
46 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 46; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
47 if (poly->setupCalled) 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)
;
48 ierr = PetscMalloc1(ndegree, &poly->degrees)PetscMallocA(1,PETSC_FALSE,48,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,(size_t)(ndegree)*sizeof(**(&poly->degrees)),(&poly
->degrees))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),48,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
49 for (deg = 0; deg < ndegree; ++deg) poly->degrees[deg] = deg;
50 if (poly->tensor) {
51 sp->maxDegree = sp->degree + PetscMax(sp->Nv - 1,0)(((sp->Nv - 1)<(0)) ? (0) : (sp->Nv - 1));
52 } else {
53 sp->maxDegree = sp->degree;
54 }
55 poly->setupCalled = PETSC_TRUE;
56 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)
;
57}
58
59PetscErrorCode PetscSpaceDestroy_Polynomial(PetscSpace sp)
60{
61 PetscSpace_Poly *poly = (PetscSpace_Poly *) sp->data;
62 PetscErrorCode ierr;
63
64 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 64; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
65 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpacePolynomialGetTensor_C", NULL)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpacePolynomialGetTensor_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),65,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
66 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpacePolynomialSetTensor_C", NULL)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpacePolynomialSetTensor_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),66,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
67 ierr = PetscFree(poly->degrees)((*PetscTrFree)((void*)(poly->degrees),67,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
) || ((poly->degrees) = 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/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
68 if (poly->subspaces) {
69 PetscInt d;
70
71 for (d = 0; d < sp->Nv; ++d) {
72 ierr = PetscSpaceDestroy(&poly->subspaces[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),72,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
73 }
74 }
75 ierr = PetscFree(poly->subspaces)((*PetscTrFree)((void*)(poly->subspaces),75,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
) || ((poly->subspaces) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),75,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
76 ierr = PetscFree(poly)((*PetscTrFree)((void*)(poly),76,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
) || ((poly) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),76,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
77 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
78}
79
80/* We treat the space as a tensor product of scalar polynomial spaces, so the dimension is multiplied by Nc */
81PetscErrorCode PetscSpaceGetDimension_Polynomial(PetscSpace sp, PetscInt *dim)
82{
83 PetscSpace_Poly *poly = (PetscSpace_Poly *) sp->data;
84 PetscInt deg = sp->degree;
85 PetscInt n = sp->Nv, i;
86 PetscReal D = 1.0;
87
88 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 88; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
89 if (poly->tensor) {
90 *dim = 1;
91 for (i = 0; i < n; ++i) *dim *= (deg+1);
92 } else {
93 for (i = 1; i <= n; ++i) {
94 D *= ((PetscReal) (deg+i))/i;
95 }
96 *dim = (PetscInt) (D + 0.5);
97 }
98 *dim *= sp->Nc;
99 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)
;
100}
101
102/*
103 LatticePoint_Internal - Returns all tuples of size 'len' with nonnegative integers that sum up to 'sum'.
104
105 Input Parameters:
106+ len - The length of the tuple
107. sum - The sum of all entries in the tuple
108- ind - The current multi-index of the tuple, initialized to the 0 tuple
109
110 Output Parameter:
111+ ind - The multi-index of the tuple, -1 indicates the iteration has terminated
112. tup - A tuple of len integers addig to sum
113
114 Level: developer
115
116.seealso:
117*/
118static PetscErrorCode LatticePoint_Internal(PetscInt len, PetscInt sum, PetscInt ind[], PetscInt tup[])
119{
120 PetscInt i;
121 PetscErrorCode ierr;
122
123 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 123; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
124 if (len == 1) {
125 ind[0] = -1;
126 tup[0] = sum;
127 } else if (sum == 0) {
128 for (i = 0; i < len; ++i) {ind[0] = -1; tup[i] = 0;}
129 } else {
130 tup[0] = sum - ind[0];
131 ierr = LatticePoint_Internal(len-1, ind[0], &ind[1], &tup[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),131,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
132 if (ind[1] < 0) {
133 if (ind[0] == sum) {ind[0] = -1;}
134 else {ind[1] = 0; ++ind[0];}
135 }
136 }
137 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)
;
138}
139
140/*
141 TensorPoint_Internal - Returns all tuples of size 'len' with nonnegative integers that are less than 'max'.
142
143 Input Parameters:
144+ len - The length of the tuple
145. max - The max for all entries in the tuple
146- ind - The current multi-index of the tuple, initialized to the 0 tuple
147
148 Output Parameter:
149+ ind - The multi-index of the tuple, -1 indicates the iteration has terminated
150. tup - A tuple of len integers less than max
151
152 Level: developer
153
154.seealso:
155*/
156static PetscErrorCode TensorPoint_Internal(PetscInt len, PetscInt max, PetscInt ind[], PetscInt tup[])
157{
158 PetscInt i;
159 PetscErrorCode ierr;
160
161 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 161; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
162 if (len == 1) {
163 tup[0] = ind[0]++;
164 ind[0] = ind[0] >= max ? -1 : ind[0];
165 } else if (max == 0) {
166 for (i = 0; i < len; ++i) {ind[0] = -1; tup[i] = 0;}
167 } else {
168 tup[0] = ind[0];
169 ierr = TensorPoint_Internal(len-1, max, &ind[1], &tup[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),169,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
170 if (ind[1] < 0) {
171 ind[1] = 0;
172 if (ind[0] == max-1) {ind[0] = -1;}
173 else {++ind[0];}
174 }
175 }
176 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)
;
177}
178
179/*
180 p in [0, npoints), i in [0, pdim), c in [0, Nc)
181
182 B[p][i][c] = B[p][i_scalar][c][c]
183*/
184PetscErrorCode PetscSpaceEvaluate_Polynomial(PetscSpace sp, PetscInt npoints, const PetscReal points[], PetscReal B[], PetscReal D[], PetscReal H[])
185{
186 PetscSpace_Poly *poly = (PetscSpace_Poly *) sp->data;
187 DM dm = sp->dm;
188 PetscInt Nc = sp->Nc;
189 PetscInt ndegree = sp->degree+1;
190 PetscInt *degrees = poly->degrees;
191 PetscInt dim = sp->Nv;
192 PetscReal *lpoints, *tmp, *LB, *LD, *LH;
193 PetscInt *ind, *tup;
194 PetscInt c, pdim, d, e, der, der2, i, p, deg, o;
195 PetscErrorCode ierr;
196
197 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 197; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
198 ierr = PetscSpaceGetDimension(sp, &pdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),198,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
199 pdim /= Nc;
200 ierr = DMGetWorkArray(dm, npoints, MPIU_REAL((MPI_Datatype)0x4c00080b), &lpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),200,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
201 ierr = DMGetWorkArray(dm, npoints*ndegree*3, MPIU_REAL((MPI_Datatype)0x4c00080b), &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),201,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
202 if (B || D || H) {ierr = DMGetWorkArray(dm, npoints*dim*ndegree, MPIU_REAL((MPI_Datatype)0x4c00080b), &LB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),202,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
203 if (D || H) {ierr = DMGetWorkArray(dm, npoints*dim*ndegree, MPIU_REAL((MPI_Datatype)0x4c00080b), &LD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),203,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
204 if (H) {ierr = DMGetWorkArray(dm, npoints*dim*ndegree, MPIU_REAL((MPI_Datatype)0x4c00080b), &LH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),204,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
205 for (d = 0; d < dim; ++d) {
206 for (p = 0; p < npoints; ++p) {
207 lpoints[p] = points[p*dim+d];
208 }
209 ierr = PetscDTLegendreEval(npoints, lpoints, ndegree, degrees, tmp, &tmp[1*npoints*ndegree], &tmp[2*npoints*ndegree]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),209,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
210 /* LB, LD, LH (ndegree * dim x npoints) */
211 for (deg = 0; deg < ndegree; ++deg) {
212 for (p = 0; p < npoints; ++p) {
213 if (B || D || H) LB[(deg*dim + d)*npoints + p] = tmp[(0*npoints + p)*ndegree+deg];
214 if (D || H) LD[(deg*dim + d)*npoints + p] = tmp[(1*npoints + p)*ndegree+deg];
215 if (H) LH[(deg*dim + d)*npoints + p] = tmp[(2*npoints + p)*ndegree+deg];
216 }
217 }
218 }
219 /* Multiply by A (pdim x ndegree * dim) */
220 ierr = PetscMalloc2(dim,&ind,dim,&tup)PetscMallocA(2,PETSC_FALSE,220,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,(size_t)(dim)*sizeof(**(&ind)),(&ind),(size_t)(dim)*
sizeof(**(&tup)),(&tup))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),220,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
221 if (B) {
222 /* B (npoints x pdim x Nc) */
223 ierr = PetscMemzero(B, npoints*pdim*Nc*Nc * sizeof(PetscReal));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),223,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
224 if (poly->tensor) {
225 i = 0;
226 ierr = PetscMemzero(ind, dim * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),226,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
227 while (ind[0] >= 0) {
228 ierr = TensorPoint_Internal(dim, sp->degree+1, ind, tup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),228,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
229 for (p = 0; p < npoints; ++p) {
230 B[(p*pdim + i)*Nc*Nc] = 1.0;
231 for (d = 0; d < dim; ++d) {
232 B[(p*pdim + i)*Nc*Nc] *= LB[(tup[d]*dim + d)*npoints + p];
233 }
234 }
235 ++i;
236 }
237 } else {
238 i = 0;
239 for (o = 0; o <= sp->degree; ++o) {
240 ierr = PetscMemzero(ind, dim * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),240,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
241 while (ind[0] >= 0) {
242 ierr = LatticePoint_Internal(dim, o, ind, tup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),242,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
243 for (p = 0; p < npoints; ++p) {
244 B[(p*pdim + i)*Nc*Nc] = 1.0;
245 for (d = 0; d < dim; ++d) {
246 B[(p*pdim + i)*Nc*Nc] *= LB[(tup[d]*dim + d)*npoints + p];
247 }
248 }
249 ++i;
250 }
251 }
252 }
253 /* Make direct sum basis for multicomponent space */
254 for (p = 0; p < npoints; ++p) {
255 for (i = 0; i < pdim; ++i) {
256 for (c = 1; c < Nc; ++c) {
257 B[(p*pdim*Nc + i*Nc + c)*Nc + c] = B[(p*pdim + i)*Nc*Nc];
258 }
259 }
260 }
261 }
262 if (D) {
263 /* D (npoints x pdim x Nc x dim) */
264 ierr = PetscMemzero(D, npoints*pdim*Nc*Nc*dim * sizeof(PetscReal));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),264,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
265 if (poly->tensor) {
266 i = 0;
267 ierr = PetscMemzero(ind, dim * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
268 while (ind[0] >= 0) {
269 ierr = TensorPoint_Internal(dim, sp->degree+1, ind, tup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),269,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
270 for (p = 0; p < npoints; ++p) {
271 for (der = 0; der < dim; ++der) {
272 D[(p*pdim + i)*Nc*Nc*dim + der] = 1.0;
273 for (d = 0; d < dim; ++d) {
274 if (d == der) {
275 D[(p*pdim + i)*Nc*Nc*dim + der] *= LD[(tup[d]*dim + d)*npoints + p];
276 } else {
277 D[(p*pdim + i)*Nc*Nc*dim + der] *= LB[(tup[d]*dim + d)*npoints + p];
278 }
279 }
280 }
281 }
282 ++i;
283 }
284 } else {
285 i = 0;
286 for (o = 0; o <= sp->degree; ++o) {
287 ierr = PetscMemzero(ind, dim * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),287,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
288 while (ind[0] >= 0) {
289 ierr = LatticePoint_Internal(dim, o, ind, tup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),289,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
290 for (p = 0; p < npoints; ++p) {
291 for (der = 0; der < dim; ++der) {
292 D[(p*pdim + i)*Nc*Nc*dim + der] = 1.0;
293 for (d = 0; d < dim; ++d) {
294 if (d == der) {
295 D[(p*pdim + i)*Nc*Nc*dim + der] *= LD[(tup[d]*dim + d)*npoints + p];
296 } else {
297 D[(p*pdim + i)*Nc*Nc*dim + der] *= LB[(tup[d]*dim + d)*npoints + p];
298 }
299 }
300 }
301 }
302 ++i;
303 }
304 }
305 }
306 /* Make direct sum basis for multicomponent space */
307 for (p = 0; p < npoints; ++p) {
308 for (i = 0; i < pdim; ++i) {
309 for (c = 1; c < Nc; ++c) {
310 for (d = 0; d < dim; ++d) {
311 D[((p*pdim*Nc + i*Nc + c)*Nc + c)*dim + d] = D[(p*pdim + i)*Nc*Nc*dim + d];
312 }
313 }
314 }
315 }
316 }
317 if (H) {
318 /* H (npoints x pdim x Nc x Nc x dim x dim) */
319 ierr = PetscMemzero(H, npoints*pdim*Nc*Nc*dim*dim * sizeof(PetscReal));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),319,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
320 if (poly->tensor) {
321 i = 0;
322 ierr = PetscMemzero(ind, dim * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),322,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
323 while (ind[0] >= 0) {
324 ierr = TensorPoint_Internal(dim, sp->degree+1, ind, tup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),324,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
325 for (p = 0; p < npoints; ++p) {
326 for (der = 0; der < dim; ++der) {
327 H[((p*pdim + i)*Nc*Nc*dim + der) * dim + der] = 1.0;
328 for (d = 0; d < dim; ++d) {
329 if (d == der) {
330 H[((p*pdim + i)*Nc*Nc*dim + der) * dim + der] *= LH[(tup[d]*dim + d)*npoints + p];
331 } else {
332 H[((p*pdim + i)*Nc*Nc*dim + der) * dim + der] *= LB[(tup[d]*dim + d)*npoints + p];
333 }
334 }
335 for (der2 = der + 1; der2 < dim; ++der2) {
336 H[((p*pdim + i)*Nc*Nc*dim + der) * dim + der2] = 1.0;
337 for (d = 0; d < dim; ++d) {
338 if (d == der || d == der2) {
339 H[((p*pdim + i)*Nc*Nc*dim + der) * dim + der2] *= LD[(tup[d]*dim + d)*npoints + p];
340 } else {
341 H[((p*pdim + i)*Nc*Nc*dim + der) * dim + der2] *= LB[(tup[d]*dim + d)*npoints + p];
342 }
343 }
344 H[((p*pdim + i)*Nc*Nc*dim + der2) * dim + der] = H[((p*pdim + i)*Nc*Nc*dim + der) * dim + der2];
345 }
346 }
347 }
348 ++i;
349 }
350 } else {
351 i = 0;
352 for (o = 0; o <= sp->degree; ++o) {
353 ierr = PetscMemzero(ind, dim * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),353,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
354 while (ind[0] >= 0) {
355 ierr = LatticePoint_Internal(dim, o, ind, tup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),355,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
356 for (p = 0; p < npoints; ++p) {
357 for (der = 0; der < dim; ++der) {
358 H[((p*pdim + i)*Nc*Nc*dim + der)*dim + der] = 1.0;
359 for (d = 0; d < dim; ++d) {
360 if (d == der) {
361 H[((p*pdim + i)*Nc*Nc*dim + der)*dim + der] *= LH[(tup[d]*dim + d)*npoints + p];
362 } else {
363 H[((p*pdim + i)*Nc*Nc*dim + der)*dim + der] *= LB[(tup[d]*dim + d)*npoints + p];
364 }
365 }
366 for (der2 = der + 1; der2 < dim; ++der2) {
367 H[((p*pdim + i)*Nc*Nc*dim + der) * dim + der2] = 1.0;
368 for (d = 0; d < dim; ++d) {
369 if (d == der || d == der2) {
370 H[((p*pdim + i)*Nc*Nc*dim + der) * dim + der2] *= LD[(tup[d]*dim + d)*npoints + p];
371 } else {
372 H[((p*pdim + i)*Nc*Nc*dim + der) * dim + der2] *= LB[(tup[d]*dim + d)*npoints + p];
373 }
374 }
375 H[((p*pdim + i)*Nc*Nc*dim + der2) * dim + der] = H[((p*pdim + i)*Nc*Nc*dim + der) * dim + der2];
376 }
377 }
378 }
379 ++i;
380 }
381 }
382 }
383 /* Make direct sum basis for multicomponent space */
384 for (p = 0; p < npoints; ++p) {
385 for (i = 0; i < pdim; ++i) {
386 for (c = 1; c < Nc; ++c) {
387 for (d = 0; d < dim; ++d) {
388 for (e = 0; e < dim; ++e) {
389 H[(((p*pdim*Nc + i*Nc + c)*Nc + c)*dim + d)*dim + e] = H[((p*pdim + i)*Nc*Nc*dim + d)*dim + e];
390 }
391 }
392 }
393 }
394 }
395 }
396 ierr = PetscFree2(ind,tup)PetscFreeA(2,396,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,&(ind),&(tup))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),396,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
397 if (H) {ierr = DMRestoreWorkArray(dm, npoints*dim*ndegree, MPIU_REAL((MPI_Datatype)0x4c00080b), &LH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),397,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
398 if (D || H) {ierr = DMRestoreWorkArray(dm, npoints*dim*ndegree, MPIU_REAL((MPI_Datatype)0x4c00080b), &LD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),398,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
399 if (B || D || H) {ierr = DMRestoreWorkArray(dm, npoints*dim*ndegree, MPIU_REAL((MPI_Datatype)0x4c00080b), &LB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),399,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
400 ierr = DMRestoreWorkArray(dm, npoints*ndegree*3, MPIU_REAL((MPI_Datatype)0x4c00080b), &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),400,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
401 ierr = DMRestoreWorkArray(dm, npoints, MPIU_REAL((MPI_Datatype)0x4c00080b), &lpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),401,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
402 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)
;
403}
404
405/*@
406 PetscSpacePolynomialSetTensor - Set whether a function space is a space of tensor polynomials (the space is spanned
407 by polynomials whose degree in each variabl is bounded by the given order), as opposed to polynomials (the space is
408 spanned by polynomials whose total degree---summing over all variables---is bounded by the given order).
409
410 Input Parameters:
411+ sp - the function space object
412- tensor - PETSC_TRUE for a tensor polynomial space, PETSC_FALSE for a polynomial space
413
414 Options Database:
415. -petscspace_poly_tensor <bool> - Whether to use tensor product polynomials in higher dimension
416
417 Level: beginner
418
419.seealso: PetscSpacePolynomialGetTensor(), PetscSpaceSetDegree(), PetscSpaceSetNumVariables()
420@*/
421PetscErrorCode PetscSpacePolynomialSetTensor(PetscSpace sp, PetscBool tensor)
422{
423 PetscErrorCode ierr;
424
425 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 425; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
426 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),426,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),426,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),426,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),426,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
427 ierr = PetscTryMethod(sp,"PetscSpacePolynomialSetTensor_C",(PetscSpace,PetscBool),(sp,tensor))0;{ PetscErrorCode (*f)(PetscSpace,PetscBool), __ierr; __ierr
= PetscObjectQueryFunction_Private(((PetscObject)sp),("PetscSpacePolynomialSetTensor_C"
),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr
),0)) return PetscError(((MPI_Comm)0x44000001),427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr =
(*f)(sp,tensor);do {if (__builtin_expect(!!(__ierr),0)) return
PetscError(((MPI_Comm)0x44000001),427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} }
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
428 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
429}
430
431/*@
432 PetscSpacePolynomialGetTensor - Get whether a function space is a space of tensor polynomials (the space is spanned
433 by polynomials whose degree in each variabl is bounded by the given order), as opposed to polynomials (the space is
434 spanned by polynomials whose total degree---summing over all variables---is bounded by the given order).
435
436 Input Parameters:
437. sp - the function space object
438
439 Output Parameters:
440. tensor - PETSC_TRUE for a tensor polynomial space, PETSC_FALSE for a polynomial space
441
442 Level: beginner
443
444.seealso: PetscSpacePolynomialSetTensor(), PetscSpaceSetDegree(), PetscSpaceSetNumVariables()
445@*/
446PetscErrorCode PetscSpacePolynomialGetTensor(PetscSpace sp, PetscBool *tensor)
447{
448 PetscErrorCode ierr;
449
450 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 450; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3
Within the expansion of the macro 'PetscFunctionBegin':
a
Assuming 'petscstack' is null
451 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),451,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),451,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),451,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),451,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
4
Within the expansion of the macro 'PetscValidHeaderSpecific':
a
Assuming the condition is false
452 PetscValidPointer(tensor, 2)do { if (!tensor) return PetscError(((MPI_Comm)0x44000001),452
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(tensor,PETSC_CHAR)) return PetscError(((
MPI_Comm)0x44000001),452,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
5
Within the expansion of the macro 'PetscValidPointer':
a
Assuming the condition is false
453 ierr = PetscTryMethod(sp,"PetscSpacePolynomialGetTensor_C",(PetscSpace,PetscBool*),(sp,tensor))0;{ PetscErrorCode (*f)(PetscSpace,PetscBool*), __ierr; __ierr
= PetscObjectQueryFunction_Private(((PetscObject)sp),("PetscSpacePolynomialGetTensor_C"
),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr
),0)) return PetscError(((MPI_Comm)0x44000001),453,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr =
(*f)(sp,tensor);do {if (__builtin_expect(!!(__ierr),0)) return
PetscError(((MPI_Comm)0x44000001),453,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} }
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),453,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6
Within the expansion of the macro 'PetscTryMethod':
a
Assuming '__ierr' is 0
b
Assuming 'f' is null
7
Within the expansion of the macro 'CHKERRQ':
454 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)
;
8
Within the expansion of the macro 'PetscFunctionReturn':
a
Assuming 'petscstack' is null
455}
456
457static PetscErrorCode PetscSpacePolynomialSetTensor_Polynomial(PetscSpace sp, PetscBool tensor)
458{
459 PetscSpace_Poly *poly = (PetscSpace_Poly *) sp->data;
460
461 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 461; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
462 poly->tensor = tensor;
463 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)
;
464}
465
466static PetscErrorCode PetscSpacePolynomialGetTensor_Polynomial(PetscSpace sp, PetscBool *tensor)
467{
468 PetscSpace_Poly *poly = (PetscSpace_Poly *) sp->data;
469
470 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 470; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
471 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),471,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),471,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),471,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),471,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
472 PetscValidPointer(tensor, 2)do { if (!tensor) return PetscError(((MPI_Comm)0x44000001),472
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(tensor,PETSC_CHAR)) return PetscError(((
MPI_Comm)0x44000001),472,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
473 *tensor = poly->tensor;
474 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)
;
475}
476
477static PetscErrorCode PetscSpaceGetHeightSubspace_Polynomial(PetscSpace sp, PetscInt height, PetscSpace *subsp)
478{
479 PetscSpace_Poly *poly = (PetscSpace_Poly *) sp->data;
480 PetscInt Nc, dim, order;
481 PetscBool tensor;
1
'tensor' declared without an initial value
482 PetscErrorCode ierr;
483
484 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 484; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
485 ierr = PetscSpaceGetNumComponents(sp, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),485,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
486 ierr = PetscSpaceGetNumVariables(sp, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),486,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
487 ierr = PetscSpaceGetDegree(sp, &order, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),487,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
488 ierr = PetscSpacePolynomialGetTensor(sp, &tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),488,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2
Calling 'PetscSpacePolynomialGetTensor'
9
Returning from 'PetscSpacePolynomialGetTensor'
489 if (height > dim || height < 0) {SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Asked for space at height %D for dimension %D space", height, dim)return PetscError(((MPI_Comm)0x44000001),489,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,63,PETSC_ERROR_INITIAL,"Asked for space at height %D for dimension %D space"
,height,dim)
;}
10
Assuming 'height' is >= 0
11
Taking false branch
490 if (!poly->subspaces) {ierr = PetscCalloc1(dim, &poly->subspaces)PetscMallocA(1,PETSC_TRUE,490,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,(size_t)(dim)*sizeof(**(&poly->subspaces)),(&poly
->subspaces))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),490,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
12
Assuming the condition is false
13
Taking false branch
491 if (height <= dim) {
14
Taking true branch
492 if (!poly->subspaces[height-1]) {
15
Taking true branch
493 PetscSpace sub;
494 const char *name;
495
496 ierr = PetscSpaceCreate(PetscObjectComm((PetscObject) sp), &sub);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),496,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
497 ierr = PetscObjectGetName((PetscObject) sp, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),497,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
498 ierr = PetscObjectSetName((PetscObject) sub, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),498,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
499 ierr = PetscSpaceSetType(sub, PETSCSPACEPOLYNOMIAL"poly");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),499,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
500 ierr = PetscSpaceSetNumComponents(sub, Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
501 ierr = PetscSpaceSetDegree(sub, order, PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),501,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
502 ierr = PetscSpaceSetNumVariables(sub, dim-height);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),502,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
503 ierr = PetscSpacePolynomialSetTensor(sub, tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),503,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
16
2nd function call argument is an uninitialized value
504 ierr = PetscSpaceSetUp(sub);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),504,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
505 poly->subspaces[height-1] = sub;
506 }
507 *subsp = poly->subspaces[height-1];
508 } else {
509 *subsp = NULL((void*)0);
510 }
511 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)
;
512}
513
514PetscErrorCode PetscSpaceInitialize_Polynomial(PetscSpace sp)
515{
516 PetscErrorCode ierr;
517
518 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 518; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
519 sp->ops->setfromoptions = PetscSpaceSetFromOptions_Polynomial;
520 sp->ops->setup = PetscSpaceSetUp_Polynomial;
521 sp->ops->view = PetscSpaceView_Polynomial;
522 sp->ops->destroy = PetscSpaceDestroy_Polynomial;
523 sp->ops->getdimension = PetscSpaceGetDimension_Polynomial;
524 sp->ops->evaluate = PetscSpaceEvaluate_Polynomial;
525 sp->ops->getheightsubspace = PetscSpaceGetHeightSubspace_Polynomial;
526 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpacePolynomialGetTensor_C", PetscSpacePolynomialGetTensor_Polynomial)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpacePolynomialGetTensor_C"
,(PetscVoidFunction)(PetscSpacePolynomialGetTensor_Polynomial
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),526,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
527 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpacePolynomialSetTensor_C", PetscSpacePolynomialSetTensor_Polynomial)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpacePolynomialSetTensor_C"
,(PetscVoidFunction)(PetscSpacePolynomialSetTensor_Polynomial
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),527,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
528 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)
;
529}
530
531/*MC
532 PETSCSPACEPOLYNOMIAL = "poly" - A PetscSpace object that encapsulates a polynomial space, e.g. P1 is the space of
533 linear polynomials. The space is replicated for each component.
534
535 Level: intermediate
536
537.seealso: PetscSpaceType, PetscSpaceCreate(), PetscSpaceSetType()
538M*/
539
540PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSpaceCreate_Polynomial(PetscSpace sp)
541{
542 PetscSpace_Poly *poly;
543 PetscErrorCode ierr;
544
545 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 545; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
546 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),546,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),546,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),546,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),546,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
547 ierr = PetscNewLog(sp,&poly)(PetscMallocA(1,PETSC_TRUE,547,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,(size_t)(1)*sizeof(**(((&poly)))),(((&poly)))) || PetscLogObjectMemory
((PetscObject)sp,sizeof(**(&poly))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),547,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
548 sp->data = poly;
549
550 poly->symmetric = PETSC_FALSE;
551 poly->tensor = PETSC_FALSE;
552 poly->degrees = NULL((void*)0);
553 poly->subspaces = NULL((void*)0);
554
555 ierr = PetscSpaceInitialize_Polynomial(sp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),555,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
556 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)
;
557}
558
559PetscErrorCode PetscSpacePolynomialSetSymmetric(PetscSpace sp, PetscBool sym)
560{
561 PetscSpace_Poly *poly = (PetscSpace_Poly *) sp->data;
562
563 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 563; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
564 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),564,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),564,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),564,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),564,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
565 poly->symmetric = sym;
566 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)
;
567}
568
569PetscErrorCode PetscSpacePolynomialGetSymmetric(PetscSpace sp, PetscBool *sym)
570{
571 PetscSpace_Poly *poly = (PetscSpace_Poly *) sp->data;
572
573 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
; petscstack->line[petscstack->currentsize] = 573; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
574 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),574,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),574,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),574,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),574,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
575 PetscValidPointer(sym, 2)do { if (!sym) return PetscError(((MPI_Comm)0x44000001),575,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(sym,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),575,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/space/impls/poly/spacepoly.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
576 *sym = poly->symmetric;
577 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)
;
578}
579