Programming in *.f90 free format with PETSc

Satish Balay balay at mcs.anl.gov
Sun Aug 5 23:42:13 CDT 2007


you can use .F90 suffix for free-from preprocesed code. [or use
compiler options to force it always use free-form]

And when using fortran modules use the following organization:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#define PETSC_AVOID_DECLARATIONS
#include "include/finclude/petsc.h"
<other includes>
#undef PETSC_AVOID_DECLARATIONS

moudle foobar
<other module stuff>
end module

subroutine xyz()
use foobar
implicit none
#include "include/finclude/petsc.h"
<other includes>
<code>
end subroutine
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Satish

On Mon, 6 Aug 2007, Ben Tay wrote:

> Hi,
> 
> I've no problem writing out codes in fortran fixed format with PETSc. However,
> is it possible to do it in fortran free format as well?
> 
> I'm using visual fortran and there's error.
> 
> original :
> 
> test.F
> 
> module global_data
> 
>    implicit none
> 
>    save
> 
> #include "include/finclude/petsc.h"
> #include "include/finclude/petscvec.h"
> #include "include/finclude/petscmat.h"
> #include "include/finclude/petscksp.h"
> #include "include/finclude/petscpc.h"
> #include "include/finclude/petscmat.h90"
> 
>    Vec    xx,b_rhs
> 
> ....
> 
> How can I change this code to fortran free format *.f90?
> 
> Thanks
> 
> 




More information about the petsc-users mailing list