Skip to content

Commit 6b53feb

Browse files
authored
Merge pull request #79 from firedrakeproject/pbrubeck/fix/restricted
RestrictedElement: optionally take the closure of the restriction domain
2 parents cba7bb2 + 69275d2 commit 6b53feb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

FIAT/restricted.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
class RestrictedElement(CiarletElement):
1212
"""Restrict given element to specified list of dofs."""
1313

14-
def __init__(self, element, indices=None, restriction_domain=None):
14+
def __init__(self, element, indices=None, restriction_domain=None, take_closure=True):
1515
'''For sake of argument, indices overrides restriction_domain'''
1616

1717
if not (indices or restriction_domain):
1818
raise RuntimeError("Either indices or restriction_domain must be passed in")
1919

2020
if not indices:
21-
indices = _get_indices(element, restriction_domain)
21+
indices = _get_indices(element, restriction_domain, take_closure)
2222

2323
if isinstance(indices, str):
2424
raise RuntimeError("variable 'indices' was a string; did you forget to use a keyword?")
@@ -70,7 +70,7 @@ def _key(x):
7070
return sorted(mapping.items(), key=_key)
7171

7272

73-
def _get_indices(element, restriction_domain):
73+
def _get_indices(element, restriction_domain, take_closure):
7474
"Restriction domain can be 'interior', 'vertex', 'edge', 'face' or 'facet'"
7575

7676
if restriction_domain == "interior":
@@ -91,9 +91,10 @@ def _get_indices(element, restriction_domain):
9191

9292
is_prodcell = isinstance(max(element.entity_dofs().keys()), tuple)
9393

94+
ldim = 0 if take_closure else dim
9495
entity_dofs = element.entity_dofs()
9596
indices = []
96-
for d in range(dim + 1):
97+
for d in range(ldim, dim + 1):
9798
if is_prodcell:
9899
for a in range(d + 1):
99100
b = d - a

0 commit comments

Comments
 (0)