[petsc-users] Fortran 90 problem (basic level)

Danny Lathouwers - TNW D.Lathouwers at tudelft.nl
Mon Apr 28 07:48:19 CDT 2014


Thanks Barry,
Works now.
I missed that from reading the doc on the internet. Will try to remember that one.
Danny.

-----Original Message-----
From: Barry Smith [mailto:bsmith at mcs.anl.gov] 
Sent: maandag 28 april 2014 13:57
To: Danny Lathouwers - TNW
Cc: petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] Fortran 90 problem (basic level)


call MatGetSize(petsc_matrix%A_PetSC,m,n)

call MatMatMult(A,B,MAT_INITIAL_MATRIX,PETSC_DEFAULT_DOUBLE_PRECISION,C)

missing the final ierr argument.

On Apr 28, 2014, at 4:26 AM, Danny Lathouwers - TNW <D.Lathouwers at tudelft.nl> wrote:

> Dear users,
>  
> I encountered some basic problems when using PETSc with Fortran90. To illustrate the problem easiest I made a simple problem (attached).
> There is a petsc.f90 that contains a module with all PETSc specific coding (initializations, etc).
> I have a main with some easy declarations and calls. There also is a f90_kind for type definition (essentially for the 'double precision'). Note that I wrap the matrices in Fortran structures so that I can keep the code free from PETSc except petsc.f90.
> The file 'output' is what I get.
>  
> The program fills two diagonal matrices of size 10. This seems to work fine.
>  
> The call to get_info should print the number of rows and columns of a matrix: it thinks the number of columns is 0.
>  
> Another routine mat_prod does matrix-matrix multiplication through MatMatMult. This seg faults.
>  
> I also tried the above with all kinds of includes instead of the 'use'-manner. This gave the same results.
>  
> It seems like the interfacing is not working as it should. Am I missing a 'use' statement or a compile option?
> strangely enough the matrix construction does work fine.
>  
> I hope anyone might shed some light on this.
>  
> Thank you.
> Danny
> <f90_kind.f90><main.f90><petsc.f90><Makefile><output>



More information about the petsc-users mailing list