<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Oct 15, 2017 at 6:54 PM, Adrian Croucher <span dir="ltr"><<a href="mailto:a.croucher@auckland.ac.nz" target="_blank">a.croucher@auckland.ac.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>hi<br>
</p><span class="gmail-">
<br>
<div class="gmail-m_-8312771401851561596moz-cite-prefix">On 14/10/17 00:47, Matthew Knepley
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote"><br>
<div>If you want the wrapper to take in F90 pointer
arguments, then you have to declare it or you get an SEGV.
These</div>
<div>get autogenerated in
include/petsc/finclude/ftn-<wbr>auto/*.h90 when you run 'make
allfortranstubs'. Did this happen</div>
<div>for your function?</div>
</div>
</div>
</div>
</blockquote>
<br></span>
I just tried running make allfortranstubs, but I don't see anything
new in include/petsc/finclude/ftn-<wbr>auto/*.h90, and my test program
still crashes.<br>
<br>
I also tried doing a make clean and make allfortranstubs all, but
that didn't help.<br>
<br>
I even tried deleting my $PETSC_ARCH directory and rebuilding
everything (including make allfortranstubs) but again it didn't
help.<br>
<br>
I'm a bit surprised that custom Fortran bindings should produce
anything in include/petsc/finclude/ftn-<wbr>auto/, I thought that would
only be for the auto-generated stuff that comes out of bfort?</div></blockquote><div><br></div><div>Okay, I was wrong about what gets produced. Barry rewrote the Fortran bindings last, and I did not understand how everything</div><div>was put together. You will need to make some modifications. Here is the idea: we build an F90 module for each class, and your</div><div>stuff will go in the Vec module here:</div><div><br></div><div> <a href="https://bitbucket.org/petsc/petsc/src/c99b676fdc4d0978b5621d138ceee2e1b7869aa6/src/vec/f90-mod/petscvecmod.F?at=master&fileviewer=file-view-default">https://bitbucket.org/petsc/petsc/src/c99b676fdc4d0978b5621d138ceee2e1b7869aa6/src/vec/f90-mod/petscvecmod.F?at=master&fileviewer=file-view-default</a></div><div><br></div><div>You will need to make a module in this file petscsf. It should look about like the petscao module. That means making</div><div>a petscsf.h90 with your new interfaces, like this one</div><div><br></div><div> <a href="https://bitbucket.org/petsc/petsc/src/c99b676fdc4d0978b5621d138ceee2e1b7869aa6/src/vec/f90-mod/petscis.h90?at=master&fileviewer=file-view-default">https://bitbucket.org/petsc/petsc/src/c99b676fdc4d0978b5621d138ceee2e1b7869aa6/src/vec/f90-mod/petscis.h90?at=master&fileviewer=file-view-default</a></div><div><br></div><div>and also a generic petscsf.h, like this one</div><div><br></div><div> <a href="https://bitbucket.org/petsc/petsc/src/c99b676fdc4d0978b5621d138ceee2e1b7869aa6/src/vec/f90-mod/petscao.h?at=master&fileviewer=file-view-default">https://bitbucket.org/petsc/petsc/src/c99b676fdc4d0978b5621d138ceee2e1b7869aa6/src/vec/f90-mod/petscao.h?at=master&fileviewer=file-view-default</a></div><div><br></div><div>Then in your example you need a</div><div><br></div><div> use petscsf</div><div><br></div><div>which will bring in the interface for your function, causing Fortran to pass the array descriptor instead of some bogus pointer.</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"><div bgcolor="#FFFFFF"><span class="gmail-HOEnZb"><font color="#888888"><br>
- Adrian</font></span><span class="gmail-"><br>
<pre class="gmail-m_-8312771401851561596moz-signature" cols="72">--
Dr Adrian Croucher
Senior Research Fellow
Department of Engineering Science
University of Auckland, New Zealand
email: <a class="gmail-m_-8312771401851561596moz-txt-link-abbreviated" href="mailto:a.croucher@auckland.ac.nz" target="_blank">a.croucher@auckland.ac.nz</a>
tel: <a href="tel:+64%209-923%204611" value="+6499234611" target="_blank">+64 (0)9 923 4611</a>
</pre>
</span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="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>