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

Converts data types to logical. More...

Private Member Functions

logical function, pointer generic_to_logical (generic, makecopy)
 Converts a generic to a logical. More...
 
logical function string_to_logical (string)
 Converts a string to a logical. More...
 
logical function integer_to_logical (input)
 Converts an integer to a logical. More...
 
logical function real_to_logical (input)
 Converts a real to a logical. More...
 

Detailed Description

Converts data types to logical.

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 a logical
copyflagFor generic data only: Whether to use a copy of the structured data or not
Returns
A logical. For generic data a pointer to the logical or null if generic conversion not possible

Definition at line 69 of file conversions.F90.

Member Function/Subroutine Documentation

◆ generic_to_logical()

logical function, pointer conversions_mod::conv_to_logical::generic_to_logical ( class(*), intent(in), pointer  generic,
logical, intent(in)  makecopy 
)
private

Converts a generic to a logical.

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

Definition at line 341 of file conversions.F90.

341  class(*), pointer, intent(in) :: generic
342  logical, intent(in) :: makecopy
343  logical, pointer :: generic_to_logical
344 
345  select type(generic)
346  type is (logical)
347  if (makecopy) then
348  allocate(generic_to_logical, source=generic)
349  else
350  generic_to_logical=>generic
351  end if
352  class default
353  generic_to_logical=>null()
354  end select

◆ integer_to_logical()

logical function conversions_mod::conv_to_logical::integer_to_logical ( integer, intent(in)  input)
private

Converts an integer to a logical.

Parameters
inputThe integer to convert into a logical
Returns
The logical

Definition at line 375 of file conversions.F90.

375  integer, intent(in) :: input
376 
377  if (input .ge. 1) then
378  integer_to_logical = .true.
379  else
380  integer_to_logical = .false.
381  end if

◆ real_to_logical()

logical function conversions_mod::conv_to_logical::real_to_logical ( real, intent(in)  input)
private

Converts a real to a logical.

Parameters
inputThe real to convert into a logical
Returns
The logical

Definition at line 388 of file conversions.F90.

388  real, intent(in) :: input
389 
390  if (input .ge. 1.0) then
391  real_to_logical = .true.
392  else
393  real_to_logical = .false.
394  end if

◆ string_to_logical()

logical function conversions_mod::conv_to_logical::string_to_logical ( character(len=*), intent(in)  string)
private

Converts a string to a logical.

Parameters
stringThe string to convert into a logical (case sensitive)
Returns
The logical

Definition at line 361 of file conversions.F90.

361  character(len=*), intent(in) :: string
362 
363  if (trim(adjustl(string)) .eq. "true" .or. trim(adjustl(string)) .eq. ".true." .or. &
364  trim(adjustl(string)) .eq. ".true" .or. trim(adjustl(string)) .eq. "true.") then
365  string_to_logical = .true.
366  else
367  string_to_logical = .false.
368  end if

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