@@ -126,7 +126,7 @@ Create a non tensor-product basis for $H^1$ discretizations
126
126
at quadrature points.
127
127
- `grad`: Array of size `(dim, nqpts, nnodes)` expressing derivatives of nodal basis
128
128
functions at quadrature points.
129
- - `qref`: Array of length ` nqpts` holding the locations of quadrature points on the
129
+ - `qref`: Matrix of size `(dim, nqpts) ` holding the locations of quadrature points on the
130
130
reference element $[-1, 1]$.
131
131
- `qweight`: Array of length `nqpts` holding the quadrature weights on the reference
132
132
element.
@@ -145,12 +145,13 @@ function create_h1_basis(
145
145
dim = getdimension (topo)
146
146
@assert size (interp) == (nqpts, nnodes)
147
147
@assert size (grad) == (dim, nqpts, nnodes)
148
- @assert length (qref) == nqpts
148
+ @assert size (qref) == (dim, nqpts)
149
149
@assert length (qweight) == nqpts
150
150
151
151
# Convert from Julia matrices and tensors (column-major) to row-major format
152
152
interp_rowmajor = collect (interp' )
153
153
grad_rowmajor = permutedims (grad, [3 , 2 , 1 ])
154
+ qref_rowmajor = collect (qref' )
154
155
155
156
ref = Ref {C.CeedBasis} ()
156
157
C. CeedBasisCreateH1 (
@@ -161,7 +162,7 @@ function create_h1_basis(
161
162
nqpts,
162
163
interp_rowmajor,
163
164
grad_rowmajor,
164
- qref ,
165
+ qref_rowmajor ,
165
166
qweight,
166
167
ref,
167
168
)
@@ -183,7 +184,7 @@ Create a non tensor-product basis for H(div) discretizations
183
184
at quadrature points.
184
185
- `div`: Array of size `(nqpts, nnodes)` expressing divergence of basis functions at
185
186
quadrature points.
186
- - `qref`: Array of length ` nqpts` holding the locations of quadrature points on the
187
+ - `qref`: Matrix of size `(dim, nqpts) ` holding the locations of quadrature points on the
187
188
reference element $[-1, 1]$.
188
189
- `qweight`: Array of length `nqpts` holding the quadrature weights on the reference
189
190
element.
@@ -202,12 +203,13 @@ function create_hdiv_basis(
202
203
dim = getdimension (topo)
203
204
@assert size (interp) == (dim, nqpts, nnodes)
204
205
@assert size (div) == (nqpts, nnodes)
205
- @assert length (qref) == nqpts
206
+ @assert size (qref) == (dim, nqpts)
206
207
@assert length (qweight) == nqpts
207
208
208
209
# Convert from Julia matrices and tensors (column-major) to row-major format
209
210
interp_rowmajor = permutedims (interp, [3 , 2 , 1 ])
210
211
div_rowmajor = collect (div' )
212
+ qref_rowmajor = collect (qref' )
211
213
212
214
ref = Ref {C.CeedBasis} ()
213
215
C. CeedBasisCreateHdiv (
@@ -218,7 +220,7 @@ function create_hdiv_basis(
218
220
nqpts,
219
221
interp_rowmajor,
220
222
div_rowmajor,
221
- qref ,
223
+ qref_rowmajor ,
222
224
qweight,
223
225
ref,
224
226
)
@@ -240,7 +242,7 @@ Create a non tensor-product basis for H(curl) discretizations
240
242
at quadrature points.
241
243
- `curl`: Matrix of size `(curlcomp, nqpts, nnodes)`, `curlcomp = 1 if dim < 3 else dim`)
242
244
matrix expressing curl of basis functions at quadrature points.
243
- - `qref`: Array of length ` nqpts` holding the locations of quadrature points on the
245
+ - `qref`: Matrix of size `(dim, nqpts) ` holding the locations of quadrature points on the
244
246
reference element $[-1, 1]$.
245
247
- `qweight`: Array of length `nqpts` holding the quadrature weights on the reference
246
248
element.
@@ -260,12 +262,13 @@ function create_hcurl_basis(
260
262
curlcomp = dim < 3 ? 1 : dim
261
263
@assert size (interp) == (dim, nqpts, nnodes)
262
264
@assert size (curl) == (curlcomp, nqpts, nnodes)
263
- @assert length (qref) == nqpts
265
+ @assert size (qref) == (dim, nqpts)
264
266
@assert length (qweight) == nqpts
265
267
266
268
# Convert from Julia matrices and tensors (column-major) to row-major format
267
269
interp_rowmajor = permutedims (interp, [3 , 2 , 1 ])
268
270
curl_rowmajor = permutedims (curl, [3 , 2 , 1 ])
271
+ qref_rowmajor = collect (qref' )
269
272
270
273
ref = Ref {C.CeedBasis} ()
271
274
C. CeedBasisCreateHcurl (
@@ -276,7 +279,7 @@ function create_hcurl_basis(
276
279
nqpts,
277
280
interp_rowmajor,
278
281
curl_rowmajor,
279
- qref ,
282
+ qref_rowmajor ,
280
283
qweight,
281
284
ref,
282
285
)
@@ -328,10 +331,9 @@ function apply(b::Basis, u::AbstractVector; nelem=1, tmode=NOTRANSPOSE, emode=EV
328
331
329
332
u_vec = CeedVector (c, u)
330
333
331
- len_v = (tmode == TRANSPOSE) ? getnumnodes (b) : getnumqpts (b)
332
- if emode == EVAL_GRAD
333
- len_v *= getdimension (b)
334
- end
334
+ qcomp = Ref {CeedInt} ()
335
+ C. CeedBasisGetNumQuadratureComponents (b[], emode, qcomp)
336
+ len_v = (tmode == TRANSPOSE) ? getnumnodes (b) : qcomp[]* getnumqpts (b)
335
337
336
338
v_vec = CeedVector (c, len_v)
337
339
@@ -437,11 +439,8 @@ function getqref(b::Basis)
437
439
ref = Ref {Ptr{CeedScalar}} ()
438
440
C. CeedBasisGetQRef (b[], ref)
439
441
copy (
440
- unsafe_wrap (
441
- Array,
442
- ref[],
443
- istensor[] ? getnumqpts1d (b) : (getnumqpts (b)* getdimension (b)),
444
- ),
442
+ istensor[] ? unsafe_wrap (Array, ref[], getnumqpts1d (b)) :
443
+ unsafe_wrap (Array, ref[], (getnumqpts (b), getdimension (b)))' ,
445
444
)
446
445
end
447
446
0 commit comments