Changeset 1653 in lmdz_wrf
- Timestamp:
- Sep 21, 2017, 8:20:40 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/module_generic.f90
r1619 r1653 10 10 ! Index1DArrayR_K: Function to provide the first index of a given value inside a 1D real(r_k) array 11 11 ! Index2DArrayR: Function to provide the first index of a given value inside a 2D real array 12 ! Index2DArrayR_K: Function to provide the first index of a given value inside a 2D real(r_k) array 12 13 ! mat2DPosition: Function to provide the i, j indices of a given value inside a 2D matrix 13 14 ! Nstrings: Function to repeat a number of times a given string … … 139 140 IMPLICIT NONE 140 141 141 INTEGER, PARAMETER :: r_k = KIND(1.d0) 142 INTEGER, INTENT(in) :: d1 143 REAL(r_k), INTENT(in) :: val 144 REAL(r_k), DIMENSION(d1), INTENT(in) :: array1D 142 INTEGER, INTENT(in) :: d1 143 REAL, INTENT(in) :: val 144 REAL, DIMENSION(d1), INTENT(in) :: array1D 145 145 146 146 ! Local … … 190 190 IMPLICIT NONE 191 191 192 INTEGER, PARAMETER :: r_k = KIND(1.d0)193 192 INTEGER, INTENT(in) :: d1, d2 194 REAL (r_k), INTENT(in):: val195 REAL (r_k), DIMENSION(d1,d2), INTENT(in):: array2D193 REAL, INTENT(in) :: val 194 REAL, DIMENSION(d1,d2), INTENT(in) :: array2D 196 195 INTEGER, DIMENSION(2) :: Index2DArrayR 197 196 … … 214 213 215 214 END FUNCTION Index2DArrayR 215 216 FUNCTION Index2DArrayR_K(array2D, d1, d2, val) 217 ! Function to provide the first index of a given value inside a 2D real array 218 219 IMPLICIT NONE 220 221 INTEGER, INTENT(in) :: d1, d2 222 REAL(r_k), INTENT(in) :: val 223 REAL(r_k), DIMENSION(d1,d2), INTENT(in) :: array2D 224 INTEGER, DIMENSION(2) :: Index2DArrayR_K 225 226 ! Local 227 INTEGER :: i, j 228 229 fname = 'Index2DArrayR_K' 230 231 Index2DArrayR_K = -1 232 233 DO i=1,d1 234 DO j=1,d2 235 IF (array2d(i,j) == val) THEN 236 Index2DArrayR_K(1) = i 237 Index2DArrayR_K(2) = j 238 EXIT 239 END IF 240 END DO 241 END DO 242 243 END FUNCTION Index2DArrayR_K 216 244 217 245 FUNCTION RangeI(d1, iniv, endv)
Note: See TracChangeset
for help on using the changeset viewer.