Programming in *.f90 free format with PETSc

Satish Balay balay at mcs.anl.gov
Mon Aug 6 10:24:38 CDT 2007


This is incorrect usage.

If you are getting errors with the correct usage, send us the error
messages, with your code, and we can sugest fixes.

- one issue could be

> > #define PETSC_AVOID_DECLARATIONS
> > #include "include/finclude/petsc.h"
> > #include "include/finclude/petscvec.h90"  <--- This should be removed from here..
> > <other includes>
> > #undef PETSC_AVOID_DECLARATIONS
> >
> > moudle foobar
> > <other module stuff>
> > end module


Satish

On Mon, 6 Aug 2007, Ben Tay wrote:

> Hi,
> 
> I tried to use
> 
> #define PETSC_AVOID_DECLARATIONS
> #include "include/finclude/petsc.h"
> <other includes>
> #undef PETSC_AVOID_DECLARATIONS
> 
> 
> module ada
> ...
> 
> subroutine ....
> 
> end module ada
> 
> but the compiler says that the module is placed in the wrong order. Anyway, I
> just move the top 4 lines into the subroutine instead and it worked. Thanks
> 
> module ada
> 
> ...
> 
> subroutine ddd
> 
> #define PETSC_AVOID_DECLARATIONS
> #include "include/finclude/petsc.h"
> <other includes>
> #undef PETSC_AVOID_DECLARATIONS
> 
> ....
> 
> end subroutine ddd
> 
> 
> 
> 
> Satish Balay wrote:
> > 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