ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/parallel/Communicator.hpp
(Generate patch)

Comparing branches/development/src/parallel/Communicator.hpp (file contents):
Revision 1551 by gezelter, Thu Apr 28 18:38:21 2011 UTC vs.
Revision 1589 by gezelter, Sun Jul 10 16:05:34 2011 UTC

# Line 136 | Line 136 | namespace OpenMD{
136          
137        int nCommProcs = myComm.Get_size();
138  
139 <      counts.reserve(nCommProcs);
140 <      displacements.reserve(nCommProcs);
139 >      counts.resize(nCommProcs, 0);
140 >      displacements.resize(nCommProcs, 0);
141  
142        planSize_ = MPITraits<T>::Length() * nObjects;
143  
# Line 146 | Line 146 | namespace OpenMD{
146        displacements[0] = 0;
147        for (int i = 1; i < nCommProcs; i++) {
148          displacements[i] = displacements[i-1] + counts[i-1];
149        size_ += counts[i-1];
149        }
150  
151        size_ = 0;
# Line 157 | Line 156 | namespace OpenMD{
156  
157      
158      void gather(vector<T>& v1, vector<T>& v2) {
159 +
160 +      // an assert would be helpful here to make sure the vectors are the
161 +      // correct geometry
162        
163        myComm.Allgatherv(&v1[0],
164                          planSize_,
# Line 170 | Line 172 | namespace OpenMD{
172      
173      
174      void scatter(vector<T>& v1, vector<T>& v2) {
175 +      // an assert would be helpful here to make sure the vectors are the
176 +      // correct geometry
177        
178        myComm.Reduce_scatter(&v1[0], &v2[0], &counts[0],
179                              MPITraits<T>::Type(), MPI::SUM);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines