00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 subroutine psmile_get_face_ind_reg (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_reg
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 Integer :: i, j, n
00075
00076
00077
00078 Integer :: ipart, nextra_prev, nprev
00079 Integer :: leni, lenij
00080
00081 Integer, Pointer :: indices_req (:)
00082 Integer, Pointer :: len_req (:)
00083 Integer, Pointer :: srcloc_i (:), srcloc_j (:)
00084 Integer, Pointer :: srcloc_k (:)
00085
00086
00087
00088 Integer :: ind (ndim_3d)
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114 Character(len=len_cvs_string), save :: mycvs =
00115 '$Id: psmile_get_face_ind_reg.F90 2082 2009-10-21 13:31:19Z hanke $'
00116
00117
00118
00119
00120
00121 #ifdef VERBOSE
00122 print 9990, trim(ch_id)
00123
00124 call psmile_flushstd
00125 #endif /* VERBOSE */
00126
00127 ierror = 0
00128
00129 len_req => extra_search%len_req
00130
00131 #ifdef PRISM_ASSERTION
00132 if (SUM(len_req(:)) > nreq) then
00133 print *, 'nreq, sum(len_req)', nreq, SUM(len_req(:))
00134 call psmile_assert ( __FILE__, __LINE__, &
00135 'nreq is too small (inconsistent data)')
00136 endif
00137
00138 if (send_info%nvec /= ndim_3d) then
00139 print *, 'nvec', send_info%nvec
00140 call psmile_assert ( __FILE__, __LINE__, &
00141 'Routine is designed for regular case (3 1d vectors)')
00142 endif
00143 #endif
00144
00145
00146
00147
00148
00149
00150 n = 0
00151 nprev = 0
00152 nextra_prev = 0
00153
00154 do ipart = 1, search%npart
00155
00156 if (len_req (ipart) > 0) then
00157 indices_req => extra_search%indices_req(ipart)%vector
00158 srcloc_i => send_info%srclocs(1,ipart)%vector
00159 srcloc_j => send_info%srclocs(2,ipart)%vector
00160 srcloc_k => send_info%srclocs(3,ipart)%vector
00161
00162 leni = send_info%npoints(1,ipart)
00163 lenij = send_info%npoints(2,ipart) * leni
00164
00165 do j = 1, len_req (ipart)
00166 if (send_mask(nextra_prev+j)) then
00167
00168
00169
00170
00171
00172 n = n + 1
00173
00174 i = indices_req(j) - nprev - 1
00175
00176 ind (3) = i / lenij
00177 ind (2) = (i-ind(3)*lenij) / leni
00178 ind (1) = mod (i, leni)
00179
00180 #ifdef PRISM_ASSERTION
00181 if (ind(1) < 0 .or. ind(1) >= send_info%npoints(1,ipart) .or. &
00182 ind(2) < 0 .or. ind(2) >= send_info%npoints(2,ipart) .or. &
00183 ind(3) < 0 .or. ind(3) >= send_info%npoints(3,ipart) ) then
00184 print *, "j, i, ind", j, i, ind
00185 call psmile_assert (__FILE__, __LINE__, &
00186 "Incorrect index generated");
00187 endif
00188 #endif
00189
00190 srcloc_ind (1, n) = srcloc_i(ind(1)+1)
00191 srcloc_ind (2, n) = srcloc_j(ind(2)+1)
00192 srcloc_ind (3, n) = srcloc_k(ind(3)+1)
00193 print *, 'get_face_ind: n', n, srcloc_ind (:, n)
00194 endif
00195 end do
00196
00197 nextra_prev = nextra_prev + len_req (ipart)
00198 endif
00199
00200 nprev = nprev + len_cpl (ipart)
00201 end do
00202
00203 #ifdef PRISM_ASSERTION
00204 if (n /= n_send) then
00205 print *, 'n, n_send', n, n_send
00206 call psmile_assert ( __FILE__, __LINE__, &
00207 'All indices were NOT generated for srcloc_ind')
00208 endif
00209 #endif
00210
00211
00212
00213 #ifdef VERBOSE
00214 print 9980, trim(ch_id), ierror
00215
00216 call psmile_flushstd
00217 #endif /* VERBOSE */
00218
00219
00220
00221 #ifdef VERBOSE
00222
00223 9990 format (1x, a, ': psmile_get_face_ind_reg:')
00224 9980 format (1x, a, ': psmile_get_face_ind_reg: eof ierror =', i3)
00225
00226 #endif /* VERBOSE */
00227
00228 #ifdef DEBUG
00229 #endif
00230
00231 end subroutine PSMILe_Get_face_ind_reg