Programming in *.f90 free format with PETSc
Ben Tay
zonexo at gmail.com
Thu Aug 9 01:45:32 CDT 2007
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 working in windows so I thought the
capital letter doesn't really matter. 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:
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
!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