00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 subroutine psmile_get_face_ind_21d (search, extra_search, &
00012 send_info, len_cpl, &
00013 send_mask, nreq, srcloc_ind, n_send, &
00014 ierror)
00015
00016
00017
00018 use PRISM
00019
00020 use PSMILe, dummy_interface => PSMILe_Get_face_ind_21d
00021
00022 Implicit none
00023
00024
00025
00026 Type (Enddef_search), Intent (In) :: search
00027
00028
00029
00030 Type (Extra_search_info), Intent (In) :: extra_search
00031
00032
00033
00034
00035
00036 Type (Send_information), Intent (In) :: send_info
00037
00038
00039
00040 Integer, Intent (In) :: len_cpl (search%npart)
00041
00042
00043
00044 Integer, Intent (In) :: nreq
00045
00046
00047
00048
00049 Logical, Intent (In) :: send_mask (nreq)
00050
00051
00052
00053 Integer, Intent (In) :: n_send
00054
00055
00056
00057
00058
00059
00060 Integer, Intent (Out) :: srcloc_ind (ndim_3d, n_send)
00061
00062
00063
00064 Integer, Intent (Out) :: ierror
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 Integer, Parameter :: indl = 1
00076 Integer, Parameter :: indz = 2
00077
00078
00079
00080
00081
00082 Integer :: i, j, n
00083
00084
00085
00086 Integer :: ipart, nextra_prev, nprev
00087 Integer :: lenij
00088
00089 Integer, Pointer :: indices_req (:)
00090 Integer, Pointer :: len_req (:)
00091 Integer, Pointer :: srcloc (:)
00092 Integer, Pointer :: srclocz (:)
00093
00094
00095
00096 Integer :: ind, indk
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 Character(len=len_cvs_string), save :: mycvs =
00123 '$Id: psmile_get_face_ind_21d.F90 2933 2011-01-31 16:42:27Z hanke $'
00124
00125
00126
00127
00128
00129 #ifdef VERBOSE
00130 print 9990, trim(ch_id)
00131
00132 call psmile_flushstd
00133 #endif /* VERBOSE */
00134
00135 ierror = 0
00136
00137 len_req => extra_search%len_req
00138
00139 #ifdef PRISM_ASSERTION
00140 if (SUM(len_req(:)) > nreq) then
00141 print *, 'nreq, sum(len_req)', nreq, SUM(len_req(:))
00142 call psmile_assert ( __FILE__, __LINE__, &
00143 'nreq is too small (inconsistent data)')
00144 endif
00145
00146 if (send_info%nvec /= 2) then
00147 print *, 'nvec', send_info%nvec
00148 call psmile_assert ( __FILE__, __LINE__, &
00149 'Routine is designed for irregular lonlat and regular z case (2d and 1d vector)')
00150 endif
00151 #endif
00152
00153
00154
00155
00156
00157
00158 n = 0
00159 nprev = 0
00160 nextra_prev = 0
00161
00162 do ipart = 1, search%npart
00163
00164 if (len_req (ipart) > 0) then
00165 indices_req => extra_search%indices_req(ipart)%vector
00166 srcloc => send_info%srclocs(indl,ipart)%vector
00167 srclocz => send_info%srclocs(indz,ipart)%vector
00168
00169 lenij = send_info%npoints(1,ipart)
00170
00171 do j = 1, len_req (ipart)
00172 if (send_mask(nextra_prev+j)) then
00173
00174
00175
00176
00177
00178
00179
00180 n = n + 1
00181
00182 i = indices_req(j) - nprev - 1
00183 indk = i / lenij
00184 ind = (i - indk*lenij) * ndim_2d
00185
00186
00187 #ifdef PRISM_ASSERTION
00188 if (ind < 0 .or. ind/ndim_2d >= send_info%npoints(1,ipart) .or. &
00189 indk < 0 .or. indk >= send_info%npoints(2,ipart)) then
00190 print *, "j, i, ind", j, i, ind, indk, &
00191 send_info%npoints(1:2,ipart)
00192 call psmile_assert (__FILE__, __LINE__, &
00193 "Incorrect index generated");
00194 endif
00195 #endif
00196
00197 srcloc_ind (1, n) = srcloc (ind+1)
00198 srcloc_ind (2, n) = srcloc (ind+2)
00199 srcloc_ind (3, n) = srclocz (indk+1)
00200 endif
00201 end do
00202
00203 nextra_prev = nextra_prev + len_req (ipart)
00204 endif
00205
00206 nprev = nprev + len_cpl (ipart)
00207 end do
00208
00209 #ifdef PRISM_ASSERTION
00210 if (n /= n_send) then
00211 print *, 'n, n_send', n, n_send
00212 call psmile_assert ( __FILE__, __LINE__, &
00213 'All indices were NOT generated for srcloc_ind')
00214 endif
00215 #endif
00216
00217
00218
00219 #ifdef VERBOSE
00220 print 9980, trim(ch_id), ierror
00221
00222 call psmile_flushstd
00223 #endif /* VERBOSE */
00224
00225
00226
00227 #ifdef VERBOSE
00228
00229 9990 format (1x, a, ': psmile_get_face_ind_21d:')
00230 9980 format (1x, a, ': psmile_get_face_ind_21d: eof ierror =', i3)
00231
00232 #endif /* VERBOSE */
00233
00234 #ifdef DEBUG
00235 #endif
00236
00237 end subroutine PSMILe_Get_face_ind_21d