Combining Lists distributed amongst processors
Hello,
I have set up a piece of code which searches my mesh for all the different distinct heights of cell centers. It is a simple block shaped mesh in which each layer is at a different height, so if there are 20 cells in the vertical direction then the list of heights is 20 elements long. This works fine in serial. What I would like to do is extend this to parallel such that at the end of the search, each processor has a global list of distinct heights. Is there a way to take each list of heights that each processor creates, collect them on the master processor, combine them into one global list, and give the global list back to each processor? Thank you, Matt |
Yes, I've done something really similar with lagrangian flamelets. The code is a mess but I can tidy it up and post it up if you like. Otherwise the outline of the approach I took is below:
Create a vector of stuff on each processor: Code:
for(int i=0;i<mesh_.nCells();++i) Code:
// Create lists of the variables on each processor so that they can be Code:
for(unsigned int i=0;i<stuff.size();++i) |
Laurence,
Thanks for the reply. It worked well! Matt Churchfield |
Quote:
I am having a similar problem as Matthew had - I have written a function object that works perfectly in series and now I want to expand it to also work in parallel, but I have a hard time understanding how I should do it. I've based my function on the "forces" function object and there they use: Code:
Pstream::listCombineGather(force_, plusEqOp<vectorField>()); I would really appreciate your help on this. Thanks, David |
All times are GMT -4. The time now is 23:14. |