<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 12, 2018 at 12:26 PM, Vaclav Hapla <span dir="ltr"><<a href="mailto:vaclav.hapla@erdw.ethz.ch" target="_blank">vaclav.hapla@erdw.ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">At master, configured with<br>
--download-exodusii --download-hdf5 --download-netcdf --download-pnetcdf --with-scalar-type=complex<br>
I get bunch of compiler warnings<br>
warning: passing argument 2 of ‘VecGetArrayRead’ from incompatible pointer type<br>
warning: passing argument 2 of ‘VecRestoreArrayRead’ from incompatible pointer type<br>
in<br>
src/dm/impls/plex/<wbr>plexexodusii.c.<br>
<br>
Is this configuration not covered by nightly tests?<br>
<br>
<br>
I want to fix it anyway. Do you agree with the following scheme?<br></blockquote><div><br></div><div>I think we can do it inline. Can you send the compile error?</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">
Vec v;<br>
const PetscScalar *arr;<br>
PetscReal *arr_real;<br>
#if defined(PETSC_USE_COMPLEX)<br>
PetscInt i;<br>
#endif<br>
<br>
...<br>
ierr = VecGetArrayRead(v, &arr);CHKERRQ(ierr);<br>
#if defined(PETSC_USE_COMPLEX)<br>
ierr = PetscMalloc1(size, &arr_real);CHKERRQ(ierr);<br>
for (i = 0; i < size; ++i) {<br>
arr_real[i] = PetscRealPart(arr[i]);<br>
#if defined(PETSC_USE_DEBUG)<br>
if (PetscImaginaryPart(arr[i])) {<br>
SETERRQ(PETSC_COMM_SELF, PETSC_ERR_SUP, "Vector contains complex numbers but only real vectors are currently supported.");<br>
}<br>
#endif<br>
}<br>
#else<br>
arr_real = (PetscReal*)arr;<br>
#endif<br>
<br>
...<br>
ierr = VecRestoreArrayRead(v, &arr);CHKERRQ(ierr);<br>
#if defined(PETSC_USE_COMPLEX)<br>
ierr = PetscFree(arr_real);CHKERRQ(<wbr>ierr);<br>
#endif<br>
<br>
<br>
Thanks,<br>
Vaclav</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>