Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | , | pointer | :: | me | ||
character(len=*), | intent(in) | :: | variable | |||
character(len=*), | intent(in) | :: | units | |||
character(len=*), | intent(in) | :: | frame | |||
character(len=*), | intent(in) | :: | center | |||
real(kind=wp), | intent(in), | dimension(:) | :: | rdata | ||
integer, | intent(inout) | :: | error_cnt |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(json_value), | public, | pointer | :: | var |
subroutine add_variables_to_input(me, variable, units, frame, center, rdata, error_cnt)
!Used by test_2.
implicit none
type(json_value),pointer :: me
character(len=*),intent(in) :: variable, units, frame, center
real(wp),dimension(:),intent(in) :: rdata
integer, intent(inout) :: error_cnt
type(json_value),pointer :: var !a variable in the trajectory:
!initialize:
nullify(var)
!create the object before data can be added:
call json_create_object(var,'') !name does not matter
if (json_failed()) then
call json_print_error_message(error_unit)
error_cnt = error_cnt + 1
end if
!variable info:
call json_add(var, 'VARIABLE',trim(variable))
if (json_failed()) then
call json_print_error_message(error_unit)
error_cnt = error_cnt + 1
end if
call json_add(var, 'UNITS', trim(units))
if (json_failed()) then
call json_print_error_message(error_unit)
error_cnt = error_cnt + 1
end if
call json_add(var, 'FRAME', trim(frame))
if (json_failed()) then
call json_print_error_message(error_unit)
error_cnt = error_cnt + 1
end if
call json_add(var, 'CENTER', trim(center))
if (json_failed()) then
call json_print_error_message(error_unit)
error_cnt = error_cnt + 1
end if
!trajectory [vector of reals]:
call json_add(var, 'DATA', rdata)
if (json_failed()) then
call json_print_error_message(error_unit)
error_cnt = error_cnt + 1
end if
!add this variable to trajectory structure:
call json_add(me, var)
if (json_failed()) then
call json_print_error_message(error_unit)
error_cnt = error_cnt + 1
end if
!cleanup:
nullify(var)
end subroutine add_variables_to_input