89 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
90 character(len=*),
intent(in) :: variable_name
91 class(*),
contiguous,
target,
intent(inout) :: vdata(:,:)
94 integer,
intent(in),
optional :: unlim_dim_level
96 integer,
dimension(2),
intent(in),
optional :: corner
100 integer,
dimension(2),
intent(in),
optional :: edge_lengths
105 integer :: xdim_index
106 integer :: ydim_index
118 logical :: buffer_includes_halos
123 type(domain2d),
pointer :: io_domain
126 integer(kind=i4_kind),
dimension(:,:),
allocatable :: buf_i4_kind_pe
127 integer(kind=i8_kind),
dimension(:,:),
allocatable :: buf_i8_kind_pe
128 real(kind=r4_kind),
dimension(:,:),
allocatable :: buf_r4_kind_pe
129 real(kind=r8_kind),
dimension(:,:),
allocatable :: buf_r8_kind_pe
130 integer(kind=i4_kind),
dimension(:,:),
allocatable :: buf_i4_kind
131 integer(kind=i8_kind),
dimension(:,:),
allocatable :: buf_i8_kind
132 real(kind=r4_kind),
dimension(:,:),
allocatable :: buf_r4_kind
133 real(kind=r8_kind),
dimension(:,:),
allocatable :: buf_r8_kind
134 class(*),
dimension(:,:,:,:),
pointer :: vdata_dummy
136 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., &
137 xdim_index, ydim_index, xpos, ypos))
then
138 call netcdf_read_data(fileobj, variable_name, vdata, &
139 unlim_dim_level=unlim_dim_level, corner=corner, &
140 edge_lengths=edge_lengths, broadcast=.true.)
144 if (xdim_index .ne. 1 .or. ydim_index .ne. 2)
then
148 vdata_dummy(1:
size(vdata,1),1:
size(vdata,2), 1:1, 1:1) => vdata(:,:)
149 call domain_read_4d(fileobj, variable_name, vdata_dummy, unlim_dim_level)
153 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
154 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, &
155 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
159 call mpp_get_global_domain(io_domain, xbegin=xgbegin, xsize=xgsize, position=xpos)
160 call mpp_get_global_domain(io_domain, ybegin=ygbegin, ysize=ygsize, position=ypos)
163 if (fileobj%is_root)
then
165 if (fileobj%adjust_indices)
then
172 c(xdim_index) = xgbegin
173 c(ydim_index) = ygbegin
176 e(xdim_index) = xgsize
177 e(ydim_index) = ygsize
181 type is (
integer(kind=i4_kind))
182 call allocate_array(buf_i4_kind, e)
183 call netcdf_read_data(fileobj, variable_name, buf_i4_kind, &
184 unlim_dim_level=unlim_dim_level, &
185 corner=c, edge_lengths=e, broadcast=.false.)
186 type is (
integer(kind=i8_kind))
187 call allocate_array(buf_i8_kind, e)
188 call netcdf_read_data(fileobj, variable_name, buf_i8_kind, &
189 unlim_dim_level=unlim_dim_level, &
190 corner=c, edge_lengths=e, broadcast=.false.)
191 type is (real(kind=r4_kind))
192 call allocate_array(buf_r4_kind, e)
193 call netcdf_read_data(fileobj, variable_name, buf_r4_kind, &
194 unlim_dim_level=unlim_dim_level, &
195 corner=c, edge_lengths=e, broadcast=.false.)
196 type is (real(kind=r8_kind))
197 call allocate_array(buf_r8_kind, e)
198 call netcdf_read_data(fileobj, variable_name, buf_r8_kind, &
199 unlim_dim_level=unlim_dim_level, &
200 corner=c, edge_lengths=e, broadcast=.false.)
202 call error(
"unsupported variable type: domain_read_2d: file: "//trim(fileobj%path)//
" variable:"// &
203 & trim(variable_name))
211 if (buffer_includes_halos)
then
213 c(xdim_index) = isc - isd + 1
214 c(ydim_index) = jsc - jsd + 1
220 e(xdim_index) = xc_size
221 e(ydim_index) = yc_size
224 type is (
integer(kind=i4_kind))
225 call allocate_array(buf_i4_kind_pe, e)
226 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, fileobj%pelist, &
227 buf_i4_kind_pe, buf_i4_kind, fileobj%is_root)
228 call put_array_section(buf_i4_kind_pe, vdata, c, e)
229 deallocate(buf_i4_kind_pe)
230 type is (
integer(kind=i8_kind))
231 call allocate_array(buf_i8_kind_pe, e)
232 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, fileobj%pelist, &
233 buf_i8_kind_pe, buf_i8_kind, fileobj%is_root)
234 call put_array_section(buf_i8_kind_pe, vdata, c, e)
235 deallocate(buf_i8_kind_pe)
236 type is (real(kind=r4_kind))
237 call allocate_array(buf_r4_kind_pe, e)
238 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, fileobj%pelist, &
239 buf_r4_kind_pe, buf_r4_kind, fileobj%is_root)
240 call put_array_section(buf_r4_kind_pe, vdata, c, e)
241 deallocate(buf_r4_kind_pe)
242 type is (real(kind=r8_kind))
243 call allocate_array(buf_r8_kind_pe, e)
244 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, fileobj%pelist, &
245 buf_r8_kind_pe, buf_r8_kind, fileobj%is_root)
246 call put_array_section(buf_r8_kind_pe, vdata, c, e)
247 deallocate(buf_r8_kind_pe)
249 call error(
"unsupported variable type: domain_read_2d: file: "//trim(fileobj%path)//
" variable:"// &
250 & trim(variable_name))
253 if (fileobj%is_root)
then
254 if (
allocated(buf_i4_kind))
deallocate(buf_i4_kind)
255 if (
allocated(buf_i8_kind))
deallocate(buf_i8_kind)
256 if (
allocated(buf_r4_kind))
deallocate(buf_r4_kind)
257 if (
allocated(buf_r8_kind))
deallocate(buf_r8_kind)
268 corner, edge_lengths)
269 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
270 character(len=*),
intent(in) :: variable_name
271 class(*),
contiguous,
target,
intent(inout) :: vdata(:,:,:)
274 integer,
intent(in),
optional :: unlim_dim_level
276 integer,
dimension(3),
intent(in),
optional :: corner
280 integer,
dimension(3),
intent(in),
optional :: edge_lengths
285 integer :: xdim_index
286 integer :: ydim_index
298 logical :: buffer_includes_halos
303 type(domain2d),
pointer :: io_domain
306 integer(kind=i4_kind),
dimension(:,:,:),
allocatable :: buf_i4_kind_pe
307 integer(kind=i8_kind),
dimension(:,:,:),
allocatable :: buf_i8_kind_pe
308 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: buf_r4_kind_pe
309 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: buf_r8_kind_pe
310 integer(kind=i4_kind),
dimension(:,:,:),
allocatable :: buf_i4_kind
311 integer(kind=i8_kind),
dimension(:,:,:),
allocatable :: buf_i8_kind
312 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: buf_r4_kind
313 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: buf_r8_kind
314 class(*),
dimension(:,:,:,:),
pointer :: vdata_dummy
316 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., &
317 xdim_index, ydim_index, xpos, ypos))
then
318 call netcdf_read_data(fileobj, variable_name, vdata, &
319 unlim_dim_level=unlim_dim_level, corner=corner, &
320 edge_lengths=edge_lengths, broadcast=.true.)
324 if (xdim_index .ne. 1 .or. ydim_index .ne. 2)
then
328 vdata_dummy(1:
size(vdata,1),1:
size(vdata,2), 1:
size(vdata,3), 1:1) => vdata(:,:,:)
329 call domain_read_4d(fileobj, variable_name, vdata_dummy, unlim_dim_level)
333 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
334 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, &
335 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
337 if (
present(corner)) c = corner
340 if (
present(edge_lengths)) e = edge_lengths
342 call mpp_get_global_domain(io_domain, xbegin=xgbegin, xsize=xgsize, position=xpos)
343 call mpp_get_global_domain(io_domain, ybegin=ygbegin, ysize=ygsize, position=ypos)
346 if (fileobj%is_root)
then
348 if (fileobj%adjust_indices)
then
355 c(xdim_index) = xgbegin
356 c(ydim_index) = ygbegin
359 e(xdim_index) = xgsize
360 e(ydim_index) = ygsize
364 type is (
integer(kind=i4_kind))
365 call allocate_array(buf_i4_kind, e)
366 call netcdf_read_data(fileobj, variable_name, buf_i4_kind, &
367 unlim_dim_level=unlim_dim_level, &
368 corner=c, edge_lengths=e, broadcast=.false.)
369 type is (
integer(kind=i8_kind))
370 call allocate_array(buf_i8_kind, e)
371 call netcdf_read_data(fileobj, variable_name, buf_i8_kind, &
372 unlim_dim_level=unlim_dim_level, &
373 corner=c, edge_lengths=e, broadcast=.false.)
374 type is (real(kind=r4_kind))
375 call allocate_array(buf_r4_kind, e)
376 call netcdf_read_data(fileobj, variable_name, buf_r4_kind, &
377 unlim_dim_level=unlim_dim_level, &
378 corner=c, edge_lengths=e, broadcast=.false.)
379 type is (real(kind=r8_kind))
380 call allocate_array(buf_r8_kind, e)
381 call netcdf_read_data(fileobj, variable_name, buf_r8_kind, &
382 unlim_dim_level=unlim_dim_level, &
383 corner=c, edge_lengths=e, broadcast=.false.)
385 call error(
"unsupported variable type: domain_read_2d: file: "//trim(fileobj%path)//
" variable:"// &
386 & trim(variable_name))
394 if (buffer_includes_halos)
then
396 c(xdim_index) = isc - isd + 1
397 c(ydim_index) = jsc - jsd + 1
403 e(xdim_index) = xc_size
404 e(ydim_index) = yc_size
407 type is (
integer(kind=i4_kind))
408 call allocate_array(buf_i4_kind_pe, e)
409 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, e(3), fileobj%pelist, &
410 buf_i4_kind_pe, buf_i4_kind, fileobj%is_root)
411 call put_array_section(buf_i4_kind_pe, vdata, c, e)
412 deallocate(buf_i4_kind_pe)
413 type is (
integer(kind=i8_kind))
414 call allocate_array(buf_i8_kind_pe, e)
415 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, e(3), fileobj%pelist, &
416 buf_i8_kind_pe, buf_i8_kind, fileobj%is_root)
417 call put_array_section(buf_i8_kind_pe, vdata, c, e)
418 deallocate(buf_i8_kind_pe)
419 type is (real(kind=r4_kind))
420 call allocate_array(buf_r4_kind_pe, e)
421 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, e(3), fileobj%pelist, &
422 buf_r4_kind_pe, buf_r4_kind, fileobj%is_root)
423 call put_array_section(buf_r4_kind_pe, vdata, c, e)
424 deallocate(buf_r4_kind_pe)
425 type is (real(kind=r8_kind))
426 call allocate_array(buf_r8_kind_pe, e)
427 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, e(3), fileobj%pelist, &
428 buf_r8_kind_pe, buf_r8_kind, fileobj%is_root)
429 call put_array_section(buf_r8_kind_pe, vdata, c, e)
430 deallocate(buf_r8_kind_pe)
432 call error(
"unsupported variable type: domain_read_2d: file: "//trim(fileobj%path)//
" variable:"// &
433 & trim(variable_name))
436 if (fileobj%is_root)
then
437 if (
allocated(buf_i4_kind))
deallocate(buf_i4_kind)
438 if (
allocated(buf_i8_kind))
deallocate(buf_i8_kind)
439 if (
allocated(buf_r4_kind))
deallocate(buf_r4_kind)
440 if (
allocated(buf_r8_kind))
deallocate(buf_r8_kind)
452 corner, edge_lengths)
454 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
455 character(len=*),
intent(in) :: variable_name
456 class(*),
dimension(:,:,:,:),
intent(inout) :: vdata
459 integer,
intent(in),
optional :: unlim_dim_level
461 integer,
dimension(4),
intent(in),
optional :: corner
465 integer,
dimension(4),
intent(in),
optional :: edge_lengths
470 integer :: xdim_index
471 integer :: ydim_index
472 type(domain2d),
pointer :: io_domain
482 integer,
dimension(:),
allocatable :: pe_isc
483 integer,
dimension(:),
allocatable :: pe_icsize
484 integer,
dimension(:),
allocatable :: pe_jsc
485 integer,
dimension(:),
allocatable :: pe_jcsize
486 integer,
dimension(4) :: c
487 integer,
dimension(4) :: e
488 integer(kind=i4_kind),
dimension(:,:,:,:),
allocatable :: buf_i4_kind
489 integer(kind=i8_kind),
dimension(:,:,:,:),
allocatable :: buf_i8_kind
490 real(kind=r4_kind),
dimension(:,:,:,:),
allocatable :: buf_r4_kind
491 real(kind=r8_kind),
dimension(:,:,:,:),
allocatable :: buf_r8_kind
492 logical :: buffer_includes_halos
496 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., &
497 xdim_index, ydim_index, xpos, ypos))
then
498 call netcdf_read_data(fileobj, variable_name, vdata, &
499 unlim_dim_level=unlim_dim_level, corner=corner, &
500 edge_lengths=edge_lengths, broadcast=.true.)
504 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
505 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, &
506 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
509 if (
present(edge_lengths)) e = edge_lengths
512 if (fileobj%is_root)
then
513 allocate(pe_isc(
size(fileobj%pelist)))
514 allocate(pe_icsize(
size(fileobj%pelist)))
515 allocate(pe_jsc(
size(fileobj%pelist)))
516 allocate(pe_jcsize(
size(fileobj%pelist)))
517 call mpp_get_compute_domains(io_domain, xbegin=pe_isc, xsize=pe_icsize, position=xpos)
518 call mpp_get_compute_domains(io_domain, ybegin=pe_jsc, ysize=pe_jcsize, position=ypos)
519 call mpp_get_global_domain(io_domain, xbegin=xgmin, position=xpos)
520 call mpp_get_global_domain(io_domain, ybegin=ygmin, position=ypos)
521 do i = 1,
size(fileobj%pelist)
522 if (
present(corner)) c = corner
523 c(xdim_index) = pe_isc(i)
524 c(ydim_index) = pe_jsc(i)
525 if (fileobj%adjust_indices)
then
526 c(xdim_index) = c(xdim_index) - xgmin + 1
527 c(ydim_index) = c(ydim_index) - ygmin + 1
529 e(xdim_index) = pe_icsize(i)
530 e(ydim_index) = pe_jcsize(i)
532 type is (
integer(kind=i4_kind))
534 call allocate_array(buf_i4_kind, e)
535 call netcdf_read_data(fileobj, variable_name, buf_i4_kind, &
536 unlim_dim_level=unlim_dim_level, &
537 corner=c, edge_lengths=e, broadcast=.false.)
541 if (buffer_includes_halos)
then
543 c(xdim_index) = isc - isd + 1
544 c(ydim_index) = jsc - jsd + 1
546 call put_array_section(buf_i4_kind, vdata, c, e)
549 call mpp_send(buf_i4_kind,
size(buf_i4_kind), fileobj%pelist(i))
552 deallocate(buf_i4_kind)
553 type is (
integer(kind=i8_kind))
555 call allocate_array(buf_i8_kind, e)
556 call netcdf_read_data(fileobj, variable_name, buf_i8_kind, &
557 unlim_dim_level=unlim_dim_level, &
558 corner=c, edge_lengths=e, broadcast=.false.)
562 if (buffer_includes_halos)
then
564 c(xdim_index) = isc - isd + 1
565 c(ydim_index) = jsc - jsd + 1
567 call put_array_section(buf_i8_kind, vdata, c, e)
570 call mpp_send(buf_i8_kind,
size(buf_i8_kind), fileobj%pelist(i))
573 deallocate(buf_i8_kind)
574 type is (real(kind=r4_kind))
576 call allocate_array(buf_r4_kind, e)
577 call netcdf_read_data(fileobj, variable_name, buf_r4_kind, &
578 unlim_dim_level=unlim_dim_level, &
579 corner=c, edge_lengths=e, broadcast=.false.)
583 if (buffer_includes_halos)
then
585 c(xdim_index) = isc - isd + 1
586 c(ydim_index) = jsc - jsd + 1
588 call put_array_section(buf_r4_kind, vdata, c, e)
591 call mpp_send(buf_r4_kind,
size(buf_r4_kind), fileobj%pelist(i))
594 deallocate(buf_r4_kind)
595 type is (real(kind=r8_kind))
597 call allocate_array(buf_r8_kind, e)
598 call netcdf_read_data(fileobj, variable_name, buf_r8_kind, &
599 unlim_dim_level=unlim_dim_level, &
600 corner=c, edge_lengths=e, broadcast=.false.)
604 if (buffer_includes_halos)
then
606 c(xdim_index) = isc - isd + 1
607 c(ydim_index) = jsc - jsd + 1
609 call put_array_section(buf_r8_kind, vdata, c, e)
612 call mpp_send(buf_r8_kind,
size(buf_r8_kind), fileobj%pelist(i))
615 deallocate(buf_r8_kind)
617 call error(
"unsupported variable type: domain_read_4d: file: "//trim(fileobj%path)//
" variable:"// &
618 & trim(variable_name))
622 deallocate(pe_icsize)
624 deallocate(pe_jcsize)
627 if (buffer_includes_halos)
then
628 c(xdim_index) = isc - isd + 1
629 c(ydim_index) = jsc - jsd + 1
631 e(xdim_index) = xc_size
632 e(ydim_index) = yc_size
634 type is (
integer(kind=i4_kind))
635 call allocate_array(buf_i4_kind, e)
636 call mpp_recv(buf_i4_kind,
size(buf_i4_kind), fileobj%io_root, block=.true.)
637 call put_array_section(buf_i4_kind, vdata, c, e)
638 deallocate(buf_i4_kind)
639 type is (
integer(kind=i8_kind))
640 call allocate_array(buf_i8_kind, e)
641 call mpp_recv(buf_i8_kind,
size(buf_i8_kind), fileobj%io_root, block=.true.)
642 call put_array_section(buf_i8_kind, vdata, c, e)
643 deallocate(buf_i8_kind)
644 type is (real(kind=r4_kind))
645 call allocate_array(buf_r4_kind, e)
646 call mpp_recv(buf_r4_kind,
size(buf_r4_kind), fileobj%io_root, block=.true.)
647 call put_array_section(buf_r4_kind, vdata, c, e)
648 deallocate(buf_r4_kind)
649 type is (real(kind=r8_kind))
650 call allocate_array(buf_r8_kind, e)
651 call mpp_recv(buf_r8_kind,
size(buf_r8_kind), fileobj%io_root, block=.true.)
652 call put_array_section(buf_r8_kind, vdata, c, e)
653 deallocate(buf_r8_kind)
655 call error(
"unsupported variable type: domain_read_4d: file: "//trim(fileobj%path)//
" variable:"// &
656 & trim(variable_name))
668 corner, edge_lengths)
670 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
671 character(len=*),
intent(in) :: variable_name
672 class(*),
dimension(:,:,:,:,:),
intent(inout) :: vdata
675 integer,
intent(in),
optional :: unlim_dim_level
677 integer,
dimension(5),
intent(in),
optional :: corner
681 integer,
dimension(5),
intent(in),
optional :: edge_lengths
686 integer :: xdim_index
687 integer :: ydim_index
688 type(domain2d),
pointer :: io_domain
698 integer,
dimension(:),
allocatable :: pe_isc
699 integer,
dimension(:),
allocatable :: pe_icsize
700 integer,
dimension(:),
allocatable :: pe_jsc
701 integer,
dimension(:),
allocatable :: pe_jcsize
702 integer,
dimension(5) :: c
703 integer,
dimension(5) :: e
704 integer(kind=i4_kind),
dimension(:,:,:,:,:),
allocatable :: buf_i4_kind
705 integer(kind=i8_kind),
dimension(:,:,:,:,:),
allocatable :: buf_i8_kind
706 real(kind=r4_kind),
dimension(:,:,:,:,:),
allocatable :: buf_r4_kind
707 real(kind=r8_kind),
dimension(:,:,:,:,:),
allocatable :: buf_r8_kind
708 logical :: buffer_includes_halos
712 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., &
713 xdim_index, ydim_index, xpos, ypos))
then
714 call netcdf_read_data(fileobj, variable_name, vdata, &
715 unlim_dim_level=unlim_dim_level, corner=corner, &
716 edge_lengths=edge_lengths, broadcast=.true.)
720 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
721 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, &
722 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
725 if (
present(edge_lengths)) e = edge_lengths
728 if (fileobj%is_root)
then
729 allocate(pe_isc(
size(fileobj%pelist)))
730 allocate(pe_icsize(
size(fileobj%pelist)))
731 allocate(pe_jsc(
size(fileobj%pelist)))
732 allocate(pe_jcsize(
size(fileobj%pelist)))
733 call mpp_get_compute_domains(io_domain, xbegin=pe_isc, xsize=pe_icsize, position=xpos)
734 call mpp_get_compute_domains(io_domain, ybegin=pe_jsc, ysize=pe_jcsize, position=ypos)
735 call mpp_get_global_domain(io_domain, xbegin=xgmin, position=xpos)
736 call mpp_get_global_domain(io_domain, ybegin=ygmin, position=ypos)
737 do i = 1,
size(fileobj%pelist)
739 if (
present(corner)) c = corner
740 c(xdim_index) = pe_isc(i)
741 c(ydim_index) = pe_jsc(i)
742 if (fileobj%adjust_indices)
then
743 c(xdim_index) = c(xdim_index) - xgmin + 1
744 c(ydim_index) = c(ydim_index) - ygmin + 1
746 e(xdim_index) = pe_icsize(i)
747 e(ydim_index) = pe_jcsize(i)
749 type is (
integer(kind=i4_kind))
751 call allocate_array(buf_i4_kind, e)
752 call netcdf_read_data(fileobj, variable_name, buf_i4_kind, &
753 unlim_dim_level=unlim_dim_level, &
754 corner=c, edge_lengths=e, broadcast=.false.)
759 if (buffer_includes_halos)
then
761 c(xdim_index) = isc - isd + 1
762 c(ydim_index) = jsc - jsd + 1
764 call put_array_section(buf_i4_kind, vdata, c, e)
767 call mpp_send(buf_i4_kind,
size(buf_i4_kind), fileobj%pelist(i))
770 deallocate(buf_i4_kind)
771 type is (
integer(kind=i8_kind))
773 call allocate_array(buf_i8_kind, e)
774 call netcdf_read_data(fileobj, variable_name, buf_i8_kind, &
775 unlim_dim_level=unlim_dim_level, &
776 corner=c, edge_lengths=e, broadcast=.false.)
780 if (buffer_includes_halos)
then
782 c(xdim_index) = isc - isd + 1
783 c(ydim_index) = jsc - jsd + 1
785 call put_array_section(buf_i8_kind, vdata, c, e)
788 call mpp_send(buf_i8_kind,
size(buf_i8_kind), fileobj%pelist(i))
791 deallocate(buf_i8_kind)
792 type is (real(kind=r4_kind))
794 call allocate_array(buf_r4_kind, e)
795 call netcdf_read_data(fileobj, variable_name, buf_r4_kind, &
796 unlim_dim_level=unlim_dim_level, &
797 corner=c, edge_lengths=e, broadcast=.false.)
801 if (buffer_includes_halos)
then
803 c(xdim_index) = isc - isd + 1
804 c(ydim_index) = jsc - jsd + 1
806 call put_array_section(buf_r4_kind, vdata, c, e)
809 call mpp_send(buf_r4_kind,
size(buf_r4_kind), fileobj%pelist(i))
812 deallocate(buf_r4_kind)
813 type is (real(kind=r8_kind))
815 call allocate_array(buf_r8_kind, e)
816 call netcdf_read_data(fileobj, variable_name, buf_r8_kind, &
817 unlim_dim_level=unlim_dim_level, &
818 corner=c, edge_lengths=e, broadcast=.false.)
822 if (buffer_includes_halos)
then
824 c(xdim_index) = isc - isd + 1
825 c(ydim_index) = jsc - jsd + 1
827 call put_array_section(buf_r8_kind, vdata, c, e)
830 call mpp_send(buf_r8_kind,
size(buf_r8_kind), fileobj%pelist(i))
833 deallocate(buf_r8_kind)
835 call error(
"unsupported variable type: domain_read_5d: file: "//trim(fileobj%path)//
" variable:"// &
836 & trim(variable_name))
840 deallocate(pe_icsize)
842 deallocate(pe_jcsize)
845 if (buffer_includes_halos)
then
846 c(xdim_index) = isc - isd + 1
847 c(ydim_index) = jsc - jsd + 1
849 e(xdim_index) = xc_size
850 e(ydim_index) = yc_size
852 type is (
integer(kind=i4_kind))
853 call allocate_array(buf_i4_kind, e)
854 call mpp_recv(buf_i4_kind,
size(buf_i4_kind), fileobj%io_root, block=.true.)
855 call put_array_section(buf_i4_kind, vdata, c, e)
856 deallocate(buf_i4_kind)
857 type is (
integer(kind=i8_kind))
858 call allocate_array(buf_i8_kind, e)
859 call mpp_recv(buf_i8_kind,
size(buf_i8_kind), fileobj%io_root, block=.true.)
860 call put_array_section(buf_i8_kind, vdata, c, e)
861 deallocate(buf_i8_kind)
862 type is (real(kind=r4_kind))
863 call allocate_array(buf_r4_kind, e)
864 call mpp_recv(buf_r4_kind,
size(buf_r4_kind), fileobj%io_root, block=.true.)
865 call put_array_section(buf_r4_kind, vdata, c, e)
866 deallocate(buf_r4_kind)
867 type is (real(kind=r8_kind))
868 call allocate_array(buf_r8_kind, e)
869 call mpp_recv(buf_r8_kind,
size(buf_r8_kind), fileobj%io_root, block=.true.)
870 call put_array_section(buf_r8_kind, vdata, c, e)
871 deallocate(buf_r8_kind)
873 call error(
"unsupported variable type: domain_read_5d: file: "//trim(fileobj%path)//
" variable:"// &
874 & trim(variable_name))