class FlockMember: public Sheep, public GroupMember<FlockMember,BalancedBinTree> { public: FlockMember(int rank) : Sheep (...) { } };The declaration above describes the group topology to be a balanced binary tree. Figure [*] shows the execution of reduce() operation on a binary tree. The numbers at the edges indicate logical time steps.
Each functor is first propagated asynchronously to the other members of the group in the order defined by the iterator before it is applied to the object instance currently visited. In case of reductions we use the asynchronous apply() method in conjunction with lazy synchronization to synchronize on the availability of results. All results are collected in exactly the same order in which the functor has been spread. Thus, the behaviour remains deterministic and application programmers can get control over collective operations either through the iterator method of the topology class or by means of custom iterators defined by application classes.