[petsc-dev] fortran questions

Blaise Bourdin bourdin at lsu.edu
Wed May 16 13:16:33 CDT 2012


On May 16, 2012, at 11:48 AM, Satish Balay wrote:

> On Wed, 16 May 2012, Satish Balay wrote:
> 
>> 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.
> 
> sorry - I misread 'src/f90-mod/petscmod.F' as 'src/sys/f90-mod/petscmod.F'
> 
> So - yes - perhaps thats a suitable location.
I remember loosing my mind once trying to find the petsc module. I'll move it to $PETSC_DIR/stc/f90-mod, unless somebody screams.

> 
> Satish
> 
>> 
>> 
>>> - 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 tried once, but I lost my mind trying to follow the way files are nested, and trying to get to a solution that preserves all possible way to interface with fortran.


>> 
>>> - 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.

That's where I get confused. Take src/sys/bag/bag.c :
PetscBagCreate fortran binding is created automatically in ftn-auto, yet there is no include/finclude/ftn-auto/petscbag.h90
What am I missing?


Blaise 

-- 
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