| 46 |
|
* [4] Vardeman & Gezelter, in progress (2009). |
| 47 |
|
*/ |
| 48 |
|
|
| 49 |
< |
#ifndef FORCEDECOMPOSITION_COMMUNICATOR_HPP |
| 50 |
< |
#define FORCEDECOMPOSITION_COMMUNICATOR_HPP |
| 49 |
> |
#ifndef PARALLEL_COMMUNICATOR_HPP |
| 50 |
> |
#define PARALLEL_COMMUNICATOR_HPP |
| 51 |
|
|
| 52 |
|
#include <config.h> |
| 53 |
|
#include <mpi.h> |
| 116 |
|
displacements[0] = 0; |
| 117 |
|
for (int i = 1; i < nCommProcs; i++) { |
| 118 |
|
displacements[i] = displacements[i-1] + counts[i-1]; |
| 119 |
< |
} |
| 119 |
> |
size_ += counts[i-1]; |
| 120 |
> |
} |
| 121 |
> |
|
| 122 |
> |
size_ = 0; |
| 123 |
> |
for (int i = 0; i < nCommProcs; i++) { |
| 124 |
> |
size_ += counts[i]; |
| 125 |
> |
} |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
|
| 144 |
|
myComm.Reduce_scatter(&v1[0], &v2[0], &counts[0], |
| 145 |
|
MPITraits<T>::datatype, MPI::SUM); |
| 146 |
|
} |
| 147 |
+ |
|
| 148 |
+ |
int getSize() { |
| 149 |
+ |
return size_; |
| 150 |
+ |
} |
| 151 |
|
|
| 152 |
|
private: |
| 153 |
|
int planSize_; ///< how many are on local proc |
| 154 |
|
int rowIndex_; |
| 155 |
|
int columnIndex_; |
| 156 |
+ |
int size_; |
| 157 |
|
std::vector<int> counts; |
| 158 |
|
std::vector<int> displacements; |
| 159 |
|
MPI::Intracomm myComm; |