Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PEUL_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 specific for PEUL Module.
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: PEUL_ClearSendRequests.F90,v 1.3 2008/12/06 08:44:39 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2003 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE peul_clearsendrequests( regions,iReg ) ! PUBLIC
47 
48  USE moddatatypes
49  USE modbndpatch, ONLY : t_patch
50  USE moddatastruct, ONLY : t_region
51  USE modglobal, ONLY : t_global
52  USE modparteul, ONLY : t_peul
53  USE moderror
54  USE modmpi
55  USE modparameters
56  IMPLICIT NONE
57 
58 ! ... parameters
59  TYPE(t_region), POINTER :: regions(:)
60  INTEGER, INTENT(IN) :: ireg
61 
62 ! ... loop variables
63  INTEGER :: ipatch, ir
64 
65 ! ... local variables
66  CHARACTER(CHRLEN) :: rcsidentstring
67 
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_peul), POINTER :: ppeul
77  TYPE(t_global), POINTER :: global
78 
79 !******************************************************************************
80 
81  rcsidentstring = '$RCSfile: PEUL_ClearSendRequests.F90,v $ $Revision: 1.3 $'
82 
83  global => regions(1)%global
84 
85  CALL registerfunction( global,'PEUL_ClearSendRequests',&
86  'PEUL_ClearSendRequests.F90' )
87 
88 #ifdef MPI
89 ! get dimensions --------------------------------------------------------------
90 
91  ilev = regions(ireg)%currLevel
92  npatches = regions(ireg)%nPatches
93 
94  ppeul => regions(ireg)%levels(ilev)%peul
95 
96 ! wait for patch data being received by other processors ----------------------
97 
98  DO ipatch=1,npatches
99 
100  patch => regions(ireg)%levels(ilev)%patches(ipatch)
101 
102  bctype = patch%bcType
103  iregsrc = patch%srcRegion
104  irequest = patch%bufferPeul%iRequest
105 
106 ! - region interface, periodic boundary
107 
108  dowait = ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
109  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
110  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range))
111 
112  IF (iregsrc > 0) THEN
113  IF (dowait .AND. (regions(iregsrc)%procid /= global%myProcid)) THEN
114  CALL mpi_wait( ppeul%requests(irequest), status, global%mpierr )
115  IF (global%mpierr /= err_none) &
116  CALL errorstop( global,err_mpi_trouble,__line__ )
117  ENDIF
118  ENDIF
119 
120  ENDDO ! iPatch
121 
122 ! wait for edges & corners being received by other processors -----------------
123 
124  IF (global%nProcAlloc>1) THEN
125  DO ir=1,global%nRegions
126  IF (regions(ireg)%levels(ilev)%sndPeulEcCells(ir)%nCells > 0) THEN
127  irequest = regions(ireg)%levels(ilev)%sndPeulEcCells(ir)%iRequest
128  CALL mpi_wait( global%requests(irequest),status,global%mpierr )
129  IF (global%mpierr /= 0) &
130  CALL errorstop( global,err_mpi_trouble,__line__ )
131  ENDIF
132  ENDDO
133  ENDIF
134 
135 #endif
136 
137 ! finalize --------------------------------------------------------------------
138 
139  CALL deregisterfunction( global )
140 
141 END SUBROUTINE peul_clearsendrequests
142 
143 !******************************************************************************
144 !
145 ! RCS Revision history:
146 !
147 ! $Log: PEUL_ClearSendRequests.F90,v $
148 ! Revision 1.3 2008/12/06 08:44:39 mtcampbe
149 ! Updated license.
150 !
151 ! Revision 1.2 2008/11/19 22:17:51 mtcampbe
152 ! Added Illinois Open Source License/Copyright
153 !
154 ! Revision 1.1 2004/12/01 21:09:28 haselbac
155 ! Initial revision after changing case
156 !
157 ! Revision 1.3 2004/04/15 16:04:03 jferry
158 ! minor formatting (removed trailing spaces)
159 !
160 ! Revision 1.2 2004/03/02 21:44:07 jferry
161 ! Added corner and edge cell data structures and routines
162 !
163 ! Revision 1.1 2003/04/09 14:33:38 fnajjar
164 ! Initial Import of MPI-based rocsmoke
165 !
166 !******************************************************************************
167 
168 
169 
170 
171 
172 
173 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
subroutine peul_clearsendrequests(regions, iReg)
Definition: patch.h:74
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469