Go to the documentation of this file.
135 character(len=*),
intent(in) :: string
137 integer :: integer_value, ierr
139 if (len(trim(string)) .ne. 0)
then
140 read(string,
'(i11)', iostat=ierr ) integer_value
151 character(len=*),
intent(in) :: string
156 if (len(trim(string)) .ne. 0)
then
157 read(string,
'(f12.2)', iostat=ierr ) real_value
168 character(len=*),
intent(in) :: string
171 if (trim(adjustl(string)) .eq.
"true" .or. trim(adjustl(string)) .eq.
"false" .or. &
172 trim(adjustl(string)) .eq.
".true." .or. trim(adjustl(string)) .eq.
".false." .or. &
173 trim(adjustl(string)) .eq.
".true" .or. trim(adjustl(string)) .eq.
"true." .or. &
174 trim(adjustl(string)) .eq.
".false" .or. trim(adjustl(string)) .eq.
"false.")
string_is_logical = .true.
183 class(*),
pointer,
intent(in) :: generic
184 logical,
intent(in) :: makecopy
185 integer,
intent(in) :: str_length
189 type is (
character(len=*))
192 temporary_generic_ptr=>generic
206 integer,
intent(in) :: input
219 integer,
optional :: decimal_places
220 logical,
optional :: exponent, exponent_small_numbers
222 logical :: transformed
225 if (
present(exponent))
then
231 if (
present(exponent_small_numbers))
then
232 if (exponent_small_numbers)
then
237 if (.not. transformed)
then
253 integer,
optional :: decimal_places
254 logical,
optional :: exponent, exponent_small_numbers
256 logical :: transformed
259 if (
present(exponent))
then
265 if (
present(exponent_small_numbers))
then
266 if (exponent_small_numbers)
then
271 if (.not. transformed)
then
276 if (
present(decimal_places))
then
288 character(len=*),
intent(inout) :: string_to_parse
289 integer,
intent(in) :: decimal_places
291 integer :: decimal_posn, exp_posn
293 string_to_parse=adjustl(string_to_parse)
294 decimal_posn=index(string_to_parse,
".")
295 exp_posn=index(string_to_parse,
"E")
296 if (decimal_posn .ne. 0 .and. decimal_posn+decimal_places+1 .le. len(string_to_parse))
then
297 if (exp_posn .eq. 0)
then
298 string_to_parse(decimal_posn+decimal_places+1:)=
" "
300 string_to_parse(decimal_posn+decimal_places+1:)=string_to_parse(exp_posn:)
301 string_to_parse(decimal_posn+decimal_places+1+(len(string_to_parse)-exp_posn)+1:)=
" "
311 character(len=*),
intent(inout) :: string_to_parse
312 integer,
intent(in) :: zeros_to_retain
314 integer :: decimal_posn, i, zero_count, nonzero_hit
318 decimal_posn=index(string_to_parse,
".")
319 if (decimal_posn .ne. 0 .and. decimal_posn .lt. len(string_to_parse))
then
320 do i=len(trim(string_to_parse)), decimal_posn, -1
321 if (string_to_parse(i:i) .ne.
"0")
then
325 zero_count=zero_count+1
328 if (zero_count .gt. zeros_to_retain)
then
329 string_to_parse(nonzero_hit+zeros_to_retain:)=
""
338 logical,
intent(in) :: input
353 class(*),
pointer,
intent(in) :: generic
354 logical,
intent(in) :: makecopy
373 character(len=*),
intent(in) :: string
375 if (trim(adjustl(string)) .eq.
"true" .or. trim(adjustl(string)) .eq.
".true." .or. &
376 trim(adjustl(string)) .eq.
".true" .or. trim(adjustl(string)) .eq.
"true.")
then
387 integer,
intent(in) :: input
389 if (input .ge. 1)
then
400 real,
intent(in) :: input
402 if (input .ge. 1.0)
then
414 class(*),
pointer,
intent(in) :: generic
415 logical,
intent(in) :: makecopy
435 class(*),
pointer,
intent(in) :: generic
436 logical,
intent(in) :: makecopy
458 character(len=*),
intent(in) :: string
460 if (scan(string,
"E") .ne. 0 .or. scan(string,
"e") .ne. 0)
then
471 integer,
intent(in) :: input
480 logical,
intent(in) :: input
494 class(*),
pointer,
intent(in) :: generic
495 logical,
intent(in) :: makecopy
514 character(len=*),
intent(in) :: string
523 real,
intent(in) :: input
532 logical,
intent(in) :: input
546 character(len=*),
target,
intent(in) :: string
547 logical,
intent(in) :: makecopy
562 integer,
target ,
intent(in) :: input
563 logical,
intent(in) :: makecopy
578 real(kind=single_precision),
target,
intent(in) :: input
579 logical,
intent(in) :: makecopy
594 real(kind=double_precision),
target,
intent(in) :: input
595 logical,
intent(in) :: makecopy
610 logical,
target,
intent(in) :: input
611 logical,
intent(in) :: makecopy
Conversion between common inbuilt FORTRAN data types.
subroutine limit_to_decimal_places(string_to_parse, decimal_places)
Helper subroutine which trims the string down to an upper limit of decimal places,...
character(len=str_length) function, pointer generic_to_string(generic, makecopy, str_length)
Converts a generic to a string.
class(*) function, pointer logical_to_generic(input, makecopy)
Converts a logical into its generic data representation.
logical function integer_to_logical(input)
Converts an integer to a logical.
Determines whether a data item can be represented as a logical or not.
logical function string_is_integer(string)
Determines whether a string is an integer or not.
Converts data types to integers.
real function, pointer generic_to_real(generic, makecopy)
Converts a generic to a real. If this is infact an integer then will do a conversion and allocate poi...
logical function string_is_logical(string)
Determines whether a string is a logical or not.
Converts data types to logical.
real function integer_to_real(input)
Converts an integer to a real.
Converts a data type into the generic (class *) form.
real(kind=default_precision) function, pointer, public generic_to_double_real(generic, makecopy)
Converts a generic to a double real.
class(*) function, pointer integer_to_generic(input, makecopy)
Converts an integer into its generic data representation.
logical function, pointer generic_to_logical(generic, makecopy)
Converts a generic to a logical.
integer function string_to_integer(string)
Converts a string to an integer.
character(len=30) function real_single_to_string(input, decimal_places, exponent, exponent_small_numbers)
Converts a single precision real to a string.
integer, parameter, public single_precision
Single precision (32 bit) kind.
Converts data types to strings.
logical function string_is_real(string)
Determines whether a string is a real or not.
character(len=30) function real_double_to_string(input, decimal_places, exponent, exponent_small_numbers)
Converts a double precision real to a string.
Determines whether a data item can be represented as a real or not.
logical function real_to_logical(input)
Converts a real to a logical.
integer function logical_to_integer(input)
Converts a logical to an integer.
Determines whether a data item can be represented as an integer or not.
integer, parameter real_rounding_precision
character(len=5) function logical_to_string(input)
Converts a logical to a string.
class(*) function, pointer string_to_generic(string, makecopy)
Converts a string into its generic data representation.
integer function real_to_integer(input)
Converts a real to an integer.
integer, parameter, public double_precision
Double precision (64 bit) kind.
Contains common definitions for the data and datatypes used by MONC.
real function logical_to_real(input)
Converts a logical to a real.
logical l_original_rounding
character(len=15) function integer_to_string(input)
Converts an integer to a string.
logical function string_to_logical(string)
Converts a string to a logical.
real function string_to_real(string)
Converts a string to a real.
class(*) function, pointer real_double_to_generic(input, makecopy)
Converts a double real into its generic data representation.
subroutine trim_trailing_zeros(string_to_parse, zeros_to_retain)
A helper subroutine which trims training zeros from the string after a decimal place this is to make ...
Converts data types to real.
class(*) function, pointer real_single_to_generic(input, makecopy)
Converts a single real into its generic data representation.
integer function, pointer generic_to_integer(generic, makecopy)
Converts a generic to an integer.
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
real(kind=double_precision) function, public conv_single_real_to_double(input_real)
Converts from a single to double precision real. This applies some rounding to a certain number of de...