Type conversion functions and other utility procedures.
Returns .true. if array contains an integer value.
Returns .true. if the integer array contains the given value.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(inout) | :: | array(:) |
Input array. |
||
| integer(kind=i4), | intent(in) | :: | value |
Value to search. |
Returns .true. if the integer array contains the given value.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(inout) | :: | array(:) |
Input array. |
||
| integer(kind=i8), | intent(in) | :: | value |
Value to search. |
Returns .true. if two real numbers are approximately the same.
Returns .true. if the 4-byte real numbers a and b are
approximately the same, else .false..
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r4), | intent(in) | :: | a | |||
| real(kind=r4), | intent(in) | :: | b |
Returns .true. if the 8-byte real numbers a and b are
approximately the same, else .false..
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | a | |||
| real(kind=r8), | intent(in) | :: | b |
Returns increased integer value.
Increases argument a by 1 or b.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | a |
Value to increase. |
||
| integer(kind=i4), | intent(in), | optional | :: | b |
Summand to use. |
Increases argument a by 1 or b.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(in) | :: | a |
Value to increase. |
||
| integer(kind=i8), | intent(in), | optional | :: | b |
Summand to use. |
Generic integer to string converter.
Converts 4-byte integer to allocatable string of length > 0.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | value |
Value. |
String of value.
Converts 8-byte integer to allocatable string of length > 0.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(in) | :: | value |
Value. |
String of value.
Generic real to string converter.
Converts 4-byte real to allocatable string of length > 1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r4), | intent(in) | :: | value |
Value. |
String of value.
Converts 8-byte real to allocatable string of length > 1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | value |
Value. |
String of value.
Converts 4-byte real to allocatable string of length > 1, with
ndigit digits to the right of the decimal point.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r4), | intent(in) | :: | value |
Value. |
||
| integer, | intent(in) | :: | n |
Number of digits to the right of the decimal point. |
String of value.
Converts 8-byte real to allocatable string of length > 1, with
ndigit digits to the right of the decimal point.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | value |
Value. |
||
| integer, | intent(in) | :: | n |
Number of digits to the right of the decimal point. |
String of value.
Converts 8-byte real to type (for response values).
Converts 8-byte real to 4-byte integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | from |
8-byte real value. |
||
| integer(kind=i4), | intent(out) | :: | to |
4-byte integer value. |
Converts 8-byte real to 8-byte integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | from |
8-byte real value. |
||
| integer(kind=i8), | intent(out) | :: | to |
8-byte integer value. |
Converts 8-byte real to logical. If f equals 0.0, the result is
.false., else .true..
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | from |
8-byte real value. |
||
| logical, | intent(out) | :: | to |
Logical value. |
Converts 8-byte real to 4-byte real
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | from |
8-byte real value. |
||
| real(kind=r4), | intent(out) | :: | to |
4-byte real value. |
Converts type to 8-byte real (for response values).
Converts 2-byte integer to 8-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i2), | intent(in) | :: | i16 |
2-byte integer value. |
Value as 8-byte real.
Converts 4-byte integer to 8-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | i32 |
4-byte integer value. |
Value as 8-byte real.
Converts 8-byte integer to 8-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(in) | :: | i64 |
8-byte integer value. |
Value as 8-byte real.
Converts logical to 8-byte real (0.0 for .false. and 1.0 for
.true.).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in) | :: | l |
Logical value. |
Value as 8-byte real.
Converts 8-byte integer to 8-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r4), | intent(in) | :: | r32 |
4-byte real value. |
Value as 8-byte real.
Returns present argument or default value.
Returns 1-byte character argument arg if present or default
otherwise.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=1), | intent(in), | optional | :: | arg |
Argument. |
|
| character(len=1), | intent(in) | :: | default |
Default value. |
Argument or default.
Returns 4-byte integer argument arg if present or default
otherwise.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in), | optional | :: | arg |
Argument. |
|
| integer(kind=i4), | intent(in) | :: | default |
Default value. |
Argument or default.
Returns 8-byte integer argument arg if present or default
otherwise.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(in), | optional | :: | arg |
Argument. |
|
| integer(kind=i8), | intent(in) | :: | default |
Default value. |
Argument or default.
Returns logical argument arg if present or default otherwise.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in), | optional | :: | arg |
Argument. |
|
| logical, | intent(in) | :: | default |
Default value. |
Argument or default.
Returns C pointer argument arg if present or default otherwise.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(c_ptr), | intent(in), | optional | :: | arg |
Argument. |
|
| type(c_ptr), | intent(in) | :: | default |
Default value. |
Argument or default.
Returns 4-byte real argument arg if present or default
otherwise.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r4), | intent(in), | optional | :: | arg |
Argument. |
|
| real(kind=r4), | intent(in) | :: | default |
Default value. |
Argument or default.
Returns 8-byte real argument arg if present or default
otherwise.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in), | optional | :: | arg |
Argument. |
|
| real(kind=r8), | intent(in) | :: | default |
Default value. |
Argument or default.
Generic seconds to milliseconds function.
Converts seconds to milliseconds (4 bytes).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | sec |
Seconds. |
Milliseconds.
Converts seconds to milliseconds (8 bytes).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(in) | :: | sec |
Seconds. |
Milliseconds.
Generic seconds to milliseconds function.
Converts milliseconds to seconds (4 bytes).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | msec |
Milliseconds. |
Seconds.
Converts milliseconds to seconds (8 bytes).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(in) | :: | msec |
Milliseconds. |
Seconds.
Generic size formatting function. Returns allocatable string of given size converted to human-readable IEC format with suffix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nbyte |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(in) | :: | nbyte |
Subroutines to reverse the byte order of integer and real variables. This is useful when reading binary data from a file intended for use on a compute whose byte order is opposite that of the computer on which the Fortran program is to be run.
Adopted from Fortran 90 routines written by David G. Simpson, NASA Goddard Space Flight Center (https://caps.gsfc.nasa.gov/simpson/).
Swaps bytes for a 2-byte integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i2), | intent(inout) | :: | n |
Swaps bytes for a 4-byte integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(inout) | :: | n |
Swaps bytes for a 8-byte integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(inout) | :: | n |
Swaps bytes for a 4-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r4), | intent(inout) | :: | f |
Swaps bytes for an 8-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(inout) | :: | f |
Converts string to 8-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | a |
Number string. |
Real result.
Converts string to 4-byte integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | a |
Number string. |
Integer result.
Returns either argument true or false as allocatable character,
depending on the value of logical value b. If true and/or
false is missing, T or F is returned respectively. The result
is trimmed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in) | :: | b |
Logical value. |
||
| character(len=*), | intent(in), | optional | :: | true |
Return value on |
|
| character(len=*), | intent(in), | optional | :: | false |
Return value on |
String result.
Converts logical (boolean) to 4-byte integer. The result is either 0
or 1, unless argument true or false is passed to overwrite the
value.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in) | :: | b |
Logical value. |
||
| integer, | intent(in), | optional | :: | true |
Returns value on |
|
| integer, | intent(in), | optional | :: | false |
Returns value on |
Integer result.
Converts angle from degrees to gon.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | a |
Angle [deg]. |
Angle [gon].
Converts angle from degrees to radiants.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | a |
Angle [deg]. |
Angle [rad].
Converts angle from gon to degrees.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | a |
Angle [gon]. |
Angle [deg].
Converts angle from gon to radiants.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | a |
Angle [gon]. |
Angle [rad].
Converts angle from radiants to degrees.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | a |
Angle [rad]. |
Angle [deg]
Converts angle from radiants to gon.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | a |
Angle [rad]. |
Angle [gon]
Converts 2-byte integer to 8-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i2), | intent(in) | :: | i16 |
2-byte integer value. |
Value as 8-byte real.
Converts 4-byte integer to 8-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | i32 |
4-byte integer value. |
Value as 8-byte real.
Converts 8-byte integer to 8-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(in) | :: | i64 |
8-byte integer value. |
Value as 8-byte real.
Converts logical to 8-byte real (0.0 for .false. and 1.0 for
.true.).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in) | :: | l |
Logical value. |
Value as 8-byte real.
Converts hex string to RGB values, for instance, #FFFFFF to
(255, 255, 255).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | hex |
Hex string. |
||
| integer, | intent(out) | :: | r |
Red. |
||
| integer, | intent(out) | :: | g |
Green. |
||
| integer, | intent(out) | :: | b |
Blue. |
Converts RGB values to hex string, for instance, (255, 255, 255) to
#FFFFFF.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | r |
Red. |
||
| integer, | intent(in) | :: | g |
Green. |
||
| integer, | intent(in) | :: | b |
Blue. |
||
| character(len=7), | intent(out) | :: | hex |
Hex string. |
Converts 8-byte real to 4-byte integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | from |
8-byte real value. |
||
| integer(kind=i4), | intent(out) | :: | to |
4-byte integer value. |
Converts 8-byte real to 8-byte integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | from |
8-byte real value. |
||
| integer(kind=i8), | intent(out) | :: | to |
8-byte integer value. |
Converts 8-byte real to logical. If f equals 0.0, the result is
.false., else .true..
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | from |
8-byte real value. |
||
| logical, | intent(out) | :: | to |
Logical value. |
Converts 8-byte real to 4-byte real
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(in) | :: | from |
8-byte real value. |
||
| real(kind=r4), | intent(out) | :: | to |
4-byte real value. |
Pauses program execution for given time in mseconds.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | msec |
Delay [msec]. |
Pauses program execution for given time in seconds.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | sec |
Delay [sec]. |
Pauses program execution for given time in useconds.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | usec |
Delay [usec]. |
Swaps bytes for a 2-byte integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i2), | intent(inout) | :: | n |
Swaps bytes for a 4-byte integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(inout) | :: | n |
Swaps bytes for a 8-byte integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(inout) | :: | n |
Swaps bytes for a 4-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r4), | intent(inout) | :: | f |
Swaps bytes for an 8-byte real.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=r8), | intent(inout) | :: | f |