MONC
Private Member Functions | List of all members
collections_mod::c_real_entry_at Interface Reference

Retrieves a map entry at a specific index. This is more efficient than calling key at and then value at (or get with the key) as only requires one search for both the key and value. More...

Private Member Functions

logical function map_real_entry_at (specificmap, i, key, real_val)
 Retrieves the entry at a specific map index or null if index > map elements. This converts precision and from ints. More...
 
logical function hashmap_real_entry_at (specificmap, i, key, real_val)
 Retrieves the entry at a specific map index. This converts between precision and from int. More...
 

Detailed Description

Retrieves a map entry at a specific index. This is more efficient than calling key at and then value at (or get with the key) as only requires one search for both the key and value.

This has a time complexity of O(n)

Parameters
collectionThe specific map involved
indexThe index to get value from
keyThe associated key
valueDouble precision real value or raises an error if none is found

Definition at line 555 of file collections.F90.

Member Function/Subroutine Documentation

◆ hashmap_real_entry_at()

logical function collections_mod::c_real_entry_at::hashmap_real_entry_at ( type(hashmap_type), intent(inout)  specificmap,
integer, intent(in)  i,
character(len=*), intent(out)  key,
real(kind=default_precision), intent(out)  real_val 
)
private

Retrieves the entry at a specific map index. This converts between precision and from int.

Do not call directly from external module, this is called via the appropriate interface

Parameters
specificmapThe specific map involved
iIndex to get value from
keyThe associated key
valueDouble precision realvalue or raises an error if none is found

Definition at line 1593 of file collections.F90.

1594  type(hashmap_type), intent(inout) :: specificmap
1595  integer, intent(in) :: i
1596  character(len=*), intent(out) :: key
1597  real(kind=default_precision), intent(out) :: real_val
1598 
1599  class(*), pointer :: generic
1600 
1601  hashmap_real_entry_at=hashmap_generic_entry_at(specificmap, i, key, generic)
1602  if (.not. associated(generic)) call log_log(log_error, "Can not find real entry with key '"//trim(key)//"'")
1603  select type(vr=>generic)
1604  type is (real(kind=default_precision))
1605  real_val=vr
1606  type is (real)
1607  real_val=conv_single_real_to_double(vr)
1608  type is (integer)
1609  real_val=conv_single_real_to_double(conv_to_real(vr))
1610  end select

◆ map_real_entry_at()

logical function collections_mod::c_real_entry_at::map_real_entry_at ( type(map_type), intent(inout)  specificmap,
integer, intent(in)  i,
character(len=*), intent(out)  key,
real(kind=default_precision), intent(out)  real_val 
)
private

Retrieves the entry at a specific map index or null if index > map elements. This converts precision and from ints.

Do not call directly from external module, this is called via the appropriate interface

Parameters
specificmapThe specific map involved
iIndex to get value from
keyThe associated key
valueReal value or raises an error if none is found

Definition at line 952 of file collections.F90.

953  type(map_type), intent(inout) :: specificmap
954  integer, intent(in) :: i
955  character(len=*), intent(out) :: key
956  real(kind=default_precision), intent(out) :: real_val
957 
958  class(*), pointer :: generic
959 
960  map_real_entry_at=map_generic_entry_at(specificmap, i, key, generic)
961  if (.not. associated(generic)) call log_log(log_error, "Can not find real entry with key '"//trim(key)//"'")
962  select type(vr=>generic)
963  type is (real(kind=default_precision))
964  real_val=vr
965  type is (real)
966  real_val=conv_single_real_to_double(vr)
967  type is (integer)
968  real_val=conv_single_real_to_double(conv_to_real(vr))
969  end select

The documentation for this interface was generated from the following file:
logging_mod::log_error
integer, parameter, public log_error
Only log ERROR messages.
Definition: logging.F90:11
logging_mod::log_log
subroutine, public log_log(level, message, str)
Logs a message at the specified level. If the level is above the current level then the message is ig...
Definition: logging.F90:75
datadefn_mod::default_precision
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17