29 subroutine domain_read_0d(fileobj, variable_name, vdata, unlim_dim_level, corner)
31 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
32 character(len=*),
intent(in) :: variable_name
33 class(*),
intent(inout) :: vdata
36 integer,
intent(in),
optional :: unlim_dim_level
38 integer,
intent(in),
optional :: corner
43 call netcdf_read_data(fileobj, variable_name, vdata, &
44 unlim_dim_level=unlim_dim_level, corner=corner, &
58 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
59 character(len=*),
intent(in) :: variable_name
60 class(*),
dimension(:),
intent(inout) :: vdata
63 integer,
intent(in),
optional :: unlim_dim_level
65 integer,
dimension(1),
intent(in),
optional :: corner
69 integer,
dimension(1),
intent(in),
optional :: edge_lengths
74 call netcdf_read_data(fileobj, variable_name, vdata, &
75 unlim_dim_level=unlim_dim_level, corner=corner, &
76 edge_lengths=edge_lengths, broadcast=.true.)
88 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
89 character(len=*),
intent(in) :: variable_name
90 class(*),
contiguous,
target,
intent(inout) :: vdata(:,:)
93 integer,
intent(in),
optional :: unlim_dim_level
95 integer,
dimension(2),
intent(in),
optional :: corner
99 integer,
dimension(2),
intent(in),
optional :: edge_lengths
104 integer :: xdim_index
105 integer :: ydim_index
117 logical :: buffer_includes_halos
122 integer :: dim_order(2)
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 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
145 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, &
146 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
148 if (fileobj%use_netcdf_mpi)
then
152 if (buffer_includes_halos)
then
155 e(xdim_index) = xc_size + 2*(isc - isd)
156 e(ydim_index) = yc_size + 2*(jsc - jsd)
160 e(xdim_index) = xc_size
161 e(ydim_index) = yc_size
164 call netcdf_read_data(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=c, edge_lengths=e)
172 call mpp_get_global_domain(io_domain, xbegin=xgbegin, xsize=xgsize, position=xpos)
173 call mpp_get_global_domain(io_domain, ybegin=ygbegin, ysize=ygsize, position=ypos)
176 if (fileobj%is_root)
then
178 if (fileobj%adjust_indices)
then
185 c(xdim_index) = xgbegin
186 c(ydim_index) = ygbegin
189 e(xdim_index) = xgsize
190 e(ydim_index) = ygsize
194 type is (
integer(kind=i4_kind))
195 call allocate_array(buf_i4_kind, e)
196 call netcdf_read_data(fileobj, variable_name, buf_i4_kind, &
197 unlim_dim_level=unlim_dim_level, &
198 corner=c, edge_lengths=e, broadcast=.false.)
199 type is (
integer(kind=i8_kind))
200 call allocate_array(buf_i8_kind, e)
201 call netcdf_read_data(fileobj, variable_name, buf_i8_kind, &
202 unlim_dim_level=unlim_dim_level, &
203 corner=c, edge_lengths=e, broadcast=.false.)
204 type is (real(kind=r4_kind))
205 call allocate_array(buf_r4_kind, e)
206 call netcdf_read_data(fileobj, variable_name, buf_r4_kind, &
207 unlim_dim_level=unlim_dim_level, &
208 corner=c, edge_lengths=e, broadcast=.false.)
209 type is (real(kind=r8_kind))
210 call allocate_array(buf_r8_kind, e)
211 call netcdf_read_data(fileobj, variable_name, buf_r8_kind, &
212 unlim_dim_level=unlim_dim_level, &
213 corner=c, edge_lengths=e, broadcast=.false.)
215 call error(
"unsupported variable type: domain_read_2d: file: "//trim(fileobj%path)//
" variable:"// &
216 & trim(variable_name))
224 if (buffer_includes_halos)
then
226 c(xdim_index) = isc - isd + 1
227 c(ydim_index) = jsc - jsd + 1
233 e(xdim_index) = xc_size
234 e(ydim_index) = yc_size
236 dim_order = (/xdim_index, ydim_index/)
239 type is (
integer(kind=i4_kind))
240 call allocate_array(buf_i4_kind_pe, e)
241 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, fileobj%pelist, &
242 buf_i4_kind_pe, buf_i4_kind, dim_order, fileobj%is_root)
243 call put_array_section(buf_i4_kind_pe, vdata, c, e)
244 deallocate(buf_i4_kind_pe)
245 type is (
integer(kind=i8_kind))
246 call allocate_array(buf_i8_kind_pe, e)
247 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, fileobj%pelist, &
248 buf_i8_kind_pe, buf_i8_kind, dim_order, fileobj%is_root)
249 call put_array_section(buf_i8_kind_pe, vdata, c, e)
250 deallocate(buf_i8_kind_pe)
251 type is (real(kind=r4_kind))
252 call allocate_array(buf_r4_kind_pe, e)
253 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, fileobj%pelist, &
254 buf_r4_kind_pe, buf_r4_kind, dim_order, fileobj%is_root)
255 call put_array_section(buf_r4_kind_pe, vdata, c, e)
256 deallocate(buf_r4_kind_pe)
257 type is (real(kind=r8_kind))
258 call allocate_array(buf_r8_kind_pe, e)
259 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, fileobj%pelist, &
260 buf_r8_kind_pe, buf_r8_kind, dim_order, fileobj%is_root)
261 call put_array_section(buf_r8_kind_pe, vdata, c, e)
262 deallocate(buf_r8_kind_pe)
264 call error(
"unsupported variable type: domain_read_2d: file: "//trim(fileobj%path)//
" variable:"// &
265 & trim(variable_name))
268 if (fileobj%is_root)
then
269 if (
allocated(buf_i4_kind))
deallocate(buf_i4_kind)
270 if (
allocated(buf_i8_kind))
deallocate(buf_i8_kind)
271 if (
allocated(buf_r4_kind))
deallocate(buf_r4_kind)
272 if (
allocated(buf_r8_kind))
deallocate(buf_r8_kind)
283 corner, edge_lengths)
284 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
285 character(len=*),
intent(in) :: variable_name
286 class(*),
contiguous,
target,
intent(inout) :: vdata(:,:,:)
289 integer,
intent(in),
optional :: unlim_dim_level
291 integer,
dimension(3),
intent(in),
optional :: corner
295 integer,
dimension(3),
intent(in),
optional :: edge_lengths
300 integer :: xdim_index
301 integer :: ydim_index
302 integer :: zdim_index
314 logical :: buffer_includes_halos
319 integer :: dim_order(3)
320 type(domain2d),
pointer :: io_domain
323 integer(kind=i4_kind),
dimension(:,:,:),
allocatable :: buf_i4_kind_pe
324 integer(kind=i8_kind),
dimension(:,:,:),
allocatable :: buf_i8_kind_pe
325 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: buf_r4_kind_pe
326 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: buf_r8_kind_pe
327 integer(kind=i4_kind),
dimension(:,:,:),
allocatable :: buf_i4_kind
328 integer(kind=i8_kind),
dimension(:,:,:),
allocatable :: buf_i8_kind
329 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: buf_r4_kind
330 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: buf_r8_kind
331 class(*),
dimension(:,:,:,:),
pointer :: vdata_dummy
333 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., &
334 xdim_index, ydim_index, xpos, ypos))
then
335 call netcdf_read_data(fileobj, variable_name, vdata, &
336 unlim_dim_level=unlim_dim_level, corner=corner, &
337 edge_lengths=edge_lengths, broadcast=.true.)
341 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
342 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, &
343 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
345 if (fileobj%use_netcdf_mpi)
then
349 if (buffer_includes_halos)
then
352 e(xdim_index) = xc_size + 2*(isc - isd)
353 e(ydim_index) = yc_size + 2*(jsc - jsd)
357 e(xdim_index) = xc_size
358 e(ydim_index) = yc_size
361 call netcdf_read_data(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=c, edge_lengths=e)
367 if (
present(corner)) c = corner
370 if (
present(edge_lengths)) e = edge_lengths
372 call mpp_get_global_domain(io_domain, xbegin=xgbegin, xsize=xgsize, position=xpos)
373 call mpp_get_global_domain(io_domain, ybegin=ygbegin, ysize=ygsize, position=ypos)
376 if (fileobj%is_root)
then
378 if (fileobj%adjust_indices)
then
385 c(xdim_index) = xgbegin
386 c(ydim_index) = ygbegin
389 e(xdim_index) = xgsize
390 e(ydim_index) = ygsize
394 type is (
integer(kind=i4_kind))
395 call allocate_array(buf_i4_kind, e)
396 call netcdf_read_data(fileobj, variable_name, buf_i4_kind, &
397 unlim_dim_level=unlim_dim_level, &
398 corner=c, edge_lengths=e, broadcast=.false.)
399 type is (
integer(kind=i8_kind))
400 call allocate_array(buf_i8_kind, e)
401 call netcdf_read_data(fileobj, variable_name, buf_i8_kind, &
402 unlim_dim_level=unlim_dim_level, &
403 corner=c, edge_lengths=e, broadcast=.false.)
404 type is (real(kind=r4_kind))
405 call allocate_array(buf_r4_kind, e)
406 call netcdf_read_data(fileobj, variable_name, buf_r4_kind, &
407 unlim_dim_level=unlim_dim_level, &
408 corner=c, edge_lengths=e, broadcast=.false.)
409 type is (real(kind=r8_kind))
410 call allocate_array(buf_r8_kind, e)
411 call netcdf_read_data(fileobj, variable_name, buf_r8_kind, &
412 unlim_dim_level=unlim_dim_level, &
413 corner=c, edge_lengths=e, broadcast=.false.)
415 call error(
"unsupported variable type: domain_read_2d: file: "//trim(fileobj%path)//
" variable:"// &
416 & trim(variable_name))
424 if (buffer_includes_halos)
then
426 c(xdim_index) = isc - isd + 1
427 c(ydim_index) = jsc - jsd + 1
433 e(xdim_index) = xc_size
434 e(ydim_index) = yc_size
437 zdim_index = 6 - xdim_index - ydim_index
439 dim_order = (/xdim_index, ydim_index, zdim_index/)
442 type is (
integer(kind=i4_kind))
443 call allocate_array(buf_i4_kind_pe, e)
444 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, e(zdim_index), &
445 fileobj%pelist, buf_i4_kind_pe, buf_i4_kind, dim_order, fileobj%is_root)
446 call put_array_section(buf_i4_kind_pe, vdata, c, e)
447 deallocate(buf_i4_kind_pe)
448 type is (
integer(kind=i8_kind))
449 call allocate_array(buf_i8_kind_pe, e)
450 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, e(zdim_index), &
451 fileobj%pelist, buf_i8_kind_pe, buf_i8_kind, dim_order, fileobj%is_root)
452 call put_array_section(buf_i8_kind_pe, vdata, c, e)
453 deallocate(buf_i8_kind_pe)
454 type is (real(kind=r4_kind))
455 call allocate_array(buf_r4_kind_pe, e)
456 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, e(zdim_index), &
457 fileobj%pelist, buf_r4_kind_pe, buf_r4_kind, dim_order, fileobj%is_root)
458 call put_array_section(buf_r4_kind_pe, vdata, c, e)
459 deallocate(buf_r4_kind_pe)
460 type is (real(kind=r8_kind))
461 call allocate_array(buf_r8_kind_pe, e)
462 call mpp_scatter(isc-xgbegin+1, isc+xc_size-xgbegin, jsc-ygbegin+1, jsc+yc_size-ygbegin, e(zdim_index), &
463 fileobj%pelist, buf_r8_kind_pe, buf_r8_kind, dim_order, fileobj%is_root)
464 call put_array_section(buf_r8_kind_pe, vdata, c, e)
465 deallocate(buf_r8_kind_pe)
467 call error(
"unsupported variable type: domain_read_2d: file: "//trim(fileobj%path)//
" variable:"// &
468 & trim(variable_name))
471 if (fileobj%is_root)
then
472 if (
allocated(buf_i4_kind))
deallocate(buf_i4_kind)
473 if (
allocated(buf_i8_kind))
deallocate(buf_i8_kind)
474 if (
allocated(buf_r4_kind))
deallocate(buf_r4_kind)
475 if (
allocated(buf_r8_kind))
deallocate(buf_r8_kind)
487 corner, edge_lengths)
489 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
490 character(len=*),
intent(in) :: variable_name
491 class(*),
dimension(:,:,:,:),
intent(inout) :: vdata
494 integer,
intent(in),
optional :: unlim_dim_level
496 integer,
dimension(4),
intent(in),
optional :: corner
500 integer,
dimension(4),
intent(in),
optional :: edge_lengths
505 integer :: xdim_index
506 integer :: ydim_index
507 type(domain2d),
pointer :: io_domain
517 integer,
dimension(:),
allocatable :: pe_isc
518 integer,
dimension(:),
allocatable :: pe_icsize
519 integer,
dimension(:),
allocatable :: pe_jsc
520 integer,
dimension(:),
allocatable :: pe_jcsize
521 integer,
dimension(4) :: c
522 integer,
dimension(4) :: e
523 integer(kind=i4_kind),
dimension(:,:,:,:),
allocatable :: buf_i4_kind
524 integer(kind=i8_kind),
dimension(:,:,:,:),
allocatable :: buf_i8_kind
525 real(kind=r4_kind),
dimension(:,:,:,:),
allocatable :: buf_r4_kind
526 real(kind=r8_kind),
dimension(:,:,:,:),
allocatable :: buf_r8_kind
527 logical :: buffer_includes_halos
531 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., &
532 xdim_index, ydim_index, xpos, ypos))
then
533 call netcdf_read_data(fileobj, variable_name, vdata, &
534 unlim_dim_level=unlim_dim_level, corner=corner, &
535 edge_lengths=edge_lengths, broadcast=.true.)
539 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
540 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, &
541 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
543 if (fileobj%use_netcdf_mpi)
then
547 if (buffer_includes_halos)
then
550 e(xdim_index) = xc_size + 2*(isc - isd)
551 e(ydim_index) = yc_size + 2*(jsc - jsd)
555 e(xdim_index) = xc_size
556 e(ydim_index) = yc_size
559 call netcdf_read_data(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=c, edge_lengths=e)
566 if (
present(edge_lengths)) e = edge_lengths
569 if (fileobj%is_root)
then
570 allocate(pe_isc(
size(fileobj%pelist)))
571 allocate(pe_icsize(
size(fileobj%pelist)))
572 allocate(pe_jsc(
size(fileobj%pelist)))
573 allocate(pe_jcsize(
size(fileobj%pelist)))
574 call mpp_get_compute_domains(io_domain, xbegin=pe_isc, xsize=pe_icsize, position=xpos)
575 call mpp_get_compute_domains(io_domain, ybegin=pe_jsc, ysize=pe_jcsize, position=ypos)
576 call mpp_get_global_domain(io_domain, xbegin=xgmin, position=xpos)
577 call mpp_get_global_domain(io_domain, ybegin=ygmin, position=ypos)
578 do i = 1,
size(fileobj%pelist)
579 if (
present(corner)) c = corner
580 c(xdim_index) = pe_isc(i)
581 c(ydim_index) = pe_jsc(i)
582 if (fileobj%adjust_indices)
then
583 c(xdim_index) = c(xdim_index) - xgmin + 1
584 c(ydim_index) = c(ydim_index) - ygmin + 1
586 e(xdim_index) = pe_icsize(i)
587 e(ydim_index) = pe_jcsize(i)
589 type is (
integer(kind=i4_kind))
591 call allocate_array(buf_i4_kind, e)
592 call netcdf_read_data(fileobj, variable_name, buf_i4_kind, &
593 unlim_dim_level=unlim_dim_level, &
594 corner=c, edge_lengths=e, broadcast=.false.)
598 if (buffer_includes_halos)
then
600 c(xdim_index) = isc - isd + 1
601 c(ydim_index) = jsc - jsd + 1
603 call put_array_section(buf_i4_kind, vdata, c, e)
606 call mpp_send(buf_i4_kind,
size(buf_i4_kind), fileobj%pelist(i))
609 deallocate(buf_i4_kind)
610 type is (
integer(kind=i8_kind))
612 call allocate_array(buf_i8_kind, e)
613 call netcdf_read_data(fileobj, variable_name, buf_i8_kind, &
614 unlim_dim_level=unlim_dim_level, &
615 corner=c, edge_lengths=e, broadcast=.false.)
619 if (buffer_includes_halos)
then
621 c(xdim_index) = isc - isd + 1
622 c(ydim_index) = jsc - jsd + 1
624 call put_array_section(buf_i8_kind, vdata, c, e)
627 call mpp_send(buf_i8_kind,
size(buf_i8_kind), fileobj%pelist(i))
630 deallocate(buf_i8_kind)
631 type is (real(kind=r4_kind))
633 call allocate_array(buf_r4_kind, e)
634 call netcdf_read_data(fileobj, variable_name, buf_r4_kind, &
635 unlim_dim_level=unlim_dim_level, &
636 corner=c, edge_lengths=e, broadcast=.false.)
640 if (buffer_includes_halos)
then
642 c(xdim_index) = isc - isd + 1
643 c(ydim_index) = jsc - jsd + 1
645 call put_array_section(buf_r4_kind, vdata, c, e)
648 call mpp_send(buf_r4_kind,
size(buf_r4_kind), fileobj%pelist(i))
651 deallocate(buf_r4_kind)
652 type is (real(kind=r8_kind))
654 call allocate_array(buf_r8_kind, e)
655 call netcdf_read_data(fileobj, variable_name, buf_r8_kind, &
656 unlim_dim_level=unlim_dim_level, &
657 corner=c, edge_lengths=e, broadcast=.false.)
661 if (buffer_includes_halos)
then
663 c(xdim_index) = isc - isd + 1
664 c(ydim_index) = jsc - jsd + 1
666 call put_array_section(buf_r8_kind, vdata, c, e)
669 call mpp_send(buf_r8_kind,
size(buf_r8_kind), fileobj%pelist(i))
672 deallocate(buf_r8_kind)
674 call error(
"unsupported variable type: domain_read_4d: file: "//trim(fileobj%path)//
" variable:"// &
675 & trim(variable_name))
679 deallocate(pe_icsize)
681 deallocate(pe_jcsize)
684 if (buffer_includes_halos)
then
685 c(xdim_index) = isc - isd + 1
686 c(ydim_index) = jsc - jsd + 1
688 e(xdim_index) = xc_size
689 e(ydim_index) = yc_size
691 type is (
integer(kind=i4_kind))
692 call allocate_array(buf_i4_kind, e)
693 call mpp_recv(buf_i4_kind,
size(buf_i4_kind), fileobj%io_root, block=.true.)
694 call put_array_section(buf_i4_kind, vdata, c, e)
695 deallocate(buf_i4_kind)
696 type is (
integer(kind=i8_kind))
697 call allocate_array(buf_i8_kind, e)
698 call mpp_recv(buf_i8_kind,
size(buf_i8_kind), fileobj%io_root, block=.true.)
699 call put_array_section(buf_i8_kind, vdata, c, e)
700 deallocate(buf_i8_kind)
701 type is (real(kind=r4_kind))
702 call allocate_array(buf_r4_kind, e)
703 call mpp_recv(buf_r4_kind,
size(buf_r4_kind), fileobj%io_root, block=.true.)
704 call put_array_section(buf_r4_kind, vdata, c, e)
705 deallocate(buf_r4_kind)
706 type is (real(kind=r8_kind))
707 call allocate_array(buf_r8_kind, e)
708 call mpp_recv(buf_r8_kind,
size(buf_r8_kind), fileobj%io_root, block=.true.)
709 call put_array_section(buf_r8_kind, vdata, c, e)
710 deallocate(buf_r8_kind)
712 call error(
"unsupported variable type: domain_read_4d: file: "//trim(fileobj%path)//
" variable:"// &
713 & trim(variable_name))
725 corner, edge_lengths)
727 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
728 character(len=*),
intent(in) :: variable_name
729 class(*),
dimension(:,:,:,:,:),
intent(inout) :: vdata
732 integer,
intent(in),
optional :: unlim_dim_level
734 integer,
dimension(5),
intent(in),
optional :: corner
738 integer,
dimension(5),
intent(in),
optional :: edge_lengths
743 integer :: xdim_index
744 integer :: ydim_index
745 type(domain2d),
pointer :: io_domain
755 integer,
dimension(:),
allocatable :: pe_isc
756 integer,
dimension(:),
allocatable :: pe_icsize
757 integer,
dimension(:),
allocatable :: pe_jsc
758 integer,
dimension(:),
allocatable :: pe_jcsize
759 integer,
dimension(5) :: c
760 integer,
dimension(5) :: e
761 integer(kind=i4_kind),
dimension(:,:,:,:,:),
allocatable :: buf_i4_kind
762 integer(kind=i8_kind),
dimension(:,:,:,:,:),
allocatable :: buf_i8_kind
763 real(kind=r4_kind),
dimension(:,:,:,:,:),
allocatable :: buf_r4_kind
764 real(kind=r8_kind),
dimension(:,:,:,:,:),
allocatable :: buf_r8_kind
765 logical :: buffer_includes_halos
769 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., &
770 xdim_index, ydim_index, xpos, ypos))
then
771 call netcdf_read_data(fileobj, variable_name, vdata, &
772 unlim_dim_level=unlim_dim_level, corner=corner, &
773 edge_lengths=edge_lengths, broadcast=.true.)
777 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
778 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, &
779 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
781 if (fileobj%use_netcdf_mpi)
then
785 if (buffer_includes_halos)
then
788 e(xdim_index) = xc_size + 2*(isc - isd)
789 e(ydim_index) = yc_size + 2*(jsc - jsd)
793 e(xdim_index) = xc_size
794 e(ydim_index) = yc_size
797 call netcdf_read_data(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=c, edge_lengths=e)
804 if (
present(edge_lengths)) e = edge_lengths
807 if (fileobj%is_root)
then
808 allocate(pe_isc(
size(fileobj%pelist)))
809 allocate(pe_icsize(
size(fileobj%pelist)))
810 allocate(pe_jsc(
size(fileobj%pelist)))
811 allocate(pe_jcsize(
size(fileobj%pelist)))
812 call mpp_get_compute_domains(io_domain, xbegin=pe_isc, xsize=pe_icsize, position=xpos)
813 call mpp_get_compute_domains(io_domain, ybegin=pe_jsc, ysize=pe_jcsize, position=ypos)
814 call mpp_get_global_domain(io_domain, xbegin=xgmin, position=xpos)
815 call mpp_get_global_domain(io_domain, ybegin=ygmin, position=ypos)
816 do i = 1,
size(fileobj%pelist)
818 if (
present(corner)) c = corner
819 c(xdim_index) = pe_isc(i)
820 c(ydim_index) = pe_jsc(i)
821 if (fileobj%adjust_indices)
then
822 c(xdim_index) = c(xdim_index) - xgmin + 1
823 c(ydim_index) = c(ydim_index) - ygmin + 1
825 e(xdim_index) = pe_icsize(i)
826 e(ydim_index) = pe_jcsize(i)
828 type is (
integer(kind=i4_kind))
830 call allocate_array(buf_i4_kind, e)
831 call netcdf_read_data(fileobj, variable_name, buf_i4_kind, &
832 unlim_dim_level=unlim_dim_level, &
833 corner=c, edge_lengths=e, broadcast=.false.)
838 if (buffer_includes_halos)
then
840 c(xdim_index) = isc - isd + 1
841 c(ydim_index) = jsc - jsd + 1
843 call put_array_section(buf_i4_kind, vdata, c, e)
846 call mpp_send(buf_i4_kind,
size(buf_i4_kind), fileobj%pelist(i))
849 deallocate(buf_i4_kind)
850 type is (
integer(kind=i8_kind))
852 call allocate_array(buf_i8_kind, e)
853 call netcdf_read_data(fileobj, variable_name, buf_i8_kind, &
854 unlim_dim_level=unlim_dim_level, &
855 corner=c, edge_lengths=e, broadcast=.false.)
859 if (buffer_includes_halos)
then
861 c(xdim_index) = isc - isd + 1
862 c(ydim_index) = jsc - jsd + 1
864 call put_array_section(buf_i8_kind, vdata, c, e)
867 call mpp_send(buf_i8_kind,
size(buf_i8_kind), fileobj%pelist(i))
870 deallocate(buf_i8_kind)
871 type is (real(kind=r4_kind))
873 call allocate_array(buf_r4_kind, e)
874 call netcdf_read_data(fileobj, variable_name, buf_r4_kind, &
875 unlim_dim_level=unlim_dim_level, &
876 corner=c, edge_lengths=e, broadcast=.false.)
880 if (buffer_includes_halos)
then
882 c(xdim_index) = isc - isd + 1
883 c(ydim_index) = jsc - jsd + 1
885 call put_array_section(buf_r4_kind, vdata, c, e)
888 call mpp_send(buf_r4_kind,
size(buf_r4_kind), fileobj%pelist(i))
891 deallocate(buf_r4_kind)
892 type is (real(kind=r8_kind))
894 call allocate_array(buf_r8_kind, e)
895 call netcdf_read_data(fileobj, variable_name, buf_r8_kind, &
896 unlim_dim_level=unlim_dim_level, &
897 corner=c, edge_lengths=e, broadcast=.false.)
901 if (buffer_includes_halos)
then
903 c(xdim_index) = isc - isd + 1
904 c(ydim_index) = jsc - jsd + 1
906 call put_array_section(buf_r8_kind, vdata, c, e)
909 call mpp_send(buf_r8_kind,
size(buf_r8_kind), fileobj%pelist(i))
912 deallocate(buf_r8_kind)
914 call error(
"unsupported variable type: domain_read_5d: file: "//trim(fileobj%path)//
" variable:"// &
915 & trim(variable_name))
919 deallocate(pe_icsize)
921 deallocate(pe_jcsize)
924 if (buffer_includes_halos)
then
925 c(xdim_index) = isc - isd + 1
926 c(ydim_index) = jsc - jsd + 1
928 e(xdim_index) = xc_size
929 e(ydim_index) = yc_size
931 type is (
integer(kind=i4_kind))
932 call allocate_array(buf_i4_kind, e)
933 call mpp_recv(buf_i4_kind,
size(buf_i4_kind), fileobj%io_root, block=.true.)
934 call put_array_section(buf_i4_kind, vdata, c, e)
935 deallocate(buf_i4_kind)
936 type is (
integer(kind=i8_kind))
937 call allocate_array(buf_i8_kind, e)
938 call mpp_recv(buf_i8_kind,
size(buf_i8_kind), fileobj%io_root, block=.true.)
939 call put_array_section(buf_i8_kind, vdata, c, e)
940 deallocate(buf_i8_kind)
941 type is (real(kind=r4_kind))
942 call allocate_array(buf_r4_kind, e)
943 call mpp_recv(buf_r4_kind,
size(buf_r4_kind), fileobj%io_root, block=.true.)
944 call put_array_section(buf_r4_kind, vdata, c, e)
945 deallocate(buf_r4_kind)
946 type is (real(kind=r8_kind))
947 call allocate_array(buf_r8_kind, e)
948 call mpp_recv(buf_r8_kind,
size(buf_r8_kind), fileobj%io_root, block=.true.)
949 call put_array_section(buf_r8_kind, vdata, c, e)
950 deallocate(buf_r8_kind)
952 call error(
"unsupported variable type: domain_read_5d: file: "//trim(fileobj%path)//
" variable:"// &
953 & trim(variable_name))
subroutine domain_read_0d(fileobj, variable_name, vdata, unlim_dim_level, corner)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
subroutine domain_read_3d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
subroutine domain_read_1d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
subroutine domain_read_2d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
subroutine domain_read_4d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
subroutine domain_read_5d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
type(domain2d) function, pointer mpp_get_io_domain(domain)
Set user stack size.
subroutine mpp_sync_self(pelist, check, request, msg_size, msg_type)
This is to check if current PE's outstanding puts are complete but we can't use shmem_fence because w...