ESyS-Particle  2.3
cart_comm.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
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
class for a cartesian communicator
Definition: cart_comm.h:33
int get_ndim() const
Definition: cart_comm.h:49
vector< int > m_dims
Definition: cart_comm.h:37
TML_CartComm(TML_Comm *comm, vector< unsigned int > dims, vector< bool > circular)
Definition: cart_comm.cpp:30
vector< int > get_coords() const
get own coords
Definition: cart_comm.cpp:174
void shift_packed(T, P &, int, int, int=0)
packed shift ops
Definition: cart_comm.hpp:86
MPI_Comm comm() const
Definition: comm.h:56
void shift(T, P &, int, int, int=0)
shift ops
Definition: cart_comm.hpp:23
abstract base class for communicator
Definition: comm.h:46
void shift_cont(T, P &, int, int, int=0)
Definition: cart_comm.hpp:66
vector< int > get_all_dims() const
get size of communicator in all directions
Definition: cart_comm.cpp:189
int m_ndims
Definition: cart_comm.h:36
void shift_array(T *, int, P *, int, int, int, int=0)
Definition: cart_comm.hpp:45
void shift_cont_packed(T, P &, int, int, int=0)
Definition: cart_comm.hpp:129
void shift_array_packed(T *, int, P *, int, int, int, int=0)
Definition: cart_comm.hpp:108
int get_dim(int)
get size of communicator in one direction
Definition: cart_comm.cpp:205