In serial, yes. It is the same. In parallel the latter approach does not update ghost values. You would have to call ’u1.vector().apply(“insert”)` afterwards to ensure updates.
Got it. Thank you very much, Dokken. Could you please tell me which one you prefer to use in serial? Besides, in parallel u1.assign(u2) will update ghost values and doesn’t need any additional operations? So I think u1.assign(u2) is the better method both in serial and parallel. Can I say this?
I don’t use legacy Dolfin much, so either would be fine. Working directly on the vector data is slightly faster than assign, as it does no checks regarding vector compatibility.