/[MITgcm]/MITgcm/pkg/compon_communic/couprecv_r8tiles.F
ViewVC logotype

Contents of /MITgcm/pkg/compon_communic/couprecv_r8tiles.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Mon Dec 15 02:35:29 2003 UTC (20 years, 5 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint58l_post, checkpoint57t_post, checkpoint57o_post, checkpoint52l_pre, checkpoint52e_pre, hrcube4, checkpoint58e_post, checkpoint57v_post, checkpoint52n_post, checkpoint52j_post, checkpoint53d_post, checkpoint58u_post, checkpoint58w_post, checkpoint54a_pre, checkpoint57m_post, checkpoint55c_post, checkpoint54e_post, checkpoint52e_post, checkpoint57s_post, checkpoint54a_post, checkpoint53c_post, checkpoint57k_post, checkpoint55d_pre, checkpoint57d_post, checkpoint57g_post, checkpoint57b_post, checkpoint57c_pre, checkpoint58r_post, checkpoint55j_post, checkpoint56b_post, checkpoint57i_post, checkpoint57y_post, checkpoint57e_post, checkpoint52l_post, checkpoint55h_post, checkpoint58n_post, checkpoint58x_post, checkpoint52k_post, checkpoint57g_pre, checkpoint54b_post, checkpoint53b_pre, checkpoint55b_post, checkpoint58t_post, checkpoint58h_post, checkpoint54d_post, checkpoint56c_post, checkpoint52m_post, checkpoint57y_pre, checkpoint55, checkpoint53a_post, checkpoint57f_pre, checkpoint57a_post, checkpoint54, checkpoint58q_post, checkpoint54f_post, checkpoint53b_post, checkpoint55g_post, checkpoint58j_post, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint55f_post, checkpoint59c, checkpoint59b, checkpoint59h, checkpoint57r_post, checkpoint59, checkpoint58, checkpoint57a_pre, checkpoint55i_post, checkpoint57, checkpoint56, checkpoint53, checkpoint52d_post, eckpoint57e_pre, checkpoint57h_done, checkpoint58f_post, checkpoint53g_post, checkpoint52f_post, checkpoint57x_post, checkpoint57n_post, checkpoint58d_post, checkpoint58c_post, checkpoint57w_post, checkpoint57p_post, checkpint57u_post, checkpoint57f_post, checkpoint58a_post, checkpoint58i_post, checkpoint57q_post, checkpoint58g_post, hrcube5, checkpoint58o_post, checkpoint57z_post, checkpoint57c_post, checkpoint58y_post, checkpoint55e_post, checkpoint58k_post, checkpoint52i_post, checkpoint52j_pre, checkpoint58v_post, checkpoint53f_post, checkpoint55a_post, checkpoint53d_pre, checkpoint54c_post, checkpoint58s_post, checkpoint58p_post, checkpoint57j_post, checkpoint58b_post, checkpoint57h_pre, checkpoint58m_post, checkpoint57l_post, checkpoint52i_pre, checkpoint52h_pre, checkpoint52f_pre, checkpoint57h_post, hrcube_2, hrcube_3, checkpoint56a_post, checkpoint55d_post
coupler - multi-components interface: low-level communication S/R package.

1 !=======================================================================
2 subroutine couprecv_r8tiles( component, dataname, Nx, Ny, arr )
3 implicit none
4 ! Arguments
5 character*(*) component
6 character*(*) dataname
7 integer Nx,Ny
8 real*8 arr(Nx,Ny)
9 ! Predefined constants/arrays
10 #include "CPLR_SIG.h"
11 ! MPI variables
12 #include "mpif.h"
13 integer count,dtype,rank,tag,comm,ierr
14 integer stat(MPI_STATUS_SIZE)
15 ! Functions
16 integer mitcplr_match_comp
17 integer generate_tag
18 ! Local
19 integer compind,numprocs
20 integer i,j,ij,n,bibj
21 integer Ni,Io,Nj,Jo
22 character*(MAXLEN_COMP_NAME) recvdname
23 ! ------------------------------------------------------------------
24
25 ! Establish who I am communicating with
26 compind=mitcplr_match_comp( component )
27 if (compind.le.0) stop 'couprecv_r8tiles: Bad component id'
28 comm=MPI_COMM_compcplr( compind )
29 numprocs=num_component_procs(compind)
30 if (numprocs.lt.1) then
31 write(LogUnit,*) 'couprecv_r8tiles: compind = ',compind
32 stop 'couprecv_r8tiles: numprocs < 1'
33 endif
34 if (VERB)
35 & write(LogUnit,*) 'couprecv_r8tiles: ',component_Name(compind)
36 if (VERB)
37 & write(LogUnit,*) 'couprecv_r8tiles: dataname=',dataname
38
39 ! Foreach component process
40 do n=1,numprocs
41
42 ! Foreach tile within process
43 do bibj=1,component_num_tiles(n,compind)
44
45 ! Receive message
46 count=MAX_R8_BUFLEN
47 dtype=MPI_DOUBLE_PRECISION
48 tag=generate_tag(103,bibj,dataname)
49 rank=rank_component_procs(n,compind)
50
51 if (VERB) then
52 write(LogUnit,*)
53 & 'couprecv_r8tiles: calling MPI_Recv rank=',rank,
54 & ' proc=',n,'/',numprocs,' tile=',bibj
55 call flush(LogUnit)
56 endif
57 call MPI_Recv(r8buf, count, dtype, rank, tag, comm, stat, ierr)
58 if (VERB) then
59 write(LogUnit,*) 'couprecv_r8tiles: returned ierr=',ierr
60 call flush(LogUnit)
61 endif
62
63 if (ierr.ne.0) then
64 write(LogUnit,*) 'couprecv_r8tiles: rank(W,G)=',
65 & my_rank_in_world,my_rank_in_global,
66 & ' ierr=',ierr
67 stop 'couprecv_r8tiles: MPI_Recv failed'
68 endif
69
70 ! Extract header
71 Io=int(0.5+r8buf(1))
72 Ni=int(0.5+r8buf(2))
73 Jo=int(0.5+r8buf(3))
74 Nj=int(0.5+r8buf(4))
75
76 if (Io+Ni-1.gt.Nx .or. Io.lt.1) then
77 write(LogUnit,*) 'couprecv_r8tiles: Io,Ni=',Io,Ni
78 stop 'couprecv_r8tiles: Incompatible header/target array'
79 endif
80 if (Jo+Nj-1.gt.Ny .or. Jo.lt.1) then
81 write(LogUnit,*) 'couprecv_r8tiles: Jo,Nj=',Jo,Nj
82 stop 'couprecv_r8tiles: Incompatible header/target array'
83 endif
84 if (Io.ne.component_tile_i0(bibj,n,compind))
85 & stop 'couprecv_r8tiles: Io != component_tile_i0'
86 if (Jo.ne.component_tile_j0(bibj,n,compind))
87 & stop 'couprecv_r8tiles: Jo != component_tile_j0'
88 if (Ni.ne.component_tile_nx(bibj,n,compind))
89 & stop 'couprecv_r8tiles: Ni != component_tile_nx'
90 if (Nj.ne.component_tile_ny(bibj,n,compind))
91 & stop 'couprecv_r8tiles: Nj != component_tile_ny'
92
93 call mitcplr_real2char( r8buf(9), recvdname )
94 if (recvdname .ne. dataname) then
95 write(LogUnit,*) 'couprecv_r8tiles: recvdname = ',recvdname
96 write(LogUnit,*) 'couprecv_r8tiles: dataname = ',dataname
97 stop 'couprecv_r8tiles: recvdname != dataname'
98 endif
99
100 ! Extract data
101 do j=1,Nj
102 do i=1,Ni
103 ij=HEADER_SIZE+i+Ni*(j-1)
104 arr(Io+i-1,Jo+j-1)=r8buf(ij)
105 enddo
106 enddo
107
108 enddo ! bibj
109
110 enddo ! n
111
112 ! ------------------------------------------------------------------
113 return
114 end
115 !=======================================================================

  ViewVC Help
Powered by ViewVC 1.1.22