source: src/comm/mpi/settings.hpp@ e85cfd

Last change on this file since e85cfd was a72216, checked in by Olaf Lenz <olenz@…>, 13 years ago

Fixed permissions.

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

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 * vmg - a versatile multigrid solver
3 * Copyright (C) 2012 Institute for Numerical Simulation, University of Bonn
4 *
5 * vmg is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * vmg is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef SETTINGS_HPP_
20#define SETTINGS_HPP_
21
22#ifndef HAVE_MPI
23#error You need MPI in order to compile VMG::MPI::Settings
24#endif
25
26#include <map>
27#include <set>
28
29#include "comm/mpi/datatypes_global.hpp"
30#include "comm/mpi/datatypes_local.hpp"
31#include "comm/mpi/key.hpp"
32
33namespace VMG
34{
35
36class TempGrid;
37
38namespace MPI
39{
40
41class DatatypesGlobal;
42
43class Settings
44{
45public:
46 Settings();
47 ~Settings();
48
49 void ComputeSettings(Multigrid& sol, Multigrid& rhs, MPI_Comm& comm);
50
51 Grid& FinerGrid(const Grid& grid);
52 Grid& CoarserGrid(const Grid& grid);
53
54 MPI_Comm CommunicatorGlobal(const Grid& grid) const;
55 MPI_Comm CommunicatorLocal(const Grid& grid) const;
56
57 MPI_Datatype& Datatype(const Index& begin, const Index& end,
58 const Index& size_local, const Index& size_global,
59 const int& level);
60 VMG::MPI::DatatypesGlobal& DatatypesGlobal(const Grid& grid_old, const Grid& grid_new, const int& direction);
61 VMG::MPI::DatatypesLocal& DatatypesLocal(const Grid& grid);
62
63private:
64 Index GlobalDims(MPI_Comm comm, Index pos);
65 void AddDatatypeGlobal(const Grid& grid_old, const Grid& grid_new, const int& direction);
66
67 void CreateGlobalCommunicator(MPI_Comm& comm_global, const Grid* grid_1, const Grid* grid_2=NULL, const Grid* grid_3=NULL);
68 void CreateLocalCommunicator(MPI_Comm& comm_global, const Grid& grid);
69
70 std::map<int, MPI_Comm> communicators_global;
71 std::map<KeyUnsorted, MPI_Comm> communicators_local;
72 std::set<MPI_Comm> communicators_local_unique;
73 std::map<const Grid*, Grid*> finer_grids, coarser_grids;
74 std::map<KeyUnsorted, MPI_Datatype> datatypes;
75 std::map<KeyUnsorted, VMG::MPI::DatatypesGlobal> datatypes_global;
76 std::map<KeyUnsorted, VMG::MPI::DatatypesLocal> datatypes_local;
77};
78
79}
80
81}
82
83#endif /* SETTINGS_HPP_ */
Note: See TracBrowser for help on using the repository browser.