xref: /petsc/src/sys/ftn-src/somefort.F90 (revision 6dd63270497ad23dcf16ae500a87ff2b2a0b7474)
1*6dd63270SBarry Smith!
2*6dd63270SBarry Smith!     Prevents: Warning: Same actual argument associated with INTENT(IN)
3*6dd63270SBarry Smith!     argument 'errorcode' and INTENT(OUT) argument 'ierror' at (1)
4*6dd63270SBarry Smith!     when MPI_Abort() is called directly
5*6dd63270SBarry Smith!
6*6dd63270SBarry Smith
7*6dd63270SBarry Smith#include <petsc/finclude/petscsys.h>
8*6dd63270SBarry Smith
9*6dd63270SBarry Smith      subroutine MPIU_Abort(comm,ierr)
10*6dd63270SBarry Smith      implicit none
11*6dd63270SBarry Smith      MPI_Comm comm
12*6dd63270SBarry Smith      PetscMPIInt ierr, nierr, ciportable
13*6dd63270SBarry Smith      call PetscCIEnabledPortableErrorOutput(ciportable)
14*6dd63270SBarry Smith      if (ciportable == 1) then
15*6dd63270SBarry Smith        call MPI_Finalize(nierr)
16*6dd63270SBarry Smith        stop 0
17*6dd63270SBarry Smith      else
18*6dd63270SBarry Smith        call MPI_Abort(comm,ierr,nierr)
19*6dd63270SBarry Smith      endif
20*6dd63270SBarry Smith      end
21*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
22*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::MPIU_Abort
23*6dd63270SBarry Smith#endif
24*6dd63270SBarry Smith
25*6dd63270SBarry Smith      subroutine PetscFortranPrintToFileUnit(unit,str,ierr)
26*6dd63270SBarry Smith      implicit none
27*6dd63270SBarry Smith      character(*) str
28*6dd63270SBarry Smith      integer4 unit
29*6dd63270SBarry Smith      PetscErrorCode ierr
30*6dd63270SBarry Smith      write(unit=unit, fmt="(A)", advance='no') str
31*6dd63270SBarry Smith      ierr = 0
32*6dd63270SBarry Smith      end
33*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
34*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PetscFortranPrintToFileUnit
35*6dd63270SBarry Smith#endif
36*6dd63270SBarry Smith
37*6dd63270SBarry Smith!  This uses F2003 feature - and is the preferred mode for accessing command line arguments
38*6dd63270SBarry Smith      integer function PetscCommandArgumentCount()
39*6dd63270SBarry Smith      implicit none
40*6dd63270SBarry Smith      PetscCommandArgumentCount = command_argument_count()
41*6dd63270SBarry Smith      end
42*6dd63270SBarry Smith
43*6dd63270SBarry Smith      subroutine PetscGetCommandArgument(n,val)
44*6dd63270SBarry Smith      implicit none
45*6dd63270SBarry Smith      integer, intent(in) :: n
46*6dd63270SBarry Smith      character(*) val
47*6dd63270SBarry Smith      call get_command_argument(n,val)
48*6dd63270SBarry Smith      end
49