Is local remeshing possible with fenicsx?

Hi all, I want to use fenicsx to solve fluid dynamics problems, and I am quite new to it.

I want to let a triangular mesh advect with the flows (Lagrangian approach). However, this means that I will have to remesh from time to time to prevent triangles to become too elongated. I want to try an approach of local remeshing where I replace just two adjacent very elongated triangles by two other triangles. Does a function already exist that does this in fenicsx? If not, does fenicsx give me sufficiently fine-grained access to the implementation that I can carry out this topology change (and the corresponding local interpolation of all functions) in python by hand, or would I need to talk to the cpp interface?

Thanks in advance for the help!

You can access all the functionality in topology to do some local refinement.
The functions are exposed in Python through:

Especially:

Set connectivity, which you should set between (tdim, 0).

For interpolation from one Mesh to a modified one, I would probably use interpolate_nonmatching, as you will have to re-create the function space and dofmap once the topology has been modified (The dofmap depends on the topology).