Introduce an interface class between the UFL visitor and the PDELab generator functions
Thinking about the design of the sum factorization backend I come to the conclusion that this is a good idea.
Current state:
class UFL2LoopyVisitor:
def argument(self, o):
....
return .... name_basis() ...
....
... many more handlers calling generator functions
Proposed solution:
class UFL2LoopyVisitor:
def argument(self, o):
....
return .... self.interface.name_basis() ...
....
... many more handlers calling generator functions
class PDELabInterface:
def name_basis(..):
return name_basis(...)
... many more generator functions ....
That would mean, you can inherit a SumFactPDELabInterface
from PDELabInterface
and feed an instance of it into the visitor instead. This might sound like it is contradicting the previously implemented backend-selection mechanism, but it is actually supporting it for those switches, where basically everything changes.