File: | dm/dt/dualspace/impls/lagrange/dspacelagrange.c |
Warning: | line 653, column 10 5th function call argument is an uninitialized value |
[?] Use j/k keys for keyboard navigation
1 | #include <petsc/private/petscfeimpl.h> /*I "petscfe.h" I*/ | |||||
2 | #include <petscdmplex.h> | |||||
3 | ||||||
4 | static PetscErrorCode PetscDualSpaceLagrangeGetTensor_Lagrange(PetscDualSpace sp, PetscBool *tensor) | |||||
5 | { | |||||
6 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *)sp->data; | |||||
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/dualspace/impls/lagrange/dspacelagrange.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 | *tensor = lag->tensorSpace; | |||||
10 | 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); | |||||
11 | } | |||||
12 | ||||||
13 | static PetscErrorCode PetscDualSpaceLagrangeSetTensor_Lagrange(PetscDualSpace sp, PetscBool tensor) | |||||
14 | { | |||||
15 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *)sp->data; | |||||
16 | ||||||
17 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 17; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
18 | lag->tensorSpace = tensor; | |||||
19 | 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); | |||||
20 | } | |||||
21 | ||||||
22 | /* | |||||
23 | LatticePointLexicographic_Internal - Returns all tuples of size 'len' with nonnegative integers that sum up to at most 'max'. | |||||
24 | Ordering is lexicographic with lowest index as least significant in ordering. | |||||
25 | e.g. for len == 2 and max == 2, this will return, in order, {0,0}, {1,0}, {2,0}, {0,1}, {1,1}, {2,0}. | |||||
26 | ||||||
27 | Input Parameters: | |||||
28 | + len - The length of the tuple | |||||
29 | . max - The maximum sum | |||||
30 | - tup - A tuple of length len+1: tup[len] > 0 indicates a stopping condition | |||||
31 | ||||||
32 | Output Parameter: | |||||
33 | . tup - A tuple of len integers whos sum is at most 'max' | |||||
34 | */ | |||||
35 | static PetscErrorCode LatticePointLexicographic_Internal(PetscInt len, PetscInt max, PetscInt tup[]) | |||||
36 | { | |||||
37 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 37; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
38 | while (len--) { | |||||
39 | max -= tup[len]; | |||||
40 | if (!max) { | |||||
41 | tup[len] = 0; | |||||
42 | break; | |||||
43 | } | |||||
44 | } | |||||
45 | tup[++len]++; | |||||
46 | 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); | |||||
47 | } | |||||
48 | ||||||
49 | /* | |||||
50 | TensorPointLexicographic_Internal - Returns all tuples of size 'len' with nonnegative integers that are all less than or equal to 'max'. | |||||
51 | Ordering is lexicographic with lowest index as least significant in ordering. | |||||
52 | e.g. for len == 2 and max == 2, this will return, in order, {0,0}, {1,0}, {2,0}, {0,1}, {1,1}, {2,1}, {0,2}, {1,2}, {2,2}. | |||||
53 | ||||||
54 | Input Parameters: | |||||
55 | + len - The length of the tuple | |||||
56 | . max - The maximum value | |||||
57 | - tup - A tuple of length len+1: tup[len] > 0 indicates a stopping condition | |||||
58 | ||||||
59 | Output Parameter: | |||||
60 | . tup - A tuple of len integers whos sum is at most 'max' | |||||
61 | */ | |||||
62 | static PetscErrorCode TensorPointLexicographic_Internal(PetscInt len, PetscInt max, PetscInt tup[]) | |||||
63 | { | |||||
64 | PetscInt i; | |||||
65 | ||||||
66 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 66; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
67 | for (i = 0; i < len; i++) { | |||||
68 | if (tup[i] < max) { | |||||
69 | break; | |||||
70 | } else { | |||||
71 | tup[i] = 0; | |||||
72 | } | |||||
73 | } | |||||
74 | tup[i]++; | |||||
75 | 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); | |||||
76 | } | |||||
77 | ||||||
78 | ||||||
79 | #define BaryIndex(perEdge,a,b,c)(((b)*(2*perEdge+1-(b)))/2)+(c) (((b)*(2*perEdge+1-(b)))/2)+(c) | |||||
80 | ||||||
81 | #define CartIndex(perEdge,a,b)(perEdge*(a)+b) (perEdge*(a)+b) | |||||
82 | ||||||
83 | static PetscErrorCode PetscDualSpaceGetSymmetries_Lagrange(PetscDualSpace sp, const PetscInt ****perms, const PetscScalar ****flips) | |||||
84 | { | |||||
85 | ||||||
86 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *) sp->data; | |||||
87 | PetscInt dim, order, p, Nc; | |||||
88 | PetscErrorCode ierr; | |||||
89 | ||||||
90 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 90; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
91 | ierr = PetscDualSpaceGetOrder(sp,&order);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
92 | ierr = PetscDualSpaceGetNumComponents(sp,&Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),92,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
93 | ierr = DMGetDimension(sp->dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),93,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
94 | if (!dim || !lag->continuous || order < 3) 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); | |||||
95 | if (dim > 3) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Lagrange symmetries not implemented for dim = %D > 3",dim)return PetscError(((MPI_Comm)0x44000001),95,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,56,PETSC_ERROR_INITIAL,"Lagrange symmetries not implemented for dim = %D > 3" ,dim); | |||||
96 | if (!lag->symmetries) { /* store symmetries */ | |||||
97 | PetscDualSpace hsp; | |||||
98 | DM K; | |||||
99 | PetscInt numPoints = 1, d; | |||||
100 | PetscInt numFaces; | |||||
101 | PetscInt ***symmetries; | |||||
102 | const PetscInt ***hsymmetries; | |||||
103 | ||||||
104 | if (lag->simplexCell) { | |||||
105 | numFaces = 1 + dim; | |||||
106 | for (d = 0; d < dim; d++) numPoints = numPoints * 2 + 1; | |||||
107 | } | |||||
108 | else { | |||||
109 | numPoints = PetscPowInt(3,dim); | |||||
110 | numFaces = 2 * dim; | |||||
111 | } | |||||
112 | ierr = PetscCalloc1(numPoints,&symmetries)PetscMallocA(1,PETSC_TRUE,112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(numPoints)*sizeof(**(&symmetries)),(&symmetries ));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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
113 | if (0 < dim && dim < 3) { /* compute self symmetries */ | |||||
114 | PetscInt **cellSymmetries; | |||||
115 | ||||||
116 | lag->numSelfSym = 2 * numFaces; | |||||
117 | lag->selfSymOff = numFaces; | |||||
118 | ierr = PetscCalloc1(2*numFaces,&cellSymmetries)PetscMallocA(1,PETSC_TRUE,118,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(2*numFaces)*sizeof(**(&cellSymmetries)),(&cellSymmetries ));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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
119 | /* we want to be able to index symmetries directly with the orientations, which range from [-numFaces,numFaces) */ | |||||
120 | symmetries[0] = &cellSymmetries[numFaces]; | |||||
121 | if (dim == 1) { | |||||
122 | PetscInt dofPerEdge = order - 1; | |||||
123 | ||||||
124 | if (dofPerEdge > 1) { | |||||
125 | PetscInt i, j, *reverse; | |||||
126 | ||||||
127 | ierr = PetscMalloc1(dofPerEdge*Nc,&reverse)PetscMallocA(1,PETSC_FALSE,127,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(dofPerEdge*Nc)*sizeof(**(&reverse)),(&reverse ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
128 | for (i = 0; i < dofPerEdge; i++) { | |||||
129 | for (j = 0; j < Nc; j++) { | |||||
130 | reverse[i*Nc + j] = Nc * (dofPerEdge - 1 - i) + j; | |||||
131 | } | |||||
132 | } | |||||
133 | symmetries[0][-2] = reverse; | |||||
134 | ||||||
135 | /* yes, this is redundant, but it makes it easier to cleanup if I don't have to worry about what not to free */ | |||||
136 | ierr = PetscMalloc1(dofPerEdge*Nc,&reverse)PetscMallocA(1,PETSC_FALSE,136,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(dofPerEdge*Nc)*sizeof(**(&reverse)),(&reverse ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),136,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
137 | for (i = 0; i < dofPerEdge; i++) { | |||||
138 | for (j = 0; j < Nc; j++) { | |||||
139 | reverse[i*Nc + j] = Nc * (dofPerEdge - 1 - i) + j; | |||||
140 | } | |||||
141 | } | |||||
142 | symmetries[0][1] = reverse; | |||||
143 | } | |||||
144 | } else { | |||||
145 | PetscInt dofPerEdge = lag->simplexCell ? (order - 2) : (order - 1), s; | |||||
146 | PetscInt dofPerFace; | |||||
147 | ||||||
148 | if (dofPerEdge > 1) { | |||||
149 | for (s = -numFaces; s < numFaces; s++) { | |||||
150 | PetscInt *sym, i, j, k, l; | |||||
151 | ||||||
152 | if (!s) continue; | |||||
153 | if (lag->simplexCell) { | |||||
154 | dofPerFace = (dofPerEdge * (dofPerEdge + 1))/2; | |||||
155 | ierr = PetscMalloc1(Nc*dofPerFace,&sym)PetscMallocA(1,PETSC_FALSE,155,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(Nc*dofPerFace)*sizeof(**(&sym)),(&sym));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),155,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
156 | for (j = 0, l = 0; j < dofPerEdge; j++) { | |||||
157 | for (k = 0; k < dofPerEdge - j; k++, l++) { | |||||
158 | i = dofPerEdge - 1 - j - k; | |||||
159 | switch (s) { | |||||
160 | case -3: | |||||
161 | sym[Nc*l] = BaryIndex(dofPerEdge,i,k,j)(((k)*(2*dofPerEdge+1-(k)))/2)+(j); | |||||
162 | break; | |||||
163 | case -2: | |||||
164 | sym[Nc*l] = BaryIndex(dofPerEdge,j,i,k)(((i)*(2*dofPerEdge+1-(i)))/2)+(k); | |||||
165 | break; | |||||
166 | case -1: | |||||
167 | sym[Nc*l] = BaryIndex(dofPerEdge,k,j,i)(((j)*(2*dofPerEdge+1-(j)))/2)+(i); | |||||
168 | break; | |||||
169 | case 1: | |||||
170 | sym[Nc*l] = BaryIndex(dofPerEdge,k,i,j)(((i)*(2*dofPerEdge+1-(i)))/2)+(j); | |||||
171 | break; | |||||
172 | case 2: | |||||
173 | sym[Nc*l] = BaryIndex(dofPerEdge,j,k,i)(((k)*(2*dofPerEdge+1-(k)))/2)+(i); | |||||
174 | break; | |||||
175 | } | |||||
176 | } | |||||
177 | } | |||||
178 | } else { | |||||
179 | dofPerFace = dofPerEdge * dofPerEdge; | |||||
180 | ierr = PetscMalloc1(Nc*dofPerFace,&sym)PetscMallocA(1,PETSC_FALSE,180,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(Nc*dofPerFace)*sizeof(**(&sym)),(&sym));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),180,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
181 | for (j = 0, l = 0; j < dofPerEdge; j++) { | |||||
182 | for (k = 0; k < dofPerEdge; k++, l++) { | |||||
183 | switch (s) { | |||||
184 | case -4: | |||||
185 | sym[Nc*l] = CartIndex(dofPerEdge,k,j)(dofPerEdge*(k)+j); | |||||
186 | break; | |||||
187 | case -3: | |||||
188 | sym[Nc*l] = CartIndex(dofPerEdge,(dofPerEdge - 1 - j),k)(dofPerEdge*((dofPerEdge - 1 - j))+k); | |||||
189 | break; | |||||
190 | case -2: | |||||
191 | sym[Nc*l] = CartIndex(dofPerEdge,(dofPerEdge - 1 - k),(dofPerEdge - 1 - j))(dofPerEdge*((dofPerEdge - 1 - k))+(dofPerEdge - 1 - j)); | |||||
192 | break; | |||||
193 | case -1: | |||||
194 | sym[Nc*l] = CartIndex(dofPerEdge,j,(dofPerEdge - 1 - k))(dofPerEdge*(j)+(dofPerEdge - 1 - k)); | |||||
195 | break; | |||||
196 | case 1: | |||||
197 | sym[Nc*l] = CartIndex(dofPerEdge,(dofPerEdge - 1 - k),j)(dofPerEdge*((dofPerEdge - 1 - k))+j); | |||||
198 | break; | |||||
199 | case 2: | |||||
200 | sym[Nc*l] = CartIndex(dofPerEdge,(dofPerEdge - 1 - j),(dofPerEdge - 1 - k))(dofPerEdge*((dofPerEdge - 1 - j))+(dofPerEdge - 1 - k)); | |||||
201 | break; | |||||
202 | case 3: | |||||
203 | sym[Nc*l] = CartIndex(dofPerEdge,k,(dofPerEdge - 1 - j))(dofPerEdge*(k)+(dofPerEdge - 1 - j)); | |||||
204 | break; | |||||
205 | } | |||||
206 | } | |||||
207 | } | |||||
208 | } | |||||
209 | for (i = 0; i < dofPerFace; i++) { | |||||
210 | sym[Nc*i] *= Nc; | |||||
211 | for (j = 1; j < Nc; j++) { | |||||
212 | sym[Nc*i+j] = sym[Nc*i] + j; | |||||
213 | } | |||||
214 | } | |||||
215 | symmetries[0][s] = sym; | |||||
216 | } | |||||
217 | } | |||||
218 | } | |||||
219 | } | |||||
220 | ierr = PetscDualSpaceGetHeightSubspace(sp,1,&hsp);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
221 | ierr = PetscDualSpaceGetSymmetries(hsp,&hsymmetries,NULL((void*)0));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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
222 | if (hsymmetries) { | |||||
223 | PetscBool *seen; | |||||
224 | const PetscInt *cone; | |||||
225 | PetscInt KclosureSize, *Kclosure = NULL((void*)0); | |||||
226 | ||||||
227 | ierr = PetscDualSpaceGetDM(sp,&K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),227,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
228 | ierr = PetscCalloc1(numPoints,&seen)PetscMallocA(1,PETSC_TRUE,228,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(numPoints)*sizeof(**(&seen)),(&seen));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),228,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
229 | ierr = DMPlexGetCone(K,0,&cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),229,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
230 | ierr = DMPlexGetTransitiveClosure(K,0,PETSC_TRUE,&KclosureSize,&Kclosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),230,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
231 | for (p = 0; p < numFaces; p++) { | |||||
232 | PetscInt closureSize, *closure = NULL((void*)0), q; | |||||
233 | ||||||
234 | ierr = DMPlexGetTransitiveClosure(K,cone[p],PETSC_TRUE,&closureSize,&closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),234,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
235 | for (q = 0; q < closureSize; q++) { | |||||
236 | PetscInt point = closure[2*q], r; | |||||
237 | ||||||
238 | if(!seen[point]) { | |||||
239 | for (r = 0; r < KclosureSize; r++) { | |||||
240 | if (Kclosure[2 * r] == point) break; | |||||
241 | } | |||||
242 | seen[point] = PETSC_TRUE; | |||||
243 | symmetries[r] = (PetscInt **) hsymmetries[q]; | |||||
244 | } | |||||
245 | } | |||||
246 | ierr = DMPlexRestoreTransitiveClosure(K,cone[p],PETSC_TRUE,&closureSize,&closure);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
247 | } | |||||
248 | ierr = DMPlexRestoreTransitiveClosure(K,0,PETSC_TRUE,&KclosureSize,&Kclosure);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
249 | ierr = PetscFree(seen)((*PetscTrFree)((void*)(seen),249,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ) || ((seen) = 0,0));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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
250 | } | |||||
251 | lag->symmetries = symmetries; | |||||
252 | } | |||||
253 | if (perms) *perms = (const PetscInt ***) lag->symmetries; | |||||
254 | 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); | |||||
255 | } | |||||
256 | ||||||
257 | /*@C | |||||
258 | PetscDualSpaceGetSymmetries - Returns a description of the symmetries of this basis | |||||
259 | ||||||
260 | Not collective | |||||
261 | ||||||
262 | Input Parameter: | |||||
263 | . sp - the PetscDualSpace object | |||||
264 | ||||||
265 | Output Parameters: | |||||
266 | + perms - Permutations of the local degrees of freedom, parameterized by the point orientation | |||||
267 | - flips - Sign reversal of the local degrees of freedom, parameterized by the point orientation | |||||
268 | ||||||
269 | Note: The permutation and flip arrays are organized in the following way | |||||
270 | $ perms[p][ornt][dof # on point] = new local dof # | |||||
271 | $ flips[p][ornt][dof # on point] = reversal or not | |||||
272 | ||||||
273 | Level: developer | |||||
274 | ||||||
275 | .seealso: PetscDualSpaceSetSymmetries() | |||||
276 | @*/ | |||||
277 | PetscErrorCode PetscDualSpaceGetSymmetries(PetscDualSpace sp, const PetscInt ****perms, const PetscScalar ****flips) | |||||
278 | { | |||||
279 | PetscErrorCode ierr; | |||||
280 | ||||||
281 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 281; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
282 | PetscValidHeaderSpecific(sp,PETSCDUALSPACE_CLASSID,1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),282,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),282,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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),282,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),282,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||||
283 | if (perms) { | |||||
284 | PetscValidPointer(perms,2)do { if (!perms) return PetscError(((MPI_Comm)0x44000001),284 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(perms,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),284,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||||
285 | *perms = NULL((void*)0); | |||||
286 | } | |||||
287 | if (flips) { | |||||
288 | PetscValidPointer(flips,3)do { if (!flips) return PetscError(((MPI_Comm)0x44000001),288 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(flips,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),288,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); | |||||
289 | *flips = NULL((void*)0); | |||||
290 | } | |||||
291 | if (sp->ops->getsymmetries) { | |||||
292 | ierr = (sp->ops->getsymmetries)(sp,perms,flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),292,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
293 | } | |||||
294 | 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); | |||||
295 | } | |||||
296 | ||||||
297 | static PetscErrorCode PetscDualSpaceLagrangeView_Ascii(PetscDualSpace sp, PetscViewer viewer) | |||||
298 | { | |||||
299 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *) sp->data; | |||||
300 | PetscErrorCode ierr; | |||||
301 | ||||||
302 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 302; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
303 | ierr = PetscViewerASCIIPrintf(viewer, "%s %sLagrange dual space\n", lag->continuous ? "Continuous" : "Discontinuous", lag->tensorSpace ? "tensor " : "");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),303,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
304 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||||
305 | } | |||||
306 | ||||||
307 | PetscErrorCode PetscDualSpaceView_Lagrange(PetscDualSpace sp, PetscViewer viewer) | |||||
308 | { | |||||
309 | PetscBool iascii; | |||||
310 | PetscErrorCode ierr; | |||||
311 | ||||||
312 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 312; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
313 | PetscValidHeaderSpecific(sp, PETSCDUALSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),313,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),313,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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),313,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),313,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||||
314 | PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),314 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if ( !PetscCheckPointer(viewer,PETSC_OBJECT)) return PetscError((( MPI_Comm)0x44000001),314,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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),314,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,2); else return PetscError(((MPI_Comm)0x44000001),314,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,2); } } while (0); | |||||
315 | ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERASCII"ascii", &iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),315,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
316 | if (iascii) {ierr = PetscDualSpaceLagrangeView_Ascii(sp, viewer);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||||
317 | 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); | |||||
318 | } | |||||
319 | ||||||
320 | static PetscErrorCode PetscDualSpaceGetDimension_SingleCell_Lagrange(PetscDualSpace sp, PetscInt order, PetscInt *dim) | |||||
321 | { | |||||
322 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *) sp->data; | |||||
323 | PetscReal D = 1.0; | |||||
324 | PetscInt n, i; | |||||
325 | PetscErrorCode ierr; | |||||
326 | ||||||
327 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 327; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
328 | *dim = -1; /* Ensure that the compiler knows *dim is set. */ | |||||
329 | ierr = DMGetDimension(sp->dm, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),329,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
330 | if (!lag->tensorSpace) { | |||||
331 | for (i = 1; i <= n; ++i) { | |||||
332 | D *= ((PetscReal) (order+i))/i; | |||||
333 | } | |||||
334 | *dim = (PetscInt) (D + 0.5); | |||||
335 | } else { | |||||
336 | *dim = 1; | |||||
337 | for (i = 0; i < n; ++i) *dim *= (order+1); | |||||
338 | } | |||||
339 | *dim *= sp->Nc; | |||||
340 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||||
341 | } | |||||
342 | ||||||
343 | static PetscErrorCode PetscDualSpaceCreateHeightSubspace_Lagrange(PetscDualSpace sp, PetscInt height, PetscDualSpace *bdsp) | |||||
344 | { | |||||
345 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *) sp->data; | |||||
346 | PetscBool continuous, tensor; | |||||
347 | PetscInt order; | |||||
348 | PetscErrorCode ierr; | |||||
349 | ||||||
350 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 350; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
351 | PetscValidHeaderSpecific(sp, PETSCDUALSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),351,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),351,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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),351,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),351,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||||
352 | PetscValidPointer(bdsp,2)do { if (!bdsp) return PetscError(((MPI_Comm)0x44000001),352, __func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(bdsp,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),352,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||||
353 | ierr = PetscDualSpaceLagrangeGetContinuity(sp,&continuous);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),353,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
354 | ierr = PetscDualSpaceGetOrder(sp,&order);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),354,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
355 | if (height == 0) { | |||||
356 | ierr = PetscObjectReference((PetscObject)sp);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
357 | *bdsp = sp; | |||||
358 | } else if (continuous == PETSC_FALSE || !order) { | |||||
359 | *bdsp = NULL((void*)0); | |||||
360 | } else { | |||||
361 | DM dm, K; | |||||
362 | PetscInt dim; | |||||
363 | ||||||
364 | ierr = PetscDualSpaceGetDM(sp,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),364,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
365 | ierr = DMGetDimension(dm,&dim);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
366 | 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),366,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,63,PETSC_ERROR_INITIAL,"Asked for dual space at height %d for dimension %d reference element\n" ,height,dim);} | |||||
367 | ierr = PetscDualSpaceDuplicate(sp,bdsp);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
368 | ierr = PetscDualSpaceCreateReferenceCell(*bdsp, dim-height, lag->simplexCell, &K);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
369 | ierr = PetscDualSpaceSetDM(*bdsp, K);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
370 | ierr = DMDestroy(&K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),370,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
371 | ierr = PetscDualSpaceLagrangeGetTensor(sp,&tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),371,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
372 | ierr = PetscDualSpaceLagrangeSetTensor(*bdsp,tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),372,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
373 | ierr = PetscDualSpaceSetUp(*bdsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),373,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
374 | } | |||||
375 | 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); | |||||
376 | } | |||||
377 | ||||||
378 | PetscErrorCode PetscDualSpaceSetUp_Lagrange(PetscDualSpace sp) | |||||
379 | { | |||||
380 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *) sp->data; | |||||
381 | DM dm = sp->dm; | |||||
382 | PetscInt order = sp->order; | |||||
383 | PetscInt Nc = sp->Nc; | |||||
384 | PetscBool continuous; | |||||
385 | PetscSection csection; | |||||
386 | Vec coordinates; | |||||
387 | PetscReal *qpoints, *qweights; | |||||
388 | PetscInt depth, dim, pdimMax, pStart, pEnd, p, *pStratStart, *pStratEnd, coneSize, d, f = 0, c; | |||||
389 | PetscBool simplex, tensorSpace; | |||||
390 | PetscErrorCode ierr; | |||||
391 | ||||||
392 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 392; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
393 | /* Classify element type */ | |||||
394 | if (!order) lag->continuous = PETSC_FALSE; | |||||
395 | continuous = lag->continuous; | |||||
396 | ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),396,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
397 | ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),397,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
398 | ierr = DMPlexGetChart(dm, &pStart, &pEnd);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
399 | ierr = PetscCalloc1(dim+1, &lag->numDof)PetscMallocA(1,PETSC_TRUE,399,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(dim+1)*sizeof(**(&lag->numDof)),(&lag-> numDof));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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
400 | ierr = PetscMalloc2(depth+1,&pStratStart,depth+1,&pStratEnd)PetscMallocA(2,PETSC_FALSE,400,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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),400,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
401 | 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),401,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||||
402 | ierr = DMPlexGetConeSize(dm, pStratStart[depth], &coneSize);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
403 | ierr = DMGetCoordinateSection(dm, &csection);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
404 | ierr = DMGetCoordinatesLocal(dm, &coordinates);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
405 | if (depth == 1) { | |||||
406 | if (coneSize == dim+1) simplex = PETSC_TRUE; | |||||
407 | else if (coneSize == 1 << dim) simplex = PETSC_FALSE; | |||||
408 | else SETERRQ(PETSC_COMM_SELF, PETSC_ERR_SUP, "Only support simplices and tensor product cells")return PetscError(((MPI_Comm)0x44000001),408,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,56,PETSC_ERROR_INITIAL,"Only support simplices and tensor product cells" ); | |||||
409 | } else if (depth == dim) { | |||||
410 | if (coneSize == dim+1) simplex = PETSC_TRUE; | |||||
411 | else if (coneSize == 2 * dim) simplex = PETSC_FALSE; | |||||
412 | else SETERRQ(PETSC_COMM_SELF, PETSC_ERR_SUP, "Only support simplices and tensor product cells")return PetscError(((MPI_Comm)0x44000001),412,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,56,PETSC_ERROR_INITIAL,"Only support simplices and tensor product cells" ); | |||||
413 | } else SETERRQ(PETSC_COMM_SELF, PETSC_ERR_SUP, "Only support cell-vertex meshes or interpolated meshes")return PetscError(((MPI_Comm)0x44000001),413,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,56,PETSC_ERROR_INITIAL,"Only support cell-vertex meshes or interpolated meshes" ); | |||||
414 | lag->simplexCell = simplex; | |||||
415 | if (dim > 1 && continuous && lag->simplexCell == lag->tensorSpace) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "Mismatching simplex/tensor cells and spaces only allowed for discontinuous elements")return PetscError(((MPI_Comm)0x44000001),415,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,56,PETSC_ERROR_INITIAL,"Mismatching simplex/tensor cells and spaces only allowed for discontinuous elements" ); | |||||
416 | tensorSpace = lag->tensorSpace; | |||||
417 | lag->height = 0; | |||||
418 | lag->subspaces = NULL((void*)0); | |||||
419 | if (continuous && sp->order > 0 && dim > 0) { | |||||
420 | PetscInt i; | |||||
421 | ||||||
422 | lag->height = dim; | |||||
423 | ierr = PetscMalloc1(dim,&lag->subspaces)PetscMallocA(1,PETSC_FALSE,423,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(dim)*sizeof(**(&lag->subspaces)),(&lag-> subspaces));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),423,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
424 | ierr = PetscDualSpaceCreateHeightSubspace_Lagrange(sp,1,&lag->subspaces[0]);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
425 | ierr = PetscDualSpaceSetUp(lag->subspaces[0]);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
426 | for (i = 1; i < dim; i++) { | |||||
427 | ierr = PetscDualSpaceGetHeightSubspace(lag->subspaces[i-1],1,&lag->subspaces[i]);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
428 | ierr = PetscObjectReference((PetscObject)(lag->subspaces[i]));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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
429 | } | |||||
430 | } | |||||
431 | ierr = PetscDualSpaceGetDimension_SingleCell_Lagrange(sp, sp->order, &pdimMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),431,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
432 | pdimMax *= (pStratEnd[depth] - pStratStart[depth]); | |||||
433 | ierr = PetscMalloc1(pdimMax, &sp->functional)PetscMallocA(1,PETSC_FALSE,433,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(pdimMax)*sizeof(**(&sp->functional)),(&sp ->functional));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),433,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
434 | if (!dim) { | |||||
435 | for (c = 0; c < Nc; ++c) { | |||||
436 | ierr = PetscQuadratureCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &sp->functional[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),436,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
437 | ierr = PetscCalloc1(Nc, &qweights)PetscMallocA(1,PETSC_TRUE,437,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(Nc)*sizeof(**(&qweights)),(&qweights));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),437,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
438 | ierr = PetscQuadratureSetOrder(sp->functional[f], 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),438,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
439 | ierr = PetscQuadratureSetData(sp->functional[f], 0, Nc, 1, NULL((void*)0), qweights);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
440 | qweights[c] = 1.0; | |||||
441 | ++f; | |||||
442 | lag->numDof[0]++; | |||||
443 | } | |||||
444 | } else { | |||||
445 | PetscInt *tup; | |||||
446 | PetscReal *v0, *hv0, *J, *invJ, detJ, hdetJ; | |||||
447 | PetscSection section; | |||||
448 | ||||||
449 | ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),§ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),449,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
450 | ierr = PetscSectionSetChart(section,pStart,pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),450,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
451 | ierr = PetscCalloc5(dim+1,&tup,dim,&v0,dim,&hv0,dim*dim,&J,dim*dim,&invJ)PetscMallocA(5,PETSC_TRUE,451,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(dim+1)*sizeof(**(&tup)),(&tup),(size_t)(dim )*sizeof(**(&v0)),(&v0),(size_t)(dim)*sizeof(**(& hv0)),(&hv0),(size_t)(dim*dim)*sizeof(**(&J)),(&J ),(size_t)(dim*dim)*sizeof(**(&invJ)),(&invJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),451,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
452 | for (p = pStart; p < pEnd; p++) { | |||||
453 | PetscInt pointDim, d, nFunc = 0; | |||||
454 | PetscDualSpace hsp; | |||||
455 | ||||||
456 | ierr = DMPlexComputeCellGeometryFEM(dm, p, NULL((void*)0), v0, J, invJ, &detJ);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
457 | for (d = 0; d < depth; d++) {if (p >= pStratStart[d] && p < pStratEnd[d]) break;} | |||||
458 | pointDim = (depth == 1 && d == 1) ? dim : d; | |||||
459 | hsp = ((pointDim < dim) && lag->subspaces) ? lag->subspaces[dim - pointDim - 1] : NULL((void*)0); | |||||
460 | if (hsp) { | |||||
461 | PetscDualSpace_Lag *hlag = (PetscDualSpace_Lag *) hsp->data; | |||||
462 | DM hdm; | |||||
463 | ||||||
464 | ierr = PetscDualSpaceGetDM(hsp,&hdm);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
465 | ierr = DMPlexComputeCellGeometryFEM(hdm, 0, NULL((void*)0), hv0, NULL((void*)0), NULL((void*)0), &hdetJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),465,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
466 | nFunc = lag->numDof[pointDim] = hlag->numDof[pointDim]; | |||||
467 | } | |||||
468 | if (pointDim == dim) { | |||||
469 | /* Cells, create for self */ | |||||
470 | PetscInt orderEff = continuous ? (!tensorSpace ? order-1-dim : order-2) : order; | |||||
471 | PetscReal denom = continuous ? order : (!tensorSpace ? order+1+dim : order+2); | |||||
472 | PetscReal numer = (!simplex || !tensorSpace) ? 2. : (2./dim); | |||||
473 | PetscReal dx = numer/denom; | |||||
474 | PetscInt cdim, d, d2; | |||||
475 | ||||||
476 | if (orderEff < 0) continue; | |||||
477 | ierr = PetscDualSpaceGetDimension_SingleCell_Lagrange(sp, orderEff, &cdim);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
478 | ierr = PetscMemzero(tup,(dim+1)*sizeof(PetscInt));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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
479 | if (!tensorSpace) { | |||||
480 | while (!tup[dim]) { | |||||
481 | for (c = 0; c < Nc; ++c) { | |||||
482 | ierr = PetscQuadratureCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &sp->functional[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),482,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
483 | ierr = PetscMalloc1(dim, &qpoints)PetscMallocA(1,PETSC_FALSE,483,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(dim)*sizeof(**(&qpoints)),(&qpoints));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),483,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
484 | ierr = PetscCalloc1(Nc, &qweights)PetscMallocA(1,PETSC_TRUE,484,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(Nc)*sizeof(**(&qweights)),(&qweights));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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
485 | ierr = PetscQuadratureSetOrder(sp->functional[f], 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),485,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
486 | ierr = PetscQuadratureSetData(sp->functional[f], dim, Nc, 1, qpoints, qweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),486,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
487 | for (d = 0; d < dim; ++d) { | |||||
488 | qpoints[d] = v0[d]; | |||||
489 | for (d2 = 0; d2 < dim; ++d2) qpoints[d] += J[d*dim+d2]*((tup[d2]+1)*dx); | |||||
490 | } | |||||
491 | qweights[c] = 1.0; | |||||
492 | ++f; | |||||
493 | } | |||||
494 | ierr = LatticePointLexicographic_Internal(dim, orderEff, tup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),494,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
495 | } | |||||
496 | } else { | |||||
497 | while (!tup[dim]) { | |||||
498 | for (c = 0; c < Nc; ++c) { | |||||
499 | ierr = PetscQuadratureCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &sp->functional[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),499,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
500 | ierr = PetscMalloc1(dim, &qpoints)PetscMallocA(1,PETSC_FALSE,500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(dim)*sizeof(**(&qpoints)),(&qpoints));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
501 | ierr = PetscCalloc1(Nc, &qweights)PetscMallocA(1,PETSC_TRUE,501,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(Nc)*sizeof(**(&qweights)),(&qweights));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),501,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
502 | ierr = PetscQuadratureSetOrder(sp->functional[f], 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),502,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
503 | ierr = PetscQuadratureSetData(sp->functional[f], dim, Nc, 1, qpoints, qweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),503,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
504 | for (d = 0; d < dim; ++d) { | |||||
505 | qpoints[d] = v0[d]; | |||||
506 | for (d2 = 0; d2 < dim; ++d2) qpoints[d] += J[d*dim+d2]*((tup[d2]+1)*dx); | |||||
507 | } | |||||
508 | qweights[c] = 1.0; | |||||
509 | ++f; | |||||
510 | } | |||||
511 | ierr = TensorPointLexicographic_Internal(dim, orderEff, tup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),511,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
512 | } | |||||
513 | } | |||||
514 | lag->numDof[dim] = cdim; | |||||
515 | } else { /* transform functionals from subspaces */ | |||||
516 | PetscInt q; | |||||
517 | ||||||
518 | for (q = 0; q < nFunc; q++, f++) { | |||||
519 | PetscQuadrature fn; | |||||
520 | PetscInt fdim, Nc, c, nPoints, i; | |||||
521 | const PetscReal *points; | |||||
522 | const PetscReal *weights; | |||||
523 | PetscReal *qpoints; | |||||
524 | PetscReal *qweights; | |||||
525 | ||||||
526 | ierr = PetscDualSpaceGetFunctional(hsp, q, &fn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),526,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
527 | ierr = PetscQuadratureGetData(fn,&fdim,&Nc,&nPoints,&points,&weights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),527,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
528 | if (fdim != pointDim) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Expected height dual space dim %D, got %D",pointDim,fdim)return PetscError(((MPI_Comm)0x44000001),528,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,77,PETSC_ERROR_INITIAL,"Expected height dual space dim %D, got %D" ,pointDim,fdim); | |||||
529 | ierr = PetscMalloc1(nPoints * dim, &qpoints)PetscMallocA(1,PETSC_FALSE,529,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(nPoints * dim)*sizeof(**(&qpoints)),(&qpoints ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),529,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
530 | ierr = PetscCalloc1(nPoints * Nc, &qweights)PetscMallocA(1,PETSC_TRUE,530,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(nPoints * Nc)*sizeof(**(&qweights)),(&qweights ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),530,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
531 | for (i = 0; i < nPoints; i++) { | |||||
532 | PetscInt j, k; | |||||
533 | PetscReal *qp = &qpoints[i * dim]; | |||||
534 | ||||||
535 | for (c = 0; c < Nc; ++c) qweights[i*Nc+c] = weights[i*Nc+c]; | |||||
536 | for (j = 0; j < dim; ++j) qp[j] = v0[j]; | |||||
537 | for (j = 0; j < dim; ++j) { | |||||
538 | for (k = 0; k < pointDim; k++) qp[j] += J[dim * j + k] * (points[pointDim * i + k] - hv0[k]); | |||||
539 | } | |||||
540 | } | |||||
541 | ierr = PetscQuadratureCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &sp->functional[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),541,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
542 | ierr = PetscQuadratureSetOrder(sp->functional[f],0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),542,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
543 | ierr = PetscQuadratureSetData(sp->functional[f],dim,Nc,nPoints,qpoints,qweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),543,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
544 | } | |||||
545 | } | |||||
546 | ierr = PetscSectionSetDof(section,p,lag->numDof[pointDim]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),546,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
547 | } | |||||
548 | ierr = PetscFree5(tup,v0,hv0,J,invJ)PetscFreeA(5,548,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,&(tup),&(v0),&(hv0),&(J),&(invJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),548,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
549 | ierr = PetscSectionSetUp(section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),549,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
550 | { /* reorder to closure order */ | |||||
551 | PetscInt *key, count; | |||||
552 | PetscQuadrature *reorder = NULL((void*)0); | |||||
553 | ||||||
554 | ierr = PetscCalloc1(f,&key)PetscMallocA(1,PETSC_TRUE,554,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(f)*sizeof(**(&key)),(&key));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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
555 | ierr = PetscMalloc1(f*sp->Nc,&reorder)PetscMallocA(1,PETSC_FALSE,555,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(f*sp->Nc)*sizeof(**(&reorder)),(&reorder ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),555,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
556 | ||||||
557 | for (p = pStratStart[depth], count = 0; p < pStratEnd[depth]; p++) { | |||||
558 | PetscInt *closure = NULL((void*)0), closureSize, c; | |||||
559 | ||||||
560 | ierr = DMPlexGetTransitiveClosure(dm,p,PETSC_TRUE,&closureSize,&closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),560,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
561 | for (c = 0; c < closureSize; c++) { | |||||
562 | PetscInt point = closure[2 * c], dof, off, i; | |||||
563 | ||||||
564 | ierr = PetscSectionGetDof(section,point,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),564,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
565 | ierr = PetscSectionGetOffset(section,point,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),565,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
566 | for (i = 0; i < dof; i++) { | |||||
567 | PetscInt fi = i + off; | |||||
568 | if (!key[fi]) { | |||||
569 | key[fi] = 1; | |||||
570 | reorder[count++] = sp->functional[fi]; | |||||
571 | } | |||||
572 | } | |||||
573 | } | |||||
574 | ierr = DMPlexRestoreTransitiveClosure(dm,p,PETSC_TRUE,&closureSize,&closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),574,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
575 | } | |||||
576 | ierr = PetscFree(sp->functional)((*PetscTrFree)((void*)(sp->functional),576,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ) || ((sp->functional) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),576,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
577 | sp->functional = reorder; | |||||
578 | ierr = PetscFree(key)((*PetscTrFree)((void*)(key),578,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ) || ((key) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),578,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
579 | } | |||||
580 | ierr = PetscSectionDestroy(§ion);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),580,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
581 | } | |||||
582 | 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),582,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,77,PETSC_ERROR_INITIAL,"Number of dual basis vectors %d not equal to dimension %d" ,f,pdimMax); | |||||
583 | ierr = PetscFree2(pStratStart, pStratEnd)PetscFreeA(2,583,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,&(pStratStart),&(pStratEnd));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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
584 | if (f > pdimMax) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Number of dual basis vectors %d is greater than dimension %d", f, pdimMax)return PetscError(((MPI_Comm)0x44000001),584,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,77,PETSC_ERROR_INITIAL,"Number of dual basis vectors %d is greater than dimension %d" ,f,pdimMax); | |||||
585 | 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); | |||||
586 | } | |||||
587 | ||||||
588 | PetscErrorCode PetscDualSpaceDestroy_Lagrange(PetscDualSpace sp) | |||||
589 | { | |||||
590 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *) sp->data; | |||||
591 | PetscInt i; | |||||
592 | PetscErrorCode ierr; | |||||
593 | ||||||
594 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 594; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
595 | if (lag->symmetries) { | |||||
596 | PetscInt **selfSyms = lag->symmetries[0]; | |||||
597 | ||||||
598 | if (selfSyms) { | |||||
599 | PetscInt i, **allocated = &selfSyms[-lag->selfSymOff]; | |||||
600 | ||||||
601 | for (i = 0; i < lag->numSelfSym; i++) { | |||||
602 | ierr = PetscFree(allocated[i])((*PetscTrFree)((void*)(allocated[i]),602,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ) || ((allocated[i]) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),602,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
603 | } | |||||
604 | ierr = PetscFree(allocated)((*PetscTrFree)((void*)(allocated),604,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ) || ((allocated) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),604,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
605 | } | |||||
606 | ierr = PetscFree(lag->symmetries)((*PetscTrFree)((void*)(lag->symmetries),606,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ) || ((lag->symmetries) = 0,0));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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
607 | } | |||||
608 | for (i = 0; i < lag->height; i++) { | |||||
609 | ierr = PetscDualSpaceDestroy(&lag->subspaces[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),609,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
610 | } | |||||
611 | ierr = PetscFree(lag->subspaces)((*PetscTrFree)((void*)(lag->subspaces),611,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ) || ((lag->subspaces) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),611,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
612 | ierr = PetscFree(lag->numDof)((*PetscTrFree)((void*)(lag->numDof),612,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ) || ((lag->numDof) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),612,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
613 | ierr = PetscFree(lag)((*PetscTrFree)((void*)(lag),613,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ) || ((lag) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),613,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
614 | ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscDualSpaceLagrangeGetContinuity_C", NULL)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscDualSpaceLagrangeGetContinuity_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
615 | ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscDualSpaceLagrangeSetContinuity_C", NULL)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscDualSpaceLagrangeSetContinuity_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),615,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
616 | ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscDualSpaceLagrangeGetTensor_C", NULL)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscDualSpaceLagrangeGetTensor_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),616,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
617 | ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscDualSpaceLagrangeSetTensor_C", NULL)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscDualSpaceLagrangeSetTensor_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),617,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
618 | 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); | |||||
619 | } | |||||
620 | ||||||
621 | PetscErrorCode PetscDualSpaceDuplicate_Lagrange(PetscDualSpace sp, PetscDualSpace *spNew) | |||||
622 | { | |||||
623 | PetscInt order, Nc; | |||||
624 | PetscBool cont, tensor; | |||||
625 | const char *name; | |||||
626 | PetscErrorCode ierr; | |||||
627 | ||||||
628 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 628; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
629 | ierr = PetscDualSpaceCreate(PetscObjectComm((PetscObject) sp), spNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),629,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
630 | ierr = PetscObjectGetName((PetscObject) sp, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),630,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
631 | ierr = PetscObjectSetName((PetscObject) *spNew, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),631,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
632 | ierr = PetscDualSpaceSetType(*spNew, PETSCDUALSPACELAGRANGE"lagrange");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),632,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
633 | ierr = PetscDualSpaceGetOrder(sp, &order);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
634 | ierr = PetscDualSpaceSetOrder(*spNew, order);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/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
635 | ierr = PetscDualSpaceGetNumComponents(sp, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),635,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
636 | ierr = PetscDualSpaceSetNumComponents(*spNew, Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),636,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
637 | ierr = PetscDualSpaceLagrangeGetContinuity(sp, &cont);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),637,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
638 | ierr = PetscDualSpaceLagrangeSetContinuity(*spNew, cont);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),638,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
639 | ierr = PetscDualSpaceLagrangeGetTensor(sp, &tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),639,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
640 | ierr = PetscDualSpaceLagrangeSetTensor(*spNew, tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),640,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
641 | 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); | |||||
642 | } | |||||
643 | ||||||
644 | PetscErrorCode PetscDualSpaceSetFromOptions_Lagrange(PetscOptionItems *PetscOptionsObject,PetscDualSpace sp) | |||||
645 | { | |||||
646 | PetscBool continuous, tensor, flg; | |||||
| ||||||
647 | PetscErrorCode ierr; | |||||
648 | ||||||
649 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 649; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
650 | ierr = PetscDualSpaceLagrangeGetContinuity(sp, &continuous);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),650,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
651 | ierr = PetscDualSpaceLagrangeGetTensor(sp, &tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),651,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
652 | ierr = PetscOptionsHead(PetscOptionsObject,"PetscDualSpace Lagrange Options");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),652,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
653 | ierr = PetscOptionsBool("-petscdualspace_lagrange_continuity", "Flag for continuous element", "PetscDualSpaceLagrangeSetContinuity", continuous, &continuous, &flg)PetscOptionsBool_Private(PetscOptionsObject,"-petscdualspace_lagrange_continuity" ,"Flag for continuous element","PetscDualSpaceLagrangeSetContinuity" ,continuous,&continuous,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),653,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
| ||||||
654 | if (flg) {ierr = PetscDualSpaceLagrangeSetContinuity(sp, continuous);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),654,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||||
655 | ierr = PetscOptionsBool("-petscdualspace_lagrange_tensor", "Flag for tensor dual space", "PetscDualSpaceLagrangeSetContinuity", tensor, &tensor, &flg)PetscOptionsBool_Private(PetscOptionsObject,"-petscdualspace_lagrange_tensor" ,"Flag for tensor dual space","PetscDualSpaceLagrangeSetContinuity" ,tensor,&tensor,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),655,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
656 | if (flg) {ierr = PetscDualSpaceLagrangeSetTensor(sp, tensor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),656,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||||
657 | 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),657,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
658 | 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); | |||||
659 | } | |||||
660 | ||||||
661 | PetscErrorCode PetscDualSpaceGetDimension_Lagrange(PetscDualSpace sp, PetscInt *dim) | |||||
662 | { | |||||
663 | DM K; | |||||
664 | const PetscInt *numDof; | |||||
665 | PetscInt spatialDim, Nc, size = 0, d; | |||||
666 | PetscErrorCode ierr; | |||||
667 | ||||||
668 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 668; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
669 | ierr = PetscDualSpaceGetDM(sp, &K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),669,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
670 | ierr = PetscDualSpaceGetNumDof(sp, &numDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),670,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
671 | ierr = DMGetDimension(K, &spatialDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),671,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
672 | ierr = DMPlexGetHeightStratum(K, 0, NULL((void*)0), &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),672,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
673 | if (Nc == 1) {ierr = PetscDualSpaceGetDimension_SingleCell_Lagrange(sp, sp->order, dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),673,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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);} | |||||
674 | for (d = 0; d <= spatialDim; ++d) { | |||||
675 | PetscInt pStart, pEnd; | |||||
676 | ||||||
677 | ierr = DMPlexGetDepthStratum(K, d, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),677,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
678 | size += (pEnd-pStart)*numDof[d]; | |||||
679 | } | |||||
680 | *dim = size; | |||||
681 | 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); | |||||
682 | } | |||||
683 | ||||||
684 | PetscErrorCode PetscDualSpaceGetNumDof_Lagrange(PetscDualSpace sp, const PetscInt **numDof) | |||||
685 | { | |||||
686 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *) sp->data; | |||||
687 | ||||||
688 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 688; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
689 | *numDof = lag->numDof; | |||||
690 | 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); | |||||
691 | } | |||||
692 | ||||||
693 | static PetscErrorCode PetscDualSpaceLagrangeGetContinuity_Lagrange(PetscDualSpace sp, PetscBool *continuous) | |||||
694 | { | |||||
695 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *) sp->data; | |||||
696 | ||||||
697 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 697; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
698 | PetscValidHeaderSpecific(sp, PETSCDUALSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),698,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),698,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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),698,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),698,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||||
699 | PetscValidPointer(continuous, 2)do { if (!continuous) return PetscError(((MPI_Comm)0x44000001 ),699,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(continuous,PETSC_CHAR)) return PetscError (((MPI_Comm)0x44000001),699,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||||
700 | *continuous = lag->continuous; | |||||
701 | 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); | |||||
702 | } | |||||
703 | ||||||
704 | static PetscErrorCode PetscDualSpaceLagrangeSetContinuity_Lagrange(PetscDualSpace sp, PetscBool continuous) | |||||
705 | { | |||||
706 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *) sp->data; | |||||
707 | ||||||
708 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 708; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
709 | PetscValidHeaderSpecific(sp, PETSCDUALSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),709,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),709,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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),709,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),709,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||||
710 | lag->continuous = continuous; | |||||
711 | 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); | |||||
712 | } | |||||
713 | ||||||
714 | /*@ | |||||
715 | PetscDualSpaceLagrangeGetContinuity - Retrieves the flag for element continuity | |||||
716 | ||||||
717 | Not Collective | |||||
718 | ||||||
719 | Input Parameter: | |||||
720 | . sp - the PetscDualSpace | |||||
721 | ||||||
722 | Output Parameter: | |||||
723 | . continuous - flag for element continuity | |||||
724 | ||||||
725 | Level: intermediate | |||||
726 | ||||||
727 | .keywords: PetscDualSpace, Lagrange, continuous, discontinuous | |||||
728 | .seealso: PetscDualSpaceLagrangeSetContinuity() | |||||
729 | @*/ | |||||
730 | PetscErrorCode PetscDualSpaceLagrangeGetContinuity(PetscDualSpace sp, PetscBool *continuous) | |||||
731 | { | |||||
732 | PetscErrorCode ierr; | |||||
733 | ||||||
734 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 734; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
735 | PetscValidHeaderSpecific(sp, PETSCDUALSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),735,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),735,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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),735,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),735,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||||
736 | PetscValidPointer(continuous, 2)do { if (!continuous) return PetscError(((MPI_Comm)0x44000001 ),736,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(continuous,PETSC_CHAR)) return PetscError (((MPI_Comm)0x44000001),736,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||||
737 | ierr = PetscTryMethod(sp, "PetscDualSpaceLagrangeGetContinuity_C", (PetscDualSpace,PetscBool*),(sp,continuous))0;{ PetscErrorCode (*f)(PetscDualSpace,PetscBool*), __ierr; __ierr = PetscObjectQueryFunction_Private(((PetscObject)sp),("PetscDualSpaceLagrangeGetContinuity_C" ),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr ),0)) return PetscError(((MPI_Comm)0x44000001),737,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(sp,continuous);do {if (__builtin_expect(!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),737,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} };CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),737,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
738 | 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); | |||||
739 | } | |||||
740 | ||||||
741 | /*@ | |||||
742 | PetscDualSpaceLagrangeSetContinuity - Indicate whether the element is continuous | |||||
743 | ||||||
744 | Logically Collective on PetscDualSpace | |||||
745 | ||||||
746 | Input Parameters: | |||||
747 | + sp - the PetscDualSpace | |||||
748 | - continuous - flag for element continuity | |||||
749 | ||||||
750 | Options Database: | |||||
751 | . -petscdualspace_lagrange_continuity <bool> | |||||
752 | ||||||
753 | Level: intermediate | |||||
754 | ||||||
755 | .keywords: PetscDualSpace, Lagrange, continuous, discontinuous | |||||
756 | .seealso: PetscDualSpaceLagrangeGetContinuity() | |||||
757 | @*/ | |||||
758 | PetscErrorCode PetscDualSpaceLagrangeSetContinuity(PetscDualSpace sp, PetscBool continuous) | |||||
759 | { | |||||
760 | PetscErrorCode ierr; | |||||
761 | ||||||
762 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 762; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
763 | PetscValidHeaderSpecific(sp, PETSCDUALSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),763,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),763,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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),763,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),763,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||||
764 | PetscValidLogicalCollectiveBool(sp, continuous, 2)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] = -(PetscMPIInt)continuous; b1[1] = (PetscMPIInt)continuous; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)sp ),2,764,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)sp))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype )0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject )sp)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),764,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2 [1]) return PetscError(PetscObjectComm((PetscObject)sp),764,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d" ,2); } while (0); | |||||
765 | ierr = PetscTryMethod(sp, "PetscDualSpaceLagrangeSetContinuity_C", (PetscDualSpace,PetscBool),(sp,continuous))0;{ PetscErrorCode (*f)(PetscDualSpace,PetscBool), __ierr; __ierr = PetscObjectQueryFunction_Private(((PetscObject)sp),("PetscDualSpaceLagrangeSetContinuity_C" ),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr ),0)) return PetscError(((MPI_Comm)0x44000001),765,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(sp,continuous);do {if (__builtin_expect(!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),765,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} };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/lagrange/dspacelagrange.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 | } | |||||
768 | ||||||
769 | PetscErrorCode PetscDualSpaceGetHeightSubspace_Lagrange(PetscDualSpace sp, PetscInt height, PetscDualSpace *bdsp) | |||||
770 | { | |||||
771 | PetscDualSpace_Lag *lag = (PetscDualSpace_Lag *) sp->data; | |||||
772 | PetscErrorCode ierr; | |||||
773 | ||||||
774 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 774; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
775 | PetscValidHeaderSpecific(sp, PETSCDUALSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),775,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),775,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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),775,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),775,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||||
776 | PetscValidPointer(bdsp,2)do { if (!bdsp) return PetscError(((MPI_Comm)0x44000001),776, __func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(bdsp,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),776,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||||
777 | if (height == 0) { | |||||
778 | *bdsp = sp; | |||||
779 | } | |||||
780 | else { | |||||
781 | DM dm; | |||||
782 | PetscInt dim; | |||||
783 | ||||||
784 | ierr = PetscDualSpaceGetDM(sp,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),784,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
785 | ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),785,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
786 | 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),786,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,63,PETSC_ERROR_INITIAL,"Asked for dual space at height %d for dimension %d reference element\n" ,height,dim);} | |||||
787 | if (height <= lag->height) { | |||||
788 | *bdsp = lag->subspaces[height-1]; | |||||
789 | } | |||||
790 | else { | |||||
791 | *bdsp = NULL((void*)0); | |||||
792 | } | |||||
793 | } | |||||
794 | 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); | |||||
795 | } | |||||
796 | ||||||
797 | PetscErrorCode PetscDualSpaceInitialize_Lagrange(PetscDualSpace sp) | |||||
798 | { | |||||
799 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 799; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
800 | sp->ops->setfromoptions = PetscDualSpaceSetFromOptions_Lagrange; | |||||
801 | sp->ops->setup = PetscDualSpaceSetUp_Lagrange; | |||||
802 | sp->ops->view = PetscDualSpaceView_Lagrange; | |||||
803 | sp->ops->destroy = PetscDualSpaceDestroy_Lagrange; | |||||
804 | sp->ops->duplicate = PetscDualSpaceDuplicate_Lagrange; | |||||
805 | sp->ops->getdimension = PetscDualSpaceGetDimension_Lagrange; | |||||
806 | sp->ops->getnumdof = PetscDualSpaceGetNumDof_Lagrange; | |||||
807 | sp->ops->getheightsubspace = PetscDualSpaceGetHeightSubspace_Lagrange; | |||||
808 | sp->ops->getsymmetries = PetscDualSpaceGetSymmetries_Lagrange; | |||||
809 | sp->ops->apply = PetscDualSpaceApplyDefault; | |||||
810 | sp->ops->applyall = PetscDualSpaceApplyAllDefault; | |||||
811 | sp->ops->createallpoints = PetscDualSpaceCreateAllPointsDefault; | |||||
812 | 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); | |||||
813 | } | |||||
814 | ||||||
815 | /*MC | |||||
816 | PETSCDUALSPACELAGRANGE = "lagrange" - A PetscDualSpace object that encapsulates a dual space of pointwise evaluation functionals | |||||
817 | ||||||
818 | Level: intermediate | |||||
819 | ||||||
820 | .seealso: PetscDualSpaceType, PetscDualSpaceCreate(), PetscDualSpaceSetType() | |||||
821 | M*/ | |||||
822 | ||||||
823 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscDualSpaceCreate_Lagrange(PetscDualSpace sp) | |||||
824 | { | |||||
825 | PetscDualSpace_Lag *lag; | |||||
826 | PetscErrorCode ierr; | |||||
827 | ||||||
828 | 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/lagrange/dspacelagrange.c" ; petscstack->line[petscstack->currentsize] = 828; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||||
829 | PetscValidHeaderSpecific(sp, PETSCDUALSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),829,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),829,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.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),829,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),829,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||||
830 | ierr = PetscNewLog(sp,&lag)(PetscMallocA(1,PETSC_TRUE,830,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,(size_t)(1)*sizeof(**(((&lag)))),(((&lag)))) || PetscLogObjectMemory ((PetscObject)sp,sizeof(**(&lag))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),830,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
831 | sp->data = lag; | |||||
832 | ||||||
833 | lag->numDof = NULL((void*)0); | |||||
834 | lag->simplexCell = PETSC_TRUE; | |||||
835 | lag->tensorSpace = PETSC_FALSE; | |||||
836 | lag->continuous = PETSC_TRUE; | |||||
837 | ||||||
838 | ierr = PetscDualSpaceInitialize_Lagrange(sp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),838,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
839 | ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscDualSpaceLagrangeGetContinuity_C", PetscDualSpaceLagrangeGetContinuity_Lagrange)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscDualSpaceLagrangeGetContinuity_C" ,(PetscVoidFunction)(PetscDualSpaceLagrangeGetContinuity_Lagrange ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),839,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
840 | ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscDualSpaceLagrangeSetContinuity_C", PetscDualSpaceLagrangeSetContinuity_Lagrange)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscDualSpaceLagrangeSetContinuity_C" ,(PetscVoidFunction)(PetscDualSpaceLagrangeSetContinuity_Lagrange ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),840,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
841 | ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscDualSpaceLagrangeGetTensor_C", PetscDualSpaceLagrangeGetTensor_Lagrange)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscDualSpaceLagrangeGetTensor_C" ,(PetscVoidFunction)(PetscDualSpaceLagrangeGetTensor_Lagrange ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),841,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
842 | ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscDualSpaceLagrangeSetTensor_C", PetscDualSpaceLagrangeSetTensor_Lagrange)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscDualSpaceLagrangeSetTensor_C" ,(PetscVoidFunction)(PetscDualSpaceLagrangeSetTensor_Lagrange ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),842,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/dt/dualspace/impls/lagrange/dspacelagrange.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||||
843 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||||
844 | } | |||||
845 |