36 use json_module,
only : json_file, json_value, json_core
66 type(json_file),
intent(inout) :: json
67 character(len=*),
intent(in) :: name
68 real(kind=
sp),
intent(out) ::
value
71 call json%get(name,
value, found)
74 call neko_error(
"Parameter "//name//
" missing from the case file")
83 type(json_file),
intent(inout) :: json
84 character(len=*),
intent(in) :: name
85 real(kind=
dp),
intent(out) ::
value
88 call json%get(name,
value, found)
91 call neko_error(
"Parameter "//name//
" missing from the case file")
100 type(json_file),
intent(inout) :: json
101 character(len=*),
intent(in) :: name
102 integer,
intent(out) :: value
105 call json%get(name,
value, found)
107 if (.not. found)
then
108 call neko_error(
"Parameter "//name//
" missing from the case file")
117 type(json_file),
intent(inout) :: json
118 character(len=*),
intent(in) :: name
119 logical,
intent(out) :: value
122 call json%get(name,
value, found)
124 if (.not. found)
then
125 call neko_error(
"Parameter "//name//
" missing from the case file")
134 type(json_file),
intent(inout) :: json
135 character(len=*),
intent(in) :: name
136 character(len=:),
allocatable,
intent(out) :: value
139 call json%get(name,
value, found)
141 if (.not. found)
then
142 call neko_error(
"Parameter "//name//
" missing from the case file")
151 type(json_file),
intent(inout) :: json
152 character(len=*),
intent(in) :: name
153 real(kind=
sp),
allocatable,
intent(out) :: value(:)
156 call json%get(name,
value, found)
158 if (.not. found)
then
159 call neko_error(
"Parameter "//name//
" missing from the case file")
168 type(json_file),
intent(inout) :: json
169 character(len=*),
intent(in) :: name
170 real(kind=
dp),
allocatable,
intent(out) :: value(:)
173 call json%get(name,
value, found)
175 if (.not. found)
then
176 call neko_error(
"Parameter "//name//
" missing from the case file")
185 type(json_file),
intent(inout) :: json
186 character(len=*),
intent(in) :: name
187 integer,
allocatable,
intent(out) ::
value(:)
190 call json%get(name,
value, found)
192 if (.not. found)
then
193 call neko_error(
"Parameter "//name//
" missing from the case file")
202 type(json_file),
intent(inout) :: json
203 character(len=*),
intent(in) :: name
204 logical,
allocatable,
intent(out) ::
value(:)
207 call json%get(name,
value, found)
209 if (.not. found)
then
210 call neko_error(
"Parameter "//name//
" missing from the case file")
220 type(json_file),
intent(inout) :: json
221 character(len=*),
intent(in) :: name
222 character(len=*),
allocatable,
intent(out) ::
value(:)
223 character(len=*),
optional,
intent(in) :: filler
225 type(json_value),
pointer :: json_val, val_ptr
226 type(json_core) :: core
227 character(len=:),
allocatable :: string_value
228 integer :: i, n_children
230 if (.not. json%valid_path(name))
then
231 call neko_error(
"Parameter "//name//
" missing from the case file")
233 call json%info(name, n_children=n_children)
235 if (.not.
allocated(
value))
then
236 allocate(value(n_children))
237 else if (len(
value) .lt. n_children)
then
239 allocate(value(n_children))
242 call json%get(name, json_val, found)
243 call json%get_core(core)
246 call core%get_child(json_val, i, val_ptr, found)
247 call core%get(val_ptr, string_value)
249 if (len(string_value) .gt. 0)
then
250 value(i) = string_value
251 else if(
present(filler))
then
264 type(json_file),
intent(inout) :: json
265 character(len=*),
intent(in) :: name
266 real(kind=
sp),
intent(out) ::
value
267 real(kind=
sp),
intent(in) :: default
270 call json%get(name,
value, found)
272 if (.not. found)
then
274 call json%add(name,
value)
284 type(json_file),
intent(inout) :: json
285 character(len=*),
intent(in) :: name
286 real(kind=
dp),
intent(out) ::
value
287 real(kind=
dp),
intent(in) :: default
290 call json%get(name,
value, found)
292 if (.not. found)
then
294 call json%add(name,
value)
304 type(json_file),
intent(inout) :: json
305 character(len=*),
intent(in) :: name
306 integer,
intent(out) :: value
307 integer,
intent(in) :: default
310 call json%get(name,
value, found)
312 if (.not. found)
then
314 call json%add(name,
value)
324 type(json_file),
intent(inout) :: json
325 character(len=*),
intent(in) :: name
326 logical,
intent(out) :: value
327 logical,
intent(in) :: default
330 call json%get(name,
value, found)
332 if (.not. found)
then
334 call json%add(name,
value)
344 type(json_file),
intent(inout) :: json
345 character(len=*),
intent(in) :: name
346 character(len=:),
allocatable,
intent(out) :: value
347 character(len=*),
intent(in) :: default
350 call json%get(name,
value, found)
352 if (.not. found)
then
354 call json%add(name,
value)
364 type(json_core),
intent(inout) :: core
365 type(json_value),
pointer,
intent(in) :: array
366 integer,
intent(in) :: i
367 type(json_file),
intent(inout) :: item
368 type(json_value),
pointer :: ptr
370 character(len=:),
allocatable :: buffer
372 call core%get_child(array, i, ptr, found)
373 call core%print_to_string(ptr, buffer)
374 call item%load_from_string(buffer)
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
Utilities for retrieving parameters from the case files.
subroutine json_get_logical(json, name, value)
Retrieves a logical parameter by name or throws an error.
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 add...
subroutine, public json_extract_item(core, array, i, item)
Extract ith item from a JSON array as a separate JSON object.
subroutine json_get_real_array(json, name, value)
Retrieves a real array 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_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 ...
subroutine json_get_or_default_double(json, name, value, default)
Retrieves a real parameter by name or assigns a provided default value. In the latter case also adds ...
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 ad...
subroutine json_get_double_array(json, name, value)
Retrieves a real array parameter by name or throws an error.
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 a...
subroutine json_get_double(json, name, value)
Retrieves a double precision real 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_logical_array(json, name, value)
Retrieves a logical array parameter by name or throws an error.
subroutine json_get_real(json, name, value)
Retrieves a 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_integer_array(json, name, value)
Retrieves a integer array parameter by name or throws an error.
integer, parameter, public dp
integer, parameter, public sp
integer, parameter, public rp
Global precision used in computations.