FEniCS / ufl

UFL - Unified Form Language
https://fenicsproject.org
GNU Lesser General Public License v3.0
97 stars 64 forks source link

Update apply_restrictions #271

Closed mscroggs closed 4 months ago

mscroggs commented 4 months ago

Replace multifunction for apply_restrictions with a class method (defined in a protocol). Caching of results is now achieved using functools.lru_cache rather than inside the multifunction.

This will allow apply_restrictions to be implemented for types defined outside UFL without having to add the implementation of this to algorithms/apply_restrictions.py.

As far as users are concerned, there should be no noticable change.

I propose that we aim to make this change for all multifunctions (https://github.com/FEniCS/ufl/issues/273).