namelist_parser_module Module

A module for parsing Fortran namelists.


Uses

  • module~~namelist_parser_module~~UsesGraph module~namelist_parser_module namelist_parser_module iso_fortran_env iso_fortran_env module~namelist_parser_module->iso_fortran_env json_module json_module module~namelist_parser_module->json_module

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: wp = real64

default real kind


Functions

private pure elemental function lowercase_string(str) result(s_lower)

Returns lowercase version of the string.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str

input string

Return Value character(len=len=(len(str)))

lowercase version of the string


Subroutines

public subroutine parse_namelist(filename, p_namelist, status_ok)

Parse a Fortran namelist into a json_value structure.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

the namelist file to parse

type(json_value), pointer :: p_namelist

the resulting JSON structure

logical, intent(out) :: status_ok

true if there were no errors

private subroutine read_line_from_file(iunit, line, eof)

Read a single line from a file.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iunit

the file unit (assumed to be opened)

character(len=:), intent(out), allocatable :: line

the line read

logical, intent(out) :: eof

if end of file reached

private subroutine add_variable(json, p_namelist, path, str)

Infers the variable type and adds it to the namelist JSON structure.

Arguments

Type IntentOptional Attributes Name
type(json_core), intent(inout) :: json
type(json_value), pointer :: p_namelist
character(len=*), intent(in) :: path
character(len=*), intent(in) :: str

private pure elemental subroutine to_real(str, val, status_ok)

Convert a string to a real(wp)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str
real(kind=wp), intent(out) :: val
logical, intent(out) :: status_ok

private pure elemental subroutine to_integer(str, val, status_ok)

Convert a string to an integer

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str
integer, intent(out) :: val
logical, intent(out) :: status_ok

private pure elemental subroutine to_logical(str, val, status_ok)

Convert a string to a logical

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str
logical, intent(out) :: val
logical, intent(out) :: status_ok