psmile_store_faces_3d_dble.F90

Go to the documentation of this file.
00001 !-----------------------------------------------------------------------
00002 ! Copyright 2006-2010, NEC Europe Ltd., London, UK.
00003 ! All rights reserved. Use is subject to OASIS4 license terms.
00004 !-----------------------------------------------------------------------
00005 !BOP
00006 !
00007 ! !ROUTINE: PSMILe_Store_faces_3d_dble
00008 !
00009 ! !INTERFACE:
00010 
00011       subroutine psmile_store_faces_3d_dble (indices_req,          &
00012                       required, nreq,                              &
00013                       tgt_coords1, tgt_coords2, tgt_coords3, ncpl, &
00014                       corners1, corners2, corners3,                &
00015                       corner_shape, nbr_corners, grid_valid_shape, &
00016                       send_mask, srcloc_ind,                       &
00017                       ibuf, len_item, ndibuf, ipia,                &
00018                       buf,  len_rtem, ndrbuf, ipa, ierror)
00019 !
00020 ! !USES:
00021 !
00022       use PRISM
00023 !
00024       use PSMILe, dummy_interface => PSMILe_Store_faces_3d_dble
00025 
00026       Implicit none
00027 !
00028 ! !INPUT PARAMETERS:
00029 
00030       Integer,           Intent (In)  :: nreq
00031 !
00032 !     Total number of extra points to be searched for the current partition.
00033 !     Dimension of "indices_req" and "send_mask"
00034 !
00035       Integer,            Intent (In) :: indices_req (nreq)
00036 !
00037 !     Indices of the extra points in entire list of all points to be
00038 !     searched (i.e. for all parts "ipart")
00039 !
00040       Integer,            Intent (In) :: required    (nreq)
00041 !
00042 !     Code for the extra points which are additionally required.
00043 !
00044       Integer,           Intent (In)  :: corner_shape (2, ndim_3d)
00045       
00046 !     Specifies the dimension of arrays "corners1", "corners2" and "corners3"
00047 
00048       Integer,           Intent (In)  :: nbr_corners
00049 
00050 !     Number of corners in control volume 
00051 !     Must be 8 for a grid of type "PRISM_Irrlonlatvrt".
00052 
00053       Integer,           Intent (In)  :: grid_valid_shape (2, ndim_3d)
00054       
00055 !     Specifies the valid block shape for the "ndim_3d"-dimensional block
00056 
00057       Integer,           Intent (In)  :: ncpl
00058       
00059 !     Total number of points to be transferred 
00060 !     = Dimensions of tgt_coords1, tgt_coords2, tgt_coords3
00061 
00062       Double Precision,  Intent (In)  :: tgt_coords1 (ncpl)
00063       Double Precision,  Intent (In)  :: tgt_coords2 (ncpl)
00064       Double Precision,  Intent (In)  :: tgt_coords3 (ncpl)
00065 
00066 !     Coordinates of the points to be searched
00067 
00068       Double Precision,  Intent (In)  ::                
00069          corners1 (corner_shape(1,1):corner_shape(2,1), 
00070                    corner_shape(1,2):corner_shape(2,2), 
00071                    corner_shape(1,3):corner_shape(2,3), nbr_corners)
00072 
00073       Double Precision,  Intent (In)  ::                
00074          corners2 (corner_shape(1,1):corner_shape(2,1), 
00075                    corner_shape(1,2):corner_shape(2,2), 
00076                    corner_shape(1,3):corner_shape(2,3), nbr_corners)
00077 
00078       Double Precision,  Intent (In)  ::                
00079          corners3 (corner_shape(1,1):corner_shape(2,1), 
00080                    corner_shape(1,2):corner_shape(2,2), 
00081                    corner_shape(1,3):corner_shape(2,3), nbr_corners)
00082 !
00083 !     Coordinates of corners of cell/control volume
00084 !
00085       Logical,           Intent (In)  :: send_mask (nreq)
00086 !
00087 !     Mask for the points (of "indices_req") to be sent.
00088 !
00089       Integer,           Intent (In)  :: ndibuf
00090 !
00091 !     Dimension of integer buffer "ibuf"
00092 !
00093       Integer,           Intent (In)  :: srcloc_ind (ndim_3d, ndibuf)
00094 !
00095 !     Indices of points in "corners" to be sent.
00096 !
00097       Integer,           Intent (In)  :: len_item
00098 !
00099 !     Length per data item in integer buffer "ibuf"
00100 !        1:3: (i,j,k) index of lower left corner
00101 !        4  : index in
00102 !        5  : code for points required
00103 !
00104       Integer,           Intent (In)  :: ndrbuf
00105 !
00106 !     Dimension of Double Precision buffer "buf"
00107 !
00108       Integer,           Intent (In)  :: len_rtem
00109 !
00110 !     Length per data item in Double Precision buffer "buf"
00111 !        1:3: Coordinates of the point to be searched
00112 !        :  : Coordinates of corners of control volume/cell
00113 !             (ndim_3d * nbr_corners values)
00114 !
00115 ! !OUTPUT PARAMETERS:
00116 !
00117       Double Precision,  Intent (InOut) :: buf (len_rtem, ndrbuf)
00118 !
00119 !     Buffer returning the packed Double Precision data.
00120 !
00121       Integer,           Intent (InOut) :: ipa
00122 !
00123 !     Number of data items stored in "buf";
00124 !     i.e. buf(1:ipa) contains buffered data.
00125 !
00126       Integer,           Intent (InOut) :: ibuf (len_item, ndibuf)
00127 !
00128 !     Integer buffer returning the packed integer data.
00129 !
00130       Integer,           Intent (InOut) :: ipia
00131 !
00132 !     Number of data items stored in "ibuf";
00133 !     i.e. ibuf(:, 1:ipia) contains buffered data.
00134 !
00135       Integer,           Intent (Out)   :: ierror
00136 
00137 !     Returns the error code of PSMILe_Store_faces_3d_dble;
00138 !             ierror = 0 : No error
00139 !             ierror > 0 : Severe error
00140 !
00141 ! !LOCAL PARAMETERS
00142 !
00143 !
00144 ! !LOCAL VARIABLES
00145 !
00146 !     ... loop variables
00147 !
00148       Integer                         :: j, n
00149 !
00150 !     ... buffer pointers
00151 !
00152       Integer                         :: ip, ipi
00153       Integer                         :: ind (ndim_3d, ipa+1:ipa+nreq)
00154 !
00155 !     ... for error handling
00156 !
00157 !     Integer, Parameter              :: nerrp = 3
00158 !     Integer                         :: ierrp (nerrp)
00159 !
00160 ! !DESCRIPTION:
00161 !
00162 ! Subroutine "PSMILe_Store_faces_3d_dble" stores the face info on
00163 ! (corner) cells to be transferred to neighbouring process for 
00164 ! global search of interpolation bases.
00165 !
00166 ! Subroutine "PSMILe_Store_faces_3d_dble" is designed for grids of
00167 ! type "PRISM_Irrlonlatvrt".
00168 !
00169 !
00170 ! !REVISION HISTORY:
00171 !
00172 !   Date      Programmer   Description
00173 ! ----------  ----------   -----------
00174 ! 02.02.05    H. Ritzdorf  created
00175 !
00176 !EOP
00177 !----------------------------------------------------------------------
00178 !
00179 !  $Id: psmile_store_faces_3d_dble.F90 2082 2009-10-21 13:31:19Z hanke $
00180 !  $Author: hanke $
00181 !
00182    Character(len=len_cvs_string), save :: mycvs = 
00183        '$Id: psmile_store_faces_3d_dble.F90 2082 2009-10-21 13:31:19Z hanke $'
00184 !
00185 !----------------------------------------------------------------------
00186 !
00187 !  Initialization
00188 !
00189 #ifdef VERBOSE
00190       print 9990, trim(ch_id), nreq
00191 
00192       call psmile_flushstd
00193 #endif /* VERBOSE */
00194 !
00195       ierror = 0
00196 !
00197 #ifdef PRISM_ASSERTION
00198 !
00199          do j = 1, nreq
00200          if (send_mask(j)) then
00201             if (required(j) == 0) exit
00202          endif
00203          end do
00204 !
00205       if (j < nreq) then
00206          print *, 'j, required', j, required (j)
00207          call psmile_assert (__FILE__, __LINE__, &
00208               "No points required")
00209       endif
00210 !
00211       if (len_item < ndim_3d + 2) then
00212          print *, 'len_item', len_item, ndim_3d + 2
00213          call psmile_assert (__FILE__, __LINE__, &
00214               "len_item is insufficicent")
00215       endif
00216 !
00217       if (len_rtem < ndim_3d * (nbr_corners+1)) then
00218          print *, 'len_rtem', len_rtem, ndim_3d * (nbr_corners + 1)
00219          call psmile_assert (__FILE__, __LINE__, &
00220               "len_rtem is insufficicent")
00221       endif
00222 !
00223       ip = count(send_mask)
00224       if (ipa+ip > ndrbuf) then
00225          print *, 'ndrbuf, ip, ipa, nreq', &
00226                    ndrbuf, ip, ipa, nreq
00227          call psmile_assert (__FILE__, __LINE__, &
00228                     "ndrbuf is not sufficient")
00229       endif
00230 !
00231       if (ipia+ip > ndibuf) then
00232          print *, 'ndibuf, ip, ipia, nreq', &
00233                    ndibuf, ip, ipia, nreq
00234          call psmile_assert (__FILE__, __LINE__, &
00235                     "ndrbuf is not sufficient")
00236       endif
00237 #endif
00238 !
00239       ipi = ipia
00240       ip  = ipa
00241 !
00242 !===> Get indices of last corner cell within domain
00243 !     Note: srcloc_ind may be indices of a virtual cell
00244 !  HUHU  ? should be use virtual_cell info (gauss grid) instead
00245 !  HUHU    and let srcloc_ind an index within the domain !
00246 
00247       do j = 1, nreq
00248       if (send_mask(j)) then
00249          ip = ip + 1
00250          ind (:, ip) = max (srcloc_ind(:,ip), grid_valid_shape (1,:))
00251          ind (:, ip) = min (ind(:, ip),       grid_valid_shape (2,:))
00252       endif
00253       end do
00254 !
00255       ip = ipa
00256 !
00257 !===> Fill buffers
00258 !
00259          do j = 1, nreq
00260          if (send_mask(j)) then
00261 !
00262 !===> ... n-th domain is a potential partner
00263 !
00264 !===> ... Store data in Double Precision buffer "buf"
00265 !
00266 !  Storage sequence in "buf":
00267 !  buf (:) = Coordinates of the point to be searched
00268 !  buf (:) = Coordinates of corners of control volume/cell
00269 !
00270             ip = ip + 1
00271 !
00272             buf (1, ip) = tgt_coords1 (indices_req(j))
00273             buf (2, ip) = tgt_coords2 (indices_req(j))
00274             buf (3, ip) = tgt_coords3 (indices_req(j))
00275 !
00276 !  HUHU: Does it make really sense to transfer the box !?!
00277 !
00278                do n = 1, nbr_corners
00279                buf (n*ndim_3d+1, ip) = corners1 (ind(1,ip), &
00280                                                  ind(2,ip), &
00281                                                  ind(3,ip), n)
00282                buf (n*ndim_3d+2, ip) = corners2 (ind(1,ip), &
00283                                                  ind(2,ip), &
00284                                                  ind(3,ip), n)
00285                buf (n*ndim_3d+3, ip) = corners3 (ind(1,ip), &
00286                                                  ind(2,ip), &
00287                                                  ind(3,ip), n)
00288                end do
00289 !
00290 !===> ... Store logical coordinates of point to be searched in
00291 !         integer buffer "ibuf"
00292 !
00293 !  ibuf (1:ndim_3d, :) = srcloc of extra point
00294 !  ibuf (4,         :) = Index of the extra point to be searched
00295 !                        This is a local index in the vectors
00296 !                        "required" and "indices_req" of the actual
00297 !                        partition "ipart".
00298 !  ibuf (5,         :) = Code for interpolation bases required
00299 !
00300             ipi = ipi + 1
00301 !
00302             ibuf (1, ipi) = srcloc_ind (1, ip)
00303             ibuf (2, ipi) = srcloc_ind (2, ip)
00304             ibuf (3, ipi) = srcloc_ind (3, ip)
00305 !
00306             ibuf (4, ipi) = j
00307             ibuf (5, ipi) = required (j)
00308 !
00309          endif
00310          end do ! j
00311 !
00312 !===> All done; return current length
00313 !
00314       ipia = ipi
00315       ipa  = ip
00316 !
00317 #ifdef VERBOSE
00318       print 9980, trim(ch_id), ierror
00319 
00320       call psmile_flushstd
00321 #endif /* VERBOSE */
00322 !
00323 !  Formats:
00324 !
00325 
00326 #ifdef VERBOSE
00327 
00328 9990 format (1x, a, ': psmile_store_faces_3d_dble: nreq ', i5)
00329 9980 format (1x, a, ': psmile_store_faces_3d_dble: eof ierror =', i3)
00330 
00331 #endif /* VERBOSE */
00332 
00333 #ifdef DEBUG
00334 #endif
00335 
00336       end subroutine PSMILe_Store_faces_3d_dble

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1