CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

How to use gatherlist and scatterlist?

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   October 16, 2014, 18:41
Question 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
gxy200992243 is on a distinguished road
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
gxy200992243 is offline   Reply With Quote

 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 23:09.