source: LMDZ5/trunk/tools/Max_diff_nc_with_lib/NR_util/scatter_max.f90 @ 1907

Last change on this file since 1907 was 1907, checked in by lguez, 10 years ago

Added a copyright property to every file of the distribution, except
for the fcm files (which have their own copyright). Use svn propget on
a file to see the copyright. For instance:

$ svn propget copyright libf/phylmd/physiq.F90
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

Also added the files defining the CeCILL version 2 license, in French
and English, at the top of the LMDZ tree.

  • 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.4 KB
Line 
1MODULE scatter_max_m
2
3  ! Bug correction: intent of "dest".
4
5  IMPLICIT NONE
6
7  INTERFACE scatter_max
8     MODULE PROCEDURE scatter_max_r, scatter_max_d
9  END INTERFACE
10
11  private scatter_max_r, scatter_max_d
12
13CONTAINS
14
15  SUBROUTINE scatter_max_r(dest, source, dest_index)
16    use assert_eq_m, only: assert_eq
17    REAL, DIMENSION(:), INTENT(inOUT) :: dest
18    REAL, DIMENSION(:), INTENT(IN) :: source
19    INTEGER, DIMENSION(:), INTENT(IN) :: dest_index
20
21    INTEGER :: m, n, j, i
22    !--------------------------------------
23    n=assert_eq(size(source), size(dest_index), 'scatter_max_r')
24    m=size(dest)
25    do j=1, n
26       i=dest_index(j)
27       if (i > 0 .and. i <= m) dest(i)=max(dest(i), source(j))
28    end do
29  END SUBROUTINE scatter_max_r
30
31  !*******************************************************
32
33  SUBROUTINE scatter_max_d(dest, source, dest_index)
34    use assert_eq_m, only: assert_eq
35    DOUBLE PRECISION, DIMENSION(:), INTENT(inOUT) :: dest
36    DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: source
37    INTEGER, DIMENSION(:), INTENT(IN) :: dest_index
38
39    INTEGER :: m, n, j, i
40    !--------------------------------------
41    n=assert_eq(size(source), size(dest_index), 'scatter_max_d')
42    m=size(dest)
43    do j=1, n
44       i=dest_index(j)
45       if (i > 0 .and. i <= m) dest(i)=max(dest(i), source(j))
46    end do
47  END SUBROUTINE scatter_max_d
48
49END MODULE scatter_max_m
Note: See TracBrowser for help on using the repository browser.