I am currently writing my own point-wise petsc4py solver which needs data that lives in u = Function(Q), where Q is of type CG1 (i.e., a P1 element, same as the coordinates).
Right now I am doing something like this:
for i in range(mesh.num_vertices()):
FormInitialGuess(u.vector()[i])
Solve(...)
...
but it seems the u.vector()[i] operation is extremely slow. Is there a faster or more efficient way of calling or extracting pointwise values?