<div class="gmail_quote">On Mon, Jun 6, 2011 at 20:34, Kai Germaschewski <span dir="ltr"><<a href="mailto:kai.germaschewski@unh.edu">kai.germaschewski@unh.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":cu">Wouldn't it make sense to have DMDAVecGetArray[23]d() and have the argument be PetscScalar ***, and PetscScalar ****, respectively? That would actually check that one passes in a reference to the right type, making it both safe and avoid the need for casting? That's also more in line with, e.g., VecGetArray2d().<br>
</div></blockquote><div><br></div><div>The field type is often not PetscScalar (it's a struct containing several PetscScalar members) so you would need the cast anyway. The cast is also very complicated if you're going to make the interface const-correct.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":cu">
<br>I'm not sure where else void ** is used, and whether similar solutions would apply. In general, I agree with Jed that I'd rather not have the explicit cast in the user code.</div></blockquote></div><br><div>I was thinking of SNESGetApplicationContext() and similar. There are a few places where the user registers a context and may also have to get it out.</div>