ESyS-Particle  4.0.1
cart_comm.hpp
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
22 template <typename T,typename P>
23 void TML_CartComm::shift(T send_data,P& recv_data,int dir,int dist,int tag)
24 {
25  int source,dest;
26 
27  if(dir<m_ndims){
28  MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
29  sendrecv(send_data,recv_data,dest,source,tag);
30  }
31 }
32 
44 template <typename T,typename P>
45 void TML_CartComm::shift_array(T* send_data,int send_count,P* recv_data,int recv_count,int dir,int dist,int tag)
46 {
47  int source,dest;
48 
49  if(dir<m_ndims){
50  MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
51  sendrecv(send_data,send_count,recv_data,recv_count,dest,source,tag);
52  }
53 }
54 
55 
65 template <typename T,typename P>
66 void TML_CartComm::shift_cont(T send_data,P& recv_data,int dir,int dist,int tag)
67 {
68  int source,dest;
69 
70  if(dir<m_ndims){
71  MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
72  sendrecv_cont(send_data,recv_data,dest,source,tag);
73  }
74 }
75 
85 template <typename T,typename P>
86 void TML_CartComm::shift_packed(T send_data,P& recv_data,int dir,int dist,int tag)
87 {
88  int source,dest;
89 
90  if(dir<m_ndims){
91  MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
92  sendrecv_packed(send_data,recv_data,dest,source,tag);
93  }
94 }
95 
107 template <typename T,typename P>
108 void TML_CartComm::shift_array_packed(T* send_data,int send_count,P* recv_data,int recv_count,int dir,int dist,int tag)
109 {
110  int source,dest;
111 
112  if(dir<m_ndims){
113  MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
114  sendrecv_array_packed(send_data,send_count,recv_data,recv_count,dest,source,tag);
115  }
116 }
117 
118 
128 template <typename T,typename P>
129 void TML_CartComm::shift_cont_packed(T send_data,P& recv_data,int dir,int dist,int tag)
130 {
131  int source,dest;
132 
133  if(dir<m_ndims){
134  MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
135  sendrecv_cont_packed(send_data,recv_data,dest,source,false,tag);
136  }
137 }