9 use kinds,
only : kind_real
36 procedure :: setup => soca_geom_iter_setup
39 procedure :: clone => soca_geom_iter_clone
42 procedure :: equals => soca_geom_iter_equals
45 procedure :: current => soca_geom_iter_current
48 procedure :: next => soca_geom_iter_next
62 subroutine soca_geom_iter_setup(self, geom, iind, jind)
64 type(
soca_geom),
pointer,
intent( in) :: geom
65 integer,
intent( in) :: iind, jind
74 end subroutine soca_geom_iter_setup
81 subroutine soca_geom_iter_clone(self, other)
86 self%geom => other%geom
89 self%iind = other%iind
90 self%jind = other%jind
92 end subroutine soca_geom_iter_clone
99 subroutine soca_geom_iter_equals(self, other, equals)
102 integer,
intent(out) :: equals
108 if (
associated(self%geom, other%geom) .and. (self%iind==other%iind) &
109 .and. (self%jind==other%jind)) equals = 1
111 end subroutine soca_geom_iter_equals
119 subroutine soca_geom_iter_current(self, lon, lat)
121 real(kind_real),
intent(out) :: lat
122 real(kind_real),
intent(out) :: lon
125 if (self%iind == -1 .AND. self%jind == -1)
then
127 lat = self%geom%lat(self%geom%iec,self%geom%jec)
128 lon = self%geom%lon(self%geom%iec,self%geom%jec)
129 elseif (self%iind < self%geom%isc .OR. self%iind > self%geom%iec .OR. &
130 self%jind < self%geom%jsc .OR. self%jind > self%geom%jec)
then
132 call abor1_ftn(
'soca_geom_iter_current: iterator out of bounds')
135 lat = self%geom%lat(self%iind,self%jind)
136 lon = self%geom%lon(self%iind,self%jind)
139 end subroutine soca_geom_iter_current
147 subroutine soca_geom_iter_next(self)
149 integer :: iind, jind
157 if (iind.lt.self%geom%iec)
then
159 elseif (iind.eq.self%geom%iec)
then
173 if (jind > self%geom%jec)
then
181 end subroutine soca_geom_iter_next