<div dir="ltr"><div dir="ltr">On Wed, Feb 1, 2023 at 6:33 PM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Would it be possible to rig the xlocal obtained from self.da.getLocalVec() to automatically trigger the da.restoreLocalVec() when the xlocal goes out of scope so that the user does not need to explicitly make the call. If so, how should I go about implementing it?<br></blockquote><div><br></div><div>This would work in C++ where the object has a defined lifetime, but Python is garbage collected. The way it does this</div><div>pattern is using the "with" statement.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Barry<br></blockquote></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>