Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 34 additions & 13 deletions docs/source/element_list.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from finat.ufl.elementlist import ufl_elements
from finat.element_factory import supported_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 = {
Expand All @@ -8,28 +11,46 @@
2: 'tensor'
}

def cells(cellnames):
firedrake_cells = ("interval",
"triangle",
"tetrahedron",
"quadrilateral",
"hexahedron")

firedrake_cells = ("interval",
"triangle",
"tetrahedron",
"quadrilateral",
"hexahedron")

cells = [c for c in cellnames if c in firedrake_cells]

return(", ".join(cells))
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, cellnames = ufl_elements[element]
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(cellnames)
cellnames = cells(cell_list)
shape = shape_names[value_rank]

csvwriter.writerow((family, short_name, shape, cellnames))
if family in {"Q", "DQ", "DQ L2"}:
cell = cell_list[-1]
elif 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)

if short_name in {"BDMCF", "BDMCE"}:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What error is thrown here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Traceback (most recent call last):
  File "/Users/lac224/Coding/work/firedrake-dev/firedrake/docs/source/element_list.py", line 51, in <module>
    finat_element.dual_basis
  File "/Users/lac224/Coding/work/firedrake-dev/fiat/finat/fiat_elements.py", line 245, in dual_basis
    Q, pts = self._dual_basis
             ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.9/Frameworks/Python.framework/Versions/3.13/lib/python3.13/functools.py", line 1026, in __get__
    val = self.func(instance)
  File "/Users/lac224/Coding/work/firedrake-dev/fiat/finat/fiat_elements.py", line 158, in _dual_basis
    fiat_dual_basis = self._element.dual_basis()
  File "/Users/lac224/Coding/work/firedrake-dev/fiat/FIAT/finite_element.py", line 63, in dual_basis
    return self.dual.get_nodes()
           ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_nodes'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, easy. We just need to redo this PR for these elements
firedrakeproject/fiat#182

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you confirm that BDMC fails as expected after checking out this FIAT branch, firedrakeproject/fiat#218?

interpolatable = "No"
else:
try:
finat_element.dual_basis
interpolatable = "Yes"
except NotImplementedError:
interpolatable = "No"

csvwriter.writerow((family, short_name, shape, cellnames, interpolatable))
7 changes: 4 additions & 3 deletions docs/source/variational-problems.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,12 @@ extrusion <extruded-meshes>` for details.
Supported finite elements
-------------------------

Firedrake supports the use of the following finite elements.
Firedrake supports the use of the following finite elements. The last column
specifies if we support interpolation **into** a function space built from the element.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should say that interpolation from is universally supported


.. csv-table::
:header: "Name", "Short name", "Value shape", "Valid cells"
:widths: 20, 10, 10, 40
:header: "Name", "Short name", "Value shape", "Valid cells", "Supports interpolation?"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The column name could be more specific. Maybe "Valid interpolation target"?

:widths: 20, 10, 10, 40, 10
:file: element_list.csv

In addition, the
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies = [
# TODO RELEASE
"fenics-ufl @ git+https://github.com/FEniCS/ufl.git@main",
# TODO RELEASE
"firedrake-fiat @ git+https://github.com/firedrakeproject/fiat.git@main",
"firedrake-fiat @ git+https://github.com/firedrakeproject/fiat.git@leo/misc-fixes",
"h5py>3.12.1",
"immutabledict",
"libsupermesh",
Expand Down
Loading