/** * @file comm_info.hpp * @author Julian Iseringhausen * @date Mon Nov 21 13:27:22 2011 * * @brief Stores some MPI-relevant information. * */ #ifndef COMM_INFO_HPP_ #define COMM_INFO_HPP_ #ifndef HAVE_MPI #error MPI is needed to compile this class #endif #include #include "base/tuple.hpp" #include "comm/mpi/key.hpp" namespace VMG { class Index; class Grid; class GridIteratorSet; namespace MPI { class CommInfo { public: CommInfo(); virtual ~CommInfo(); MPI_Comm GetCommunicator(const Grid& grid); MPI_Comm GetUnionCommunicator(const Grid& grid_1, const Grid& grid_2); MPI_Datatype GetDatatypeSubarray(const Grid& grid, const GridIteratorSet& bounds); MPI_Datatype GetDatatypeSubarray(const Index& begin, const Index& end, const Index& size_total); Index Pos(const Grid& grid); Index Procs(const Grid& grid); void SetCommGlobal(MPI_Comm& comm_global_) { comm_global = comm_global_; } private: std::map communicators; std::map datatypes; MPI_Comm comm_global; int max_level; static Index GetGlobalDims(MPI_Comm comm, Index pos); }; } } #endif /* COMM_INFO_HPP_ */