MONC
Private Member Functions | List of all members
optionsdatabase_mod::options_add Interface Reference

Generic add interface for adding different types of data to the databases. More...

Private Member Functions

recursive subroutine options_add_integer (options_database, key, int_value, do_not_replace, array_index)
 Adds an integer value to the options database with a specific key. More...
 
subroutine options_add_real (options_database, key, real_value, do_not_replace, array_index)
 Adds a real value to the options database with a specific key. More...
 
subroutine options_add_logical (options_database, key, logical_value, do_not_replace, array_index)
 Adds a logical value to the options database with a specific key. More...
 
subroutine options_add_string (options_database, key, string_value, do_not_replace, array_index)
 Adds a string value to the options database with a specific key. More...
 

Detailed Description

Generic add interface for adding different types of data to the databases.

Definition at line 28 of file optionsdatabase.F90.

Member Function/Subroutine Documentation

◆ options_add_integer()

recursive subroutine optionsdatabase_mod::options_add::options_add_integer ( type(hashmap_type), intent(inout)  options_database,
character(len=*), intent(in)  key,
integer, intent(in)  int_value,
logical, intent(in), optional  do_not_replace,
integer, intent(in), optional  array_index 
)
private

Adds an integer value to the options database with a specific key.

Parameters
options_databaseThe options database
keyThe key to use
valueThe integer value to add to the database
do_not_replaceOptional flag whether to ignore existing values or replace them
array_indexOptional array index which specifies which location in the array to write to

Definition at line 552 of file optionsdatabase.F90.

553  type(hashmap_type), intent(inout) :: options_database
554  character(len=*), intent(in) :: key
555  integer, intent(in) :: int_value
556  integer, intent(in), optional :: array_index
557  logical, intent(in), optional :: do_not_replace
558 
559  integer :: temp_size
560  character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
561 
562  if (present(do_not_replace)) then
563  if (do_not_replace) then
564  if (present(array_index)) then
565  if (options_has_key(options_database, trim(key)//"a_"//conv_to_string(array_index))) return
566  else
567  if (options_has_key(options_database, key)) return
568  end if
569  end if
570  end if
571 
572  if (present(array_index)) then
573  if (options_has_key(options_database, trim(key)//"a_size")) then
574  temp_size=options_get_integer(options_database, trim(key)//"a_size")
575  if (temp_size .lt. array_index) temp_size=temp_size+1
576  else
577  temp_size=1
578  end if
579  call options_add(options_database, trim(key)//"a_size", temp_size)
580  lookup_key=get_options_array_key(key, array_index)
581  else
582  lookup_key=key
583  end if
584  call c_put_integer(options_database, lookup_key, int_value)

◆ options_add_logical()

subroutine optionsdatabase_mod::options_add::options_add_logical ( type(hashmap_type), intent(inout)  options_database,
character(len=*), intent(in)  key,
logical, intent(in)  logical_value,
logical, intent(in), optional  do_not_replace,
integer, intent(in), optional  array_index 
)
private

Adds a logical value to the options database with a specific key.

Parameters
options_databaseThe options database
keyThe key to use
valueThe logical value to add to the database
do_not_replaceOptional flag whether to ignore existing values or replace them
array_indexOptional array index which specifies which location in the array to write to

Definition at line 468 of file optionsdatabase.F90.

469  type(hashmap_type), intent(inout) :: options_database
470  character(len=*), intent(in) :: key
471  logical, intent(in) :: logical_value
472  integer, intent(in), optional :: array_index
473  logical, intent(in), optional :: do_not_replace
474 
475  integer :: temp_size
476  character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
477 
478  if (present(do_not_replace)) then
479  if (do_not_replace) then
480  if (present(array_index)) then
481  if (options_has_key(options_database, trim(key)//"a_"//conv_to_string(array_index))) return
482  else
483  if (options_has_key(options_database, key)) return
484  end if
485  end if
486  end if
487 
488  if (present(array_index)) then
489  if (options_has_key(options_database, trim(key)//"a_size")) then
490  temp_size=options_get_integer(options_database, trim(key)//"a_size")
491  if (temp_size .lt. array_index) temp_size=temp_size+1
492  else
493  temp_size=1
494  end if
495  call options_add(options_database, trim(key)//"a_size", temp_size)
496  lookup_key=get_options_array_key(key, array_index)
497  else
498  lookup_key=key
499  end if
500  call c_put_logical(options_database, lookup_key, logical_value)

◆ options_add_real()

subroutine optionsdatabase_mod::options_add::options_add_real ( type(hashmap_type), intent(inout)  options_database,
character(len=*), intent(in)  key,
real(kind=default_precision), intent(in)  real_value,
logical, intent(in), optional  do_not_replace,
integer, intent(in), optional  array_index 
)
private

Adds a real value to the options database with a specific key.

Parameters
options_databaseThe options database
keyThe key to use
valueThe real value to add to the database
do_not_replaceOptional flag whether to ignore existing values or replace them
array_indexOptional array index which specifies which location in the array to write to

Definition at line 427 of file optionsdatabase.F90.

428  type(hashmap_type), intent(inout) :: options_database
429  character(len=*), intent(in) :: key
430  real(kind=default_precision), intent(in) :: real_value
431  integer, intent(in), optional :: array_index
432  logical, intent(in), optional :: do_not_replace
433 
434  integer :: temp_size
435  character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
436 
437  if (present(do_not_replace)) then
438  if (do_not_replace) then
439  if (present(array_index)) then
440  if (options_has_key(options_database, trim(key)//"a_"//conv_to_string(array_index))) return
441  else
442  if (options_has_key(options_database, key)) return
443  end if
444  end if
445  end if
446 
447  if (present(array_index)) then
448  if (options_has_key(options_database, trim(key)//"a_size")) then
449  temp_size=options_get_integer(options_database, trim(key)//"a_size")
450  if (temp_size .lt. array_index) temp_size=temp_size+1
451  else
452  temp_size=1
453  end if
454  call options_add(options_database, trim(key)//"a_size", temp_size)
455  lookup_key=get_options_array_key(key, array_index)
456  else
457  lookup_key=key
458  end if
459  call c_put_real(options_database, lookup_key, real_value)

◆ options_add_string()

subroutine optionsdatabase_mod::options_add::options_add_string ( type(hashmap_type), intent(inout)  options_database,
character(len=*), intent(in)  key,
character(len=*), intent(in)  string_value,
logical, intent(in), optional  do_not_replace,
integer, intent(in), optional  array_index 
)
private

Adds a string value to the options database with a specific key.

Parameters
options_databaseThe options database
keyThe key to use
valueThe string value to add to the database
do_not_replaceOptional flag whether to ignore existing values or replace them
array_indexOptional array index which specifies which location in the array to write to

Definition at line 509 of file optionsdatabase.F90.

510  type(hashmap_type), intent(inout) :: options_database
511  character(len=*), intent(in) :: key, string_value
512  integer, intent(in), optional :: array_index
513  logical, intent(in), optional :: do_not_replace
514 
515  character(len=STRING_LENGTH) :: value_to_store
516  integer :: temp_size
517  character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
518 
519  if (present(do_not_replace)) then
520  if (do_not_replace) then
521  if (present(array_index)) then
522  if (options_has_key(options_database, trim(key)//"a_"//conv_to_string(array_index))) return
523  else
524  if (options_has_key(options_database, key)) return
525  end if
526  end if
527  end if
528 
529  value_to_store=string_value
530 
531  if (present(array_index)) then
532  if (options_has_key(options_database, trim(key)//"a_size")) then
533  temp_size=options_get_integer(options_database, trim(key)//"a_size")
534  if (temp_size .lt. array_index) temp_size=temp_size+1
535  else
536  temp_size=1
537  end if
538  call options_add(options_database, trim(key)//"a_size", temp_size)
539  lookup_key=get_options_array_key(key, array_index)
540  else
541  lookup_key=key
542  end if
543  call c_put_string(options_database, lookup_key, value_to_store)

The documentation for this interface was generated from the following file:
optionsdatabase_mod::options_get_integer
integer function, public options_get_integer(options_database, key, index)
Retrieves an integer value from the database that matches the provided key.
Definition: optionsdatabase.F90:217
optionsdatabase_mod::options_add
Generic add interface for adding different types of data to the databases.
Definition: optionsdatabase.F90:28
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