22function parse_reals_ ( text, label, values )
result (parse)
23character(len=*),
intent(in) :: text
24character(len=*),
intent(in) :: label
25real(FMS_FM_KIND_),
intent(out) :: values(:)
28end function parse_reals_
30function parse_real_ ( text, label, parse_rval )
result (parse)
31character(len=*),
intent(in) :: text
32character(len=*),
intent(in) :: label
33real(FMS_FM_KIND_),
intent(out) :: parse_rval
36real(FMS_FM_KIND_) :: values(1)
38 parse = parse_reals_( text, label, values )
39 if (parse > 0) parse_rval = values(1)
40 end function parse_real_
44function fm_get_value_real_(name, get_rval, index) &
47character(len=*),
intent(in) :: name
48real(FMS_FM_KIND_),
intent(out) :: get_rval
49integer,
intent(in),
optional :: index
52type (field_def),
pointer,
save :: temp_field_p
55integer,
parameter :: lkind=fms_fm_kind_
59if (.not. module_is_initialized)
then
60 call initialize_module_variables
63if (name .eq.
' ')
then
69if (
present(index))
then
75temp_field_p => get_field(name, current_list_p)
77if (
associated(temp_field_p))
then
79 if (temp_field_p%field_type .eq. real_type)
then
80 if (index_t .lt. 1 .or. index_t .gt. temp_field_p%max_index)
then
86 get_rval = real(temp_field_p%r_value(index_t),lkind)
98end function fm_get_value_real_
102function fm_new_value_real_(name, new_rval, create, index, append) &
104integer :: field_index
105character(len=*),
intent(in) :: name
107real(FMS_FM_KIND_),
intent(in) :: new_rval
109logical,
intent(in),
optional :: create
111integer,
intent(in),
optional :: index
113logical,
intent(in),
optional :: append
119real(r8_kind),
allocatable,
dimension(:) :: temp_r_value
120character(len=FMS_PATH_LEN) :: path
121character(len=fm_field_name_len) :: base
122type (field_def),
pointer,
save :: temp_list_p
123type (field_def),
pointer,
save :: temp_field_p
128if (.not. module_is_initialized)
then
129 call initialize_module_variables
132if (name .eq.
' ')
then
133 field_index = no_field
137if (
present(create))
then
143if (
present(index) .and.
present(append))
then
144 if (append .and. index .gt. 0)
then
145 field_index = no_field
150if (
present(index))
then
152 if (index_t .lt. 0)
then
154 field_index = no_field
162call find_base(name, path, base)
163temp_list_p => find_list(path, current_list_p, create_t)
165if (
associated(temp_list_p))
then
166 temp_field_p => find_field(base, temp_list_p)
167 if (.not.
associated(temp_field_p))
then
169 temp_field_p => create_field(temp_list_p, base)
171 if (
associated(temp_field_p))
then
174 if (temp_field_p%field_type == integer_type)
then
176 allocate(temp_field_p%r_value(
size(temp_field_p%i_value)))
177 do i = 1,
size(temp_field_p%i_value)
179 temp_field_p%r_value(i) = real(temp_field_p%i_value(i),r8_kind)
181 temp_field_p%field_type = real_type
182 deallocate(temp_field_p%i_value)
183 else if (temp_field_p%field_type /= real_type )
then
188 temp_field_p%max_index = 0
191 temp_field_p%field_type = real_type
193 if (
present(append))
then
195 index_t = temp_field_p%max_index + 1
198 if (index_t .gt. temp_field_p%max_index + 1)
then
200 field_index = no_field
202 elseif (index_t .eq. 0 .and. &
203 temp_field_p%max_index .gt. 0)
then
205 field_index = no_field
207 elseif (.not.
allocated(temp_field_p%r_value) .and. &
210 allocate(temp_field_p%r_value(1))
211 temp_field_p%max_index = 1
212 temp_field_p%array_dim = 1
213 elseif (index_t .gt. temp_field_p%array_dim)
then
216 temp_field_p%array_dim = temp_field_p%array_dim + array_increment
217 allocate (temp_r_value(temp_field_p%array_dim))
218 do i = 1, temp_field_p%max_index
219 temp_r_value(i) = temp_field_p%r_value(i)
221 if (
allocated(temp_field_p%r_value))
deallocate(temp_field_p%r_value)
222 temp_field_p%r_value = temp_r_value
223 temp_field_p%max_index = index_t
227 if (index_t .gt. 0)
then
229 temp_field_p%r_value(index_t) = real(new_rval,r8_kind)
230 if (index_t .gt. temp_field_p%max_index)
then
231 temp_field_p%max_index = index_t
234 field_index = temp_field_p%index
237 field_index = no_field
241 field_index = no_field
244end function fm_new_value_real_