[petsc-users] variable declaration in Fortran90
Dharmendar Reddy
dharmareddy84 at gmail.com
Tue Aug 28 16:00:58 CDT 2012
>From what i understand, you should #include the corresponding petscdef
files in the module and the petsc headers in the subroutine.
petsc version installed on machine is petsc-3.2-p5
I use a single include file: #include "finclude/petscdef.h" in the module
and in the subroutines (including the ones that are defined after contains
in the module) and program.
#include "finclude/petsc.h"
you can use #include "finclude/petsc.h90" if you are using the things such
as vecgetArrayF90
On Tue, Aug 28, 2012 at 3:45 PM, Roc Wang <pengxwang at hotmail.com> wrote:
> Hello,
>
>
> I am developing Fortran90 code with PETSc. Several Modules are defined
> in the code. Such as
>
> Module MyParameter
> Implicit none
> #include "finclude/petscsys.h"
> #include "finclude/petscvec.h"
> #include "finclude/petscmat.h"
> #include "finclude/petscpc.h"
> #include "finclude/petscksp.h"
> #include "finclude/petscvec.h90"
> #include "finclude/petscmat.h90"
>
> Integer:: ... ...
> Real:: ... ...
>
>
> End Module MyParameter
>
> Module MySub
> Use Myparameter
> Contains
> ... ...
> Call MatSetType(A_Mat, MATAIJ, ierr)
> ... ...
> EndModule MySub
>
>
> Main Program
> Use MyParameter
> Use MySub
> ... ...
> ... ...
> End
>
> If I put all the modules in a single .F90 file, the compilation can be
> done successfully. However, If I put the modules in separated files, the
> following error information comes out:
>
> Error: Symbol 'mataij' at (1) has no IMPLICIT type.
>
> In addition, if I use PetscInt, PetscErrorCode to declare variables in
> Module MySub, the similar errors come out. How declare the variable with
> PETSc type in separate files? Thanks.
>
>
>
>
>
>
>
>
--
-----------------------------------------------------
Dharmendar Reddy Palle
Graduate Student
Microelectronics Research center,
University of Texas at Austin,
10100 Burnet Road, Bldg. 160
MER 2.608F, TX 78758-4445
e-mail: dharmareddy84 at gmail.com
Phone: +1-512-350-9082
United States of America.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120828/595dd34d/attachment.html>
More information about the petsc-users
mailing list