<div dir="ltr"><div dir="ltr">On Wed, Mar 13, 2019 at 12:16 PM Bastian Löhrer via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear PETSc users,<br>
<br>
I am having difficulties passing PETSc data on to Paraview Catalyst and <br>
it may be related to the way we handle the PETSs data in our Fortran code.<br>
<br>
We have DMDA objects, which we pass on to subroutines this way:<br>
<br>
> ...<br>
> call DMCreateLocalVector(da1dof, loc_p, ierr)<br>
> ...<br>
> call VecGetArray(loc_p, loc_p_v, loc_p_i, ierr)<br>
> call process( loc_p_v(loc_p_i+1) )<br>
> ...<br>
><br>
<br>
Inside the subroutine (process in this example) we treat the <br>
subroutine's argument as if it were an ordinary Fortran array:<br>
<br>
> subroutine process( p )<br>
><br>
> use gridinfo ! provides gis, gie, ... etc.<br>
><br>
> implicit none<br>
><br>
> #include "petsc_include.h"<br>
><br>
> PetscScalar, dimension(gis:gie,gjs:gje,gks:gke) :: p<br>
> PetscInt i,j,k<br>
><br>
> do k = gks, gke<br>
> do j = gjs, gje<br>
> do i = gis, gie<br>
><br>
> p(i,j,k) = ...<br>
><br>
> enddo<br>
> enddo<br>
> enddo<br>
><br>
> end subroutine process<br>
><br>
I find this procedure a little quirky, but it has been working <br>
flawlessly for years.<br>
<br>
However, I am now encountering difficulties when passing this <br>
variable/array p on to a Paraview Catalyst adaptor subroutine. Doing so <br>
I end up with very strange values there. When replacing p with an <br>
ordinary local Fortran array everything is fine.<br></blockquote><div><br></div><div>I can't think of a reason it would not work. I would look at the pointer you get inside</div><div>the Catalyst function using the debugger.</div><div><br></div><div>Note that you can also get an F90 array out if that is what Catalyst needs.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Bastian<br></blockquote></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><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.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>