<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 12, 2020, at 2:59 PM, Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" class="">thibault.bridelbertomeu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="auto" class="">Dear Jed, dear Barry,</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Thank you for the fast answers ! </div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">If I have any success I will make sure to make a pull request to provide some version of ex11 in Fortran. </div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Regarding the stubs, I admit I started looking in that direction to add the missing wrappers but I am not sure I fully understand the process yet. </div><div dir="auto" class="">For each C function, I gotta provide a Fortran interface in a .h90 file as well as a C function that has a Fortran-like prototype and calls the C function - right ?</div></div></blockquote><div><br class=""></div>  Yes,</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""> However there are a few things I could not find / understand yet. </div><div dir="auto" class="">For instance, it appears that for C functions that have character string arguments take an extra argument in their Fortran-like-prototype-wrapper, namely the length of the string. Is that passed automatically ? I couldn’t find where it could come from ...</div></div></blockquote><div><br class=""></div>   This secret argument is put automatically by the Fortran compiler.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class="">Another thing is for functions like PetscFVView. I guess the wrapping is less straightforward because I tried a quick something and it segfault’ed. I couldnt find the wrapper for DMView although there is such a routine in Fortran too. Could you please detail how to wrap such functions ? </div></div></blockquote><div><br class=""></div><div>PETSC_EXTERN void dmview_(DM *da,PetscViewer *vin,PetscErrorCode *ierr)</div><div>{</div><div>  PetscViewer v;</div><div>  PetscPatchDefaultViewers_Fortran(vin,v);</div><div>  *ierr = DMView(*da,v);</div><div>}</div><div class=""><br class=""></div><div class="">dm/interface/ftn-custom/zdmf.c</div><div class=""><br class=""></div><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Thank you very much again,</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Thibault Bridel-Bertomeu</div><div class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 12 déc. 2020 à 21:48, Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>> a écrit :<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div style="word-wrap:break-word;line-break:after-white-space" class=""><div class=""><br class=""></div>   PETSc Fortran interfaces are a combination of automatically generated and manually generated. <div class=""><br class=""></div><div class="">   For any C PETSc function if the manual page begins with /*@  it generates the Fortran interface automatically (make allfortranstubs).  If it begins /*@C then either the Fortran interface is done manually or is missing. </div><div class=""><br class=""></div><div class="">   C functions that have character string arguments or function arguments (or a few other special cases) need to be manually provided.  The automatically generated stubs go in the directory ftn-auto while manually generated ones go in the directory fin-custom.</div><div class=""><br class=""></div><div class="">   Perhaps you could first generate a list of "missing" Fortran stubs and then for each stub determine why it is missing and if it can be provided. Some are likely easy to provide but a few (involving function arguments) will be more involved. Once you have all the stubs available translating ex11.c becomes straightforward.</div></div><div style="word-wrap:break-word;line-break:after-white-space" class=""><div class=""><br class=""></div><div class="">  Barry</div><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Dec 12, 2020, at 9:30 AM, Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank" class="">thibault.bridelbertomeu@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div class="">Dear all, </div><div class=""><br class=""></div><div class="">Is there somewhere a version of the TS tutorial ex11.c in Fortran ?</div><div class="">I am looking into building in F90 (let's say that it is an unavoidable constraint) an unstructured 3D solver of the Euler equations using the "new" features of PETSc - mostly DMPlex & PetscFV - but I think there are some interfaces missing and I find it hard to find workarounds in Fortran. I would be grateful if anyone could please give me some pointers ...</div><div class=""><br class=""></div><div class="">Thank you very much in advance,</div><br clear="all" class=""><div class=""><div dir="ltr" data-smartmail="gmail_signature" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class="">Thibault Bridel-Bertomeu<br class="">—<br class=""></div></div></div></div>Eng, MSc, PhD</div><div class="">Research Engineer</div><div class="">CEA/CESTA</div><div class="">33114 LE BARP</div><div class="">Tel.: (+33)557046924</div><div class="">Mob.: (+33)611025322<br class=""></div><div class="">Mail: <a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank" class="">thibault.bridelbertomeu@gmail.com</a><br class=""></div></div></div></div></div></div></div></div>
</div></blockquote></div><br class=""></div></div></blockquote></div></div>-- <br class=""><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class="">Thibault Bridel-Bertomeu<br class="">—<br class=""></div></div></div></div>Eng, MSc, PhD</div><div class="">Research Engineer</div><div class="">CEA/CESTA</div><div class="">33114 LE BARP</div><div class="">Tel.: (+33)557046924</div><div class="">Mob.: (+33)611025322<br class=""></div><div class="">Mail: <a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank" class="">thibault.bridelbertomeu@gmail.com</a><br class=""></div></div></div></div></div></div>
</div></blockquote></div><br class=""></body></html>