<!DOCTYPE html>
<!-- BaNnErBlUrFlE-BoDy-start -->
<!-- Preheader Text : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">
Martin, Thanks for the suggestions and offer. The tool we use for automatically generating the Fortran stubs and interfaces is bfort. Its limitations include that it cannot handle string arguments automatically and cannot generate more than
</div>
<!-- Preheader Text : END -->
<!-- Email Banner : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerStart</div>
<!--[if ((ie)|(mso))]>
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="padding: 16px 0px 16px 0px; direction: ltr" ><tr><td>
<table border="0" cellspacing="0" cellpadding="0" style="padding: 0px 10px 5px 6px; width: 100%; border-radius:4px; border-top:4px solid #90a4ae;background-color:#D0D8DC;"><tr><td valign="top">
<table align="left" border="0" cellspacing="0" cellpadding="0" style="padding: 4px 8px 4px 8px">
<tr><td style="color:#000000; font-family: 'Arial', sans-serif; font-weight:bold; font-size:14px; direction: ltr">
This Message Is From an External Sender
</td></tr>
<tr><td style="color:#000000; font-weight:normal; font-family: 'Arial', sans-serif; font-size:12px; direction: ltr">
This message came from outside your organization.
</td></tr>
</table>
</td></tr></table>
</td></tr></table>
<![endif]-->
<![if !((ie)|(mso))]>
<div dir="ltr" id="pfptBanner9anu06b" style="all: revert !important; display:block !important; text-align: left !important; margin:16px 0px 16px 0px !important; padding:8px 16px 8px 16px !important; border-radius: 4px !important; min-width: 200px !important; background-color: #D0D8DC !important; background-color: #D0D8DC; border-top: 4px solid #90a4ae !important; border-top: 4px solid #90a4ae;">
<div id="pfptBanner9anu06b" style="all: unset !important; float:left !important; display:block !important; margin: 0px 0px 1px 0px !important; max-width: 600px !important;">
<div id="pfptBanner9anu06b" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-weight:bold !important; font-weight:bold; font-size:14px !important; line-height:18px !important; line-height:18px">
This Message Is From an External Sender
</div>
<div id="pfptBanner9anu06b" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-weight:normal; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-size:12px !important; line-height:18px !important; line-height:18px; margin-top:2px !important;">
This message came from outside your organization.
</div>
</div>
<div style="clear: both !important; display: block !important; visibility: hidden !important; line-height: 0 !important; font-size: 0.01px !important; height: 0px"> </div>
</div>
<![endif]>
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerEnd</div>
<!-- Email Banner : END -->
<!-- BaNnErBlUrFlE-BoDy-end -->
<html>
<head><!-- BaNnErBlUrFlE-HeAdEr-start -->
<style>
#pfptBanner9anu06b { all: revert !important; display: block !important;
visibility: visible !important; opacity: 1 !important;
background-color: #D0D8DC !important;
max-width: none !important; max-height: none !important }
.pfptPrimaryButton9anu06b:hover, .pfptPrimaryButton9anu06b:focus {
background-color: #b4c1c7 !important; }
.pfptPrimaryButton9anu06b:active {
background-color: #90a4ae !important; }
</style>
<!-- BaNnErBlUrFlE-HeAdEr-end -->
<meta charset="utf-8"></head><body><pre style="font-family: sans-serif; font-size: 100%; white-space: pre-wrap; word-wrap: break-word">
Martin,
Thanks for the suggestions and offer.
The tool we use for automatically generating the Fortran stubs and interfaces is bfort.
Its limitations include that it cannot handle string arguments automatically and cannot generate more than one interface for a function. This is why we need to provide these manually (the use of a,b,... is to prevent long lines and the need for continuations in the definitions of the interfaces).
Adding support for strings is very straightforward, just a little more smarts in bfort.
Adding support for multiple interface generation is a bit trickier because the code must (based on the C calling sequence) automatically determine all the combinations of array vs single value the interfaces should generate and then generate a Fortran stub for each (all mapping back to the same master stub for that function). I've talked to Bill Gropp about having him add such support, but he simply does not have time for such work so most recent work on the bfort that PETSc uses has been by us.
We've always had some tension between adding new features to bfort vs developing an entirely new tool (for example in Python (maybe calling a little LLVM to help parse the C function), for maybe there is already a tool out there) to replace bfort. Both approaches have their advantages and disadvantages instead we've relied on the quick and dirty of providing the interfaces as needed). We have not needed the Fortran standard C interface stuff and I would prefer not to use it unless it offers some huge advantage).
Thoughts?
Barry
> On Mar 21, 2024, at 12:21 PM, Martin Diehl <martin.diehl@kuleuven.be> wrote:
>
> Dear PETSc team,
>
> I've worked on Fortran interfaces (see
> <a href="https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/issues/1540__;!!G_uCfscf7eWS!Z2hB888HeDFnBuJk3ArQd9Lx0RRQuRSNQOAcJo8skOxRMZ5_V4fU8Ss6mn2AEQ-4Jn6tWTEhS-o5TzXOdkf8tNc$">https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/issues/1540__;!!G_uCfscf7eWS!Z2hB888HeDFnBuJk3ArQd9Lx0RRQuRSNQOAcJo8skOxRMZ5_V4fU8Ss6mn2AEQ-4Jn6tWTEhS-o5TzXOdkf8tNc$</a>) but could not get far in
> the time I could afford.
>
> In discussion with Javier (in CC) the idea came up to propose to offer
> the work on Fortran interfaces for PETSc as a Google Summer of Code
> project.
>
> fortran-lang has been accepted as organization and the current projects
> are on:
> <a href="https://urldefense.us/v3/__https://github.com/fortran-lang/webpage/wiki/GSoC-2024-Project-ideas__;!!G_uCfscf7eWS!Z2hB888HeDFnBuJk3ArQd9Lx0RRQuRSNQOAcJo8skOxRMZ5_V4fU8Ss6mn2AEQ-4Jn6tWTEhS-o5TzXO0g4xW4w$">https://urldefense.us/v3/__https://github.com/fortran-lang/webpage/wiki/GSoC-2024-Project-ideas__;!!G_uCfscf7eWS!Z2hB888HeDFnBuJk3ArQd9Lx0RRQuRSNQOAcJo8skOxRMZ5_V4fU8Ss6mn2AEQ-4Jn6tWTEhS-o5TzXO0g4xW4w$</a>
>
> The main work would be the automatization of interfaces that are
> currently manually created via Python. This includes an improved user
> experience, because correct variable names (not a, b, c) can be used.
> It should be also possible to automatically create descriptions of the
> enumerators.
>
> As outlook tasks, I would propose:
> - check whether a unified automatization script can also replace the
> current tool for creation of interfaces.
> - investigate improved handling of strings (there are ways in newer
> standards).
>
> I can offer to do the supervision, but would certainly need guidance
> and the ok from the PETSc core team.
>
> best regards,
> Martin
>
> --
> KU Leuven
> Department of Computer Science
> Department of Materials Engineering
> Celestijnenlaan 200a
> 3001 Leuven, Belgium
</pre></body></html>