<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Nov 8, 2017 at 2:09 PM, Munson, Todd <span dir="ltr"><<a href="mailto:tmunson@mcs.anl.gov" target="_blank">tmunson@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On Nov 8, 2017, at 10:32 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
><br>
> On Wed, Nov 8, 2017 at 11:21 AM, Munson, Todd <<a href="mailto:tmunson@mcs.anl.gov">tmunson@mcs.anl.gov</a>> wrote:<br>
><br>
> I had a question. There is VecGetArrayRead and VecRestoreArrayRead. However, the<br>
> sameconcept does not appear with IS. Is there a reason for not having<br>
> ISGetIndicesRead and ISRestoreIndicesRead?<br>
><br>
> Actually, ISGetIndices() is always read-only. Maybe we should change the name?<br>
<br>
If you want to be consistent, I would change the name. However, it looks<br>
like propagating the change would be a headache.<br></blockquote><div><br></div><div>Its one of those things that is true, but has little upside.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Just to push on some buttons, is there any reason why the user cannot change<br>
the contents of the array? The documentation just says "should not".<br></blockquote><div><br></div><div>They are mostly copies, so changing them would have no effect.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is there any requirement that the indices be in increasing order? (Other<br>
than perhaps poor performance.)<br></blockquote><div><br></div><div>No, but I think that it is assumed for some operations.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am also wondering if the IS objects should keep track of the space allocated<br>
in addition to the actual amount used. This would let me create an IS of the<br>
maximum size and update it. Currently, when using, for example, VecWhichInactive,<br>
a new IS is always created inside the code. Inside of TRON, I then need to destroy<br>
the old IS and create a new one every iteration, rather than reusing the space.<br>
Is eliminating a free and malloc per iteration worth making changes?<br></blockquote><div><br></div><div>We could consider this, but really IS is intended to be a static object, not a dynamic one.</div><div>I think Jed's SegBuffer is supposed to be dynamic, and could underlie a dynamic index</div><div>object.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Note: MatMult does not create a new vector for the result when called, so it<br>
seems a bit inconsistent for VecWhichInactive, etc. to create a new IS for<br>
the result.<br></blockquote><div><br></div><div>Most of the objects in PETSc are fixed size, and when the size changes you recreate it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If we keep the code as currently written, should we somehow change the<br>
name of the methods and the documentation to reflect that the IS<br>
result is created by the method (so a pointer to a NULL object<br>
should be passed in and the caller is responsible for<br>
freeing it).<br></blockquote><div><br></div><div>Yes, I agree with that.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Yes, I should have looked at this a long time ago. Now index<br>
sets are used all over the place and I do not quite<br>
understand the design considerations.</blockquote><div><br></div><div>IS objects can be views into other memory, so the object could be created but the backing</div><div>memory could be maintained somewhere else so that there is not a big malloc every time.</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"><span class="HOEnZb"><font color="#888888"><br>
Todd.<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><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.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>