22
22
import typing
23
23
import warnings
24
24
25
+ import basix
25
26
import numpy as np
26
27
import numpy .typing as npt
27
28
import ufl
@@ -256,8 +257,6 @@ def _compute_integral_ir(
256
257
points = md ["quadrature_points" ]
257
258
weights = md ["quadrature_weights" ]
258
259
elif scheme == "vertex" :
259
- # FIXME: Could this come from basix?
260
-
261
260
# The vertex scheme, i.e., averaging the function value in the
262
261
# vertices and multiplying with the simplex volume, is only of
263
262
# order 1 and inferior to other generic schemes in terms of
@@ -276,55 +275,11 @@ def _compute_integral_ir(
276
275
"Explicitly selected vertex quadrature (degree 1), "
277
276
f"but requested degree is { degree } ."
278
277
)
279
- if cellname == "tetrahedron" :
280
- points , weights = (
281
- np .array (
282
- [[0.0 , 0.0 , 0.0 ], [1.0 , 0.0 , 0.0 ], [0.0 , 1.0 , 0.0 ], [0.0 , 0.0 , 1.0 ]]
283
- ),
284
- np .array ([1.0 / 24.0 , 1.0 / 24.0 , 1.0 / 24.0 , 1.0 / 24.0 ]),
285
- )
286
- elif cellname == "triangle" :
287
- points , weights = (
288
- np .array ([[0.0 , 0.0 ], [1.0 , 0.0 ], [0.0 , 1.0 ]]),
289
- np .array ([1.0 / 6.0 , 1.0 / 6.0 , 1.0 / 6.0 ]),
290
- )
291
- elif cellname == "interval" :
292
- # Trapezoidal rule
293
- points , weights = (np .array ([[0.0 ], [1.0 ]]), np .array ([1.0 / 2.0 , 1.0 / 2.0 ]))
294
- elif cellname == "quadrilateral" :
295
- points , weights = (
296
- np .array ([[0.0 , 0 ], [1.0 , 0.0 ], [0.0 , 1.0 ], [1.0 , 1 ]]),
297
- np .array ([1.0 / 4.0 , 1.0 / 4.0 , 1.0 / 4.0 , 1.0 / 4.0 ]),
298
- )
299
- elif cellname == "hexahedron" :
300
- points , weights = (
301
- np .array (
302
- [
303
- [0.0 , 0.0 , 0.0 ],
304
- [1.0 , 0.0 , 0.0 ],
305
- [0.0 , 1.0 , 0.0 ],
306
- [1.0 , 1.0 , 0.0 ],
307
- [0.0 , 0.0 , 1.0 ],
308
- [1.0 , 0.0 , 1.0 ],
309
- [0.0 , 1.0 , 1.0 ],
310
- [1.0 , 1.0 , 1.0 ],
311
- ]
312
- ),
313
- np .array (
314
- [
315
- 1.0 / 8.0 ,
316
- 1.0 / 8.0 ,
317
- 1.0 / 8.0 ,
318
- 1.0 / 8.0 ,
319
- 1.0 / 8.0 ,
320
- 1.0 / 8.0 ,
321
- 1.0 / 8.0 ,
322
- 1.0 / 8.0 ,
323
- ]
324
- ),
325
- )
326
- else :
327
- raise RuntimeError (f"Vertex scheme is not supported for cell: { cellname } " )
278
+ points = basix .cell .geometry (getattr (basix .CellType , cellname ))
279
+ cell_volume = basix .cell .volume (getattr (basix .CellType , cellname ))
280
+ weights = np .full (
281
+ points .shape [0 ], cell_volume / points .shape [0 ], dtype = points .dtype
282
+ )
328
283
else :
329
284
degree = md ["quadrature_degree" ]
330
285
points , weights , tensor_factors = create_quadrature_points_and_weights (
0 commit comments