dokken
3
A general advice is to set physical group after all synchronisation is done.
Please also note that you could have presented a way smaller example.
Also note that you cannot write both triangles and lines to the same xdmf file and be compatible with legacy dolfin, this is for instance shown here:
And