Thanks @dokken!
I’ve been analyzing the code and it’s only possible to refine the predefined MeshTag. Is it not possible to refine some mesh cells (selected through a given condition) with the help of MeshTag?

mesh.topology.create_connectivity(mesh.topology.dim,1)
c_to_e = mesh.topology.connectivity(mesh.topology.dim,1)
edges=[]
for cell in marked_cells:
for e in c_to_e.links(cell):
edges.append(e)

One last question: it is not possible to define the degree of refinement, correct? By default in the refinement, the edge is divided into 2 parts. For example, to divide it into 4 parts, I have done through 2 cycles the refinement. Is there a more efficient way?