|
1 | 1 | from finat.ufl.elementlist import ufl_elements |
2 | | -from finat.element_factory import supported_elements |
| 2 | +from finat.element_factory import supported_elements, create_element |
| 3 | +from finat.ufl import FiniteElement |
| 4 | +from ufl.cell import TensorProductCell |
| 5 | +from ufl import interval, quadrilateral |
3 | 6 | import csv |
4 | 7 |
|
5 | 8 | shape_names = { |
|
8 | 11 | 2: 'tensor' |
9 | 12 | } |
10 | 13 |
|
11 | | -def cells(cellnames): |
| 14 | +firedrake_cells = ("interval", |
| 15 | + "triangle", |
| 16 | + "tetrahedron", |
| 17 | + "quadrilateral", |
| 18 | + "hexahedron") |
12 | 19 |
|
13 | | - firedrake_cells = ("interval", |
14 | | - "triangle", |
15 | | - "tetrahedron", |
16 | | - "quadrilateral", |
17 | | - "hexahedron") |
18 | 20 |
|
19 | | - cells = [c for c in cellnames if c in firedrake_cells] |
20 | | - |
21 | | - return(", ".join(cells)) |
| 21 | +def cells(cell_list): |
| 22 | + return(", ".join(cell_list)) |
22 | 23 |
|
23 | 24 |
|
24 | 25 | with open("element_list.csv", 'w', newline='') as csvfile: |
25 | 26 | csvwriter = csv.writer(csvfile) |
26 | 27 |
|
27 | 28 | for element in supported_elements: |
28 | 29 | family, short_name, value_rank, sobolev_space, \ |
29 | | - mapping, degree_range, cellnames = ufl_elements[element] |
| 30 | + mapping, degree_range, cell_list = ufl_elements[element] |
30 | 31 |
|
| 32 | + cell_list = [c for c in cell_list if c in firedrake_cells] |
31 | 33 | short_name = short_name if short_name != family else "" |
32 | | - cellnames = cells(cellnames) |
| 34 | + cellnames = cells(cell_list) |
33 | 35 | shape = shape_names[value_rank] |
34 | 36 |
|
35 | | - csvwriter.writerow((family, short_name, shape, cellnames)) |
| 37 | + if family in {"Q", "DQ", "DQ L2"}: |
| 38 | + cell = cell_list[-1] |
| 39 | + elif family in {"NCE", "NCF"}: |
| 40 | + cell = TensorProductCell(quadrilateral, interval) |
| 41 | + else: |
| 42 | + cell = cell_list[0] |
| 43 | + |
| 44 | + ufl_elem = FiniteElement(family, cell=cell, degree=degree_range[0]) |
| 45 | + finat_element = create_element(ufl_elem) |
| 46 | + |
| 47 | + if short_name in {"BDMCF", "BDMCE"}: |
| 48 | + interpolatable = "No" |
| 49 | + else: |
| 50 | + try: |
| 51 | + finat_element.dual_basis |
| 52 | + interpolatable = "Yes" |
| 53 | + except NotImplementedError: |
| 54 | + interpolatable = "No" |
| 55 | + |
| 56 | + csvwriter.writerow((family, short_name, shape, cellnames, interpolatable)) |
0 commit comments