-
Notifications
You must be signed in to change notification settings - Fork 25
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
Wire up Q/DQ elements in the FInAT interface #71
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c38f3ae
wire up FInAT interface to TensorProductElement
miklos1 1d7ce21
cause not to trigger coneoproject/COFFEE#97
miklos1 24cb325
enable structured Q/DQ element on quadrilaterals
miklos1 863613d
push QuadrilateralElement over to FInAT
miklos1 81ee6f3
DROP THIS COMMIT BEFORE MERGE
miklos1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
git+https://github.com/coneoproject/COFFEE#egg=COFFEE | ||
git+https://github.com/firedrakeproject/ufl.git#egg=ufl | ||
git+https://github.com/firedrakeproject/fiat.git#egg=fiat | ||
git+https://github.com/FInAT/FInAT.git#egg=finat | ||
git+https://github.com/FInAT/FInAT.git@tensor-product#egg=finat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
import finat | ||
|
||
import ufl | ||
from ufl.algorithms.elementtransformations import reconstruct_element | ||
|
||
from tsfc.ufl_utils import spanning_degree | ||
|
||
|
@@ -48,6 +49,9 @@ | |
"Nedelec 2nd kind H(curl)": finat.NedelecSecondKind, | ||
"Raviart-Thomas": finat.RaviartThomas, | ||
"Regge": finat.Regge, | ||
# These require special treatment below | ||
"DQ": None, | ||
"Q": None, | ||
} | ||
"""A :class:`.dict` mapping UFL element family names to their | ||
FIAT-equivalent constructors. If the value is ``None``, the UFL | ||
|
@@ -90,11 +94,20 @@ def convert(element): | |
@convert.register(ufl.FiniteElement) | ||
def convert_finiteelement(element): | ||
cell = as_fiat_cell(element.cell()) | ||
lmbda = supported_elements.get(element.family()) | ||
if lmbda: | ||
return lmbda(cell, element.degree()) | ||
else: | ||
if element.family() not in supported_elements: | ||
return fiat_compat(element) | ||
lmbda = supported_elements.get(element.family()) | ||
if lmbda is None: | ||
if element.cell().cellname() != "quadrilateral": | ||
raise ValueError("%s is supported, but handled incorrectly" % | ||
element.family()) | ||
# Handle quadrilateral short names like RTCF and RTCE. | ||
element = reconstruct_element(element, | ||
element.family(), | ||
quad_opc, | ||
element.degree()) | ||
return finat.QuadrilateralElement(create_element(element)) | ||
return lmbda(cell, element.degree()) | ||
|
||
|
||
# MixedElement case | ||
|
@@ -117,6 +130,17 @@ def convert_tensorelement(element): | |
return finat.TensorFiniteElement(scalar_element, element.reference_value_shape()) | ||
|
||
|
||
# TensorProductElement case | ||
@convert.register(ufl.TensorProductElement) | ||
def convert_tensorproductelement(element): | ||
cell = element.cell() | ||
if type(cell) is not ufl.TensorProductCell: | ||
raise ValueError("TensorProductElement not on TensorProductCell?") | ||
return finat.TensorProductElement([create_element(elem) | ||
for elem in element.sub_elements()]) | ||
|
||
|
||
quad_opc = ufl.TensorProductCell(ufl.Cell("interval"), ufl.Cell("interval")) | ||
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. I guess you could take this opportunity to rename this variable as |
||
_cache = weakref.WeakKeyDictionary() | ||
|
||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We assume this basically doesn't matter because the big zero blocks are gone in this implementation anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. No zero blocks from mixed or vector. There are still zeros if many basis functions are zero at the quadrature points, like here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually what I have on the link is something I might be able to optimise away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this has more compact tables, but code actually looks worse. I think it is better to just leave it like above for now.