source: src/comm/mpi/comm_info.hpp@ fab30d

Last change on this file since fab30d was 76e019, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Check that mpi.h will be included as the first header.

Needed by certain mpi implementations.

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

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[dfed1c]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 <map>
18
19#include "base/tuple.hpp"
[2112b1]20#include "comm/mpi/key.hpp"
[dfed1c]21
22namespace VMG
23{
24
25class Index;
26class Grid;
[2112b1]27class GridIteratorSet;
[dfed1c]28
29namespace MPI
30{
31
32class CommInfo
33{
34public:
35 CommInfo();
36 virtual ~CommInfo();
37
38 MPI_Comm GetCommunicator(const Grid& grid);
39 MPI_Comm GetUnionCommunicator(const Grid& grid_1, const Grid& grid_2);
[2112b1]40
41 MPI_Datatype GetDatatypeSubarray(const Grid& grid, const GridIteratorSet& bounds);
42 MPI_Datatype GetDatatypeSubarray(const Index& begin, const Index& end, const Index& size_total);
[dfed1c]43
44 Index Pos(const Grid& grid);
45 Index Procs(const Grid& grid);
46
47 void SetCommGlobal(MPI_Comm& comm_global_)
48 {
49 comm_global = comm_global_;
50 }
51
52private:
[2112b1]53 std::map<Key, MPI_Comm> communicators;
54 std::map<Key, MPI_Datatype> datatypes;
[dfed1c]55
56 MPI_Comm comm_global;
57 int max_level;
58
59 static Index GetGlobalDims(MPI_Comm comm, Index pos);
60};
61
62}
63
64}
65
66#endif /* COMM_INFO_HPP_ */
Note: See TracBrowser for help on using the repository browser.