<html><head></head><body>It should get/restore.<br><br><div class="gmail_quote">On May 19, 2017 12:10:32 PM MDT, Barry Smith <bsmith@mcs.anl.gov> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><br />   Jed,<br /><br />     Should this utilize the Get/Restore paradigm? <br /><br />     If not should the name be different to prevent confusion? Currently we have <br /><br />  XXXCreate -->  user needs to call a destroy<br /><br />   XXXXGetYYY  --> user needs to call a restore (but not always?)<br /><br />   Could we introduce say<br /><br />    XXXAccessYYY   --> user does not call destroy or restore ?<br /><br />  Barry<br /><br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> On May 19, 2017, at 9:20 AM, Jed Brown <jed@jedbrown.org> wrote:<br /> <br /> Thanks.  I just pushed this.<br /> <br /> commit 96a6f12955a790d77f6eb7eb6b1dcf9dd5e1cf30<br /> Author: Jed Brown <jed@jedbrown.org><br /> Date:   Fri May 19 08:17:45 2017 -0600<br /> <br />    MatISGetLocalMat: add note on reference counting<br /> <br />    Reported-by: Franck Houssen <franck.houssen@inria.fr><br /> <br /> diff --git a/src/mat/impls/is/matis.c b/src/mat/impls/is/matis.c<br /> index dc4a894aae..287c0aa554 100644<br /> --- a/src/mat/impls/is/matis.c<br /> +++ b/src/mat/impls/is/matis.c<br /> @@ -837,6 +837,9 @@ PetscErrorCode MatISGetLocalMat_IS(Mat mat,Mat *local)<br />   matrix and want to provide it to the inner matrix object to improve the performance<br />   of the MatSetValues() operation.<br /> <br /> +  This function does not increase the reference count for the local Mat.  Do not destroy it and do not attempt to use<br /> +  your reference after destroying the parent mat.<br /> +<br /> .seealso: MATIS<br /> @*/<br /> PetscErrorCode MatISGetLocalMat(Mat mat,Mat *local)<br /> <br /> Franck Houssen <franck.houssen@inria.fr> writes:<br /> <br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> Hello, <br /> <br /> Do I need to MatDestroy the local matrix returned by MatISGetLocalMat ? (the global matrix has been created with MatCreateIS) <br /> <br /> Tried to look in the source tree... But I'am not sure to get the answer: in petsc-3.7.6/src/mat/impls/is/matis.c, MatISGetLocalMat seems to call MatISGetLocalMat_C, but, I can't find MatISGetLocalMat_C in the source tree !?... <br /> <br /> Franck <br /></blockquote></blockquote><br /></pre></blockquote></div></body></html>