00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 subroutine psmile_store_faces_gauss2_real (indices_req, &
00012 required, nreq, &
00013 tgt_coords1, tgt_coords2, tgt_coords3, ncpl, &
00014 corners1, corners2, corners3, corner_shape, &
00015 nbr_corners, grid_id, grid_valid_shape, &
00016 send_mask, srcloc_ind, &
00017 virtual_ind, virtual_cell_available, &
00018 ibuf, len_item, ndibuf, ipia, &
00019 buf, len_rtem, ndrbuf, ipa, ierror)
00020
00021
00022
00023 use PRISM
00024
00025 use PSMILe, dummy_interface => PSMILe_Store_faces_gauss2_real
00026 #ifdef DEBUG_TRACE
00027 use psmile_debug_trace
00028 #endif
00029
00030 Implicit none
00031
00032
00033
00034 Integer, Intent (In) :: nreq
00035
00036
00037
00038
00039 Integer, Intent (In) :: indices_req (nreq)
00040
00041
00042
00043
00044 Integer, Intent (In) :: required (nreq)
00045
00046
00047
00048 Integer, Intent (In) :: corner_shape (2, ndim_3d)
00049
00050
00051
00052 Integer, Intent (In) :: nbr_corners
00053
00054
00055
00056
00057 Integer, Intent (In) :: grid_id
00058
00059
00060
00061
00062 Integer, Intent (In) :: grid_valid_shape (2, ndim_3d)
00063
00064
00065
00066 Integer, Intent (In) :: ncpl
00067
00068
00069
00070
00071 Real, Intent (In) :: tgt_coords1 (ncpl)
00072 Real, Intent (In) :: tgt_coords2 (ncpl)
00073 Real, Intent (In) :: tgt_coords3 (ncpl)
00074
00075
00076
00077 Real, Intent (In) ::
00078 corners1 ( corner_shape(1,1):corner_shape(2,1), 2)
00079
00080
00081 Real, Intent (In) ::
00082 corners2 ( corner_shape(1,1):corner_shape(2,1), 2)
00083
00084
00085 Real, Intent (In) ::
00086 corners3 ( corner_shape(1,3):corner_shape(2,3), 2)
00087
00088
00089
00090
00091
00092 Logical, Intent (In) :: send_mask (nreq)
00093
00094
00095
00096 Integer, Intent (In) :: ndibuf
00097
00098
00099
00100 Integer, Intent (In) :: srcloc_ind (ndim_3d, ndibuf)
00101
00102
00103
00104
00105
00106 Integer, Intent (In) :: virtual_ind (ndibuf)
00107
00108
00109
00110 Logical, Intent (In) :: virtual_cell_available
00111
00112
00113
00114 Integer, Intent (In) :: len_item
00115
00116
00117
00118
00119
00120
00121 Integer, Intent (In) :: ndrbuf
00122
00123
00124
00125 Integer, Intent (In) :: len_rtem
00126
00127
00128
00129
00130
00131
00132
00133
00134 Real, Intent (InOut) :: buf (len_rtem, ndrbuf)
00135
00136
00137
00138 Integer, Intent (InOut) :: ipa
00139
00140
00141
00142
00143 Integer, Intent (InOut) :: ibuf (len_item, ndibuf)
00144
00145
00146
00147 Integer, Intent (InOut) :: ipia
00148
00149
00150
00151
00152 Integer, Intent (Out) :: ierror
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162 Integer, Parameter :: nc_reg = 2
00163
00164
00165
00166
00167
00168 Integer :: j, n
00169
00170 Integer :: nbc
00171
00172
00173
00174 Integer :: nbr_lats
00175 Logical :: store_virtual
00176
00177 Type (Grid), Pointer :: gp
00178 Integer, Pointer :: points_per_lat (:,:)
00179
00180
00181
00182
00183 Integer :: ip, ipi
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210 Character(len=len_cvs_string), save :: mycvs =
00211 '$Id: psmile_store_faces_gauss2_real.F90 2966 2011-02-18 09:47:30Z hanke $'
00212
00213
00214
00215
00216
00217 #ifdef VERBOSE
00218 print 9990, trim(ch_id), nreq
00219
00220 call psmile_flushstd
00221 #endif /* VERBOSE */
00222
00223 ierror = 0
00224
00225
00226 nbc = 2
00227
00228 #ifdef PRISM_ASSERTION
00229
00230 if (grid_valid_shape (1,2) /= 1 .or. &
00231 grid_valid_shape (2,2) /= 1) then
00232 call psmile_assert (__FILE__, __LINE__, &
00233 "Internal definition of GaussReduced grid not correct")
00234 endif
00235
00236 if (grid_valid_shape (1,1) /= corner_shape(1,1) .or. &
00237 grid_valid_shape (2,1) /= corner_shape(2,1) .or. &
00238 grid_valid_shape (1,2) /= corner_shape(1,2) .or. &
00239 grid_valid_shape (2,2) /= corner_shape(2,2)) then
00240
00241 print *, 'corner_shape ', corner_shape
00242 print *, 'grid_valid_shape', grid_valid_shape
00243
00244 call psmile_assert (__FILE__, __LINE__, &
00245 "corner_shape /= grid_valid_shape; don't know to address")
00246 endif
00247
00248 do j = 1, nreq
00249 if (send_mask(j)) then
00250 if (required(j) == 0) exit
00251 endif
00252 end do
00253
00254 if (j < nreq) then
00255 print *, 'j, required', j, required (j)
00256 call psmile_assert (__FILE__, __LINE__, &
00257 "No points required")
00258 endif
00259
00260 if (len_item < ndim_3d + 2) then
00261 print *, 'len_item', len_item, ndim_3d + 2
00262 call psmile_assert (__FILE__, __LINE__, &
00263 "len_item is insufficicent")
00264 endif
00265
00266 if (len_rtem < ndim_3d + nbc*ndim_2d + ndim_2d) then
00267 print *, 'len_rtem', len_rtem, ndim_3d + nbc*ndim_2d + ndim_2d
00268 call psmile_assert (__FILE__, __LINE__, &
00269 "len_rtem is insufficicent")
00270 endif
00271
00272 ip = count(send_mask)
00273 if (ipa+ip > ndrbuf) then
00274 print *, 'ndrbuf, ip, ipa, nreq', &
00275 ndrbuf, ip, ipa, nreq
00276 call psmile_assert (__FILE__, __LINE__, &
00277 "ndrbuf is not sufficient")
00278 endif
00279
00280 if (ipia+ip > ndibuf) then
00281 print *, 'ndibuf, ip, ipia, nreq', &
00282 ndibuf, ip, ipia, nreq
00283 call psmile_assert (__FILE__, __LINE__, &
00284 "ndrbuf is not sufficient")
00285 endif
00286 #endif
00287
00288
00289
00290 gp => Grids(grid_id)
00291 points_per_lat => gp%extent
00292
00293 nbr_lats = size(gp%extent(:,1))
00294
00295 ipi = ipia
00296 ip = ipa
00297
00298 store_virtual = virtual_cell_available
00299
00300
00301
00302
00303 do j = 1, nreq
00304 if (send_mask(j)) then
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314 ip = ip + 1
00315
00316 buf (1, ip) = tgt_coords1 (indices_req (j))
00317 buf (2, ip) = tgt_coords2 (indices_req (j))
00318 buf (3, ip) = tgt_coords3 (indices_req (j))
00319
00320
00321
00322 do n = 1, nbc
00323 buf (n*ndim_3d+1, ip) = corners1 (srcloc_ind(1,ip), n)
00324 buf (n*ndim_3d+2, ip) = corners2 (srcloc_ind(1,ip), n)
00325 buf (n*ndim_3d+3, ip) = corners3 (srcloc_ind(3,ip), n)
00326 end do
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338 ipi = ipi + 1
00339
00340 ibuf (1, ipi) = srcloc_ind (1, ip)
00341 ibuf (2, ipi) = srcloc_ind (2, ip)
00342 ibuf (3, ipi) = srcloc_ind (3, ip)
00343
00344 ibuf (4, ipi) = j
00345 ibuf (5, ipi) = required (j)
00346 if (store_virtual) ibuf (6, ipi) = virtual_ind (ip)
00347
00348 #ifdef DEBUG_TRACE
00349 if (indices_req (j) == ictl) then
00350 print *, "psmile_store_faces_gauss2_real: indices_req(j)", &
00351 indices_req (j), ", ipi", ipi
00352 print *, 'required: j, ind, required', &
00353 j, ibuf (1, ipi), ibuf (2, ipi), ibuf (3, ipi), &
00354 required (j), 'virtual', ibuf (6, ipi)
00355 endif
00356 #endif
00357
00358 #ifdef DEBUGX
00359 print *, 'required: j, ind, required', &
00360 j, ibuf (1, ipi), ibuf (2, ipi), ibuf (3, ipi), &
00361 required (j), 'virtual', ibuf (6, ipi)
00362 #endif
00363
00364 endif
00365 end do
00366
00367
00368
00369 ipia = ipi
00370 ipa = ip
00371
00372 #ifdef VERBOSE
00373 print 9980, trim(ch_id), ierror
00374
00375 call psmile_flushstd
00376 #endif /* VERBOSE */
00377
00378
00379
00380
00381 #ifdef VERBOSE
00382
00383 9990 format (1x, a, ': psmile_store_faces_gauss2_real: nreq ', i5)
00384 9980 format (1x, a, ': psmile_store_faces_gauss2_real: eof ierror =', i3)
00385
00386 #endif /* VERBOSE */
00387
00388 #ifdef DEBUG
00389 #endif
00390
00391 end subroutine PSMILe_Store_faces_gauss2_real