[petsc-dev] SETERRQ in fortran

Blaise A Bourdin bourdin at lsu.edu
Thu Jan 4 13:42:20 CST 2018


Hi,

Is SETERRQ still available in fortran? I notice that it is not used in any of the example, but the man page still mentions fortran. Using it in a fortran code leads to compiler errors.
Am I doing something wrong?

MacBookGray:F90 $ cat TestSETERRQ.F90 
Program TestSETERRQ
#include <petsc/finclude/petsc.h>
   Use petsc

   Implicit NONE
   PetscInt           :: ierr
   Character(len=256) :: IOBuffer
   
   Call PetscInitialize(PETSC_NULL_CHARACTER, ierr);CHKERRA(ierr)
   write(IOBuffer,'("This is a test ierr = ",I2,"\n")') ierr
   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,IOBuffer)
   call foo()
   Call PetscFinalize(ierr)
Contains
    subroutine foo()
       Character(len=256) :: IOBuffer
       
       write(IOBuffer,'("This is a test ierr = ",I2,"\n")') 42
       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,IOBuffer)
    end subroutine foo
End Program TestSETERRQ

MacBookGray:F90 $ make -f makefile.TestSETERRQ TestSETERRQ
mpif90 -c -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g    -I/opt/HPC/petsc-next/include -I/opt/HPC/petsc-next/Darwin-gcc7.2-g/include -I/opt/X11/include    -o TestSETERRQ.o TestSETERRQ.F90
TestSETERRQ.F90:11:61:

    SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,IOBuffer)
                                                             1
Error: Expecting END PROGRAM statement at (1)
TestSETERRQ.F90:19:65:

        SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,IOBuffer)
                                                                 1
Error: Expecting END SUBROUTINE statement at (1)
make: [TestSETERRQ.o] Error 1 (ignored)


Blaise

-- 
Department of Mathematics and Center for Computation & Technology
Louisiana State University, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin









More information about the petsc-dev mailing list