psmile_get_faces_virtual_ind.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_Get_faces_virtual_ind
00008 !
00009 ! !INTERFACE:
00010 
00011       subroutine psmile_get_faces_virtual_ind (search, extra_search, &
00012                       send_info, len_cpl,                            &
00013                       send_mask, nreq, virtual_ind, n_send,          &
00014                       ierror)
00015 !
00016 ! !USES:
00017 !
00018       use PRISM
00019 !
00020       use PSMILe, dummy_interface => PSMILe_Get_faces_virtual_ind
00021 
00022       Implicit none
00023 !
00024 ! !INPUT PARAMETERS:
00025 !
00026       Type (Enddef_search),     Intent (In) :: search
00027 
00028 !     Info's on coordinates to be searched
00029 !
00030       Type (Extra_search_info), Intent (In) :: extra_search
00031 !
00032 !     Info's on locations which 
00033 !     (*) require global search or
00034 !     (*) extra neighbourhood search
00035 !
00036       Type (Send_information),  Intent (In) :: send_info
00037 !
00038 !     Send info's for sends to the coupler.
00039 !
00040       Integer,                  Intent (In) :: len_cpl (search%npart)
00041 
00042 !     Number of points to be sent to the coupler for each partition.
00043 
00044       Integer,                  Intent (In) :: nreq
00045 !
00046 !     Total number of extra points to be searched.
00047 !     Dimension of "send_mask".
00048 !
00049       Logical,                  Intent (In) :: send_mask (nreq)
00050 !
00051 !     Mask for the points (of "indices_req") to be sent.
00052 !
00053       Integer,                  Intent (In) :: n_send
00054 !
00055 !     Number of extra points to be sent and 
00056 !     number of indices to be returned.
00057 !
00058 ! !OUTPUT PARAMETERS:
00059 !
00060       Integer,                  Intent (Out) :: virtual_ind (n_send)
00061 !
00062 !     Codes of the virtual cell info's sent
00063 !
00064       Integer,                  Intent (Out) :: ierror
00065 
00066 !     Returns the error code of PSMILe_Get_faces_virtual_ind;
00067 !             ierror = 0 : No error
00068 !             ierror > 0 : Severe error
00069 !
00070 ! !DEFINED PARAMETERS:
00071 !
00072 ! !LOCAL VARIABLES
00073 !
00074 !     ... loop variables
00075 !
00076       Integer                         :: j, n
00077 !
00078 !     ... for partitions
00079 !
00080       Integer                         :: ipart, nextra_prev, nprev
00081       Integer                         :: nvec
00082 !
00083       Integer, Pointer                :: indices_req (:)
00084       Integer, Pointer                :: len_req (:)
00085       Integer, Pointer                :: virtual (:)
00086 !
00087 !     ... for locations
00088 !
00089 #ifdef PRISM_ASSERTION
00090       Integer                         :: nlast, ispart
00091 #endif
00092 !
00093 !     ... for error handling
00094 !
00095 !     Integer, Parameter              :: nerrp = 3
00096 !     Integer                         :: ierrp (nerrp)
00097 !
00098 ! !DESCRIPTION:
00099 !
00100 ! Subroutine "PSMILe_Get_faces_virtual_ind" stores the code of virtual cell
00101 ! info for the locations to be sent to a "coinciding" (neighboured)
00102 ! process of the same component.
00103 !
00104 !
00105 ! !REVISION HISTORY:
00106 !
00107 !   Date      Programmer   Description
00108 ! ----------  ----------   -----------
00109 ! 02.02.05    H. Ritzdorf  created
00110 !
00111 !EOP
00112 !----------------------------------------------------------------------
00113 !
00114 !  $Id: psmile_get_faces_virtual_ind.F90 2897 2011-01-19 15:42:53Z hanke $
00115 !  $Author: hanke $
00116 !
00117    Character(len=len_cvs_string), save :: mycvs = 
00118        '$Id: psmile_get_faces_virtual_ind.F90 2897 2011-01-19 15:42:53Z hanke $'
00119 !
00120 !----------------------------------------------------------------------
00121 !
00122 !  Initialization
00123 !
00124 #ifdef VERBOSE
00125       print 9990, trim(ch_id)
00126 
00127       call psmile_flushstd
00128 #endif /* VERBOSE */
00129 !
00130       ierror = 0
00131 !
00132       len_req => extra_search%len_req
00133 !
00134 #ifdef PRISM_ASSERTION
00135       if (SUM(len_req(:)) > nreq) then
00136          print *, 'nreq, sum(len_req)', nreq, SUM(len_req(:))
00137          call psmile_assert ( __FILE__, __LINE__, &
00138                  'nreq is too small (inconsistent data)')
00139       endif
00140 #endif
00141 !
00142 !  For all parts "ipart"
00143 !
00144 !  indices_req = Indices of the extra points in entire list of all points
00145 !                to be searched (i.e. for all parts "ipart")
00146 !
00147       n = 0
00148       nprev = 0
00149       nextra_prev = 0
00150 !
00151       nvec = send_info%nvec
00152       if (nvec == 1) then
00153 !        Virtual cell info is store in single vector
00154 !        independent on number of parts
00155          virtual => send_info%virtual(1, 1)%vector
00156       endif
00157 ! 
00158       do ipart = 1, search%npart
00159 !
00160          if (len_req (ipart) > 0) then
00161             indices_req => extra_search%indices_req(ipart)%vector
00162             if (nvec > 1) virtual => send_info%virtual(1, ipart)%vector
00163 !
00164 #ifdef PRISM_ASSERTION
00165             nlast = n
00166             ispart = min (ipart, nvec)
00167 #endif
00168 !
00169 !cdir vector
00170             do j = 1, len_req (ipart)
00171                if (send_mask(nextra_prev+j)) then
00172 !
00173 !  ... Compute index in virtual
00174 !
00175                   n = n + 1
00176 !
00177                   virtual_ind (n) = virtual (indices_req(j) - nprev)
00178                endif
00179             end do ! j
00180 !
00181 #ifdef PRISM_ASSERTION
00182             do j = nlast+1, n
00183                if (virtual_ind (j) < 0 .or. &
00184                    virtual_ind (j) >= send_info%npoints(1,ispart)) exit
00185             end do 
00186 !
00187             if (j <= n) then
00188                print *, "j, ind", j, virtual_ind (j), &
00189                         send_info%npoints(1,ispart)
00190                call psmile_assert (__FILE__, __LINE__, &
00191                      "Incorrect index generated");
00192             endif
00193 #endif
00194 !
00195             nextra_prev = nextra_prev + len_req (ipart)
00196          endif
00197 !
00198          if (nvec > 1) nprev = nprev + len_cpl (ipart)
00199       end do ! ipart
00200 !
00201 #ifdef PRISM_ASSERTION
00202       if (n /= n_send) then
00203          print *, 'n, n_send', n, n_send
00204          call psmile_assert ( __FILE__, __LINE__, &
00205                  'All indices were NOT generated for virtual_ind')
00206       endif
00207 #endif
00208 !
00209 !===> All done
00210 !
00211 #ifdef VERBOSE
00212       print 9980, trim(ch_id), ierror
00213 
00214       call psmile_flushstd
00215 #endif /* VERBOSE */
00216 !
00217 !  Formats:
00218 !
00219 #ifdef VERBOSE
00220 
00221 9990 format (1x, a, ': psmile_get_faces_virtual_ind:')
00222 9980 format (1x, a, ': psmile_get_faces_virtual_ind: eof ierror =', i3)
00223 
00224 #endif /* VERBOSE */
00225 
00226 #ifdef DEBUG
00227 #endif
00228 
00229       end subroutine PSMILe_Get_faces_virtual_ind

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1