Hi Alex,
if you have defined the regions as specific materials/boundaries you can integrate over them by e.g. Integrate(gf*dx(“materialname”),mesh), Integrate(gf*ds(“boundaryname”),mesh).
Another possibility is to create an order zero L2 or FacetFESpace GridFunction and set the faces/edges of interest to 1. This GridFunction is then used as indicator function. E.g.
gfl = GridFunction(L2(mesh,order=0))
gfl.vec[...]=1
Integrate(gf*gfl, mesh)
Best,
Michael