xref: /petsc/src/sys/ftn-src/somefort.F90 (revision b06eb4cd3db6f436e3907d9ad23211c2914d8916)
16dd63270SBarry Smith!
26dd63270SBarry Smith!     Prevents: Warning: Same actual argument associated with INTENT(IN)
36dd63270SBarry Smith!     argument 'errorcode' and INTENT(OUT) argument 'ierror' at (1)
46dd63270SBarry Smith!     when MPI_Abort() is called directly
56dd63270SBarry Smith!
66dd63270SBarry Smith
76dd63270SBarry Smith#include <petsc/finclude/petscsys.h>
86dd63270SBarry Smith      subroutine MPIU_Abort(comm, ierr)
9fe66ebccSMartin Diehl        use, intrinsic :: ISO_C_binding
10*b06eb4cdSBarry Smith        use petscmpi
116dd63270SBarry Smith        implicit none
12*b06eb4cdSBarry Smith        MPIU_Comm comm
136dd63270SBarry Smith        PetscMPIInt ierr, nierr, ciportable
146dd63270SBarry Smith        call PetscCIEnabledPortableErrorOutput(ciportable)
156dd63270SBarry Smith        if (ciportable == 1) then
166dd63270SBarry Smith          call MPI_Finalize(nierr)
176dd63270SBarry Smith          stop 0
186dd63270SBarry Smith        else
196dd63270SBarry Smith          call MPI_Abort(comm, ierr, nierr)
206dd63270SBarry Smith        end if
216dd63270SBarry Smith      end
226dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
236dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::MPIU_Abort
246dd63270SBarry Smith#endif
256dd63270SBarry Smith
266dd63270SBarry Smith      subroutine PetscFortranPrintToFileUnit(unit, str, ierr)
27fe66ebccSMartin Diehl        use, intrinsic :: ISO_C_binding
286dd63270SBarry Smith        implicit none
296dd63270SBarry Smith        character(*) str
306dd63270SBarry Smith        integer4 unit
316dd63270SBarry Smith        PetscErrorCode ierr
326dd63270SBarry Smith        write (unit=unit, fmt="(A)", advance='no') str
336dd63270SBarry Smith        ierr = 0
346dd63270SBarry Smith      end
356dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
366dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PetscFortranPrintToFileUnit
376dd63270SBarry Smith#endif
386dd63270SBarry Smith
396dd63270SBarry Smith!  This uses F2003 feature - and is the preferred mode for accessing command line arguments
406dd63270SBarry Smith      integer function PetscCommandArgumentCount()
41fe66ebccSMartin Diehl        use, intrinsic :: ISO_C_binding
426dd63270SBarry Smith        implicit none
436dd63270SBarry Smith        PetscCommandArgumentCount = command_argument_count()
446dd63270SBarry Smith      end
456dd63270SBarry Smith
466dd63270SBarry Smith      subroutine PetscGetCommandArgument(n, val)
476dd63270SBarry Smith        implicit none
486dd63270SBarry Smith        integer, intent(in) :: n
496dd63270SBarry Smith        character(*) val
506dd63270SBarry Smith        call get_command_argument(n, val)
516dd63270SBarry Smith      end
52