[petsc-dev] fortran questions

Satish Balay balay at mcs.anl.gov
Wed May 16 11:44:14 CDT 2012


On Wed, 16 May 2012, Blaise Bourdin wrote:

> Hi,
> 
> I am trying to have a look at the fortran modules code.
> - the petsc and petscdef modules are defined in src/ts/f90-mod/petsctsmod.F would it make more sense to move them to src/f90-mod/petscmod.F

The progression was as follows:

- every petsc object [in the object hierarchy] has its own module -
  i.e petscts is in src/ts/f90-mod/petsctsmod.F

- and each module shoud be built in the correct order of
  hierarchy. [i.e 'petscts' is built after 'petscsnes']

- we decided to have 'petsc' and 'petscdef' to be the over-arching
  module for all petsc modules - hence they are in
  src/ts/f90-mod/petsctsmod.F.

So src/f90-mod/petscmod.F is an appropriate place for 'petscsys.mod'
but not 'petsc.mod'. If we have to move it out of ts - then it would
probably be some new dir like:
src/overarching-super-petsc/f90-mod/petsctsmod.F or some more suitable
name.


> - Is there a valid reason for not including petscdef.h in the module petsc? 

Hm - because its a supermodule that makes sure all petsc component
modules are getting used? So each component module already had the
necessary stuff? BTW: the def.h files [like petscdef.h] just have
preprocessing info - so it doesn't get instantiated into the
module. [All of this #define stuff needs to be transformed into a
format that can be instantiated in a module eventually]

> - I would like to create the fortran datatype for PetscBag (Barry: yes, I have a fortran fetish), but I am not completely sure where to start. In particular, how are the .h / .h90 in include/finclude/f90-auto created?

bfort should be creating these during fortranstub generation [either
during configure step - or with 'make allfortranstubs']. If the c-code
has a formatted comment that tells bfort to auto-generate fortran stub
- it might also generate the 'interface' function and stash it in
include/finclude/f90-auto.

Satish



More information about the petsc-dev mailing list