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 49 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 493 of file conversions.F90.

494  class(*), pointer, intent(in) :: generic
495  logical, intent(in) :: makecopy
496  integer, pointer :: generic_to_integer
497 
498  select type(generic)
499  type is (integer)
500  if (makecopy) then
501  allocate(generic_to_integer, source=generic)
502  else
503  generic_to_integer=>generic
504  end if
505  class default
506  generic_to_integer=>null()
507  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 531 of file conversions.F90.

532  logical, intent(in) :: input
533 
534  if (input) then
535  logical_to_integer = 1
536  else
537  logical_to_integer = 0
538  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 522 of file conversions.F90.

523  real, intent(in) :: input
524 
525  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 513 of file conversions.F90.

514  character(len=*), intent(in) :: string
515 
516  read(string, '(i15)' ) string_to_integer

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