<div dir="ltr">On Tue, Jul 16, 2013 at 9:15 AM, Karl Rupp <span dir="ltr"><<a href="mailto:rupp@mcs.anl.gov" target="_blank">rupp@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hey,<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As an extra error checking on user code we could save the Vec state of read only input Vecs and check it on exit of the routine to insure the user has not changed the Vec. This could be done in PCApply_Shell(), functions provided to SNES and TS etc.<br>
</blockquote>
<br>
we could do that, but I think this would slow the debug build down by quite a substantial amount (VecGetArrayRead() is used quite a lot internally as well), resulting in users to go with optimized builds during the development phase more often. Also, since VecGetArrayRead() returns a pointer to const, a user needs to cast away the const in order to manipulate entries, which already serves as an indication of doing something evil.<br>
</blockquote><div><br></div><div>I think Barry is only suggesting we save the state integer.</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">
What about a second debug level instead, something like 'PETSC_DEBUG_EXTRA', which enables additional, more expensive checks like the one you suggested? We could do similar valgrind-like checks for matrices, etc. there.<br>
<br>
Best regards,<br>
Karli<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Jul 16, 2013, at 8:08 AM, Rémi Lacroix <<a href="mailto:remi.lacroix@inria.fr" target="_blank">remi.lacroix@inria.fr</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
I'm currently developing a preconditioner using PETSc. I have a small question about the PCApply function.<br>
<br>
Is it safe to destroy the content of the input vector x while applying the preconditioner or should I make a copy of it and work on that?<br>
<br>
Best regards,<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Rémi Lacroix<br>
Équipe ALPINES<br>
Inria Paris-Rocquencourt / Laboratoire Jacques Louis Lions, UPMC<br>
<br>
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
</font></span></blockquote>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>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>