PolyDiM
C++ library for POLYtopal DIscretization Methods
Loading...
Searching...
No Matches
MpiProcess.hpp
Go to the documentation of this file.
1// _LICENSE_HEADER_
2//
3// Copyright (C) 2019 - 2025.
4// Terms register on the GPL-3.0 license.
5//
6// This file can be redistributed and/or modified under the license terms.
7//
8// See top level LICENSE file for more details.
9//
10// This file can be used citing references in CITATION.cff file.
11
12#ifndef __GEDIM_MPIPROCESS_H
13#define __GEDIM_MPIPROCESS_H
14
15#include <string>
16#include <vector>
17
18#include "IMpiProcess.hpp"
19
20namespace Gedim
21{
22class MpiProcess : public IMpiProcess
23{
24 protected:
25 unsigned int _rank;
26 unsigned int _numberProcesses;
27 bool _isActive;
28
29 public:
30 MpiProcess(unsigned int rank, unsigned int numberProcesses, bool isActive);
31 virtual ~MpiProcess();
32
33 unsigned int Rank() const
34 {
35 return _rank;
36 }
37 unsigned int NumberProcesses() const
38 {
39 return _numberProcesses;
40 }
41 bool IsActive() const
42 {
43 return _isActive;
44 }
45
46 virtual void Summary();
47};
48
50{
51 private:
52 static int mpiSendTag;
53 static int mpiRecvTag;
54 public:
55 static int MpiSendTag(const int &numSends = 1)
56 {
57 int tag = mpiSendTag;
58 mpiSendTag += numSends;
59 return tag;
60 }
61 static int MpiRecvTag(const int &numRecvs = 1)
62 {
63 int tag = mpiRecvTag;
64 mpiRecvTag += numRecvs;
65 return tag;
66 }
67};
68} // namespace Gedim
69
70#endif // __GEDIM_MPIPROCESS_H
Eigen column vector.
Definition Eigen_Array.hpp:23
Interface used to implement the MPI process.
Definition IMpiProcess.hpp:20
Definition MpiProcess.hpp:50
static int MpiRecvTag(const int &numRecvs=1)
Definition MpiProcess.hpp:61
static int MpiSendTag(const int &numSends=1)
Definition MpiProcess.hpp:55
Definition MpiProcess.hpp:23
bool _isActive
Tells if the process is active.
Definition MpiProcess.hpp:27
virtual void Summary()
Summary of the process.
Definition MpiProcess.cpp:29
bool IsActive() const
Definition MpiProcess.hpp:41
unsigned int NumberProcesses() const
Definition MpiProcess.hpp:37
unsigned int Rank() const
Definition MpiProcess.hpp:33
virtual ~MpiProcess()
Definition MpiProcess.cpp:25
unsigned int _numberProcesses
Number of all the processes of the MPI simulation.
Definition MpiProcess.hpp:26
unsigned int _rank
Rank of the process.
Definition MpiProcess.hpp:25
Definition Eigen_Array.cpp:22