ESyS-Particle  4.0.1
cart_comm.h
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 
00013 #ifndef __CARTCOMM_H
00014 #define __CARTCOMM_H
00015 
00016 //--- MPI ---
00017 #include <mpi.h>
00018 
00019 //--- project includes ---
00020 #include "tml/comm/comm.h"
00021 
00022 //--- STL ---
00023 #include <vector>
00024 using std::vector;
00033 class TML_CartComm : public TML_Comm
00034 {
00035 private:
00036   int m_ndims;
00037   vector<int> m_dims;
00038  
00039  public:
00040   // constructor
00041   TML_CartComm(TML_Comm *comm, vector<unsigned int> dims, vector<bool> circular);
00042   TML_CartComm(TML_Comm *comm, unsigned int ndims, const vector<int> &dims, const vector<bool> &circular);
00043   TML_CartComm(TML_Comm*,unsigned int,int*,int*);
00044 
00045   vector<int> get_coords(int); 
00046   vector<int> get_coords() const; 
00047   vector<int> get_all_dims() const; 
00048   int get_dim(int); 
00049   int get_ndim() const {return m_ndims;}; 
00050 
00052   template <typename T,typename P> void shift(T,P&,int,int,int=0);
00053   template <typename T,typename P> void shift_array(T*,int,P*,int,int,int,int=0);
00054   template <typename T,typename P> void shift_cont(T,P&,int,int,int=0);
00055 
00057   template <typename T,typename P> void shift_packed(T,P&,int,int,int=0);
00058   template <typename T,typename P> void shift_array_packed(T*,int,P*,int,int,int,int=0);
00059   template <typename T,typename P> void shift_cont_packed(T,P&,int,int,int=0);
00060   // shift_replace ops?
00061 };
00062 
00063 #include "tml/comm/cart_comm.hpp"
00064 
00065 #endif // __CARTCOMM_H