| [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 | {
|
|---|
| [ac6d04] | 22 |
|
|---|
| 23 | class DatatypesGlobal;
|
|---|
| 24 |
|
|---|
| [894a5f] | 25 | class Settings
|
|---|
| 26 | {
|
|---|
| 27 | public:
|
|---|
| 28 | Settings();
|
|---|
| 29 | ~Settings();
|
|---|
| 30 |
|
|---|
| 31 | void ComputeSettings(Multigrid& sol, Multigrid& rhs, MPI_Comm& comm);
|
|---|
| 32 |
|
|---|
| 33 | Grid& FinerGrid(const Grid& grid);
|
|---|
| 34 | Grid& CoarserGrid(const Grid& grid);
|
|---|
| 35 |
|
|---|
| [ac6d04] | 36 | MPI_Comm CommunicatorGlobal(const Grid& grid) const;
|
|---|
| 37 | MPI_Comm CommunicatorLocal(const Grid& grid) const;
|
|---|
| [894a5f] | 38 |
|
|---|
| [ac6d04] | 39 | MPI_Datatype& Datatype(const Index& begin, const Index& end,
|
|---|
| 40 | const Index& size_local, const Index& size_global,
|
|---|
| 41 | const int& level);
|
|---|
| 42 | VMG::MPI::DatatypesGlobal& DatatypesGlobal(const Grid& grid_old, const Grid& grid_new, const int& direction);
|
|---|
| [894a5f] | 43 | VMG::MPI::DatatypesLocal& DatatypesLocal(const Grid& grid);
|
|---|
| 44 |
|
|---|
| 45 | private:
|
|---|
| 46 | Index GlobalDims(MPI_Comm comm, Index pos);
|
|---|
| [ac6d04] | 47 | void AddDatatypeGlobal(const Grid& grid_old, const Grid& grid_new, const int& direction);
|
|---|
| [894a5f] | 48 |
|
|---|
| 49 | void CreateGlobalCommunicator(MPI_Comm& comm_global, const Grid* grid_1, const Grid* grid_2=NULL, const Grid* grid_3=NULL);
|
|---|
| 50 | void CreateLocalCommunicator(MPI_Comm& comm_global, const Grid& grid);
|
|---|
| 51 |
|
|---|
| 52 | std::map<int, MPI_Comm> communicators_global;
|
|---|
| 53 | std::map<KeyUnsorted, MPI_Comm> communicators_local;
|
|---|
| 54 | std::set<MPI_Comm> communicators_local_unique;
|
|---|
| 55 | std::map<const Grid*, Grid*> finer_grids, coarser_grids;
|
|---|
| 56 | std::map<KeyUnsorted, MPI_Datatype> datatypes;
|
|---|
| 57 | std::map<KeyUnsorted, VMG::MPI::DatatypesGlobal> datatypes_global;
|
|---|
| 58 | std::map<KeyUnsorted, VMG::MPI::DatatypesLocal> datatypes_local;
|
|---|
| 59 | };
|
|---|
| 60 |
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | #endif /* SETTINGS_HPP_ */
|
|---|