[petsc-dev] What needs to be done before a release?

Blaise Bourdin bourdin at lsu.edu
Wed May 2 12:02:35 CDT 2012


Barry,

>> Also, fortran wrappers over PetscOptionsEnum and PetscBagRegisterEnum would be nice. I understand that it
>> is a bit tricky since it involves passing fortran arrays of strings.
> 
>     Yup. We'd be willing to support these from FORTRAN but someone else has to do the dirty work of figuring out how to handle those array of strings (maybe F2003?).

I am attaching a simple proof of concept example that demonstrates how to write a fortran interface and call petsc C functions from fortran using F2003 C-interoperability instead of going through the fortran bindings.

Don't be put off by all the warnings if you use gfortran. They would be easy to avoid. Basically, right now, you detect the fortran integer and real kinds that match that of the C ones. It would be quite simple to get the fortran C-interoperable integer and real types associated with the C type of PetscInt, PetscReal etc.

Basically, we (I?) could write a fortran interface and a fortran function for the tricky functions involving arrays of string, instead of creating a custom binding in C. Are you willing to let some fortran pollution into the petsc code? Where would these function have to be? 

Blaise

PS: you need FCFLAGS='-ffixed-line-length-none  -ffree-line-length-none -ffree-form' or some subset of these to compile with gfortran. I'm not sure why these are not the default with a file suffix .F90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PetscF2003Binding.F90
Type: application/octet-stream
Size: 4437 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120502/f364196c/attachment.obj>
-------------- next part --------------

-- 
Department of Mathematics and Center for Computation & Technology
Louisiana State University, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin









More information about the petsc-dev mailing list