[petsc-dev] PetscSF in Fortran

Jed Brown jed at jedbrown.org
Fri Oct 20 20:09:34 CDT 2017


Barry Smith <bsmith at mcs.anl.gov> writes:

>> On Oct 20, 2017, at 12:31 PM, Jed Brown <jed at jedbrown.org> wrote:
>> 
>> Barry Smith <bsmith at mcs.anl.gov> writes:
>> 
>>>   Adrian,
>>> 
>>>    You should not use F90Array1d *rptr as arguments in the Fortran interface. You should just use a regular Fortran one dimensional array of real/scalar.
>>> Fortran doesn't handle polymorphism in this way at all. You have to have multiple f90 interfaces, one for each type and provide a C stub for real, int, or whatever else you want to send.
>> 
>> Barry, look at the "use mpi_f08" way of calling MPI from Fortran.
>
>   Jed,
>
>    Rather terse response. 
>
>    Are you suggesting in PETSc we use type(*) to manage multiple types through the same function?  Looks doable, I wasn't aware of this. This could possibly reduce a lot of code duplication we currently have. 

PetscSF uses MPI type handling and thus it would make sense to use a
similarly designed Fortran module.

>    Still I would like to get rid of the use PetscDataType rather than write new code that uses it.
>
>    I need to think more in this case.
>
>    Waiting to hear from Adrian what types he needs to pass around (use of PetscDataType restricts to built in MPI datatypes regardless of what Fortran interface approach we use

What does that has to do with PetscSF, which never used PetscDataType
and uses MPI datatypes with support for derived types (albeit with a
limited number of combiners)?


More information about the petsc-dev mailing list