Neko 1.99.3
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
json_utils Module Reference

Utilities for retrieving parameters from the case files.

Data Types

interface  json_extract_item
 
interface  json_get
 Retrieves a parameter by name or throws an error. More...
 
interface  json_get_or_default
 Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the missing paramter to the json. More...
 
interface  json_get_or_lookup
 
interface  json_get_or_lookup_or_default
 

Functions/Subroutines

subroutine json_get_real (json, name, value)
 Retrieves a real parameter by name or throws an error.
 
subroutine json_get_double (json, name, value)
 Retrieves a double precision real parameter by name or throws an error.
 
subroutine json_get_integer (json, name, value)
 Retrieves an integer parameter by name or throws an error.
 
subroutine json_get_logical (json, name, value)
 Retrieves a logical parameter by name or throws an error.
 
subroutine json_get_string (json, name, value)
 Retrieves a string parameter by name or throws an error.
 
subroutine json_get_real_array (json, name, value, expected_size)
 Retrieves a real array parameter by name or throws an error.
 
subroutine json_get_double_array (json, name, value, expected_size)
 Retrieves a double precision array parameter by name or throws an error.
 
subroutine json_get_integer_array (json, name, value, expected_size)
 Retrieves a integer array parameter by name or throws an error.
 
subroutine json_get_logical_array (json, name, value, expected_size)
 Retrieves a logical array parameter by name or throws an error.
 
subroutine json_get_string_array (json, name, value, filler)
 Retrieves a string array parameter by name or throws an error.
 
subroutine json_get_subdict (json, key, output)
 Extract a sub-object from a json object.
 
subroutine json_get_or_default_real (json, name, value, default)
 Retrieves a real parameter by name or assigns a provided default value. In the latter case also adds the missing paramter to the json.
 
subroutine json_get_or_default_double (json, name, value, default)
 Retrieves a double precision parameter by name or assigns a provided default value. In the latter case also adds the missing paramter to the json.
 
subroutine json_get_or_default_integer (json, name, value, default)
 Retrieves an integer parameter by name or assigns a provided default value. In the latter case also adds the missing paramter to the json.
 
subroutine json_get_or_default_logical (json, name, value, default)
 Retrieves a logical parameter by name or assigns a provided default value. In the latter case also adds the missing paramter to the json.
 
subroutine json_get_or_default_string (json, name, value, default)
 Retrieves a string parameter by name or assigns a provided default value. In the latter case also adds the missing paramter to the json.
 
subroutine json_extract_item_from_array (core, array, i, item)
 Extract ith item from a JSON array as a separate JSON object.
 
subroutine json_extract_item_from_name (json, name, i, item)
 Extract ith item from a JSON array as a separate JSON object.
 
subroutine check_expected_size (name, actual_size, expected_size)
 Routine to validate array sizes against an expected size.
 

Variables

logical, public json_no_defaults = .false.
 If true, the json_get_or_default routines will not add missing parameters.
 

Function/Subroutine Documentation

◆ check_expected_size()

subroutine json_utils::check_expected_size ( character(len=*), intent(in name,
integer, intent(in actual_size,
integer, intent(in expected_size 
)
private
Parameters
[in]nameThe name of the parameter for error reporting
[in]actual_sizeThe size found in the JSON
[in]expected_size(Optional) The size it is supposed to be

Definition at line 657 of file json_utils.f90.

◆ json_extract_item_from_array()

subroutine json_utils::json_extract_item_from_array ( type(json_core), intent(inout core,
type(json_value), intent(in), pointer  array,
integer, intent(in i,
type(json_file), intent(inout item 
)
private
Parameters
[in,out]coreJSON core object.
[in]arrayThe JSON object with the array.
[in]iThe index of the item to extract.
[in,out]itemJSON object object to be filled with the subdict.

Definition at line 606 of file json_utils.f90.

◆ json_extract_item_from_name()

subroutine json_utils::json_extract_item_from_name ( type(json_file), intent(inout json,
character(len=*), intent(in name,
integer, intent(in i,
type(json_file), intent(out item 
)
private
Parameters
[in,out]jsonThe JSON object with the array.
[in]nameThe name of the array.
[in]iThe index of the item to extract.
[in,out]itemJSON object object to be filled with the subdict.

Definition at line 627 of file json_utils.f90.

◆ json_get_double()

subroutine json_utils::json_get_double ( type(json_file), intent(inout json,
character(len=*), intent(in name,
real(kind=dp), intent(out value 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter

Definition at line 178 of file json_utils.f90.

◆ json_get_double_array()

subroutine json_utils::json_get_double_array ( type(json_file), intent(inout json,
character(len=*), intent(in name,
real(kind=dp), dimension(:), intent(out), allocatable  value,
integer, intent(in), optional  expected_size 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter
[in]expected_size(Optional) The expected size of the array. If provided, throws an error if the actual size does not match.

Definition at line 295 of file json_utils.f90.

◆ json_get_integer()

subroutine json_utils::json_get_integer ( type(json_file), intent(inout json,
character(len=*), intent(in name,
integer, intent(out value 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter

Definition at line 199 of file json_utils.f90.

◆ json_get_integer_array()

subroutine json_utils::json_get_integer_array ( type(json_file), intent(inout json,
character(len=*), intent(in name,
integer, dimension(:), intent(out), allocatable  value,
integer, intent(in), optional  expected_size 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter
[in]expected_size(Optional) The expected size of the array. If provided, throws an error if the actual size does not match.

Definition at line 326 of file json_utils.f90.

◆ json_get_logical()

subroutine json_utils::json_get_logical ( type(json_file), intent(inout json,
character(len=*), intent(in name,
logical, intent(out value 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter

Definition at line 220 of file json_utils.f90.

◆ json_get_logical_array()

subroutine json_utils::json_get_logical_array ( type(json_file), intent(inout json,
character(len=*), intent(in name,
logical, dimension(:), intent(out), allocatable  value,
integer, intent(in), optional  expected_size 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter
[in]expected_size(Optional) The expected size of the array. If provided, throws an error if the actual size does not match.

Definition at line 355 of file json_utils.f90.

◆ json_get_or_default_double()

subroutine json_utils::json_get_or_default_double ( type(json_file), intent(inout json,
character(len=*), intent(in name,
real(kind=dp), intent(out value,
real(kind=dp), intent(in default 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter

Definition at line 488 of file json_utils.f90.

◆ json_get_or_default_integer()

subroutine json_utils::json_get_or_default_integer ( type(json_file), intent(inout json,
character(len=*), intent(in name,
integer, intent(out value,
integer, intent(in default 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter

Definition at line 517 of file json_utils.f90.

◆ json_get_or_default_logical()

subroutine json_utils::json_get_or_default_logical ( type(json_file), intent(inout json,
character(len=*), intent(in name,
logical, intent(out value,
logical, intent(in default 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter

Definition at line 547 of file json_utils.f90.

◆ json_get_or_default_real()

subroutine json_utils::json_get_or_default_real ( type(json_file), intent(inout json,
character(len=*), intent(in name,
real(kind=sp), intent(out value,
real(kind=sp), intent(in default 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter

Definition at line 458 of file json_utils.f90.

◆ json_get_or_default_string()

subroutine json_utils::json_get_or_default_string ( type(json_file), intent(inout json,
character(len=*), intent(in name,
character(len=:), intent(out), allocatable  value,
character(len=*), intent(in default 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter

Definition at line 576 of file json_utils.f90.

◆ json_get_real()

subroutine json_utils::json_get_real ( type(json_file), intent(inout json,
character(len=*), intent(in name,
real(kind=sp), intent(out value 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter.

Definition at line 157 of file json_utils.f90.

◆ json_get_real_array()

subroutine json_utils::json_get_real_array ( type(json_file), intent(inout json,
character(len=*), intent(in name,
real(kind=sp), dimension(:), intent(out), allocatable  value,
integer, intent(in), optional  expected_size 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter
[in]expected_size(Optional) The expected size of the array. If provided, throws an error if the actual size does not match.

Definition at line 264 of file json_utils.f90.

◆ json_get_string()

subroutine json_utils::json_get_string ( type(json_file), intent(inout json,
character(len=*), intent(in name,
character(len=:), intent(out), allocatable  value 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter

Definition at line 241 of file json_utils.f90.

◆ json_get_string_array()

subroutine json_utils::json_get_string_array ( type(json_file), intent(inout json,
character(len=*), intent(in name,
character(len=*), dimension(:), intent(out), allocatable  value,
character(len=*), intent(in), optional  filler 
)
private
Parameters
[in,out]jsonThe json to retrieve the parameter from.
[in]nameThe full path to the parameter.
[out]valueThe variable to be populated with the retrieved parameter
[in]fillerThe default string to fill empty array items with.

Definition at line 385 of file json_utils.f90.

◆ json_get_subdict()

subroutine json_utils::json_get_subdict ( type(json_file), intent(inout json,
character(len=*), intent(in key,
type(json_file), intent(inout output 
)
private

Definition at line 429 of file json_utils.f90.

Variable Documentation

◆ json_no_defaults

logical, public json_utils::json_no_defaults = .false.

Definition at line 55 of file json_utils.f90.