The TELEMAC-MASCARET system
trunk
sources
utils
special
plante.F
Go to the documentation of this file.
1
! *****************
2
SUBROUTINE
plante
3
! *****************
4
!
5
&(ival)
6
!
7
!***********************************************************************
8
! SPECIAL V6P1 21/08/2010
9
!***********************************************************************
10
!
11
!brief CAUSES A DIVIDE CHECK IF IVAL = 0 SUCH THAT THE CALL TREE
12
!+ IS GIVEN WHEN THE PROGRAM STOPS FOLLOWING DETECTION OF
13
!+ AN ERROR.
14
!+
15
!+ USE INSTEAD OF "STOP"
16
!
17
!warning ALSO EXISTS IN THE BIEF LIBRARY
18
!warning CALL TO PLANTE MUST BE FOLLOWED BY A "STOP" SO THAT
19
!+ THE COMPILER UNDERSTANDS THAT'S THE END
20
!
21
!bug IN THE EVENT OF A COMPILATION ERROR WITH THIS SUBROUTINE
22
!+ ERASE THE TWO LINES MARKED CJAJ
23
!
24
!history J-M HERVOUET (LNH) ; F LEPEINTRE (LNH)
25
!+ 17/08/1994
26
!+ V5P5
27
!+
28
!
29
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
30
!+ 13/07/2010
31
!+ V6P0
32
!+ Translation of French comments within the FORTRAN sources into
33
!+ English comments
34
!
35
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
36
!+ 21/08/2010
37
!+ V6P0
38
!+ Creation of DOXYGEN tags for automated documentation and
39
!+ cross-referencing of the FORTRAN sources
40
!
41
!history Y AUDOUIN (LNHE)
42
!+ 25/05/2015
43
!+ V7P0
44
!+ Now crashing properly in parallel
45
!
46
!history S.E.BOURBAN (HRW)
47
!+ 16/09/2016
48
!+ V7P2
49
!+ Compatible flushing depending on compiler used
50
!+ (necessary for Algorithmic Differentiation)
51
!+ TODO: Create a common function with NESTOR and other flushes.
52
!
53
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54
!| IVAL |-->| INTEGER VALUE, OPTION, SEE CODE BELOW
55
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56
!
57
USE
declarations_special
58
#if defined NO_STD_FLUSH || NAGFOR
59
USE
f90_unix_io
, ONLY
: flush
60
#endif /* NO_STD_FLUSH || NAGFOR */
61
!
62
#if defined HAVE_MPI
63
# if defined HAVE_MPI_MOD
64
USE
mpi
65
IMPLICIT NONE
66
# else
67
IMPLICIT NONE
68
include
'mpif.h'
69
# endif
70
#endif
71
!
72
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
73
!
74
INTEGER
,
INTENT(IN)
:: ival
75
!
76
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
77
!
78
INTEGER
icode, ierr
79
LOGICAL
mpi_is_init
80
!
81
!-----------------------------------------------------------------------
82
!
83
WRITE
(
lu
,20)
84
20
FORMAT
(1x,///,1x,
'PLANTE: PROGRAM STOPPED AFTER AN ERROR'
)
85
!
86
!-----------------------------------------------------------------------
87
! PARALLEL MODE
88
!
89
!JAJ SETTING EXIT VALUES ACCORDING TO THE IVAL VALUE
90
! IN CODE IVAL=0 OR IVAL=1 ARE USED NON-CONSEQUENTLY
91
!
92
! STANDARD F90 : STOP [n] WHERE N IS A STRING OF NOT MORE
93
! THAN FIVE DIGITS OR IS A CHARACTER CONSTANT.
94
! HOWEVER, CODE IS NOT ALWAYS SENT TO STDERR
95
! (COMPILER DEPENDENT, NAG DOESN'T FOR INSTANCE)
96
! ICODE MIGHT BE USED IN A POSSIBLE SYSTEM DEPENDENT EXIT PROCEDURE
97
#if defined NO_STD_FLUSH
98
CALL
flush(
lu
)
99
#else
100
FLUSH
(
lu
)
101
#endif
102
#if defined HAVE_MPI
103
CALL
mpi_initialized(mpi_is_init,icode)
104
#endif
105
IF
(ival.LT.0)
THEN
106
icode = 0
! JUST ASSUMED FOR NON-ERROR STOP
107
ELSEIF
(ival.EQ.0.OR.ival.EQ.1)
THEN
108
icode = 2
! EXIT IVAL 0 OR 1 INDICATING A "CONTROLLED" ERROR
109
ELSE
110
icode = 1
! SOMETHING ELSE? BUT AN ERROR!
111
ENDIF
112
WRITE
(
lu
,*)
'RETURNING EXIT CODE: '
, icode
113
!
114
#if defined HAVE_MPI
115
IF
(mpi_is_init)
CALL
mpi_abort(mpi_comm_world,icode,ierr)
116
#endif
117
stop 1
! WHICH IS USUALLY EQUIVALENT TO CALL EXIT(1)
118
!
119
!-----------------------------------------------------------------------
120
!
121
END SUBROUTINE
plante
declarations_special
Definition:
declarations_special.F:3
declarations_special::lu
integer lu
Definition:
declarations_special.F:45