Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Params: Add do_not_log to param block open/close #558

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/framework/MOM_file_parser.F90
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
!> Specify the active parameter block
type, private :: parameter_block ; private
character(len=240) :: name = '' !< The active parameter block name
logical :: log_access = .true.
!< Log the entry and exit of the block (but not its contents)
end type parameter_block

!> A structure that can be parsed to read and document run-time parameters.
Expand Down Expand Up @@ -2082,17 +2084,29 @@
end subroutine clearParameterBlock

!> Tags blockName onto the end of the active parameter block name
subroutine openParameterBlock(CS,blockName,desc)
subroutine openParameterBlock(CS, blockName, desc, do_not_log)
type(param_file_type), intent(in) :: CS !< The control structure for the file_parser module,
!! it is also a structure to parse for run-time parameters
character(len=*), intent(in) :: blockName !< The name of a parameter block being added
character(len=*), optional, intent(in) :: desc !< A description of the parameter block being added
logical, optional, intent(in) :: do_not_log
!< Log block entry if true. This only prevents logging of entry to the block, and not the contents.

type(parameter_block), pointer :: block => NULL()
logical :: do_log

do_log = .true.
if (present(do_not_log)) do_log = .not. do_not_log

Check warning on line 2099 in src/framework/MOM_file_parser.F90

View check run for this annotation

Codecov / codecov/patch

src/framework/MOM_file_parser.F90#L2099

Added line #L2099 was not covered by tests

if (associated(CS%blockName)) then
block => CS%blockName
block%name = pushBlockLevel(block%name,blockName)
call doc_openBlock(CS%doc,block%name,desc)
if (do_log) then
call doc_openBlock(CS%doc, block%name, desc)
block%log_access = .true.
else
block%log_access = .false.

Check warning on line 2108 in src/framework/MOM_file_parser.F90

View check run for this annotation

Codecov / codecov/patch

src/framework/MOM_file_parser.F90#L2108

Added line #L2108 was not covered by tests
endif
else
if (is_root_pe()) call MOM_error(FATAL, &
'openParameterBlock: A push was attempted before allocation.')
Expand All @@ -2111,7 +2125,7 @@
if (is_root_pe().and.len_trim(block%name)==0) call MOM_error(FATAL, &
'closeParameterBlock: A pop was attempted on an empty stack. ("'//&
trim(block%name)//'")')
call doc_closeBlock(CS%doc,block%name)
if (block%log_access) call doc_closeBlock(CS%doc, block%name)
else
if (is_root_pe()) call MOM_error(FATAL, &
'closeParameterBlock: A pop was attempted before allocation.')
Expand Down
Loading