Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | intent(inout) | :: | me | |||
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. |
Change the json_value variable to a double.
subroutine to_double(me,val,name)
implicit none
type(json_value),intent(inout) :: me
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(me)
me%var_type = json_double
allocate(me%dbl_value)
if (present(val)) then
me%dbl_value = val
else
me%dbl_value = 0.0_RK !default value
end if
!name:
if (present(name)) me%name = trim(name)
end subroutine to_double