interface
  Subroutine PetscFortranPrintToFileUnit(unit,str,ierr)
    import tPetscViewer
    integer unit
    character(len=*), intent(in) :: str
    PetscErrorCode, intent(out):: ierr
  End Subroutine
  Subroutine PetscViewerASCIIOpenWithFileUnit(comm,unit,lab,ierr)
    import tPetscViewer
    MPI_Comm, intent(in) :: comm
    integer, intent(in) :: unit
    PetscViewer, intent(out) :: lab
    PetscErrorCode, intent(out):: ierr
  End Subroutine
  Subroutine PetscViewerASCIISetFileUnit(lab,unit,ierr)
    import tPetscViewer
    PetscViewer, intent(in) :: lab
    integer, intent(in) :: unit
    PetscErrorCode, intent(out):: ierr
  End Subroutine
end interface

Interface PetscViewerBinaryWrite
  Subroutine PetscViewerBinaryWriteInt(v,a,cnt,tmp,ierr)
   import tPetscViewer
    PetscViewer v
    PetscInt a(*)
    PetscInt cnt
    PetscBool  tmp
    PetscErrorCode, intent(out):: ierr
  End Subroutine

  Subroutine PetscViewerBinaryWriteScalar(v,a,cnt,tmp,ierr)
    import tPetscViewer
    PetscViewer v
    PetscScalar a(*)
    PetscInt cnt
    PetscBool  tmp
    PetscErrorCode, intent(out):: ierr
  End Subroutine

#if defined(PETSC_USE_COMPLEX)
  Subroutine PetscViewerBinaryWriteReal(v,a,cnt,tmp,ierr)
    import tPetscViewer
    PetscViewer v
    PetscReal a(*)
    PetscInt cnt
    PetscBool  tmp
    PetscErrorCode, intent(out):: ierr
  End Subroutine
#endif

  Subroutine PetscViewerBinaryReadInt(v,a,cnt,ierr)
    import tPetscViewer
    PetscViewer v
    PetscInt a(*)
    PetscInt cnt
    PetscErrorCode, intent(out):: ierr
  End Subroutine

  Subroutine PetscViewerBinaryReadScalar(v,a,cnt,ierr)
    import tPetscViewer
    PetscViewer v
    PetscScalar a(*)
    PetscInt cnt
    PetscErrorCode, intent(out):: ierr
  End Subroutine

#if defined(PETSC_USE_COMPLEX)
  Subroutine PetscViewerBinaryReadReal(v,a,cnt,ierr)
    import tPetscViewer
    PetscViewer v
    PetscReal a(*)
    PetscInt cnt
    PetscErrorCode, intent(out):: ierr
  End Subroutine
#endif

End Interface
