Change the json_value variable to a double.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | intent(inout) | :: | p | |||
real(kind=RK), | intent(in), | optional | :: | val | if the value is also to be set (if not present, then 0.0_rk is used). |
|
character(kind=CK,len=*), | intent(in), | optional | :: | name | if the name is also to be changed. |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
subroutine to_double(p,val,name)
implicit none
type(json_value),intent(inout) :: p
real(RK),intent(in),optional :: val !! if the value is also to be set (if not present, then 0.0_rk is used).
character(kind=CK,len=*),intent(in),optional :: name !! if the name is also to be changed.
!set type and value:
call destroy_json_data(p)
p%var_type = json_double
allocate(p%dbl_value)
if (present(val)) then
p%dbl_value = val
else
p%dbl_value = 0.0_RK !default value
end if
!name:
if (present(name)) p%name = trim(name)
end subroutine to_double