source: src/comm/mpi/comm_info.hpp@ 97c25dd

Last change on this file since 97c25dd was 2112b1, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Did some work on the MPI communication.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1245 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file comm_info.hpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Nov 21 13:27:22 2011
5 *
6 * @brief Stores some MPI-relevant information.
7 *
8 */
9
10#ifndef COMM_INFO_HPP_
11#define COMM_INFO_HPP_
12
13#ifndef HAVE_MPI
14#error MPI is needed to compile this class
15#endif
16
17#include <mpi.h>
18
19#include <map>
20
21#include "base/tuple.hpp"
22#include "comm/mpi/key.hpp"
23
24namespace VMG
25{
26
27class Index;
28class Grid;
29class GridIteratorSet;
30
31namespace MPI
32{
33
34class CommInfo
35{
36public:
37 CommInfo();
38 virtual ~CommInfo();
39
40 MPI_Comm GetCommunicator(const Grid& grid);
41 MPI_Comm GetUnionCommunicator(const Grid& grid_1, const Grid& grid_2);
42
43 MPI_Datatype GetDatatypeSubarray(const Grid& grid, const GridIteratorSet& bounds);
44 MPI_Datatype GetDatatypeSubarray(const Index& begin, const Index& end, const Index& size_total);
45
46 Index Pos(const Grid& grid);
47 Index Procs(const Grid& grid);
48
49 void SetCommGlobal(MPI_Comm& comm_global_)
50 {
51 comm_global = comm_global_;
52 }
53
54private:
55 std::map<Key, MPI_Comm> communicators;
56 std::map<Key, MPI_Datatype> datatypes;
57
58 MPI_Comm comm_global;
59 int max_level;
60
61 static Index GetGlobalDims(MPI_Comm comm, Index pos);
62};
63
64}
65
66}
67
68#endif /* COMM_INFO_HPP_ */
Note: See TracBrowser for help on using the repository browser.