ufl icon indicating copy to clipboard operation
ufl copied to clipboard

Should `VectorElement` and `TensorElement` be subclasses of `MixedElement`?

Open ReubenHill opened this issue 5 years ago • 2 comments

Changes required to support vertex cells led to questions about the design decision of having VectorElement and TensorElement be subclasses of MixedElement.

Originally posted by @wence- in https://github.com/FEniCS/ufl/pull/30 :

I would advocate keeping MixedElement only for a "bag of unrelated elements" and create new Vector/TensorElement classes that rank-augment an existing FiniteElement object. One could then go one step further and just make VectorElement a functional constructor for a TensorElement.

ReubenHill avatar Jul 06 '20 15:07 ReubenHill

Probably the reason that VectorElement and TensorElement in UFL are MixedElement, because FFC implemented them such.

miklos1 avatar Jul 06 '20 18:07 miklos1

I now think that there shouldn’t be an inheritance hierarchy for finite element objects at all really. Instead there should be some abstract interface that they have to conform too and concrete implementations should just implement that interface. This would eliminate a lot of the anti patterns in the current inheritance hierarchy where either the superclass constructor is not called, or it is called multiple times from different places (see eg vectorelement).

this would be a breaking change because form compilers and assembly libraries would need to adapt to the new structure.

wence- avatar Feb 13 '21 12:02 wence-