> On Oct 20, 2017, at 8:09 PM, Jed Brown <[email protected]> wrote:
> 
> Barry Smith <[email protected]> writes:
> 
>>> On Oct 20, 2017, at 12:31 PM, Jed Brown <[email protected]> wrote:
>>> 
>>> Barry Smith <[email protected]> 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)?

   Because the code he started to write uses F90Array1dAccess() which is built 
around PetscDataType, hence he needs to convert the MPI_Datatype. Which is 
where all the trouble comes from. There are multiple ways of resolving his 
problem, it more depends on my time then anything else since it is unlikely 
anyone but you or I will "fix" this, and you don't have time.

   

  Barry




Reply via email to