-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathelement_list.py
More file actions
52 lines (40 loc) · 1.5 KB
/
element_list.py
File metadata and controls
52 lines (40 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from finat.ufl.elementlist import ufl_elements
from finat.element_factory import supported_elements, create_element
from finat.ufl import FiniteElement
from ufl.cell import TensorProductCell
from ufl import interval, quadrilateral
import csv
shape_names = {
0: 'scalar',
1: 'vector',
2: 'tensor'
}
firedrake_cells = ("interval",
"triangle",
"tetrahedron",
"quadrilateral",
"hexahedron")
def cells(cell_list):
return(", ".join(cell_list))
with open("element_list.csv", 'w', newline='') as csvfile:
csvwriter = csv.writer(csvfile)
for element in supported_elements:
family, short_name, value_rank, sobolev_space, \
mapping, degree_range, cell_list = ufl_elements[element]
cell_list = [c for c in cell_list if c in firedrake_cells]
short_name = short_name if short_name != family else ""
cellnames = cells(cell_list)
shape = shape_names[value_rank]
if family in {"NCE", "NCF"}:
cell = TensorProductCell(quadrilateral, interval)
else:
cell = cell_list[0]
ufl_elem = FiniteElement(family, cell=cell, degree=degree_range[0])
finat_element = create_element(ufl_elem)
try:
finat_element.dual_basis
except NotImplementedError:
interpolatable = "No"
else:
interpolatable = "Yes"
csvwriter.writerow((family, short_name, shape, cellnames, interpolatable))