38 integer(i4_kind),
intent(in) :: funit
39 type(fieldtype),
intent(in) :: field
40 type(domainug),
intent(in) :: domain
41 real(KIND=r8_kind),
dimension(:),
intent(inout) :: fdata
42 integer(i4_kind),
intent(in),
optional :: tindex
43 integer(i4_kind),
dimension(:),
intent(in),
optional :: start
44 integer(i4_kind),
dimension(:),
intent(in),
optional :: nread
45 integer(i4_kind),
intent(in),
optional :: threading
49 integer(i4_kind) :: threading_flag
51 type(domainug),
pointer :: io_domain
52 integer(i4_kind) :: io_domain_npes
53 integer(i4_kind),
dimension(:),
allocatable :: pelist
55 logical(l4_kind) :: compute_chksum
57 integer(i8_kind) :: chk
61 call mpp_clock_begin(mpp_read_clock)
64 if (.not. module_is_initialized)
then
65 call mpp_error(fatal, &
66 "mpp_io_unstructured_read_r_1D:" &
67 //
" you must must first call mpp_io_init.")
72 if (.not. mpp_file(funit)%valid)
then
73 call mpp_error(fatal, &
74 "mpp_io_unstructured_read_r_1D:" &
75 //
" the inputted file unit is already in use.")
79 if (
size(fdata) .gt. 0)
then
85 threading_flag = mpp_single
86 if (
present(threading))
then
87 threading_flag = threading
91 if (threading_flag .eq. mpp_multi)
then
94 call read_record_r8(funit, &
101 elseif (threading_flag .eq. mpp_single)
then
106 io_domain => mpp_get_ug_io_domain(domain)
109 io_domain_npes = mpp_get_ug_domain_npes(io_domain)
110 allocate(pelist(io_domain_npes))
111 call mpp_get_ug_domain_pelist(io_domain, &
116 if (
mpp_pe() .eq. pelist(1))
then
117 call read_record_r8(funit, &
128 if (
mpp_pe() .eq. pelist(1))
then
129 do p = 2,io_domain_npes
130 call mpp_send(fdata, &
137 call mpp_recv(fdata, &
146 call mpp_error(fatal, &
147 "mpp_io_unstructured_read_r_1D:" &
148 //
" threading should be MPP_SINGLE or MPP_MULTI")
155 compute_chksum = .false.
156 if (any(field%checksum .ne. default_field%checksum))
then
157 compute_chksum = .true.
161 if (compute_chksum)
then
163 if (field%type .eq. nf_int)
then
164 if (field%fill .eq. mpp_fill_double .or. field%fill .eq. &
165 real(MPP_FILL_INT)) then
166 chk = mpp_chksum(ceiling(fdata), &
167 mask_val=mpp_fill_int)
169 call mpp_error(note, &
170 "mpp_io_unstructured_read_r_1D:" &
171 //
" int field "//trim(field%name) &
172 //
" found fill. Icebergs, or code using" &
173 //
" defaults can safely ignore." &
174 //
" If manually overriding compressed" &
175 //
" restart fills, confirm this is what you" &
177 chk = mpp_chksum(ceiling(fdata), &
181 chk = mpp_chksum(fdata, mask_val=real(field%fill,kind(fdata)))
202 call mpp_clock_end(mpp_read_clock)
220 integer(i4_kind),
intent(in) :: funit
221 type(fieldtype),
intent(in) :: field
222 type(domainug),
intent(in) :: domain
223 real(KIND=r8_kind),
dimension(:,:),
intent(inout) :: fdata
224 integer(i4_kind),
intent(in),
optional :: tindex
225 integer(i4_kind),
dimension(:),
intent(in),
optional :: start
226 integer(i4_kind),
dimension(:),
intent(in),
optional :: nread
227 integer(i4_kind),
intent(in),
optional :: threading
231 integer(i4_kind) :: threading_flag
233 type(domainug),
pointer :: io_domain
234 integer(i4_kind) :: io_domain_npes
235 integer(i4_kind),
dimension(:),
allocatable :: pelist
236 integer(i4_kind) :: p
237 logical(l4_kind) :: compute_chksum
239 integer(i8_kind) :: chk
243 call mpp_clock_begin(mpp_read_clock)
246 if (.not. module_is_initialized)
then
247 call mpp_error(fatal, &
248 "mpp_io_unstructured_read_r_2D:" &
249 //
" you must must first call mpp_io_init.")
254 if (.not. mpp_file(funit)%valid)
then
255 call mpp_error(fatal, &
256 "mpp_io_unstructured_read_r_2D:" &
257 //
" the inputted file unit is already in use.")
261 if (
size(fdata) .gt. 0)
then
267 threading_flag = mpp_single
268 if (
present(threading))
then
269 threading_flag = threading
273 if (threading_flag .eq. mpp_multi)
then
276 call read_record_r8(funit, &
283 elseif (threading_flag .eq. mpp_single)
then
288 io_domain => mpp_get_ug_io_domain(domain)
291 io_domain_npes = mpp_get_ug_domain_npes(io_domain)
292 allocate(pelist(io_domain_npes))
293 call mpp_get_ug_domain_pelist(io_domain, &
298 if (
mpp_pe() .eq. pelist(1))
then
299 call read_record_r8(funit, &
310 if (
mpp_pe() .eq. pelist(1))
then
311 do p = 2,io_domain_npes
312 call mpp_send(fdata, &
319 call mpp_recv(fdata, &
328 call mpp_error(fatal, &
329 "mpp_io_unstructured_read_r_2D:" &
330 //
" threading should be MPP_SINGLE or MPP_MULTI")
337 compute_chksum = .false.
338 if (any(field%checksum .ne. default_field%checksum))
then
339 compute_chksum = .true.
343 if (compute_chksum)
then
345 if (field%type .eq. nf_int)
then
346 if (field%fill .eq. mpp_fill_double .or. field%fill .eq. &
347 real(MPP_FILL_INT)) then
348 chk = mpp_chksum(ceiling(fdata), &
349 mask_val=mpp_fill_int)
351 call mpp_error(note, &
352 "mpp_io_unstructured_read_r_2D:" &
353 //
" int field "//trim(field%name) &
354 //
" found fill. Icebergs, or code using" &
355 //
" defaults can safely ignore." &
356 //
" If manually overriding compressed" &
357 //
" restart fills, confirm this is what you" &
359 chk = mpp_chksum(ceiling(fdata), &
363 chk = mpp_chksum(fdata, mask_val=real(field%fill,kind(fdata)))
384 call mpp_clock_end(mpp_read_clock)
402 integer(i4_kind),
intent(in) :: funit
403 type(fieldtype),
intent(in) :: field
404 type(domainug),
intent(in) :: domain
405 real(KIND=r8_kind),
dimension(:,:,:),
intent(inout) :: fdata
406 integer(i4_kind),
intent(in),
optional :: tindex
407 integer(i4_kind),
dimension(:),
intent(in),
optional :: start
408 integer(i4_kind),
dimension(:),
intent(in),
optional :: nread
409 integer(i4_kind),
intent(in),
optional :: threading
413 integer(i4_kind) :: threading_flag
415 type(domainug),
pointer :: io_domain
416 integer(i4_kind) :: io_domain_npes
417 integer(i4_kind),
dimension(:),
allocatable :: pelist
418 integer(i4_kind) :: p
419 logical(l4_kind) :: compute_chksum
421 integer(i8_kind) :: chk
425 call mpp_clock_begin(mpp_read_clock)
428 if (.not. module_is_initialized)
then
429 call mpp_error(fatal, &
430 "mpp_io_unstructured_read_r_3D:" &
431 //
" you must must first call mpp_io_init.")
436 if (.not. mpp_file(funit)%valid)
then
437 call mpp_error(fatal, &
438 "mpp_io_unstructured_read_r_3D:" &
439 //
" the inputted file unit is already in use.")
443 if (
size(fdata) .gt. 0)
then
449 threading_flag = mpp_single
450 if (
present(threading))
then
451 threading_flag = threading
455 if (threading_flag .eq. mpp_multi)
then
458 call read_record_r8(funit, &
465 elseif (threading_flag .eq. mpp_single)
then
470 io_domain => mpp_get_ug_io_domain(domain)
473 io_domain_npes = mpp_get_ug_domain_npes(io_domain)
474 allocate(pelist(io_domain_npes))
475 call mpp_get_ug_domain_pelist(io_domain, &
480 if (
mpp_pe() .eq. pelist(1))
then
481 call read_record_r8(funit, &
492 if (
mpp_pe() .eq. pelist(1))
then
493 do p = 2,io_domain_npes
494 call mpp_send(fdata, &
501 call mpp_recv(fdata, &
510 call mpp_error(fatal, &
511 "mpp_io_unstructured_read_r_3D:" &
512 //
" threading should be MPP_SINGLE or MPP_MULTI")
519 compute_chksum = .false.
520 if (any(field%checksum .ne. default_field%checksum))
then
521 compute_chksum = .true.
525 if (compute_chksum)
then
527 if (field%type .eq. nf_int)
then
528 if (field%fill .eq. mpp_fill_double .or. field%fill .eq. &
529 real(MPP_FILL_INT)) then
530 chk = mpp_chksum(ceiling(fdata), &
531 mask_val=mpp_fill_int)
533 call mpp_error(note, &
534 "mpp_io_unstructured_read_r_3D:" &
535 //
" int field "//trim(field%name) &
536 //
" found fill. Icebergs, or code using" &
537 //
" defaults can safely ignore." &
538 //
" If manually overriding compressed" &
539 //
" restart fills, confirm this is what you" &
541 chk = mpp_chksum(ceiling(fdata), &
545 chk = mpp_chksum(fdata, mask_val=real(field%fill,kind(fdata)))
566 call mpp_clock_end(mpp_read_clock)
588 integer(i4_kind),
intent(in) :: funit
589 type(fieldtype),
intent(in) :: field
590 type(domainug),
intent(in) :: domain
591 real(KIND=r4_kind),
dimension(:),
intent(inout) :: fdata
592 integer(i4_kind),
intent(in),
optional :: tindex
593 integer(i4_kind),
dimension(:),
intent(in),
optional :: start
594 integer(i4_kind),
dimension(:),
intent(in),
optional :: nread
595 integer(i4_kind),
intent(in),
optional :: threading
599 integer(i4_kind) :: threading_flag
601 type(domainug),
pointer :: io_domain
602 integer(i4_kind) :: io_domain_npes
603 integer(i4_kind),
dimension(:),
allocatable :: pelist
604 integer(i4_kind) :: p
605 logical(l4_kind) :: compute_chksum
607 integer(i8_kind) :: chk
611 call mpp_clock_begin(mpp_read_clock)
614 if (.not. module_is_initialized)
then
615 call mpp_error(fatal, &
616 "mpp_io_unstructured_read_r_1D:" &
617 //
" you must must first call mpp_io_init.")
622 if (.not. mpp_file(funit)%valid)
then
623 call mpp_error(fatal, &
624 "mpp_io_unstructured_read_r_1D:" &
625 //
" the inputted file unit is already in use.")
629 if (
size(fdata) .gt. 0)
then
635 threading_flag = mpp_single
636 if (
present(threading))
then
637 threading_flag = threading
641 if (threading_flag .eq. mpp_multi)
then
644 call read_record_r4(funit, &
651 elseif (threading_flag .eq. mpp_single)
then
656 io_domain => mpp_get_ug_io_domain(domain)
659 io_domain_npes = mpp_get_ug_domain_npes(io_domain)
660 allocate(pelist(io_domain_npes))
661 call mpp_get_ug_domain_pelist(io_domain, &
666 if (
mpp_pe() .eq. pelist(1))
then
667 call read_record_r4(funit, &
678 if (
mpp_pe() .eq. pelist(1))
then
679 do p = 2,io_domain_npes
680 call mpp_send(fdata, &
687 call mpp_recv(fdata, &
696 call mpp_error(fatal, &
697 "mpp_io_unstructured_read_r_1D:" &
698 //
" threading should be MPP_SINGLE or MPP_MULTI")
705 compute_chksum = .false.
706 if (any(field%checksum .ne. default_field%checksum))
then
707 compute_chksum = .true.
711 if (compute_chksum)
then
713 if (field%type .eq. nf_int)
then
714 if (field%fill .eq. mpp_fill_double .or. field%fill .eq. &
715 real(MPP_FILL_INT)) then
716 chk = mpp_chksum(ceiling(fdata), &
717 mask_val=mpp_fill_int)
719 call mpp_error(note, &
720 "mpp_io_unstructured_read_r_1D:" &
721 //
" int field "//trim(field%name) &
722 //
" found fill. Icebergs, or code using" &
723 //
" defaults can safely ignore." &
724 //
" If manually overriding compressed" &
725 //
" restart fills, confirm this is what you" &
727 chk = mpp_chksum(ceiling(fdata), &
731 chk = mpp_chksum(fdata, mask_val=real(field%fill,kind(fdata)))
752 call mpp_clock_end(mpp_read_clock)
770 integer(i4_kind),
intent(in) :: funit
771 type(fieldtype),
intent(in) :: field
772 type(domainug),
intent(in) :: domain
773 real(KIND=r4_kind),
dimension(:,:),
intent(inout) :: fdata
774 integer(i4_kind),
intent(in),
optional :: tindex
775 integer(i4_kind),
dimension(:),
intent(in),
optional :: start
776 integer(i4_kind),
dimension(:),
intent(in),
optional :: nread
777 integer(i4_kind),
intent(in),
optional :: threading
781 integer(i4_kind) :: threading_flag
783 type(domainug),
pointer :: io_domain
784 integer(i4_kind) :: io_domain_npes
785 integer(i4_kind),
dimension(:),
allocatable :: pelist
786 integer(i4_kind) :: p
787 logical(l4_kind) :: compute_chksum
789 integer(i8_kind) :: chk
793 call mpp_clock_begin(mpp_read_clock)
796 if (.not. module_is_initialized)
then
797 call mpp_error(fatal, &
798 "mpp_io_unstructured_read_r_2D:" &
799 //
" you must must first call mpp_io_init.")
804 if (.not. mpp_file(funit)%valid)
then
805 call mpp_error(fatal, &
806 "mpp_io_unstructured_read_r_2D:" &
807 //
" the inputted file unit is already in use.")
811 if (
size(fdata) .gt. 0)
then
817 threading_flag = mpp_single
818 if (
present(threading))
then
819 threading_flag = threading
823 if (threading_flag .eq. mpp_multi)
then
826 call read_record_r4(funit, &
833 elseif (threading_flag .eq. mpp_single)
then
838 io_domain => mpp_get_ug_io_domain(domain)
841 io_domain_npes = mpp_get_ug_domain_npes(io_domain)
842 allocate(pelist(io_domain_npes))
843 call mpp_get_ug_domain_pelist(io_domain, &
848 if (
mpp_pe() .eq. pelist(1))
then
849 call read_record_r4(funit, &
860 if (
mpp_pe() .eq. pelist(1))
then
861 do p = 2,io_domain_npes
862 call mpp_send(fdata, &
869 call mpp_recv(fdata, &
878 call mpp_error(fatal, &
879 "mpp_io_unstructured_read_r_2D:" &
880 //
" threading should be MPP_SINGLE or MPP_MULTI")
887 compute_chksum = .false.
888 if (any(field%checksum .ne. default_field%checksum))
then
889 compute_chksum = .true.
893 if (compute_chksum)
then
895 if (field%type .eq. nf_int)
then
896 if (field%fill .eq. mpp_fill_double .or. field%fill .eq. &
897 real(MPP_FILL_INT)) then
898 chk = mpp_chksum(ceiling(fdata), &
899 mask_val=mpp_fill_int)
901 call mpp_error(note, &
902 "mpp_io_unstructured_read_r_2D:" &
903 //
" int field "//trim(field%name) &
904 //
" found fill. Icebergs, or code using" &
905 //
" defaults can safely ignore." &
906 //
" If manually overriding compressed" &
907 //
" restart fills, confirm this is what you" &
909 chk = mpp_chksum(ceiling(fdata), &
913 chk = mpp_chksum(fdata, mask_val=real(field%fill,kind(fdata)))
934 call mpp_clock_end(mpp_read_clock)
952 integer(i4_kind),
intent(in) :: funit
953 type(fieldtype),
intent(in) :: field
954 type(domainug),
intent(in) :: domain
955 real(KIND=r4_kind),
dimension(:,:,:),
intent(inout) :: fdata
956 integer(i4_kind),
intent(in),
optional :: tindex
957 integer(i4_kind),
dimension(:),
intent(in),
optional :: start
958 integer(i4_kind),
dimension(:),
intent(in),
optional :: nread
959 integer(i4_kind),
intent(in),
optional :: threading
963 integer(i4_kind) :: threading_flag
965 type(domainug),
pointer :: io_domain
966 integer(i4_kind) :: io_domain_npes
967 integer(i4_kind),
dimension(:),
allocatable :: pelist
968 integer(i4_kind) :: p
969 logical(l4_kind) :: compute_chksum
971 integer(i8_kind) :: chk
975 call mpp_clock_begin(mpp_read_clock)
978 if (.not. module_is_initialized)
then
979 call mpp_error(fatal, &
980 "mpp_io_unstructured_read_r_3D:" &
981 //
" you must must first call mpp_io_init.")
986 if (.not. mpp_file(funit)%valid)
then
987 call mpp_error(fatal, &
988 "mpp_io_unstructured_read_r_3D:" &
989 //
" the inputted file unit is already in use.")
993 if (
size(fdata) .gt. 0)
then
999 threading_flag = mpp_single
1000 if (
present(threading))
then
1001 threading_flag = threading
1005 if (threading_flag .eq. mpp_multi)
then
1008 call read_record_r4(funit, &
1015 elseif (threading_flag .eq. mpp_single)
then
1020 io_domain => mpp_get_ug_io_domain(domain)
1023 io_domain_npes = mpp_get_ug_domain_npes(io_domain)
1024 allocate(pelist(io_domain_npes))
1025 call mpp_get_ug_domain_pelist(io_domain, &
1030 if (
mpp_pe() .eq. pelist(1))
then
1031 call read_record_r4(funit, &
1042 if (
mpp_pe() .eq. pelist(1))
then
1043 do p = 2,io_domain_npes
1044 call mpp_send(fdata, &
1051 call mpp_recv(fdata, &
1060 call mpp_error(fatal, &
1061 "mpp_io_unstructured_read_r_3D:" &
1062 //
" threading should be MPP_SINGLE or MPP_MULTI")
1069 compute_chksum = .false.
1070 if (any(field%checksum .ne. default_field%checksum))
then
1071 compute_chksum = .true.
1075 if (compute_chksum)
then
1077 if (field%type .eq. nf_int)
then
1078 if (field%fill .eq. mpp_fill_double .or. field%fill .eq. &
1079 real(MPP_FILL_INT)) then
1080 chk = mpp_chksum(ceiling(fdata), &
1081 mask_val=mpp_fill_int)
1083 call mpp_error(note, &
1084 "mpp_io_unstructured_read_r_3D:" &
1085 //
" int field "//trim(field%name) &
1086 //
" found fill. Icebergs, or code using" &
1087 //
" defaults can safely ignore." &
1088 //
" If manually overriding compressed" &
1089 //
" restart fills, confirm this is what you" &
1091 chk = mpp_chksum(ceiling(fdata), &
1092 mask_val=field%fill)
1095 chk = mpp_chksum(fdata, mask_val=real(field%fill,kind(fdata)))
1116 call mpp_clock_end(mpp_read_clock)
subroutine mpp_io_unstructured_read_r4_2d(funit, field, domain, fdata, tindex, start, nread, threading)
Read in two-dimensional data for a field associated with an unstructured mpp domain.
subroutine mpp_io_unstructured_read_r4_1d(funit, field, domain, fdata, tindex, start, nread, threading)
Read in one-dimensional data for a field associated with an unstructured mpp domain.
subroutine mpp_io_unstructured_read_r8_1d(funit, field, domain, fdata, tindex, start, nread, threading)
Read in one-dimensional data for a field associated with an unstructured mpp domain.
subroutine mpp_io_unstructured_read_r8_3d(funit, field, domain, fdata, tindex, start, nread, threading)
Read in three-dimensional data for a field associated with an unstructured mpp domain.
subroutine mpp_io_unstructured_read_r4_3d(funit, field, domain, fdata, tindex, start, nread, threading)
Read in three-dimensional data for a field associated with an unstructured mpp domain.
subroutine mpp_io_unstructured_read_r8_2d(funit, field, domain, fdata, tindex, start, nread, threading)
Read in two-dimensional data for a field associated with an unstructured mpp domain.
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...
integer function mpp_pe()
Returns processor ID.