F.dim()
is the global dimension of the function space. Consider the following:
from dolfin import *
import numpy as np
mesh = RectangleMesh(Point(0, 0), Point(1, 1), 2, 2)
F = FunctionSpace(mesh, "CG", 1)
c = Function(F)
dm = F.dofmap()
local_range = dm.ownership_range()
local_dim = local_range[1] - local_range[0]
info("This process has ownership of DoFs: %s" % str(local_range))
c.vector().set_local(np.array([1.0]*local_dim, dtype=np.double))