21 function parse_reals_ ( text, label, values )
result (parse)
22 character(len=*),
intent(in) :: text
23 character(len=*),
intent(in) :: label
24 real(FMS_FM_KIND_),
intent(out) :: values(:)
27 end function parse_reals_
29 function parse_real_ ( text, label, parse_rval )
result (parse)
30 character(len=*),
intent(in) :: text
31 character(len=*),
intent(in) :: label
32 real(FMS_FM_KIND_),
intent(out) :: parse_rval
35 real(FMS_FM_KIND_) :: values(1)
37 parse = parse_reals_( text, label, values )
38 if (parse > 0) parse_rval = values(1)
39 end function parse_real_
43 function fm_get_value_real_(name, get_rval, index) &
46 character(len=*),
intent(in) :: name
47 real(FMS_FM_KIND_),
intent(out) :: get_rval
48 integer,
intent(in),
optional :: index
51 type (field_def),
pointer,
save :: temp_field_p
54 integer,
parameter :: lkind=fms_fm_kind_
58 if (.not. module_is_initialized)
then
59 call initialize_module_variables
62 if (name .eq.
' ')
then
68 if (
present(index))
then
74 temp_field_p => get_field(name, current_list_p)
76 if (
associated(temp_field_p))
then
78 if (temp_field_p%field_type .eq. real_type)
then
79 if (index_t .lt. 1 .or. index_t .gt. temp_field_p%max_index)
then
85 get_rval = real(temp_field_p%r_value(index_t),lkind)
97 end function fm_get_value_real_
101 function fm_new_value_real_(name, new_rval, create, index, append) &
103 integer :: field_index
104 character(len=*),
intent(in) :: name
106 real(FMS_FM_KIND_),
intent(in) :: new_rval
108 logical,
intent(in),
optional :: create
110 integer,
intent(in),
optional :: index
112 logical,
intent(in),
optional :: append
118 real(r8_kind),
allocatable,
dimension(:) :: temp_r_value
119 character(len=FMS_PATH_LEN) :: path
120 character(len=fm_field_name_len) :: base
121 type (field_def),
pointer,
save :: temp_list_p
122 type (field_def),
pointer,
save :: temp_field_p
127 if (.not. module_is_initialized)
then
128 call initialize_module_variables
131 if (name .eq.
' ')
then
132 field_index = no_field
136 if (
present(create))
then
142 if (
present(index) .and.
present(append))
then
143 if (append .and. index .gt. 0)
then
144 field_index = no_field
149 if (
present(index))
then
151 if (index_t .lt. 0)
then
153 field_index = no_field
161 call find_base(name, path, base)
162 temp_list_p => find_list(path, current_list_p, create_t)
164 if (
associated(temp_list_p))
then
165 temp_field_p => find_field(base, temp_list_p)
166 if (.not.
associated(temp_field_p))
then
168 temp_field_p => create_field(temp_list_p, base)
170 if (
associated(temp_field_p))
then
173 if (temp_field_p%field_type == integer_type)
then
175 allocate(temp_field_p%r_value(
size(temp_field_p%i_value)))
176 do i = 1,
size(temp_field_p%i_value)
178 temp_field_p%r_value(i) = real(temp_field_p%i_value(i),r8_kind)
180 temp_field_p%field_type = real_type
181 deallocate(temp_field_p%i_value)
182 else if (temp_field_p%field_type /= real_type )
then
187 temp_field_p%max_index = 0
190 temp_field_p%field_type = real_type
192 if (
present(append))
then
194 index_t = temp_field_p%max_index + 1
197 if (index_t .gt. temp_field_p%max_index + 1)
then
199 field_index = no_field
201 elseif (index_t .eq. 0 .and. &
202 temp_field_p%max_index .gt. 0)
then
204 field_index = no_field
206 elseif (.not.
allocated(temp_field_p%r_value) .and. &
209 allocate(temp_field_p%r_value(1))
210 temp_field_p%max_index = 1
211 temp_field_p%array_dim = 1
212 elseif (index_t .gt. temp_field_p%array_dim)
then
215 temp_field_p%array_dim = temp_field_p%array_dim + array_increment
216 allocate (temp_r_value(temp_field_p%array_dim))
217 do i = 1, temp_field_p%max_index
218 temp_r_value(i) = temp_field_p%r_value(i)
220 if (
allocated(temp_field_p%r_value))
deallocate(temp_field_p%r_value)
221 temp_field_p%r_value = temp_r_value
222 temp_field_p%max_index = index_t
226 if (index_t .gt. 0)
then
228 temp_field_p%r_value(index_t) = real(new_rval,r8_kind)
229 if (index_t .gt. temp_field_p%max_index)
then
230 temp_field_p%max_index = index_t
233 field_index = temp_field_p%index
236 field_index = no_field
240 field_index = no_field
243 end function fm_new_value_real_
integer function stdout()
This function returns the current standard fortran unit numbers for output.