[petsc-dev] PetscOptionsXXX, PetscOptionsGetXX, and PetscBag in Fortran

Barry Smith bsmith at petsc.dev
Tue May 16 11:53:37 CDT 2023


  Using block might be possible, but I would say is likely overkill; better just to skip the "local scope" that the C versions of the routines have. No one ever used the GUI interface, so that code is all unnecessary plus a Fortran programmer would never use a GUI anyways :-)

  https://gitlab.com/petsc/petsc/-/merge_requests/6473

  Barry


   

> On May 16, 2023, at 11:33 AM, Blaise Bourdin <bourdin at mcmaster.ca> wrote:
> 
> Hi,
> 
> 
> I am revisiting the way I handle options my fortran fracture code. I see the following options:
>  - use PetscGetXXX, with the caveat that as far as I can see options define this way do not show up when using -help 
>  - use PetscBags, which is what I do now. It is a bit convoluted and I am still struggling to make it work with fortran deferred types for instance
> 
> In a C code, I would use PetscOptionsXXX, but this is not an options since PetscOptionsBegin / PetscOptionsEnd do not exist in fortran. I remember looking at this a while ago, and concluding that a Fortran version was not possible because these were macro that defined local variables at locations where it cannot be done legally in Fortran. With the concept of blocks in modern fortran, this issue is gone, but PetscOptionsBegin has become more complicated and relies on multiple operations and data types that are not available in Fortran.
> 
> Does anybody see a way to build fortran versions of PetscOptionsBegin/PetscOptionsEnd? 
> 
> Regards,
> Blaise
> 
> 
>> Canada Research Chair in Mathematical and Computational Aspects of Solid Mechanics (Tier 1)
> Professor, Department of Mathematics & Statistics
> Hamilton Hall room 409A, McMaster University
> 1280 Main Street West, Hamilton, Ontario L8S 4K1, Canada 
> https://www.math.mcmaster.ca/bourdin | +1 (905) 525 9140 ext. 27243
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20230516/cec229a1/attachment.html>


More information about the petsc-dev mailing list