Skip to content

Commit

Permalink
cache node family
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrubeck committed Nov 1, 2023
1 parent 6239eca commit 9def721
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion FIAT/reference_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
QUADRILATERAL = 11
HEXAHEDRON = 111
TENSORPRODUCT = 99
_family_cache = {}


def multiindex_equal(d, isum, imin=0):
Expand Down Expand Up @@ -77,7 +78,11 @@ def make_lattice(verts, n, interior=0, family="equi"):
and interior = 0, this function will return the vertices and
midpoint, but with interior = 1, it will only return the
midpoint."""
family = _decode_family(family)
key = family
try:
family = _family_cache[key]
except KeyError:
family = _family_cache.setdefault(key, _decode_family(family))
D = len(verts)
X = numpy.array(verts)
get_point = lambda alpha: tuple(numpy.dot(_recursive(D - 1, n, alpha, family), X))
Expand Down

0 comments on commit 9def721

Please sign in to comment.