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

Barry Smith bsmith at mcs.anl.gov
Mon Apr 28 06:57:24 CDT 2014

call MatGetSize(petsc_matrix%A_PetSC,m,n)


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