> On Jan 9, 2018, at 12:53 AM, Matteo Semplice <[email protected]> wrote: > > Dear all, > > I could not find info on the manual but from the examples and my own > trying I guess that the vectors involved in the SNESfunction should be global > ones and that, if one needs ghosts values to compute the function and/or the > jacobian, should do a GlobalToLocal communication inside the function. > Correct?
Absolutely > (I get errors of inconsistent dimensions between Vecs and Mats if I call > SNESSolve(snes,b, localU)...) > > Since I need the ghost values both in the function and in the jacobian > evaluation, would it be safe (and worthwhile) to do define a local vector in > the ctx, perform the communication in the function and using the vec in the > ctx in the jacobian evaluation (without performing again the communication in > the SNESJacobianFunction?)... Put in other words, is it guaranteed that each > call to the jacobian function is preceded by a call to the function with the > same x argument? I would not rely on this. It is an unnecessary and risky optimization. Just treat the function and Jacobian evaluations as independent operations. Barry > > Thanks, > Matteo Semplice
