[petsc-dev] PetscSF in Fortran

Adrian Croucher a.croucher at auckland.ac.nz
Sun Sep 24 19:18:30 CDT 2017


On 21/09/17 15:15, Jed Brown wrote:
> Unfortunately PetscSFSetGraph/PetscSFGetGraph need custom bindings for
> Fortran and they have not been written.  Shouldn't be difficult, but
> will take a little work/testing.  I would probably make the array of
> PetscSFNode be a PetscInt array of length 2n (or of shape (2,n)) --
> that's an equivalent memory representation to what we're using now.

That sounds like the sort of thing I need.

Alternatively, it occurred to me I could probably just use 
DMCreateDefaultSF() to create the point SF on the new DM- would there be 
any disadvantage in doing it that way?

However, at the moment I can't, because it appears the Fortran interface 
for DMCreateDefaultSF() is missing. I would have thought the interface 
for that should be simple enough, as it just takes a DM and a couple of 

- Adrian
> Adrian Croucher <a.croucher at auckland.ac.nz> writes:
>> hi
>> For the dual-porosity stuff I'm working on, I'm creating a modified
>> DMPlex. Looking at e.g. TS ex11.c (in the SplitFaces() routine), it
>> appears I am going to have to set up a PetscSF for the new DM (from what
>> I can gather, that is needed for managing parallel communication of
>> partition ghost cell values).
>> The way I've set up the modified DMPlex, the partition ghost cells are
>> in the same locations as they were in the original single-porosity DM.
>> So I'm thinking I basically just have to copy the SF straight over from
>> the original DM.
>> The routine DMGetPointSF() seems to work OK in Fortran, but I'm having a
>> bit of trouble with PetscSFGetGraph().
>> When I try to declare an array of type PetscSFNode for the iremote
>> parameter, it doesn't seem to know about PetscSFNode, even though I have
>> a 'use petsc' in my code, which normally gives access to everything.
>> Also I'm not sure of exactly how to set up the ilocal and iremote array
>> parameters for this function in Fortran. How should they be declared- as
>> pointer arrays?
>> - Adrian

Dr Adrian Croucher
Senior Research Fellow
Department of Engineering Science
University of Auckland, New Zealand
email: a.croucher at auckland.ac.nz
tel: +64 (0)9 923 4611

More information about the petsc-dev mailing list