Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
layout.h
Go to the documentation of this file.
1 
14 #ifndef LAYOUT_INCLUDED
15 #define LAYOUT_INCLUDED
16 
17 #include "communicator_mpi.h"
19 
21 
29  public:
30 
31  static int grid_rank(int *rank, const int *gcoord);
32  static int grid_coord(int *gcoord, const int rank);
33  static int grid_dims(int *gdims);
34 
35  static int ipe(const int idir);
36  static int npe(const int idir);
37 
38  static int tag(int rank, int idir, int ipm);
39 
40  static int layout_setup();
41  static int layout_setup(
42  const std::vector<int>& lattice_size,
43  std::vector<int>& grid_size);
44  static int layout_delete();
45 
46  static int m_ndim;
47  static int *m_dims;
48 
49  // logical layout
50  static int *m_grid_dims;
51  static int *m_grid_coord;
52 
53  static int *m_ipe_up;
54  static int *m_ipe_dn;
55 
56  // physical mapping
57  static char m_map_grid[16];
58  static int *m_physical_to_logical;
59 
60  static int physical_map_setup();
61  static int physical_map_delete();
62 
63  // subdimensional-slices
64  static MPI_Comm *m_sub_comm;
65 
66  static int subgrid_setup();
67  static int subgrid_delete();
68 
69  private:
70  Layout() {}
71  Layout(const Layout&) {}
72  Layout& operator=(const Layout&);
73 };
74 
75 /*
76  struct LogicalLayout {
77  int ndim;
78  int *dims; // global lattice size
79 
80  int *grid_dims; // number of division along axis
81  int *grid_coord; // logical grid coord
82 
83  int *ipe_up; // rank of upward neighbour along ith axis
84  int *ipe_dn; // rank of downward neighbour along ith axis
85 
86  MPI_Comm *sub_comm; // communicator of reduced dimensions
87  };
88 
89  static LogicalLayout m_layout;
90 
91  static int layout_setup ();
92  static int layout_delete ();
93 
94  static int subgrid_setup ();
95  static int subgrid_delete ();
96 
97  static int physical_map_setup ();
98  static int physical_map_delete ();
99 */
100 #endif /* m__COMMUNICATOR_MPI_LAYOUT_H */
static int layout_setup()
initialise layout.
Definition: layout.cpp:93
static int grid_coord(int *gcoord, const int rank)
find grid coordinate corresponding to rank.
static char m_map_grid[16]
Definition: layout.h:57
static int * m_ipe_up
rank of upward neighbour in directions.
Definition: layout.h:53
static int subgrid_setup()
Definition: layout.cpp:258
static int * m_ipe_dn
rank of downward neighbour in directions.
Definition: layout.h:54
static int * m_dims
lattice extent (Lx, Ly, Lz, Lt)
Definition: layout.h:47
static int subgrid_delete()
Definition: layout.cpp:297
static int grid_rank(int *rank, const int *gcoord)
find rank from grid coordinate.
static int * m_grid_dims
grid dimensions in directions.
Definition: layout.h:50
static int npe(const int idir)
grid size in idir direction.
Definition: layout.cpp:50
static int grid_dims(int *gdims)
find grid size.
Definition: layout.cpp:57
static MPI_Comm * m_sub_comm
subgrid
Definition: layout.h:64
static int * m_grid_coord
grid coordinate.
Definition: layout.h:51
Layout class for logical organisation of parallel nodes.
Definition: layout.h:28
Layout()
constructor is hidden as private; no instantiation.
Definition: layout.h:70
static int ipe(const int idir)
grid coordinate along idir direction.
Definition: layout.cpp:43
static int tag(int rank, int idir, int ipm)
generate tag for communication.
Definition: layout.cpp:68
static int layout_delete()
destroy layout and clean up.
Definition: layout.cpp:240
static int * m_physical_to_logical
map between physical and logical grid
Definition: layout.h:58
static int m_ndim
number of dimensions.
Definition: layout.h:46
static int physical_map_delete()
Layout & operator=(const Layout &)
assignment is hidden as private.
static int physical_map_setup()
Layout(const Layout &)
copy constructor is hidden as private; no instantiation.
Definition: layout.h:71