ESyS-Particle  4.0.1
cart_comm.hpp
00001 
00002 //                                                         //
00003 // Copyright (c) 2003-2011 by The University of Queensland //
00004 // Earth Systems Science Computational Centre (ESSCC)      //
00005 // http://www.uq.edu.au/esscc                              //
00006 //                                                         //
00007 // Primary Business: Brisbane, Queensland, Australia       //
00008 // Licensed under the Open Software License version 3.0    //
00009 // http://www.opensource.org/licenses/osl-3.0.php          //
00010 //                                                         //
00012 
00022 template <typename T,typename P> 
00023 void TML_CartComm::shift(T send_data,P& recv_data,int dir,int dist,int tag)
00024 {
00025   int source,dest;
00026 
00027   if(dir<m_ndims){
00028     MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
00029     sendrecv(send_data,recv_data,dest,source,tag);
00030   }
00031 }
00032 
00044 template <typename T,typename P> 
00045 void TML_CartComm::shift_array(T* send_data,int send_count,P* recv_data,int recv_count,int dir,int dist,int tag)
00046 {
00047   int source,dest;
00048 
00049   if(dir<m_ndims){
00050     MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
00051     sendrecv(send_data,send_count,recv_data,recv_count,dest,source,tag);
00052   }
00053 }
00054 
00055 
00065 template <typename T,typename P> 
00066 void TML_CartComm::shift_cont(T send_data,P& recv_data,int dir,int dist,int tag)
00067 {
00068   int source,dest;
00069 
00070   if(dir<m_ndims){
00071     MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
00072     sendrecv_cont(send_data,recv_data,dest,source,tag);
00073   }
00074 }
00075 
00085 template <typename T,typename P> 
00086 void TML_CartComm::shift_packed(T send_data,P& recv_data,int dir,int dist,int tag)
00087 {
00088   int source,dest;
00089 
00090   if(dir<m_ndims){
00091     MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
00092     sendrecv_packed(send_data,recv_data,dest,source,tag);
00093   }
00094 }
00095 
00107 template <typename T,typename P> 
00108 void TML_CartComm::shift_array_packed(T* send_data,int send_count,P* recv_data,int recv_count,int dir,int dist,int tag)
00109 {
00110   int source,dest;
00111 
00112   if(dir<m_ndims){
00113     MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
00114     sendrecv_array_packed(send_data,send_count,recv_data,recv_count,dest,source,tag);
00115   }
00116 }
00117 
00118 
00128 template <typename T,typename P> 
00129 void TML_CartComm::shift_cont_packed(T send_data,P& recv_data,int dir,int dist,int tag)
00130 {
00131   int source,dest;
00132 
00133   if(dir<m_ndims){
00134     MPI_Cart_shift(m_comm,dir,dist,&source,&dest);
00135     sendrecv_cont_packed(send_data,recv_data,dest,source,false,tag);
00136   }
00137 }