Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_ClearSendRequests.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: wait until data is received by other processors communicating
26 ! with the current region.
27 !
28 ! Description: none.
29 !
30 ! Input: regions = all regiona
31 ! iReg = current region
32 ! geometry = true if geometrical data were send, false otherwise.
33 !
34 ! Output: none.
35 !
36 ! Notes: none.
37 !
38 !******************************************************************************
39 !
40 ! $Id: RFLO_ClearSendRequests.F90,v 1.4 2008/12/06 08:44:26 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2001 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE rflo_clearsendrequests( regions,iReg,geometry )
47 
48  USE moddatatypes
49  USE modbndpatch, ONLY : t_patch
50  USE moddatastruct, ONLY : t_region
51  USE modglobal, ONLY : t_global
52  USE moderror
53  USE modmpi
54  USE modparameters
55  IMPLICIT NONE
56 
57 ! ... parameters
58  TYPE(t_region), POINTER :: regions(:)
59 
60  INTEGER :: ireg
61 
62  LOGICAL :: geometry
63 
64 ! ... loop variables
65  INTEGER :: ipatch, ir
66 
67 ! ... local variables
68  INTEGER :: ilev, npatches, bctype, iregsrc, irequest
69 #ifdef MPI
70  INTEGER :: status(mpi_status_size)
71 #endif
72 
73  LOGICAL dowait
74 
75  TYPE(t_patch), POINTER :: patch
76  TYPE(t_global), POINTER :: global
77 
78 !******************************************************************************
79 
80  global => regions(1)%global
81 
82  CALL registerfunction( global,'RFLO_ClearSendRequests',&
83  'RFLO_ClearSendRequests.F90' )
84 
85 #ifdef MPI
86 ! get dimensions --------------------------------------------------------------
87 
88  IF (geometry) THEN
89  ilev = 1
90  ELSE
91  ilev = regions(ireg)%currLevel
92  ENDIF
93  npatches = regions(ireg)%nPatches
94 
95 ! wait for patch data being received by other processors ----------------------
96 
97  DO ipatch=1,npatches
98 
99  patch => regions(ireg)%levels(ilev)%patches(ipatch)
100 
101  bctype = patch%bcType
102  iregsrc = patch%srcRegion
103 
104 ! - region interface, periodic boundary
105 
106  IF (geometry) THEN
107  dowait = ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) &
108  .OR. &
109  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) &
110  .OR. &
111  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range))
112  ELSE
113  dowait = ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) &
114  .OR. &
115  (bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) &
116  .OR. &
117  (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) &
118  .OR. &
119  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) &
120  .OR. &
121  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range))
122  ENDIF
123 
124  IF (iregsrc > 0) THEN
125  IF (dowait .AND. (regions(iregsrc)%procid /= global%myProcid)) THEN
126  CALL mpi_wait( global%requests(patch%mixt%iRequest),status, &
127  global%mpierr )
128  IF (global%mpierr /= 0) CALL errorstop( global,err_mpi_trouble,__line__ )
129  ENDIF
130  ENDIF
131 
132  ENDDO ! iPatch
133 
134 ! wait for edges & corners being received by other processors -----------------
135 
136  IF (.NOT. geometry .AND. global%nProcAlloc>1) THEN
137  DO ir=1,global%nRegions
138  IF (regions(ireg)%levels(ilev)%sendEcCells(ir)%nCells > 0) THEN
139  irequest = regions(ireg)%levels(ilev)%sendEcCells(ir)%iRequest
140  CALL mpi_wait( global%requests(irequest),status,global%mpierr )
141  IF (global%mpierr /= 0) CALL errorstop( global,err_mpi_trouble,__line__ )
142  ENDIF
143  ENDDO
144  ENDIF
145 #endif
146 
147 ! finalize --------------------------------------------------------------------
148 
149  CALL deregisterfunction( global )
150 
151 END SUBROUTINE rflo_clearsendrequests
152 
153 !******************************************************************************
154 !
155 ! RCS Revision history:
156 !
157 ! $Log: RFLO_ClearSendRequests.F90,v $
158 ! Revision 1.4 2008/12/06 08:44:26 mtcampbe
159 ! Updated license.
160 !
161 ! Revision 1.3 2008/11/19 22:17:37 mtcampbe
162 ! Added Illinois Open Source License/Copyright
163 !
164 ! Revision 1.2 2006/08/19 15:39:32 mparmar
165 ! Renamed patch variables
166 !
167 ! Revision 1.1 2004/11/29 20:51:38 wasistho
168 ! lower to upper case
169 !
170 ! Revision 1.8 2003/05/15 02:57:03 jblazek
171 ! Inlined index function.
172 !
173 ! Revision 1.7 2003/02/24 16:57:43 jferry
174 ! Moved #endif for #ifdef MPI to encompass final section of code
175 !
176 ! Revision 1.6 2003/02/14 22:32:37 jblazek
177 ! Finished implementation of corener and edge cells.
178 !
179 ! Revision 1.5 2002/09/30 19:58:17 jblazek
180 ! Added check of iRegSrc before IF (dowait ...) THEN statement.
181 !
182 ! Revision 1.4 2002/09/27 00:57:10 jblazek
183 ! Changed makefiles - no makelinks needed.
184 !
185 ! Revision 1.3 2002/09/05 17:40:21 jblazek
186 ! Variable global moved into regions().
187 !
188 ! Revision 1.2 2002/07/12 21:50:07 jblazek
189 ! Added tool to split single grid into multiple regions.
190 !
191 ! Revision 1.1 2002/04/01 19:36:08 jblazek
192 ! Added routine to clear send requests.
193 !
194 !******************************************************************************
195 
196 
197 
198 
199 
200 
201 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
Definition: patch.h:74
subroutine rflo_clearsendrequests(regions, iReg, geometry)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469