[petsc-users] PetscCall( ) in fortran

Sanjay Govindjee s_g at berkeley.edu
Thu Aug 17 18:57:10 CDT 2023


Thanks.

For what it is worth in regards to question (1), GNU Fortran (Homebrew 
GCC 11.3.0_2) 11.3.0 seems to need .F90 (as opposed to just .F).

-sanjay


On 8/17/23 4:50 PM, Barry Smith wrote:
>
>> On Aug 17, 2023, at 7:44 PM, Sanjay Govindjee <s_g at berkeley.edu> wrote:
>>
>> Two questions about the PetscCall( ) etc. functionality in fortran:
>>
>> (1) To use this functionality, is it required to use a .F90 naming convention? or should I be able to use .F?
>     This likely depends on the compiler.
>> (2) Is it permitted to use line continuation within these calls? For example something like
>>
>>        PetscCallMPIA(MPI_Allreduce(localval,globalsum,1,&
>>          MPIU_REAL,MPIU_SUM, PETSC_COMM_WORLD,ierr))
>>
>> or is it required to just have an extra long line? or is there an alternate syntax for continuation in this case?
>     Because PetscCallXXX() is a macro, it "breaks" if a continuation is used, so yes, you will sometimes need long lines. Most Fortran compilers have an option to allow infinitely long lines.
>
>     Note that you can still use CHKERRQ() either all the time or in situations where you "need" a continuation character.
>
>    Barry
>
>
>> -sanjay
>>



More information about the petsc-users mailing list