It depends what is your function. For example
from dolfin import *
mesh = UnitSquareMesh(42, 42)
c = Constant(42.0)
print assemble(c*ds, mesh=mesh)
f = Expression("1.0 + x[0]*x[1]", degree=2)
print assemble(f*dx, mesh=mesh)
V = FunctionSpace(mesh, "Lagrange", 2)
u = project(f, V)
print assemble(u*dx)
Necessary quadrature degree is automatically estimated by algorithms in UFL (altough they are not flawless) and corresponding Gauss rule is used. Note explicit setting of polynomial degree of compiled expression f
- it is not recognized in any way.