Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_PatchBufferSendRecv.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: driver to communicate buffer data for adjacent regions
26 ! on different processors.
27 !
28 ! Description: none.
29 !
30 ! Input: regions = data of all regions.
31 !
32 ! Output: buffer sizes, data and appended PLAG data.
33 !
34 ! Notes: None.
35 !
36 !******************************************************************************
37 !
38 ! $Id: PLAG_PatchBufferSendRecv.F90,v 1.3 2008/12/06 08:44:34 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2003 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE plag_patchbuffersendrecv( regions )
45 
46  USE moddatatypes
47  USE modpartlag, ONLY : t_buffer_plag
48  USE modbndpatch, ONLY : t_patch
49  USE moddatastruct, ONLY : t_region
50  USE modglobal, ONLY : t_global
51  USE modpartlag, ONLY : t_plag
59  USE moderror
60  USE modmpi
61  USE modparameters
62  IMPLICIT NONE
63 
64 ! ... parameters
65  TYPE(t_region), POINTER :: regions(:)
66 
67 ! ... loop variables
68  INTEGER :: ireg
69 
70 ! ... local variables
71  CHARACTER(CHRLEN) :: rcsidentstring
72 
73  TYPE(t_global), POINTER :: global
74 
75 !******************************************************************************
76 
77  rcsidentstring = '$RCSfile: PLAG_PatchBufferSendRecv.F90,v $ $Revision: 1.3 $'
78 
79  global => regions(1)%global
80 
81  CALL registerfunction( global,'PLAG_PatchBufferSendRecv',&
82  'PLAG_PatchBufferSendRecv.F90' )
83 
84 ! communicate buffer size -----------------------------------------------------
85 
86 ! send buffer size ------------------------------------------------------------
87 
88  DO ireg = 1, global%nRegions
89  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
90  regions(ireg)%active==active) THEN ! on my processor
91  CALL plag_buffersizesend(regions, ireg)
92  ENDIF ! regions
93  ENDDO ! iReg
94 
95 ! receive buffer size ---------------------------------------------------------
96 
97  DO ireg = 1, global%nRegions
98  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
99  regions(ireg)%active==active) THEN ! on my processor
100  CALL plag_buffersizerecv(regions, ireg)
101  ENDIF ! regions
102  ENDDO ! iReg
103 
104 ! wait for data being received by other processors ----------------------------
105 
106  DO ireg = 1, global%nRegions
107  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
108  regions(ireg)%active==active) THEN ! on my processor
109  CALL plag_clearsizesendrequests(regions, ireg)
110  ENDIF ! regions
111  ENDDO ! iReg
112 
113 ! communicate buffer arrays ---------------------------------------------------
114 
115 ! send buffer data ------------------------------------------------------------
116 
117  DO ireg = 1, global%nRegions
118  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
119  regions(ireg)%active==active) THEN ! on my processor
120  CALL plag_bufferdatasend(regions, ireg)
121  ENDIF ! regions
122  ENDDO ! iReg
123 
124 ! receive buffer data ---------------------------------------------------------
125 
126  DO ireg = 1, global%nRegions
127  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
128  regions(ireg)%active==active) THEN ! on my processor
129  CALL plag_bufferdatarecv(regions, ireg)
130  ENDIF ! regions
131  ENDDO ! iReg
132 
133 ! wait for data being received by other processors ----------------------------
134 
135  DO ireg = 1, global%nRegions
136  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
137  regions(ireg)%active==active) THEN ! on my processor
138  CALL plag_cleardatasendrequests(regions, ireg)
139  ENDIF ! regions
140  ENDDO ! iReg
141 
142 ! Append data from buffers ----------------------------------------------------
143 
144  DO ireg = 1, global%nRegions
145  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
146  regions(ireg)%active==active) THEN ! on my processor
147 
148 ! WRITE(STDOUT,'(A,I2)') ' Entering PLAG_AppendDatafromBuffers: iReg', iReg
149 
150  CALL plag_appenddatafrombuffers( regions(ireg), ireg )
151 
152  ENDIF ! regions
153  ENDDO ! iReg
154 
155 #ifdef MPI
156  CALL mpi_barrier( global%mpiComm,global%mpierr )
157  IF ( global%mpierr /= err_none ) &
158  CALL errorstop( global,err_mpi_trouble,__line__ )
159 
160 ! CALL MPI_Finalize(global%mpierr)
161 ! IF ( global%mpierr /= ERR_NONE ) &
162 ! CALL ErrorStop( global,ERR_MPI_TROUBLE,__LINE__ )
163 !
164 ! STOP
165 #endif
166 
167 ! finalize --------------------------------------------------------------------
168 
169  CALL deregisterfunction( global )
170 
171 END SUBROUTINE plag_patchbuffersendrecv
172 
173 !******************************************************************************
174 !
175 ! RCS Revision history:
176 !
177 ! $Log: PLAG_PatchBufferSendRecv.F90,v $
178 ! Revision 1.3 2008/12/06 08:44:34 mtcampbe
179 ! Updated license.
180 !
181 ! Revision 1.2 2008/11/19 22:17:47 mtcampbe
182 ! Added Illinois Open Source License/Copyright
183 !
184 ! Revision 1.1 2004/12/01 20:57:54 fnajjar
185 ! Initial revision after changing case
186 !
187 ! Revision 1.4 2003/02/21 17:07:55 fnajjar
188 ! Included calls to Data Send and Recv
189 !
190 ! Revision 1.3 2003/01/24 22:40:27 f-najjar
191 ! Added MPI_Barrier and MPI_Finalize for testing
192 !
193 ! Revision 1.2 2003/01/24 22:08:31 f-najjar
194 ! Include function call to PLAG_ClearRequests
195 !
196 ! Revision 1.1 2003/01/23 18:51:49 f-najjar
197 ! Initial Import for MPI
198 !
199 !******************************************************************************
200 
201 
202 
203 
204 
205 
206 
subroutine plag_clearsizesendrequests(regions, iReg)
subroutine plag_bufferdatasend(regions, iReg)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine plag_patchbuffersendrecv(regions)
subroutine plag_bufferdatarecv(regions, iReg)
subroutine plag_appenddatafrombuffers(region, iReg)
subroutine plag_cleardatasendrequests(regions, iReg)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine plag_buffersizerecv(regions, iReg)
subroutine plag_buffersizesend(regions, iReg)