1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
!======================================================================= |
5 |
subroutine comprecv_i4vec( dataname, length, vecFld ) |
6 |
implicit none |
7 |
! Predefined constants/arrays |
8 |
#include "CPLR_SIG.h" |
9 |
! MPI variables |
10 |
#include "mpif.h" |
11 |
! Arguments |
12 |
character*(*) dataname |
13 |
integer length |
14 |
integer vecFld(length) |
15 |
! Functions |
16 |
integer generate_tag |
17 |
external generate_tag |
18 |
! Local |
19 |
integer count,dtype,rank,tag,comm,ierr |
20 |
integer stat(MPI_STATUS_SIZE) |
21 |
integer i, j |
22 |
integer ibuf(MAX_IBUF) |
23 |
! ------------------------------------------------------------------ |
24 |
|
25 |
if ( 1+length .gt. MAX_IBUF ) |
26 |
& STOP 'comprecv_i4vec: length exceeds MAX_IBUF' |
27 |
|
28 |
! Receive message |
29 |
count = MAX_IBUF |
30 |
dtype = MPI_INTEGER |
31 |
rank = my_coupler_rank |
32 |
tag = generate_tag( 125, my_rank_in_global, dataname ) |
33 |
comm = MPI_COMM_myglobal |
34 |
|
35 |
if (VERB) then |
36 |
write(LogUnit,*) |
37 |
& 'comprecv_i4vec: calling MPI_Recv rank=',rank |
38 |
write(LogUnit,*) 'comprecv_i4vec: dataname=',dataname |
39 |
call flush(LogUnit) |
40 |
endif |
41 |
call MPI_Recv( ibuf, count, dtype, rank, tag, comm, stat, ierr ) |
42 |
if (VERB) then |
43 |
write(LogUnit,*) 'comprecv_i4vec: returned ierr=',ierr |
44 |
call flush(LogUnit) |
45 |
endif |
46 |
|
47 |
if (ierr.ne.0) then |
48 |
write(LogUnit,*) 'comprecv_i4vec: rank(W,G,L)=', |
49 |
& my_rank_in_world,my_rank_in_global,my_rank_in_local, |
50 |
& ' ierr=',ierr |
51 |
STOP 'comprecv_i4vec: MPI_Recv failed' |
52 |
endif |
53 |
|
54 |
! Check header |
55 |
j = ibuf(1) |
56 |
if ( j.ne.length ) then |
57 |
write(LogUnit,*) 'comprecv_i4vec: length,header=', length, j |
58 |
STOP 'comprecv_i4vec: Incompatible header' |
59 |
endif |
60 |
|
61 |
! Extract data |
62 |
do i=1,length |
63 |
vecFld(i) = ibuf(i+1) |
64 |
enddo |
65 |
|
66 |
! ------------------------------------------------------------------ |
67 |
return |
68 |
end |
69 |
!======================================================================= |