N.A. Chester,
Phase Transformations Group,
Department of Materials Science and Metallurgy,
University of Cambridge,
Cambridge, U.K.
Added to MAP: July 1999.
To write an error message indicating a variable lies outside the specified limits and to read in a new value.
Language: | FORTRAN |
Product form: | Source code |
SUBROUTINE MAP_UTIL_BOUND(A,B,C) DOUBLE PRECISION A,B,C
The subroutine prints out a statement to say that the value of the input variable does not lie within a specified range. It then prints out the values of the upper and lower limits and requests and reads in a new value for the variable. This process is repeated until a value has been obtained which does lie within the specified range.
None.
This subroutine calls MAP_UTIL_REED which uses the FORTRAN ERR specifier to detect an incorrect input data value.
Not applicable.
None.
DOUBLE PRECISION T,RLOW,RHIGH RLOW = 0.0D0 RHIGH = 100.0D0 T = 25.0D0 WRITE(*,*)'Input value for water temperature (deg. C):' READ (*,*) T IF (T.LT.RLOW.OR.T.GT.RHIGH) CALL MAP_UTIL_BOUND(T,RLOW,RHIGH) T = T + 273.15 WRITE(*,1) T STOP 1 FORMAT('The water temperature is ',F7.2,' Kelvin.') END
Input value for water temperature (deg. C): -10 Input value out of bounds The limits are 0.0000D+00 to 0.1000D+03 Input new value: 10
The water temperature is 283.15 Kelvin.
Subroutines
MAP_UTIL_REED
input, range, limits, error, real
MAP originated from a joint project of the National Physical Laboratory and the University of Cambridge.
MAP Website administration / map@msm.cam.ac.uk