Grouping the cells

Hello everyone,
I would like to know how I can group the cells in a mesh in dolfinx. This way, instead of taking one cell, I can consider a group of cells.
I really appreciate any help you can provide.

What do you imply when you say grouping? What kind of operation would you like to apply on the group?

I am trying to coarsen the mesh. So I want to find the cells where it has value by creating groups. In this way, I can refer to the collection of cells having that particular value instead of looking for each ell.

This is still very abstract. You can get indices of groups of cells by for instance using a marking function

def marker_func(x):
     # Create some criterion based on the vertices of the cells
     criterion = # some numpy array with true_false values of the same size as x.shape[1]
     return criterion
cells = dolfinx.mesh.locate_entities(mesh, mesh.topology.dim, marker_func)

Thank you, I will take a look at this