FlexELA
Loading...
Searching...
No Matches
mpidomain.h
1#ifndef MPI_DOMAIN_H
2#define MPI_DOMAIN_H
3
4#include <mpi.h>
5
6#include "domain.h"
7
8namespace domain {
9
14class MPIDomain : public Domain {
15 public:
27 MPIDomain(const int& ni, const int& nj, const int& nk, const int& nn, MPI_Comm comm_cart);
28
37 constexpr bool hasNeighbor(Face f) const;
38
43 constexpr bool isBoss() const;
44
55 void updateGhost(const Face& recv);
56
58 template <class T>
59 T getMax(const T& in) const;
60
62 MPI_Comm getMPIComm() const
63 {
64 return comm_cart;
65 }
66
67 private:
68 MPI_Comm comm_cart;
69 int neighbors[6];
70 bool boss;
71};
72
73constexpr bool MPIDomain::hasNeighbor(Face d) const
74{
75 return neighbors[d] != MPI_PROC_NULL;
76}
77
78constexpr bool MPIDomain::isBoss() const
79{
80 return boss;
81}
82
83} // namespace domain
84
85#endif
An extension of Domain for parallelization with MPI.
Definition mpidomain.h:14
MPIDomain(const int &ni, const int &nj, const int &nk, const int &nn, MPI_Comm comm_cart)
Construct a new MPIDomain object.
void updateGhost(const Face &recv)
Update the ghost cell adjacent to Face recv.
constexpr bool isBoss() const
Check if this process is the boss (rank is 0)
Definition mpidomain.h:78
constexpr bool hasNeighbor(Face f) const
Determine if there is a neighboring domain on the Face f.
Definition mpidomain.h:73
T getMax(const T &in) const
Get the maximum value across all domains.
MPI_Comm getMPIComm() const
Get the MPI communicator.
Definition mpidomain.h:62
Container for ELA Data including its physical structure.
Definition compression.h:6
Face
Corresponds to each of the six faces of the domain.
Definition domain.h:17
A wrapper for global ELA data.
Definition domain.h:43
const int & nj
Number of (non-ghost) cells in second direction.
Definition domain.h:63
const int & ni
Number of (non-ghost) cells in first direction.
Definition domain.h:60
const int & nk
Number of (non-ghost) cells in third direction.
Definition domain.h:66
const int nn
Number of ELA instances.
Definition domain.h:69