source: LMDZ6/branches/Amaury_dev/libf/misc/lmdz_assert_eq.f90

Last change on this file was 5119, checked in by abarral, 4 months ago

enforce PRIVATE by default in several modules, expose PUBLIC as needed
move eigen.f90 to obsolete/
(lint) aslong the way

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 1.8 KB
RevLine 
[5113]1MODULE lmdz_assert_eq
[1157]2
[5119]3  IMPLICIT NONE; PRIVATE
4  PUBLIC assert_eq
[1157]5
6  INTERFACE assert_eq
[5113]7    MODULE PROCEDURE assert_eq2, assert_eq3, assert_eq4, assert_eqn
[1157]8  END INTERFACE
9
10CONTAINS
11
[5113]12  FUNCTION assert_eq2(n1, n2, string)
13    CHARACTER(LEN = *), INTENT(IN) :: string
14    INTEGER, INTENT(IN) :: n1, n2
[1157]15    INTEGER  assert_eq2
[5113]16    IF (n1 == n2) THEN
17      assert_eq2 = n1
18    ELSE
19      WRITE (*, *) 'nrerror: an assert_eq failed with this tag: ', &
20              string
21      PRINT *, 'program terminated by assert_eq2'
22      STOP 1
23    END IF
[1157]24  END FUNCTION assert_eq2
25  !BL
[5113]26  FUNCTION assert_eq3(n1, n2, n3, string)
27    CHARACTER(LEN = *), INTENT(IN) :: string
28    INTEGER, INTENT(IN) :: n1, n2, n3
[1157]29    INTEGER  assert_eq3
[5117]30    IF (n1 == n2 .AND. n2 == n3) THEN
[5113]31      assert_eq3 = n1
32    ELSE
33      WRITE (*, *) 'nrerror: an assert_eq failed with this tag: ', &
34              string
35      PRINT *, 'program terminated by assert_eq3'
36      STOP 1
37    END IF
[1157]38  END FUNCTION assert_eq3
39  !BL
[5113]40  FUNCTION assert_eq4(n1, n2, n3, n4, string)
41    CHARACTER(LEN = *), INTENT(IN) :: string
42    INTEGER, INTENT(IN) :: n1, n2, n3, n4
[1157]43    INTEGER  assert_eq4
[5117]44    IF (n1 == n2 .AND. n2 == n3 .AND. n3 == n4) THEN
[5113]45      assert_eq4 = n1
46    ELSE
47      WRITE (*, *) 'nrerror: an assert_eq failed with this tag: ', &
48              string, n1, n2, n3, n4
49      PRINT *, 'program terminated by assert_eq4'
50      STOP 1
51    END IF
[1157]52  END FUNCTION assert_eq4
53  !BL
[5113]54  FUNCTION assert_eqn(nn, string)
55    CHARACTER(LEN = *), INTENT(IN) :: string
[1157]56    INTEGER, DIMENSION(:), INTENT(IN) :: nn
57    INTEGER  assert_eqn
[5113]58    IF (all(nn(2:) == nn(1))) THEN
59      assert_eqn = nn(1)
60    ELSE
61      WRITE (*, *) 'nrerror: an assert_eq failed with this tag: ', &
62              string
63      PRINT *, 'program terminated by assert_eqn'
64      STOP 1
65    END IF
[1157]66  END FUNCTION assert_eqn
67
[5113]68END MODULE lmdz_assert_eq
Note: See TracBrowser for help on using the repository browser.