<div dir="ltr"><div><div>Thanks a lot. So, I guess I shouldn't destroy it before I use it completely in other functions. And in the end I just call a destroy functions.<br><br></div>Best,<br></div>Ehsan<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 15, 2015 at 5:36 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Mon, Jun 15, 2015 at 4:12 PM, ehsan sadrfaridpour <span dir="ltr"><<a href="mailto:it.sadr@gmail.com" target="_blank">it.sadr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi,<br></div>Thanks for your great support. <br>I am developing my code in c++ and I have created 4 matrices in a function and they are work fine.<br>In the end of the function I need to delete them to release the memory space they occupied.<br></div><div><ul><li>My question:</li></ul></div><div><div style="margin-left:40px">However, I need to pass these matrices to other functions (or another class) and use their contents before I destroy them in the current function.<br></div><br>(I need it because now I have a long function and I want to make it smaller. Also I need to make a recursive function that gets matrices as input.)<br><br></div></div>I was thinking of using a pointer to the beginning of each of them, but I am not very good at this. Also I am worried about how I destroy them.<br><br></div><div>Would you please let me know what is the best approach for this?<br></div></div></blockquote><div><br></div></div></div><div>You can just use "Mat A" since the PETSc type is a pointer.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div><div>Best,<br></div><div>Ehsan<br></div><br></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><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>
</font></span></div></div>
</blockquote></div><br></div>