On Wed, Jun 1, 2011 at 3:48 AM, Jed Brown <span dir="ltr"><<a href="mailto:jed@59a2.org">jed@59a2.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><div class="gmail_quote">On Wed, Jun 1, 2011 at 04:56, 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">

I did not want to downcast because PetscPow() works for (Scalar, Int) and (Scalar, Real) so automatically casting to (int) is not right.</blockquote></div><div><br></div></div>1. There is no PetscPow()  :-)<div><br><div>
2. In C, PetscPowScalar *always* has arguments (PetscScalar, PetscScalar), *not* (PetscScalar,PetscReal), (PetscScalar, int), or other variants. The fact that it "works" with other combinations is only because of C's automatic promotion rules. C++ has different promotion rules and overloads the name for (PetscScalar, int).</div>
</div></blockquote><div><br></div><div>Yes, C was not producing a problem.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div>This still isn't (PetscScalar, PetscInt). Indeed, if PetscInt is int64_t, then PetscPowScalar(some_scalar, some_int) fails. That is the problem you fixed by introducing PowInt. But PowInt is always defined to be int, either by explicit typedef (with PETC_USE_64BIT_INDICES) or indirectly (because PetscInt was already typedef'd to int). So "typedef int PowInt" will always be equivalent to what you have.</div>

</div>
</blockquote></div><br>BUT that cast is explicit so the user knows. I do not see a way to do it implicitly. If they really wanted a Scalar, it would<div>get cast to an int. Alternatively, If they really wanted and int, it would get cast to a Scalar.<br>
<div><br></div><div>   Matt<br clear="all"><br>-- <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<br>

</div></div>