| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * @file comm_mpi_aux.hpp
|
|---|
| 3 | * @author Julian <julian@ubuntu-laptop>
|
|---|
| 4 | * @date Wed May 11 17:29:46 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief Auxiliary classes for VMG::CommMPI and VMG::CommMPIInfo.
|
|---|
| 7 | *
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | #ifndef COMM_MPI_AUX_HPP_
|
|---|
| 11 | #define COMM_MPI_AUX_HPP_
|
|---|
| 12 |
|
|---|
| 13 | #ifndef HAVE_MPI
|
|---|
| 14 | #error MPI needed to compile VMG::CommMPI
|
|---|
| 15 | #endif
|
|---|
| 16 |
|
|---|
| 17 | #include <mpi.h>
|
|---|
| 18 |
|
|---|
| 19 | #include "base/index.hpp"
|
|---|
| 20 |
|
|---|
| 21 | namespace VMG
|
|---|
| 22 | {
|
|---|
| 23 |
|
|---|
| 24 | class Grid;
|
|---|
| 25 |
|
|---|
| 26 | class DatatypeKey
|
|---|
| 27 | {
|
|---|
| 28 | public:
|
|---|
| 29 | DatatypeKey(const Index& start_, const Index& end_, const Index& gridsize_) :
|
|---|
| 30 | start(start_),
|
|---|
| 31 | subsize(end_ - start_),
|
|---|
| 32 | gridsize(gridsize_)
|
|---|
| 33 | {}
|
|---|
| 34 |
|
|---|
| 35 | bool operator==(const DatatypeKey& rhs) const
|
|---|
| 36 | {
|
|---|
| 37 | bool equal = true;
|
|---|
| 38 |
|
|---|
| 39 | for (int i=0; i<3; ++i) {
|
|---|
| 40 | equal &= this->start[i] == rhs.start[i];
|
|---|
| 41 | equal &= this->subsize[i] == rhs.subsize[i];
|
|---|
| 42 | equal &= this->gridsize[i] == rhs.gridsize[i];
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | return equal;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | bool operator<(const DatatypeKey& rhs) const
|
|---|
| 49 | {
|
|---|
| 50 | for (int i=0; i<3; ++i) {
|
|---|
| 51 |
|
|---|
| 52 | if (this->start[i] < rhs.start[i])
|
|---|
| 53 | return true;
|
|---|
| 54 | else if (this->start[i] > rhs.start[i])
|
|---|
| 55 | return false;
|
|---|
| 56 |
|
|---|
| 57 | if (this->subsize[i] < rhs.subsize[i])
|
|---|
| 58 | return true;
|
|---|
| 59 | else if (this->subsize[i] > rhs.subsize[i])
|
|---|
| 60 | return false;
|
|---|
| 61 |
|
|---|
| 62 | if (this->gridsize[i] < rhs.gridsize[i])
|
|---|
| 63 | return true;
|
|---|
| 64 | else if (this->gridsize[i] > rhs.gridsize[i])
|
|---|
| 65 | return false;
|
|---|
| 66 |
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | return false;
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 | Index& Start() {return start;}
|
|---|
| 73 | Index& SubSize() {return subsize;}
|
|---|
| 74 | Index& GridSize() {return gridsize;}
|
|---|
| 75 |
|
|---|
| 76 | private:
|
|---|
| 77 | Index start;
|
|---|
| 78 | Index subsize;
|
|---|
| 79 | Index gridsize;
|
|---|
| 80 | };
|
|---|
| 81 |
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | #endif /* COMM_MPI_AUX_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.