|
[Sponsors] |
October 16, 2014, 18:41 |
How to use gatherlist and scatterlist?
|
#1 |
New Member
Xiangyu Gao
Join Date: Sep 2013
Location: West Lafayette, IN, USA
Posts: 29
Rep Power: 12 |
Hi, everyone!
I am writing a parallel code. In my code, I have to search for cell label that satisfies certain criteria through the domain, combine the lists obtained by each processor and then distribute the combined list back to each processor. I know the combination should be done by gatherlist() and the distribution should be done by scatterlist(), but there must be something wrong with my code or my understanding about gatherlist and scatterlist(). My code is like this. List<label> mylist(100,0); List<List<label> > t1_first(30,mylist); List<List<List<label> > > gatherfirst(Pstream::nProcs(), t1_first); for(label m=0;m<iMesh.C().size();m++) { //get the label value for each element in t1_first //I have checked, the label values for t1_first is right } gatherfirst[Pstream::myProcNo()] = t1_first;//Do I need a loop over all the processors here? Pstream::gatherList(gatherfirst); Pstream::scatterList(gatherfirst); Every label in gatherfirst is zero, which is wrong. Can anyone help me with this problem? Billions of thanks, Xiangyu |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
discussions about the gatherList, scatterList, and combine | openfoammaofnepo | OpenFOAM Programming & Development | 0 | February 5, 2014 11:15 |