22 function parse_reals_ ( text, label, values )
result (parse)
23 character(len=*),
intent(in) :: text
24 character(len=*),
intent(in) :: label
25 real(FMS_FM_KIND_),
intent(out) :: values(:)
28 end function parse_reals_
30 function parse_real_ ( text, label, parse_rval )
result (parse)
31 character(len=*),
intent(in) :: text
32 character(len=*),
intent(in) :: label
33 real(FMS_FM_KIND_),
intent(out) :: parse_rval
36 real(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_
44 function fm_get_value_real_(name, get_rval, index) &
47 character(len=*),
intent(in) :: name
48 real(FMS_FM_KIND_),
intent(out) :: get_rval
49 integer,
intent(in),
optional :: index
52 type (field_def),
pointer,
save :: temp_field_p
55 integer,
parameter :: lkind=fms_fm_kind_
59 if (.not. module_is_initialized)
then
60 call initialize_module_variables
63 if (name .eq.
' ')
then
69 if (
present(index))
then
75 temp_field_p => get_field(name, current_list_p)
77 if (
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)
98 end function fm_get_value_real_
102 function fm_new_value_real_(name, new_rval, create, index, append) &
104 integer :: field_index
105 character(len=*),
intent(in) :: name
107 real(FMS_FM_KIND_),
intent(in) :: new_rval
109 logical,
intent(in),
optional :: create
111 integer,
intent(in),
optional :: index
113 logical,
intent(in),
optional :: append
119 real(r8_kind),
allocatable,
dimension(:) :: temp_r_value
120 character(len=FMS_PATH_LEN) :: path
121 character(len=fm_field_name_len) :: base
122 type (field_def),
pointer,
save :: temp_list_p
123 type (field_def),
pointer,
save :: temp_field_p
128 if (.not. module_is_initialized)
then
129 call initialize_module_variables
132 if (name .eq.
' ')
then
133 field_index = no_field
137 if (
present(create))
then
143 if (
present(index) .and.
present(append))
then
144 if (append .and. index .gt. 0)
then
145 field_index = no_field
150 if (
present(index))
then
152 if (index_t .lt. 0)
then
154 field_index = no_field
162 call find_base(name, path, base)
163 temp_list_p => find_list(path, current_list_p, create_t)
165 if (
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
244 end function fm_new_value_real_
integer function stdout()
This function returns the current standard fortran unit numbers for output.