00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 subroutine psmile_locations_3d_mask (search, inter, shift, method_id, &
00012 dir_index, ierror)
00013
00014
00015
00016 use PRISM_constants
00017
00018 use PSMILe, dummy_interface => PSMILe_Locations_3d_mask
00019
00020 implicit none
00021
00022
00023
00024 Type (Enddef_search), Intent (InOut) :: search
00025
00026
00027
00028 Integer, Intent (In) :: inter (2, ndim_3d, search%npart)
00029
00030
00031
00032 Integer, Intent (In) :: shift (ndim_3d)
00033
00034
00035
00036
00037
00038 Integer, Intent (In) :: method_id
00039
00040
00041
00042
00043
00044 Integer, Intent (Out) :: dir_index
00045
00046
00047
00048
00049
00050 Integer, Intent (Out) :: ierror
00051
00052
00053
00054
00055
00056
00057
00058 Integer, Parameter :: send_direct_index = 2
00059
00060
00061
00062
00063
00064 Type (Method), Pointer :: mp
00065
00066
00067
00068 Integer :: n, nadd, ndir, nprev
00069 Integer :: index
00070
00071
00072
00073 Integer :: ipart
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 Character(len=len_cvs_string), save :: mycvs =
00104 '$Id: psmile_locations_3d_mask.F90 2788 2010-11-30 14:34:07Z hanke $'
00105
00106
00107
00108
00109
00110 #ifdef VERBOSE
00111 print 9990, trim(ch_id), method_id, search%msg_intersections%first_tgt_method_id, &
00112 search%sender
00113
00114 call psmile_flushstd
00115 #endif /* VERBOSE */
00116
00117 ierror = 0
00118
00119 dir_index = PRISM_undefined
00120
00121 mp => Methods(method_id)
00122
00123 #ifdef PRISM_ASSERTION
00124 if ( mp%status == PSMILe_Status_free .or. &
00125 mp%status == PSMILe_Status_undefined ) then
00126 call psmile_assert (__FILE__, __LINE__, "Incorrect method")
00127 endif
00128
00129 do ipart = 1, search%npart
00130 if (inter (1,1,ipart) < search%range (1,1,ipart) .or. &
00131 search%range (2,1,ipart) < inter (2,1,ipart) .or. &
00132 inter (1,2,ipart) < search%range (1,2,ipart) .or. &
00133 search%range (2,2,ipart) < inter (2,2,ipart) .or. &
00134 inter (1,3,ipart) < search%range (1,3,ipart) .or. &
00135 search%range (2,3,ipart) < inter (2,3,ipart)) then
00136 print *, ipart, inter (:,:,ipart), search%range (:,:,ipart)
00137 call psmile_assert (__FILE__, __LINE__, "inter is out of range")
00138 endif
00139 end do
00140 #endif
00141
00142
00143
00144
00145
00146
00147 ndir = 0
00148
00149 do ipart = 1, search%npart
00150 if (maxval(search%shape(:,:,ipart)-inter(:,:,ipart)) == 0) then
00151
00152
00153
00154 ndir = ndir + count (search%search_mask(ipart)%vector(:))
00155 else
00156
00157
00158
00159 call psmile_get_true_mask_entries ( &
00160 search%search_mask(ipart)%vector, &
00161 search%shape (:, :, ipart), &
00162 inter (:, :, ipart), n, ierror)
00163 if (ierror > 0) return
00164
00165 ndir = ndir + n
00166 endif
00167
00168 end do
00169
00170
00171
00172
00173
00174
00175
00176 if (ndir > 0) then
00177
00178 call psmile_get_info_index (method_id, send_direct_index, index, ierror)
00179 if (ierror > 0) return
00180
00181 dir_index = index
00182
00183 mp%send_infos_direct(index)%dest = search%sender
00184 mp%send_infos_direct(index)%nvec = 1
00185 mp%send_infos_direct(index)%nparts = 1
00186
00187 mp%send_infos_direct(index)%nrecv = 0
00188 mp%send_infos_direct(index)%num2recv = 0
00189
00190 mp%send_infos_direct(index)%remote_method_id = search%msg_intersections%first_tgt_method_id
00191
00192
00193
00194
00195
00196 call psmile_locations_alloc (mp%send_infos_direct(index), ierror)
00197 if (ierror > 0) return
00198
00199 nprev = 0
00200
00201 do ipart = 1, search%npart
00202 call psmile_store_dest_locs_3d_msk ( &
00203 search%search_mask(ipart)%vector, &
00204 search%shape (:, :, ipart), &
00205 inter (:, :, ipart), &
00206 mp%send_infos_direct(index), ndir, &
00207 nprev, nadd, ierror)
00208 if (ierror > 0) return
00209
00210 call psmile_store_source_locs_3d_msk ( &
00211 search%search_mask(ipart)%vector, &
00212 search%shape (:, :, ipart), &
00213 inter (:, :, ipart), &
00214 mp%send_infos_direct(index), ndir, &
00215 nprev, nadd, ierror)
00216 if (ierror > 0) return
00217
00218 nprev = nprev + nadd
00219 end do
00220
00221 mp%send_infos_direct(index)%nloc = nprev
00222
00223
00224
00225 do n = 1, ndim_3d
00226 mp%send_infos_direct(index)%dstijk (n, 1:nprev) = &
00227 mp%send_infos_direct(index)%dstijk (n, 1:nprev) - shift (n)
00228 end do
00229
00230 endif
00231
00232
00233
00234 #ifdef VERBOSE
00235 print 9980, trim(ch_id), ierror, dir_index
00236
00237 call psmile_flushstd
00238 #endif /* VERBOSE */
00239
00240
00241
00242
00243 #ifdef VERBOSE
00244
00245 9990 format (1x, a, ': psmile_locations_3d_mask: method_id', i3, &
00246 ' to ', i3, '(', i2, ')')
00247 9980 format (1x, a, ': psmile_locations_3d_mask: eof ierror =', i3, &
00248 '; dir_index', i7)
00249
00250 #endif /* VERBOSE */
00251
00252 end subroutine PSMILe_Locations_3d_mask