Closed chrisrichardson closed 1 year ago
Other use of switch/case and code in the ufcx interface can also be replaced with static data, e.g. for integrals and function space.
tabulate_entity_dofs()
and tabulate_entity_closure_dofs()
coefficient_name_map()
and constant_name_map()
integral_ids()
integrals()
and num_integrals()
Agree. We had many "dynamic" allocations and dynamic factories in the old FFC, https://github.com/FEniCS/ffcx/pull/321
UFCx provides some functions, e.g.
tabulate_entity_dofs
which are implemented in C using switch/case. There is no real need for this, and there are additional issues for prism/pyramid where the number of dofs per entity is variable. The switch/case syntax is messy and confusing, error prone.I propose replacing the code with static data. Essentially, it is just a list of lists, and this can be encoded with two arrays:
e.g. for closure dofs on a prism, note different lengths for dim 2. Python:
C:
In fact, these offsets could all be put into one array, assuming we know the topology already (I think we do).