Problem with type annotations in facedof_index()
The function facedof_index()
from indexing.py
currently states that its index
argument should be of type Tuple[int,int,int]
. However, of these three indices it only makes use of the first two when unpacking the tuple: x, y, _ = index
.
Now in my implementation of local_dofs in p2_plus_bubble_space_impl
I call
volume_dof_indices = micro_element_to_volume_indices(
element_type, element_index, 1, VolumeDoFMemoryLayout.SoA
)
and get back: [DoFIndex([ctr_0, ctr_1], DoFType.VOLUME, FaceType.GRAY)
. Which has a list of only two ints as primitive_index
.
So feeding this into facedof_index()
via calling:
volume_array_indices = [
dof_idx.array_index(geometry, indexing_info)
for dof_idx in volume_dof_indices
]
crashes as there tuple has not enough entries for the unpacking.
Changing the type annotation to Tuple[int,int]
and unpacking via x, y = index
does not work for mypy, as apparently the formal type of the argument that gets passed is Tuple[int,int]
.
Edited by Marcus Mohr