Indeed, a tighter check on the IndexSet::subIndex interface shows that other implemented indices may as well be not conforming with the Index::index result.
The codim==1 case for 3d grids is not implemented for UGGrid because the relevant information is not readily available in the UG3 grid data structure. However, this doesn't mean that the method cannot be written. It will just be a bit more complicated and slower than you may expect.
Very few (==0?) people have asked for this particular case in the past. If you need it for something I'll try to find the time to add the missing code.
I am trying to have finite elements on the skeleton of the grid (i.e. codim!=0), and for that I am relying on the subIndex method to attach degrees of freedom to a unique index on the grid. So indexation is exactly the same processes as for codim==0 but the argument of subIndex becomes an entity of codim!=0. 2D grid with 1D elements works perfectly, but with a 3D grid with 2D elements I hit this exception.
I had a quick look at this again. The faces (entity of codim 1 asking for sub entity of codim 0) seems easy, but I didn't manage to get the edges and vertices out of a face (sub-entities of codim 1 and 2). It seems to me that the method UG_NS<dim>::Corners is missing for the face element in 3D (I guess this is a UG_NS<dim>:Node?) @oliver.sander could you help me out with some hints for this?
Alternatively, is there any other form to get this info out of the grids? I really could not find anything else yet.
Historically, UG3 did not have an internal representation for 2d-facets of 3d elements (let's call them "facets") at all. (Ask Christian or Peter about "UG-with-faces" for interesting reactions...)
The current implementation therefore uses objects of type vector instead. Historically, these were the objects that held numerical data, like FE coefficients. They could be attached to vertices, edges, and elements. They could not be attached to facets, but they could be attached to element sides (which, from a user perspective, was made to look like the same thing). I removed a lot of code concerning that, but parts of it remain. Now only vectors attached to element sides ("side vectors") are still allowed.
The UGGridEntity object of the grid interface points to a vector element in dune-uggrid. But for the historic reasons given above, that vector objects knows very little about the grid topology. All it knows is (one of) the (two) element it is attached to, in the object member. So what you need to to implement subIndex for facets is to get the element, and extract the numbers from there.
I recognize that this is tricky. I'll be happy to do a phone call to explain more details.