19 integer,
parameter ::
logical_type=0,& !< Type of logical value data
54 integer,
intent(in) :: i
65 integer,
intent(in) :: i
77 character(len=*),
intent(in) :: key
92 character(len=*),
intent(in) :: key
93 integer,
intent(in),
optional :: index
95 character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
97 if (
present(index))
then
114 character(len=*),
intent(in) :: key
116 integer,
intent(in),
optional :: from, to
118 integer :: num_elements, i, start, end
121 if (num_elements .gt. 0 .and.
options_has_key(options_database, trim(key)//
"a_size"))
then
122 if (
present(from))
then
127 if (
present(to))
then
132 do i=start, num_elements
137 if (
present(from))
then
138 if (from .gt. 1)
return
140 if (
present(to))
then
141 if (to .lt. 1)
return
154 type(hashmap_type),
intent(inout) :: options_database
155 character(len=*),
intent(in) :: key
156 integer,
intent(in),
optional :: index
158 character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
160 if (
present(index))
then
176 type(hashmap_type),
intent(inout) :: options_database
177 character(len=*),
intent(in) :: key
178 logical,
dimension(:),
intent(inout) :: array_data
179 integer,
intent(in),
optional :: from, to
181 integer :: num_elements, i, start, end
184 if (num_elements .gt. 0 .and.
options_has_key(options_database, trim(key)//
"a_size"))
then
185 if (
present(from))
then
190 if (
present(to))
then
195 do i=start, num_elements
200 if (
present(from))
then
201 if (from .gt. 1)
return
203 if (
present(to))
then
204 if (to .lt. 1)
return
217 type(hashmap_type),
intent(inout) :: options_database
218 character(len=*),
intent(in) :: key
219 integer,
intent(in),
optional :: index
221 character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
223 if (
present(index))
then
239 type(hashmap_type),
intent(inout) :: options_database
240 character(len=*),
intent(in) :: key
241 integer,
dimension(:),
intent(inout) :: array_data
242 integer,
intent(in),
optional :: from, to
244 integer :: num_elements, i, start, end
247 if (num_elements .gt. 0 .and.
options_has_key(options_database, trim(key)//
"a_size"))
then
248 if (
present(from))
then
253 if (
present(to))
then
258 do i=start, num_elements
263 if (
present(from))
then
264 if (from .gt. 1)
return
266 if (
present(to))
then
267 if (to .lt. 1)
return
280 type(hashmap_type),
intent(inout) :: options_database
281 character(len=*),
intent(in) :: key
282 integer,
intent(in),
optional :: index
284 character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
286 if (
present(index))
then
302 type(hashmap_type),
intent(inout) :: options_database
303 character(len=*),
intent(in) :: key
304 character(len=STRING_LENGTH),
dimension(:),
intent(inout) :: array_data
305 integer,
intent(in),
optional :: from, to
307 integer :: num_elements, i, start, end
310 if (num_elements .gt. 0 .and.
options_has_key(options_database, trim(key)//
"a_size"))
then
311 if (
present(from))
then
316 if (
present(to))
then
321 do i=start, num_elements
326 if (
present(from))
then
327 if (from .gt. 1)
return
329 if (
present(to))
then
330 if (to .lt. 1)
return
342 type(hashmap_type),
intent(inout) :: options_database
343 character(len=*),
intent(in) :: key
357 type(hashmap_type),
intent(inout) :: options_database
359 integer :: i, arguments, equals_posn, type_of_config
360 character(len=LONG_STRING_LENGTH) :: specific_arg
362 arguments = command_argument_count()
365 call get_command_argument(i,
value = specific_arg)
366 specific_arg = trim(specific_arg)
367 equals_posn=index(specific_arg,
"=")
368 if (index(specific_arg,
"--") .eq. 1)
then
369 if (equals_posn .gt. 0)
then
384 type(hashmap_type),
intent(inout) :: options_database
385 character(len=*),
intent(in) :: key
387 integer :: array_size, i
391 if (array_size .gt. 0)
then
397 call c_remove(options_database, trim(key)//
"a_size")
400 call c_remove(options_database, key)
413 type(hashmap_type),
intent(inout) :: options_database
414 character(len=*),
intent(in) :: key
417 call log_log(log_error,
"No configuration option with key "//trim(key)//
" present")
427 subroutine options_add_real(options_database, key, real_value, do_not_replace, array_index)
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
435 character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
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
447 if (
present(array_index))
then
450 if (temp_size .lt. array_index) temp_size=temp_size+1
454 call options_add(options_database, trim(key)//
"a_size", temp_size)
459 call c_put_real(options_database, lookup_key, real_value)
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
476 character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
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
488 if (
present(array_index))
then
491 if (temp_size .lt. array_index) temp_size=temp_size+1
495 call options_add(options_database, trim(key)//
"a_size", temp_size)
500 call c_put_logical(options_database, lookup_key, logical_value)
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
515 character(len=STRING_LENGTH) :: value_to_store
517 character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
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
529 value_to_store=string_value
531 if (
present(array_index))
then
534 if (temp_size .lt. array_index) temp_size=temp_size+1
538 call options_add(options_database, trim(key)//
"a_size", temp_size)
543 call c_put_string(options_database, lookup_key, value_to_store)
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
560 character(len=len(key)+ARRAY_APPEND_SIZE) :: lookup_key
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
572 if (
present(array_index))
then
575 if (temp_size .lt. array_index) temp_size=temp_size+1
579 call options_add(options_database, trim(key)//
"a_size", temp_size)
584 call c_put_integer(options_database, lookup_key, int_value)
592 character(len=*),
intent(in) :: key
593 integer,
intent(in) :: index
606 character(len=*),
intent(in) :: specific_value
607 integer :: dot_posn, exponent_posn
609 if (conv_is_logical(specific_value))
then
615 dot_posn = index(specific_value,
".")
616 exponent_posn = index(specific_value,
"e")
617 if (dot_posn .eq. 0 .and. exponent_posn .eq. 0)
then
619 if (conv_is_integer(specific_value))
then
625 if (conv_is_real(specific_value))
then
641 integer,
intent(in) :: type_of_config
642 character(len=*),
intent(in) :: specific_arg
643 type(hashmap_type),
intent(inout) :: parse_options
645 integer :: equals_posn
646 equals_posn=index(specific_arg,
"=")
649 if (equals_posn .gt. 0)
then
651 conv_to_logical(specific_arg(equals_posn+1:len(specific_arg))))
658 conv_to_integer(specific_arg(equals_posn+1:len(specific_arg))))
659 else if (type_of_config ==
real_type)
then
661 conv_single_real_to_double(conv_to_real(specific_arg(equals_posn+1:len(specific_arg)))))
663 call set_options_string_value(parse_options, specific_arg(3:equals_posn-1), specific_arg(equals_posn+1:len(specific_arg)))
669 type(hashmap_type),
intent(inout) :: optionhashmap_type
670 character(len=*),
intent(in) :: key
671 logical,
intent(in) :: logical_value
673 call c_put_logical(optionhashmap_type, key, logical_value)
678 type(hashmap_type),
intent(inout) :: optionhashmap_type
679 character(len=*),
intent(in) :: key
680 real(kind=default_precision),
intent(in) :: real_value
682 call c_put_real(optionhashmap_type, key, real_value)
687 type(hashmap_type),
intent(inout) :: optionhashmap_type
688 character(len=*),
intent(in) :: key
689 integer,
intent(in) :: int_value
691 call c_put_integer(optionhashmap_type, key, int_value)
696 type(hashmap_type),
intent(inout) :: optionhashmap_type
697 character(len=*),
intent(in) :: key
698 character(len=*),
intent(in) :: str_value
700 character(len=STRING_LENGTH) :: write_value
703 write_value = str_value
704 call c_put_string(optionhashmap_type, key, write_value)