Dear Petsc,

Commit 051fd8986cf23c0556f4229193defe128fafa1f7 changed the C signature
of the sorting routines and as a result I cannot compile against them
anymore from Fortran.
I tried to rebuild Petsc from scratch and did a make allfortranstubs but
still to no avail.

I attach a simple fortran program that calls PetscSortInt and gives the
following error at compile time.




petsc_fortran_sort.F90:15:27:

       call PetscSortInt(N, x, ierr)
                           1
Error: Rank mismatch in argument ‘b’ at (1) (scalar and rank-1)

Same applies for other routines such as PetscSortIntWithArrayPair...

I am not sure where to find the FortranInterfaces and currently had no
time to dig deeper.

Please let me know if I have missed something stupid.

Many thanks,

Fabian


P.S. Petsc was compiled with
--with-fortran
--with-fortran-interfaces
--with-shared-libraries=1
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules

run:: petsc_fortran_sort
                ./petsc_fortran_sort

petsc_fortran_sort:: petsc_fortran_sort.F90
                ${PETSC_FCOMPILE} -c petsc_fortran_sort.F90
                ${FLINKER} petsc_fortran_sort.o -o petsc_fortran_sort 
${PETSC_LIB}

clean::
                rm -rf *.o petsc_fortran_sort
program main
#include "petsc/finclude/petsc.h"

  use petsc
  implicit none

  PetscErrorCode :: ierr
  PetscInt, parameter :: N=3
  PetscInt :: x(N)

  call PetscInitialize(PETSC_NULL_CHARACTER,ierr)

  x = [3, 2, 1]

  call PetscSortInt(N, x, ierr)

  call PetscFinalize(ierr)
end program

Reply via email to