Revert "Update package dependency from libwxgtk3.0-dev to libwxgtk3.0-gtk3-dev for...
[ctsim.git] / include / mpiworld.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          mpiworld.h
5 **   Purpose:       MPIWorld classes
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  June 6, 2000
8 **
9 **  This is part of the CTSim program
10 **  Copyright (c) 1983-2009 Kevin Rosenberg
11 **
12 **  This program is free software; you can redistribute it and/or modify
13 **  it under the terms of the GNU General Public License (version 2) as
14 **  published by the Free Software Foundation.
15 **
16 **  This program is distributed in the hope that it will be useful,
17 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 **  GNU General Public License for more details.
20 **
21 **  You should have received a copy of the GNU General Public License
22 **  along with this program; if not, write to the Free Software
23 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 ******************************************************************************/
25
26 #include <mpi++.h>
27 #include <vector.h>
28 #include <string>
29
30 class MPIWorld
31 {
32  public:
33     MPIWorld (int& argc, char* const *& argv);
34
35     void setTotalWorkUnits (int totalUnits);
36
37     int getRank (void) const
38         { return m_myRank; }
39
40     int getNumProcessors (void) const
41         { return m_nProcessors; }
42
43     int getStartWorkUnit (int rank) const
44         { return m_vStartWorkUnit [rank]; }
45
46     int getEndWorkUnit (int rank) const
47       { return m_vEndWorkUnit [rank]; }
48
49     int getLocalWorkUnits (int rank) const
50         { return m_vLocalWorkUnits [rank]; }
51
52     int getMyStartWorkUnit (void) const
53         { return m_vStartWorkUnit [m_myRank]; }
54
55     int getMyEndWorkUnit (void) const
56         { return m_vEndWorkUnit [m_myRank]; }
57
58     int getMyLocalWorkUnits (void) const
59         { return m_vLocalWorkUnits [m_myRank]; }
60
61     MPI::Intracomm& getComm()
62       { return m_comm; }
63
64     void BcastString (string& str);
65
66 private:
67     int m_myRank;
68     int m_nProcessors;
69     vector<int> m_vLocalWorkUnits;
70     vector<int> m_vStartWorkUnit;
71     vector<int> m_vEndWorkUnit;
72     MPI::Intracomm m_comm;
73 };
74