<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Nov 3, 2017 at 6:33 PM, Ed D'Azevedo <span dir="ltr"><<a href="mailto:dazevedoef@ornl.gov" target="_blank">dazevedoef@ornl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Dear PETSc expert,</p>
<p>I have a question on the correct way to use Fortran module in
petsc.</p>
<p>In this url on "UsingFortran"<br>
</p>
<p><br>
</p>
<p><font size="+1"><a class="m_-6850346571983587095moz-txt-link-freetext" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/UsingFortran.html#UsingFortran" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>petsc-current/docs/<wbr>manualpages/Sys/UsingFortran.<wbr>html#UsingFortran</a></font></p>
<p><font size="+1"><br>
</font></p>
<p><font size="+1">it mentions including both the
"petsc/finclude/petscXXX.h" file and the Fortran "use"
statement. <br>
</font></p>
<p><font size="+1">The example show the following:</font></p>
<p><br>
</p>
<p><font size="+1">#include "petsc/finclude/petscvec.h"<br>
use petscvec</font></p>
<p><font size="+1"> Vec b<br>
type(tVec) x<br>
</font></p>
<p><font size="+1"><br>
</font></p>
<p><font size="+1">My understanding of Fortran syntax is there
cannot be "parameter" statements before the module "use"
statement or in other words "use" statement cannot follow
"parameter" statement.<br>
</font></p>
<p><font size="+1">Do I understand correctly then all ".h" include
header files under "petsc/finclude/" should not have "parameter"
statements but just pure cpp macro statements such as "#define"
or "#ifdef"? <br>
</font></p>
<p><font size="+1"></font></p></div></blockquote><div>All the parameter statements are in the module.</div><div><br></div><div> Matt <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><p><font size="+1">One may imagine substituting "parameter"
statements with '#define' such as instead of <br>
</font></p>
<p><font size="+1">parameter (NOT_SET_VALUES=0)</font></p>
<p><font size="+1">#define NOT_SET_VALUES 0</font></p>
<p><font size="+1">#define not_set_values 0</font></p>
<p><font size="+1">In the petsc version 3.6.2 under
include/petsc/finclude, there seems to be some files such as
petscvec.h and petscmat.h that contain "parameter" statements.
<br>
</font></p>
<p><font size="+1"><br>
</font></p>
<p><font size="+1"><br>
</font></p>
<p><font size="+1">If there should be "parameter" statements in the
petsc/finclude header files, perhaps the order of the code
should be to list all F90 module "use" statements first, then
include 'petsc/finclude' header files?</font></p>
<p><br>
<font size="+1"><font size="+1">!
------------------------------<wbr>------------------------------<wbr>------------------</font></font></p>
<p><font size="+1">! parameter statements after the module use
statement</font></p>
<p><font size="+1">!
------------------------------<wbr>------------------------------<wbr>------------------<br>
</font></p>
<p><font size="+1"> use petscvec<br>
</font></p>
<p><font size="+1">#include "petsc/finclude/petscvec.h"<br>
<br>
</font></p>
<p><font size="+1"> Vec b<br>
type(tVec) x<br>
</font></p>
<p><font size="+1"></font><br>
</p>
</div>
</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>