74 CHARACTER(CHRLEN) :: RCSIdentString = &
75 '$RCSfile: RFLU_ModRegionMapping.F90,v $ $Revision: 1.7 $'
77 INTEGER,
PARAMETER,
PUBLIC :: MAPTYPE_REG = 1, &
121 TYPE(t_level
),
POINTER :: levels(:)
128 INTEGER :: errorflag,ilev,ireg
135 'RFLU_ModRegionMapping.F90')
137 IF ( global%myProcid == masterproc .AND. &
138 global%verbLevel >= verbose_high )
THEN
139 WRITE(stdout,
'(A,1X,A)') solver_name,
'Applying region mapping...'
148 DO ireg = 0,global%nRegionsLocal
149 levels(ilev)%regions(ireg)%iRegionGlobal = global%regMap(ireg)
152 DO ilev = 2,global%nLevels
153 DO ireg = 1,global%nRegionsLocal
154 levels(ilev)%regions(ireg)%iRegionGlobal = global%regMap(ireg)
162 IF ( global%myProcid == masterproc .AND. &
163 global%verbLevel >= verbose_high )
THEN
164 WRITE(stdout,
'(A,1X,A)') solver_name,
'Applying region mapping done.'
212 INTEGER ::
i,
ibeg,
iend,ioffset,iproc,nregsperproc
219 'RFLU_ModRegionMapping.F90')
221 IF ( global%myProcid == masterproc .AND. &
222 global%verbLevel >= verbose_med)
THEN
223 WRITE(stdout,
'(A,1X,A)') solver_name,
'Building region mapping...'
224 WRITE(stdout,
'(A,3X,A)') solver_name,
'Method: Simple'
231 nregsperproc = global%nRegions/global%nProcs
233 IF ( global%nRegions > 1 )
THEN
239 DO iproc = 1,global%nProcs
240 IF ( iproc > 1 )
THEN
241 ibeg = global%proc2RegMapInfo(2,iproc-1) + 1
246 IF ( iproc /= global%nProcs )
THEN
249 iend = global%nRegions
252 global%proc2RegMapInfo(1,iproc) =
ibeg
253 global%proc2RegMapInfo(2,iproc) =
iend
256 global%proc2RegMap(
i) =
i - ioffset
264 IF ( global%myProcid == masterproc .AND. &
265 global%verbLevel >= verbose_high )
THEN
266 WRITE(stdout,
'(A,1X,A)') solver_name,
'Building region mapping done.'
313 INTEGER :: checksum,errorflag,
i
314 INTEGER,
DIMENSION(:),
ALLOCATABLE :: proc2regmaptemp
321 'RFLU_ModRegionMapping.F90')
323 IF ( global%myProcid == masterproc .AND. &
324 global%verbLevel >= verbose_high )
THEN
325 WRITE(stdout,
'(A,1X,A)') solver_name,
'Checking region mapping...'
332 IF ( global%nRegions > 1 )
THEN
333 ALLOCATE(proc2regmaptemp(global%nRegions),stat=errorflag)
334 global%error = errorflag
335 IF ( global%error /= err_none )
THEN
336 CALL
errorstop(global,err_allocate,__line__,
'proc2RegMapTemp')
339 DO i = 1,global%nRegions
340 proc2regmaptemp(
i) = global%proc2RegMap(
i)
347 DO i = 1,global%nRegions
348 checksum = checksum + proc2regmaptemp(
i)
351 IF ( checksum /= global%nRegions*(global%nRegions+1)/2 )
THEN
352 CALL
errorstop(global,err_proc2reg_mapping,__line__)
355 DEALLOCATE(proc2regmaptemp,stat=errorflag)
356 global%error = errorflag
357 IF ( global%error /= err_none )
THEN
358 CALL
errorstop(global,err_deallocate,__line__,
'proc2RegMapTemp')
366 IF ( global%myProcid == masterproc .AND. &
367 global%verbLevel >= verbose_high )
THEN
368 WRITE(stdout,
'(A,1X,A)') solver_name,
'Checking region mapping done.'
413 CHARACTER(CHRLEN) :: ifilename
421 'RFLU_ModRegionMapping.F90')
423 IF ( global%myProcid == masterproc .AND. &
424 global%verbLevel >= verbose_high )
THEN
425 WRITE(stdout,
'(A,1X,A)') solver_name,
'Closing region mapping file...'
434 CLOSE(if_regmap,iostat=errorflag)
435 global%error = errorflag
436 IF ( global%error /= err_none )
THEN
437 CALL
errorstop(global,err_file_close,__line__,ifilename)
444 IF ( global%myProcid == masterproc .AND. &
445 global%verbLevel >= verbose_high )
THEN
446 WRITE(stdout,
'(A,1X,A)') solver_name,
'Closing region mapping file done.'
485 INTEGER,
INTENT(IN) :: maptype
499 'RFLU_ModRegionMapping.F90')
501 IF ( global%myProcid == masterproc .AND. &
502 global%verbLevel >= verbose_high )
THEN
503 WRITE(stdout,
'(A,1X,A)') solver_name,
'Creating region mapping...'
510 IF ( maptype == maptype_reg )
THEN
511 ALLOCATE(global%regMap(0:global%nRegionsLocal),stat=errorflag)
512 global%error = errorflag
513 IF ( global%error /= err_none )
THEN
514 CALL
errorstop(global,err_allocate,__line__,
'global%regMap')
516 ELSE IF ( maptype == maptype_proc2reg )
THEN
517 ALLOCATE(global%proc2RegMap(global%nRegions),stat=errorflag)
518 global%error = errorflag
519 IF ( global%error /= err_none )
THEN
520 CALL
errorstop(global,err_allocate,__line__,
'global%proc2RegMap')
523 ALLOCATE(global%proc2RegMapInfo(2,global%nProcs),stat=errorflag)
524 global%error = errorflag
525 IF ( global%error /= err_none )
THEN
526 CALL
errorstop(global,err_allocate,__line__,
'global%proc2RegMapInfo')
529 CALL
errorstop(global,err_reached_default,__line__)
536 IF ( global%myProcid == masterproc .AND. &
537 global%verbLevel >= verbose_high )
THEN
538 WRITE(stdout,
'(A,1X,A)') solver_name,
'Creating region mapping done.'
577 INTEGER,
INTENT(IN) :: maptype
591 'RFLU_ModRegionMapping.F90')
593 IF ( global%myProcid == masterproc .AND. &
594 global%verbLevel >= verbose_high )
THEN
595 WRITE(stdout,
'(A,1X,A)') solver_name,
'Destroying region mapping...'
602 IF ( maptype == maptype_reg )
THEN
603 DEALLOCATE(global%regMap,stat=errorflag)
604 global%error = errorflag
605 IF ( global%error /= err_none )
THEN
606 CALL
errorstop(global,err_deallocate,__line__,
'global%regMap')
608 ELSE IF ( maptype == maptype_proc2reg )
THEN
609 DEALLOCATE(global%proc2RegMap,stat=errorflag)
610 global%error = errorflag
611 IF ( global%error /= err_none )
THEN
612 CALL
errorstop(global,err_deallocate,__line__,
'global%proc2RegMap')
615 DEALLOCATE(global%proc2RegMapInfo,stat=errorflag)
616 global%error = errorflag
617 IF ( global%error /= err_none )
THEN
618 CALL
errorstop(global,err_deallocate,__line__,
'global%proc2RegMapInfo')
621 CALL
errorstop(global,err_reached_default,__line__)
628 IF ( global%myProcid == masterproc .AND. &
629 global%verbLevel >= verbose_high )
THEN
630 WRITE(stdout,
'(A,1X,A)') solver_name,
'Destroying region mapping done.'
674 INTEGER,
INTENT(IN) :: nregids
675 INTEGER,
INTENT(IN) :: regids(nregids)
676 INTEGER,
INTENT(OUT) :: locregids(nregids),procids(nregids)
683 CHARACTER(CHRLEN) :: sectionstring,targetstring
684 INTEGER :: errorflag,ifile,iproc,ireg,iregid,iregid2,nprocs,nregionsglobal, &
692 'RFLU_ModRegionMapping.F90')
704 DO iregid = 1,nregids
705 procids(iregid) = crazy_value_int
706 locregids(iregid) = crazy_value_int
713 DO iregid = 1,nregids
720 READ(ifile,
'(A)') sectionstring
721 IF ( trim(sectionstring) /=
'# ROCFLU region mapping file' )
THEN
722 CALL
errorstop(global,err_invalid_marker,__line__,trim(sectionstring))
729 READ(ifile,
'(A)') sectionstring
730 IF ( trim(sectionstring) /=
'# Number of regions' )
THEN
731 CALL
errorstop(global,err_invalid_marker,__line__,trim(sectionstring))
734 READ(ifile,*) nregionsglobal
736 IF ( nregionsglobal /= global%nRegions )
THEN
737 CALL
errorstop(global,err_nregions_mismatch,__line__)
740 READ(ifile,
'(A)') sectionstring
741 IF ( trim(sectionstring) /=
'# Number of processes' )
THEN
742 CALL
errorstop(global,err_invalid_marker,__line__,trim(sectionstring))
747 IF ( nprocs /= global%nProcs )
THEN
748 CALL
errorstop(global,err_nprocs_mismatch,__line__)
755 procloop:
DO iproc = 0,global%nProcs-1
756 WRITE(targetstring,
'(A,1X,I6.6)')
'# Process',iproc+1
758 READ(ifile,
'(A)') sectionstring
760 IF ( trim(sectionstring) /= trim(targetstring) )
THEN
761 CALL
errorstop(global,err_invalid_marker,__line__,trim(sectionstring))
764 READ(ifile,*) nregionslocal
766 DO ireg = 1,nregionslocal
767 READ(ifile,*) iregid2
769 IF ( iregid2 == regids(iregid) )
THEN
770 procids(iregid) = iproc+1
771 locregids(iregid) = ireg
830 INTEGER :: errorflag,ireg
837 'RFLU_ModRegionMapping.F90')
839 IF ( global%myProcid == masterproc .AND. &
840 global%verbLevel >= verbose_high )
THEN
841 WRITE(stdout,
'(A,1X,A)') solver_name,
'Imposing serial region mapping...'
848 DO ireg = 0,global%nRegionsLocal
849 global%regMap(ireg) = ireg
852 IF ( global%nRegionsLocal == 1 )
THEN
860 IF ( global%myProcid == masterproc .AND. &
861 global%verbLevel >= verbose_high )
THEN
862 WRITE(stdout,
'(A,1X,A)') solver_name,
'Imposing serial region mapping done.'
907 CHARACTER(CHRLEN) :: ifilename
915 'RFLU_ModRegionMapping.F90')
917 IF ( global%myProcid == masterproc .AND. &
918 global%verbLevel >= verbose_high )
THEN
919 WRITE(stdout,
'(A,1X,A)') solver_name,
'Opening region mapping file...'
928 OPEN(if_regmap,file=ifilename,
form=
"FORMATTED",
status=
"UNKNOWN", &
930 global%error = errorflag
931 IF ( global%error /= err_none )
THEN
932 CALL
errorstop(global,err_file_open,__line__,ifilename)
939 IF ( global%myProcid == masterproc .AND. &
940 global%verbLevel >= verbose_high )
THEN
941 WRITE(stdout,
'(A,1X,A)') solver_name,
'Opening region mapping file done.'
993 INTEGER,
INTENT(IN) :: myprocid,readmode
1000 LOGICAL :: fileexists,foundentry
1001 CHARACTER(CHRLEN) :: dummystring,ifilename,sectionstring,targetstring
1002 INTEGER :: errorflag,ifile,iproc,ireg,nregions
1009 'RFLU_ModRegionMapping.F90')
1011 IF ( global%myProcid == masterproc )
THEN
1012 IF ( global%verbLevel >= verbose_high )
THEN
1013 WRITE(stdout,
'(A,1X,A)') solver_name,
'Reading region mapping file...'
1015 IF ( global%verbLevel >= verbose_med )
THEN
1016 IF ( readmode == mapfile_readmode_all )
THEN
1017 WRITE(stdout,
'(A,3X,A)') solver_name,
'Read mode: All'
1018 ELSE IF ( readmode == mapfile_readmode_peek )
THEN
1019 WRITE(stdout,
'(A,3X,A)') solver_name,
'Read mode: Peek'
1021 CALL
errorstop(global,err_reached_default,__line__)
1035 INQUIRE(file=ifilename,exist=fileexists)
1041 IF ( fileexists .EQV. .true. )
THEN
1042 IF ( global%myProcid == masterproc .AND. &
1043 global%verbLevel >= verbose_high )
THEN
1044 WRITE(stdout,
'(A,3X,A)') solver_name,
'Mapping file found.'
1053 READ(ifile,
'(A)') sectionstring
1054 IF ( trim(sectionstring) /=
'# ROCFLU region mapping file' )
THEN
1055 CALL
errorstop(global,err_invalid_marker,__line__,trim(sectionstring))
1062 READ(ifile,
'(A)') sectionstring
1063 IF ( trim(sectionstring) /=
'# Number of regions' )
THEN
1064 CALL
errorstop(global,err_invalid_marker,__line__,trim(sectionstring))
1067 READ(ifile,*) global%nRegions
1069 READ(ifile,
'(A)') sectionstring
1070 IF ( trim(sectionstring) /=
'# Number of processes' )
THEN
1071 CALL
errorstop(global,err_invalid_marker,__line__,trim(sectionstring))
1074 READ(ifile,*) global%nProcs
1080 DO iproc = 0,global%nProcs-1
1081 foundentry = .false.
1083 WRITE(targetstring,
'(A,1X,I6.6)')
'# Process',iproc+1
1084 READ(ifile,
'(A)') sectionstring
1086 IF ( trim(sectionstring) /= trim(targetstring) )
THEN
1087 CALL
errorstop(global,err_invalid_marker,__line__,trim(sectionstring))
1090 READ(ifile,*) nregions
1092 IF ( iproc == myprocid )
THEN
1095 global%nRegionsLocal = nregions
1098 IF ( (foundentry .EQV. .true.) .AND. &
1099 (readmode == mapfile_readmode_all) )
THEN
1100 global%regMap(0) = 0
1102 DO ireg = 1,global%nRegionsLocal
1103 READ(ifile,*) global%regMap(ireg)
1106 DO ireg = 1,nregions
1107 READ(ifile,
'(A)') dummystring
1112 READ(ifile,
'(A)') sectionstring
1113 IF ( trim(sectionstring) /=
'# End' )
THEN
1114 CALL
errorstop(global,err_invalid_marker,__line__,trim(sectionstring))
1123 ELSE IF ( (fileexists .EQV. .false.) .AND. (global%nProcAlloc == 1) )
THEN
1124 global%warnCounter = global%warnCounter + 1
1126 IF ( global%myProcid == masterproc .AND. &
1127 global%verbLevel >= verbose_none )
THEN
1128 WRITE(stdout,
'(A,3X,A,1X,A)') solver_name,
'*** WARNING ***', &
1129 'Mapping file not found.'
1130 WRITE(stdout,
'(A,3X,A,1X,A)') solver_name,
'Initializing for', &
1131 'single-process run.'
1136 global%nRegionsLocal = 1
1143 CALL
errorstop(global,err_file_exist,__line__,trim(ifilename))
1150 IF ( global%myProcid == masterproc .AND. &
1151 global%verbLevel >= verbose_high )
THEN
1152 WRITE(stdout,
'(A,1X,A)') solver_name,
'Reading region mapping file done.'
1208 'RFLU_ModRegionMapping.F90')
1210 IF ( global%myProcid == masterproc .AND. &
1211 global%verbLevel >= verbose_high )
THEN
1212 WRITE(stdout,
'(A,1X,A)') solver_name,
'Setting serial region mapping...'
1219 global%nRegionsLocal = global%nRegions
1225 IF ( global%myProcid == masterproc .AND. &
1226 global%verbLevel >= verbose_high )
THEN
1227 WRITE(stdout,
'(A,1X,A)') solver_name,
'Setting serial region mapping done.'
1280 'RFLU_ModRegionMapping.F90')
1282 IF ( global%myProcid == masterproc .AND. &
1283 global%verbLevel >= verbose_high )
THEN
1284 WRITE(stdout,
'(A,1X,A)') solver_name,
'Writing region mapping file...'
1291 WRITE(if_regmap,
'(A)')
'# ROCFLU region mapping file'
1293 WRITE(if_regmap,
'(A)')
'# Number of regions'
1294 WRITE(if_regmap,
'(I7)') global%nRegions
1296 WRITE(if_regmap,
'(A)')
'# Number of processes'
1297 WRITE(if_regmap,
'(I7)') global%nProcs
1299 DO iproc = 1,global%nProcs
1300 WRITE(if_regmap,
'(A,1X,I6.6)')
'# Process',iproc
1302 ibeg = global%proc2RegMapInfo(1,iproc)
1303 iend = global%proc2RegMapInfo(2,iproc)
1305 WRITE(if_regmap,
'(I7)')
iend -
ibeg + 1
1308 WRITE(if_regmap,
'(I7)') global%proc2RegMap(
i)
1312 WRITE(if_regmap,
'(A)')
'# End'
1318 IF ( global%myProcid == masterproc .AND. &
1319 global%verbLevel >= verbose_high )
THEN
1320 WRITE(stdout,
'(A,1X,A)') solver_name,
'Writing region mapping file done.'
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE ibeg
subroutine, public rflu_openregionmappingfile(global)
subroutine, public rflu_destroyregionmapping(global, mapType)
subroutine registerfunction(global, funName, fileName)
int status() const
Obtain the status of the attribute.
subroutine quicksortinteger(a, n)
subroutine, public rflu_setregionmappingserial(global)
subroutine buildfilenameplain(global, dest, ext, fileName)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
subroutine, public rflu_closeregionmappingfile(global)
subroutine, public rflu_buildregionmappingsimple(global)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE form
subroutine, public rflu_readregionmappingfile(global, readMode, myProcId)
subroutine, public rflu_writeregionmappingfile(global)
subroutine, public rflu_getproclocregids(global, regIds, nRegIds, procIds, locRegIds)
subroutine, public rflu_checkregionmapping(global)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine deregisterfunction(global)
subroutine, public rflu_applyregionmapping(global, levels)
subroutine, public rflu_imposeregionmappingserial(global)
subroutine, public rflu_createregionmapping(global, mapType)