From fdf7887b47a6e8f6b30942856a529368d9ba0bd8 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Wed, 24 Jun 2020 11:56:21 +0200 Subject: [PATCH] handle default internally --- src/YAML_parse.f90 | 7 +++---- src/numerics.f90 | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/YAML_parse.f90 b/src/YAML_parse.f90 index 8850a62fc..cfbcf11f3 100644 --- a/src/YAML_parse.f90 +++ b/src/YAML_parse.f90 @@ -34,10 +34,9 @@ end subroutine YAML_init !> @brief reads the flow style string and stores it in the form of dictionaries, lists and scalars. !> @details A node type pointer can either point to a dictionary, list or scalar type entities. !-------------------------------------------------------------------------------------------------- -recursive function parse_flow(flow_string,defaultVal) result(node) +recursive function parse_flow(flow_string) result(node) character(len=*), intent(inout) :: flow_string - class(tDict), intent(in), optional, target :: defaultVal class (tNode), pointer :: node class (tNode), pointer :: myVal @@ -48,8 +47,8 @@ recursive function parse_flow(flow_string,defaultVal) result(node) d !> position of key: value separator (':') flow_string = trim(adjustl(flow_string(:))) - if (len_trim(flow_string) == 0 .and. present(defaultVal)) then - node => defaultVal + if (len_trim(flow_string) == 0) then + node => emptyDict return elseif (flow_string(1:1) == '{') then ! start of a dictionary e = 1 diff --git a/src/numerics.f90 b/src/numerics.f90 index bb861a6d0..132c01f87 100644 --- a/src/numerics.f90 +++ b/src/numerics.f90 @@ -70,7 +70,7 @@ subroutine numerics_init flush(6) numerics_input = IO_read('numerics.yaml') numerics_inFlow = to_flow(numerics_input) - numerics_root => parse_flow(numerics_inFlow,defaultVal=emptyDict) + numerics_root => parse_flow(numerics_inFlow) endif !--------------------------------------------------------------------------------------------------