| [894a5f] | 1 | #ifndef SETTINGS_HPP_
|
|---|
| 2 | #define SETTINGS_HPP_
|
|---|
| 3 |
|
|---|
| 4 | #ifndef HAVE_MPI
|
|---|
| 5 | #error You need MPI in order to compile VMG::MPI::Settings
|
|---|
| 6 | #endif
|
|---|
| 7 |
|
|---|
| 8 | #include <map>
|
|---|
| 9 | #include <set>
|
|---|
| 10 |
|
|---|
| 11 | #include "comm/mpi/datatypes_global.hpp"
|
|---|
| 12 | #include "comm/mpi/datatypes_local.hpp"
|
|---|
| 13 | #include "comm/mpi/key.hpp"
|
|---|
| 14 |
|
|---|
| 15 | namespace VMG
|
|---|
| 16 | {
|
|---|
| 17 |
|
|---|
| 18 | class TempGrid;
|
|---|
| 19 |
|
|---|
| 20 | namespace MPI
|
|---|
| 21 | {
|
|---|
| 22 | class Settings
|
|---|
| 23 | {
|
|---|
| 24 | public:
|
|---|
| 25 | Settings();
|
|---|
| 26 | ~Settings();
|
|---|
| 27 |
|
|---|
| 28 | void ComputeSettings(Multigrid& sol, Multigrid& rhs, MPI_Comm& comm);
|
|---|
| 29 |
|
|---|
| 30 | Grid& FinerGrid(const Grid& grid);
|
|---|
| 31 | Grid& CoarserGrid(const Grid& grid);
|
|---|
| 32 | Grid& GlobalCoarseGrid();
|
|---|
| 33 |
|
|---|
| 34 | MPI_Comm CommunicatorGlobal(const Grid& grid);
|
|---|
| 35 | MPI_Comm CommunicatorLocal(const Grid& grid);
|
|---|
| 36 |
|
|---|
| 37 | MPI_Datatype& Datatype(const Index& begin, const Index& end, const Index& size_local, const Index& size_global);
|
|---|
| 38 | VMG::MPI::DatatypesGlobal& DatatypesGlobal(const Grid& grid_old, const Grid& grid_new);
|
|---|
| 39 | VMG::MPI::DatatypesLocal& DatatypesLocal(const Grid& grid);
|
|---|
| 40 |
|
|---|
| 41 | private:
|
|---|
| 42 | Index GlobalDims(MPI_Comm comm, Index pos);
|
|---|
| 43 | void AddDatatypeGlobal(const Grid& grid_old, const Grid& grid_new);
|
|---|
| 44 |
|
|---|
| 45 | void CreateGlobalCommunicator(MPI_Comm& comm_global, const Grid* grid_1, const Grid* grid_2=NULL, const Grid* grid_3=NULL);
|
|---|
| 46 | void CreateLocalCommunicator(MPI_Comm& comm_global, const Grid& grid);
|
|---|
| 47 |
|
|---|
| 48 | std::map<int, MPI_Comm> communicators_global;
|
|---|
| 49 | std::map<KeyUnsorted, MPI_Comm> communicators_local;
|
|---|
| 50 | std::set<MPI_Comm> communicators_local_unique;
|
|---|
| 51 | std::map<const Grid*, Grid*> finer_grids, coarser_grids;
|
|---|
| 52 | std::map<KeyUnsorted, MPI_Datatype> datatypes;
|
|---|
| 53 | std::map<KeyUnsorted, VMG::MPI::DatatypesGlobal> datatypes_global;
|
|---|
| 54 | std::map<KeyUnsorted, VMG::MPI::DatatypesLocal> datatypes_local;
|
|---|
| 55 | TempGrid* global_coarse_grid;
|
|---|
| 56 | };
|
|---|
| 57 |
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | #endif /* SETTINGS_HPP_ */
|
|---|