Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_CECellsRecvSize.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: receive buffer size to edge and corner cells of an adjacent region.
26 !
27 ! Description: kernel is pertinent when the other region is located
28 ! on a different processor.
29 !
30 ! Input:
31 ! regions = data of all regions
32 ! iReg = current region.
33 !
34 ! Output: buffer size received.
35 !
36 ! Notes: none.
37 !
38 !******************************************************************************
39 !
40 ! $Id: PLAG_CECellsRecvSize.F90,v 1.4 2009/03/02 00:19:36 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2004 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE plag_cecellsrecvsize( regions,iReg )
47 
48  USE moddatatypes
49  USE moderror
50  USE modmpi
51  USE modparameters
52  USE modglobal, ONLY : t_global
53  USE moddatastruct, ONLY : t_dcelltransf, t_level, t_region
54 
55  IMPLICIT NONE
56 
57 ! ******************************************************************************
58 ! Definitions and declarations
59 ! ******************************************************************************
60 
61 ! ==============================================================================
62 ! Arguments
63 ! ==============================================================================
64 
65  TYPE(t_region), POINTER :: regions(:)
66 
67  INTEGER, INTENT(IN) :: ireg
68 
69 ! ==============================================================================
70 ! Locals
71 ! ==============================================================================
72 
73  CHARACTER(CHRLEN) :: rcsidentstring
74 
75 #ifdef MPI
76  INTEGER :: statusplag(mpi_status_size)
77 #endif
78 
79  INTEGER :: ilev,ir,ndimbuffsize,source,tag
80 
81  TYPE(t_dcelltransf), POINTER :: precveccell
82  TYPE(t_global), POINTER :: global
83  TYPE(t_level), POINTER :: plevel
84  TYPE(t_region), POINTER :: pregion
85 
86 ! ******************************************************************************
87 ! Start
88 ! ******************************************************************************
89 
90  rcsidentstring = '$RCSfile: PLAG_CECellsRecvSize.F90,v $ $Revision: 1.4 $'
91 
92  global => regions(ireg)%global
93 
94  CALL registerfunction( global,'PLAG_CECellsRecvSize',&
95  'PLAG_CECellsRecvSize.F90' )
96 
97 ! ******************************************************************************
98 ! Get dimensions
99 ! ******************************************************************************
100 
101  ilev = regions(ireg)%currLevel
102 
103  ndimbuffsize = 1
104 
105 ! ******************************************************************************
106 ! Set pointers
107 ! ******************************************************************************
108 
109  pregion => regions(ireg)
110  plevel => regions(ireg)%levels(ilev)
111 
112 ! ******************************************************************************
113 ! Receive buffer size from source processor
114 ! ******************************************************************************
115 
116  DO ir=1,global%nRegions
117  IF (regions(ir)%procid /= global%myProcid) THEN
118  IF (plevel%recvEcCells(ir)%nCells > 0) THEN
119  precveccell => plevel%recvEcCells(ir)
120 
121 #ifdef MPI
122  source = regions(ir)%procid
123  tag = regions(ireg)%localNumber +plag_tag_shift +mpi_patchoff +1000
124 
125  IF(tag .gt. global%mpiTagMax) tag = mod(tag,global%mpiTagMax)
126  CALL mpi_recv( precveccell%nBuffSizePlag,ndimbuffsize,mpi_integer, &
127  source,tag,global%mpiComm,statusplag,global%mpierr )
128  IF ( global%mpierr /= err_none ) &
129  CALL errorstop( global,err_mpi_trouble,__line__ )
130 #endif
131 
132 #ifdef PLAG_CECELLS_MPI_DEBUG
133  IF ( precveccell%nBuffSizePlag > 0 ) &
134  WRITE(stdout,*) ' PLAG_CECellsRecvSize: iRegDes, iRegSrc, procSrc, tagSrc, nBuffSizePlag = ',&
135  ireg, ir,source,tag,precveccell%nBuffSizePlag
136 #endif
137 
138  ENDIF ! some cells to receive
139  ENDIF ! not my processor
140  ENDDO ! ir
141 
142 ! ******************************************************************************
143 ! finalize
144 ! ******************************************************************************
145 
146  CALL deregisterfunction( global )
147 
148 END SUBROUTINE plag_cecellsrecvsize
149 
150 !******************************************************************************
151 !
152 ! RCS Revision history:
153 !
154 ! $Log: PLAG_CECellsRecvSize.F90,v $
155 ! Revision 1.4 2009/03/02 00:19:36 mtcampbe
156 ! Added some ifdefs around Rocflo to disable particle injection on INFLOW
157 ! boundaries and added some checks around MPI tags utilizing a new global
158 ! data item, global%mpiTagMax.
159 !
160 ! Revision 1.3 2008/12/06 08:44:33 mtcampbe
161 ! Updated license.
162 !
163 ! Revision 1.2 2008/11/19 22:17:45 mtcampbe
164 ! Added Illinois Open Source License/Copyright
165 !
166 ! Revision 1.1 2004/12/01 20:57:16 fnajjar
167 ! Initial revision after changing case
168 !
169 ! Revision 1.1 2004/03/10 23:16:09 fnajjar
170 ! Initial import of routines to MPI-communicate buffer sizes
171 !
172 !******************************************************************************
173 
174 
175 
176 
177 
178 
179 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine plag_cecellsrecvsize(regions, iReg)
CGAL::Point_2< R > source() const
Definition: Ray_2.h:128
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469