Programming in *.f90 free format with PETSc
Satish Balay
balay at mcs.anl.gov
Thu Aug 9 01:58:09 CDT 2007
On Thu, 9 Aug 2007, Ben Tay wrote:
> Hi,
>
> Guess I'm too used to typing .f90 ;-) .... I've changed it to .F90 before but
> perhaps at that time the error I got didn't disappear so I didn't bother after
> that.
I'm sorry - but you can't keep silently discarding the sugestions we
make and keep reporting the same issues multiple times..
This is frustrating.
> I'm working in windows so I thought the capital letter doesn't really
> matter.
I've indicated this before. Most compilers use .F90 for prerpocessed
free form. And you keep indicating this is what you require. [Most
compilers don't preprocess .f90 files]
> Moreover, .f90 also works with my ifort in linux. Is it really
> important? If so, I'll change all my .f90 to F90. Thanks for highlighting.
>
> Here's a sample code test.F90:
I'll need a test code that can reproduce the problems you report.
>
> module global_data
>
> implicit none
>
> save
>
> #define PETSC_AVOID_DECLARATIONS
> #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"
> #undef PETSC_AVOID_DECLARATIONS
>
> integer :: size_x,size_y
>
> Mat A_mat ! /* sparse matrix */
>
> !MPI_Comm PETSC_COMM_SELF - commented out will result in error
>
> contains
>
> subroutine allo_var
Again you are ignoring the sample template I sent you. You need to
include PETSc include files in every subroutine.
I'm sorry I can't repeat this anymore.
Satish
>
> !allocate memory for variables
>
> integer :: status(2),ierr,k
>
> size_x=10;size_y=10
>
> call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
>
> call
> MatCreateSeqAIJ(PETSC_COMM_SELF,size_x*size_y,size_x*size_y,13,PETSC_NULL_INTEGER,A_mat,ierr)
>
> end subroutine allo_var
>
> end module global_data
>
> I got "Error: This name does not have a type, and must have an explicit type.
> [PETSC_NULL_CHARACTER]". Same for PETSC_NULL_INTEGER and PETSC_COMM_SELF.
>
> It was ok when I'm programming in fixed format.
>
> Thanks
>
> Satish Balay wrote:
> > On Thu, 9 Aug 2007, Ben Tay wrote:
> >
> >
> > > Hi,
> > >
> > > when I changed my global.F to global.f90,
> > >
> >
> > Any perticular reason why you keep using .f90 suffix even though I've
> > recommended using .F90 suffix [for preprocessed free form] a few
> > times?
> >
> >
> > > I was told that PETSC_COMM_SELF, PETSC_NULL_INTEGER and
> > > PETSC_NULL_CHARACTER does not have a type.
> > >
> >
> > Please send a test code that demonstrates this problem.
> >
> > Satish
> >
> >
> >
>
>
More information about the petsc-users
mailing list