Skip to content

Commit ac1205a

Browse files
committed
automate
add column
1 parent 3c64298 commit ac1205a

2 files changed

Lines changed: 38 additions & 16 deletions

File tree

docs/source/element_list.py

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
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
36
import csv
47

58
shape_names = {
@@ -8,28 +11,46 @@
811
2: 'tensor'
912
}
1013

11-
def cells(cellnames):
14+
firedrake_cells = ("interval",
15+
"triangle",
16+
"tetrahedron",
17+
"quadrilateral",
18+
"hexahedron")
1219

13-
firedrake_cells = ("interval",
14-
"triangle",
15-
"tetrahedron",
16-
"quadrilateral",
17-
"hexahedron")
1820

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))
2223

2324

2425
with open("element_list.csv", 'w', newline='') as csvfile:
2526
csvwriter = csv.writer(csvfile)
2627

2728
for element in supported_elements:
2829
family, short_name, value_rank, sobolev_space, \
29-
mapping, degree_range, cellnames = ufl_elements[element]
30+
mapping, degree_range, cell_list = ufl_elements[element]
3031

32+
cell_list = [c for c in cell_list if c in firedrake_cells]
3133
short_name = short_name if short_name != family else ""
32-
cellnames = cells(cellnames)
34+
cellnames = cells(cell_list)
3335
shape = shape_names[value_rank]
3436

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))

docs/source/variational-problems.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,12 @@ extrusion <extruded-meshes>` for details.
267267
Supported finite elements
268268
-------------------------
269269

270-
Firedrake supports the use of the following finite elements.
270+
Firedrake supports the use of the following finite elements. The last column
271+
specifies if we support interpolation **into** a function space built from the element.
271272

272273
.. csv-table::
273-
:header: "Name", "Short name", "Value shape", "Valid cells"
274-
:widths: 20, 10, 10, 40
274+
:header: "Name", "Short name", "Value shape", "Valid cells", "Supports interpolation?"
275+
:widths: 20, 10, 10, 40, 10
275276
:file: element_list.csv
276277

277278
In addition, the

0 commit comments

Comments
 (0)