ESyS-Particle  4.0.1
cart_comm.h
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 
13 #ifndef __CARTCOMM_H
14 #define __CARTCOMM_H
15 
16 //--- MPI ---
17 #include <mpi.h>
18 
19 //--- project includes ---
20 #include "tml/comm/comm.h"
21 
22 //--- STL ---
23 #include <vector>
24 using std::vector;
33 class TML_CartComm : public TML_Comm
34 {
35 private:
36  int m_ndims;
37  vector<int> m_dims;
38 
39  public:
40  // constructor
41  TML_CartComm(TML_Comm *comm, vector<unsigned int> dims, vector<bool> circular);
42  TML_CartComm(TML_Comm *comm, unsigned int ndims, const vector<int> &dims, const vector<bool> &circular);
43  TML_CartComm(TML_Comm*,unsigned int,int*,int*);
44 
45  vector<int> get_coords(int);
46  vector<int> get_coords() const;
47  vector<int> get_all_dims() const;
48  int get_dim(int);
49  int get_ndim() const {return m_ndims;};
50 
52  template <typename T,typename P> void shift(T,P&,int,int,int=0);
53  template <typename T,typename P> void shift_array(T*,int,P*,int,int,int,int=0);
54  template <typename T,typename P> void shift_cont(T,P&,int,int,int=0);
55 
57  template <typename T,typename P> void shift_packed(T,P&,int,int,int=0);
58  template <typename T,typename P> void shift_array_packed(T*,int,P*,int,int,int,int=0);
59  template <typename T,typename P> void shift_cont_packed(T,P&,int,int,int=0);
60  // shift_replace ops?
61 };
62 
63 #include "tml/comm/cart_comm.hpp"
64 
65 #endif // __CARTCOMM_H