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