-
Notifications
You must be signed in to change notification settings - Fork 189
Automate docs element list for interpolation #4854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release
Are you sure you want to change the base?
Changes from 4 commits
23f2139
d32b8e0
9e5be96
caef71d
583ba05
3886c7b
c8ffef2
521e3fb
6649f2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 = { | ||
|
|
@@ -8,28 +11,43 @@ | |
| 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] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes zero sense without a comment
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like we can't do these elements on an interval, even though it says in the manual we can. I think the correct fix is in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that seems more reasonable, but @pbrubeck needs to look this all over. Once this line goes I'm happy with everything else. |
||
| 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) | ||
|
|
||
| try: | ||
| finat_element.dual_basis | ||
| interpolatable = "Yes" | ||
| except NotImplementedError: | ||
| interpolatable = "No" | ||
|
leo-collins marked this conversation as resolved.
|
||
|
|
||
| csvwriter.writerow((family, short_name, shape, cellnames, interpolatable)) | ||
Uh oh!
There was an error while loading. Please reload this page.