MONC
Private Member Functions | List of all members
conversions_mod::conv_to_integer Interface Reference

Converts data types to integers. More...

Private Member Functions

integer function, pointer generic_to_integer (generic, makecopy)
 Converts a generic to an integer. More...
 
integer function string_to_integer (string)
 Converts a string to an integer. More...
 
integer function real_to_integer (input)
 Converts a real to an integer. More...
 
integer function logical_to_integer (input)
 Converts a logical to an integer. More...
 

Detailed Description

Converts data types to integers.

For the generic input then a flag indicating whether to make a copy of the underlying generic data or not is required. For all other data this copy is made automatically and no flag is required

Parameters
dataThe data to convert into an integer
copyflagFor generic data only: Whether to use a copy of the structured data or not
Returns
An integer. For generic data a pointer to the integer or null if generic conversion not possible

Definition at line 47 of file conversions.F90.

Member Function/Subroutine Documentation

◆ generic_to_integer()

integer function, pointer conversions_mod::conv_to_integer::generic_to_integer ( class(*), intent(in), pointer  generic,
logical, intent(in)  makecopy 
)
private

Converts a generic to an integer.

Parameters
genericThe generic to convert into an integer
makecopyWhether to use a copy of the generic data or not
Returns
A pointer to the integer or null if generic conversion not possible

Definition at line 482 of file conversions.F90.

482  class(*), pointer, intent(in) :: generic
483  logical, intent(in) :: makecopy
484  integer, pointer :: generic_to_integer
485 
486  select type(generic)
487  type is (integer)
488  if (makecopy) then
489  allocate(generic_to_integer, source=generic)
490  else
491  generic_to_integer=>generic
492  end if
493  class default
494  generic_to_integer=>null()
495  end select

◆ logical_to_integer()

integer function conversions_mod::conv_to_integer::logical_to_integer ( logical, intent(in)  input)
private

Converts a logical to an integer.

Parameters
inputThe logical to convert into an integer
Returns
The integer

Definition at line 520 of file conversions.F90.

520  logical, intent(in) :: input
521 
522  if (input) then
523  logical_to_integer = 1
524  else
525  logical_to_integer = 0
526  end if

◆ real_to_integer()

integer function conversions_mod::conv_to_integer::real_to_integer ( real, intent(in)  input)
private

Converts a real to an integer.

Parameters
inputThe real to convert into an integer
Returns
The integer

Definition at line 511 of file conversions.F90.

511  real, intent(in) :: input
512 
513  real_to_integer = int(input)

◆ string_to_integer()

integer function conversions_mod::conv_to_integer::string_to_integer ( character(len=*), intent(in)  string)
private

Converts a string to an integer.

Parameters
stringThe string to convert into an integer
Returns
The integer

Definition at line 502 of file conversions.F90.

502  character(len=*), intent(in) :: string
503 
504  read(string, '(i15)' ) string_to_integer

The documentation for this interface was generated from the following file: