Call PETSc matrix operator MatDiagonalSet (…)

Dear Prof. Pierre Jolivet,

Your know, after solving a PDE for u, we can use dx(u) to get the derivative of u.

However, In the case parallel, it seems we cannot directly do so, because I found the results were different between using one processor and two processors.

Do we have to gather (centralise) u to one processor, compute the derivative, and then distribute the results across different processors? or there is a simple trick?

Best,
Yongxing.