The TELEMAC-MASCARET system  trunk
get_free_id.f
Go to the documentation of this file.
1 ! **********************
2  SUBROUTINE get_free_id
3 ! **********************
4 !
5  &(id)
6 !
7 !***********************************************************************
8 ! BIEF V7P1
9 !***********************************************************************
10 !
11 !brief Returns an unused id to open a file
12 !
13 !history Y AUDOUIN (LNHE)
14 !+ 09/09/2016
15 !+ V7P2
16 !+
17 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 !| ID |-->| ID
19 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 !
21  USE declarations_special, ONLY : max_id, lu
22  IMPLICIT NONE
23 !
24 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25 !
26 
27  INTEGER, INTENT(INOUT) :: id
28 !
29 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
30 !
31  INTEGER :: i
32  LOGICAL :: is_used
33 !
34 !
35 !-----------------------------------------------------------------------
36 !
37  i=max_id
38  DO
39  IF(i.EQ.5.OR.i.EQ.6) THEN
40  i = i + 1
41  CONTINUE
42  ENDIF
43  INQUIRE(i,opened=is_used)
44  IF(.NOT.is_used) THEN
45  id = i
46  max_id = i
47  RETURN
48  ENDIF
49  i = i+1
50  ENDDO
51  WRITE(lu,*) "Ay Caramba !! Should not happen"
52  CALL plante(1)
53 !
54 !-----------------------------------------------------------------------
55 !
56  RETURN
57  END SUBROUTINE