How to work with nonconforming meshes?

Hi, I solved a Dirichlet problem associated to a Laplace equation with FEniCSx, in a square.
After that, I computed the normal derivatives in the cells of the mesh adjacent to the boundary of the square.
Then I want to map these derivatives on the dofs of the inner boundary of a domain made up by a rectangle with a hole in the centre, where the hole is the square in which I solved the problem. I managed to do this when the two meshes are conforming, but when the two meshes are not conforming how can I do this? Is there a specific function that I can use?
I paste the code that works with conforming meshes

def map_normal_derivatives_on_dof(V, msh, inner_facets, normal_derivatives_dict):
    """
    Map the normal derivatives (from dict di interpolate_derivatives_near_boundary)
    to the DOF of the inner boundary of the rectangle with hole
    """
    import numpy as np
    import matplotlib.pyplot as plt
    from dolfinx import fem, mesh

    g_neumann = fem.Function(V)
    g_neumann.x.array[:] = 0.0

    dof_vals = np.zeros_like(g_neumann.x.array)
    dof_count = np.zeros_like(g_neumann.x.array)

    # Connettività: faccets → vertices
    msh.topology.create_connectivity(1, 0)
    edge_to_vertex = msh.topology.connectivity(1, 0)

    for facet in inner_facets:
        if facet not in normal_derivatives_dict:
            continue

        normal_derivative = normal_derivatives_dict[facet]["normal_derivative"]

        # Find the vertices (nodes) of the faccet
        nodes = edge_to_vertex.links(facet)

        for node in nodes:
            dofs = fem.locate_dofs_topological(V, 0, [node])
            for dof in dofs:
                dof_vals[dof] += normal_derivative
                dof_count[dof] += 1

    # Normalize
    mask = dof_count > 0
    g_neumann.x.array[mask] = dof_vals[mask] / dof_count[mask]


    for facet in inner_facets:
        if facet in normal_derivatives_dict:
            val = normal_derivatives_dict[facet]["normal_derivative"]
            print(f"  Facet {facet}: normal_derivative = {val:.6e}")
    return g_neumann

This is the case that I’ studying now:

If you specify the two meshes as separate dolfinx.mesh.Mesh instances, you can use nonmatching interpolation, see for instance:

V0.9.x:

Main branch: