Next: The pC++ Runtime Up: A Brief Introduction Previous: Collections and Templates

Communication Between Elements in a Collection

One of the key ideas behind collection classes is to enable the programmer to build a distributed data structure where data movement operators can be closely linked to the semantics of the data type. For example, elements of a DistributedGrid need to access their neighbors. A Tree node will often reference its children or parent. Each application has a topology of communication and global operators that must be supported efficiently by the collection structure.

If c is a collection of type C<E>, then any processor thread may access the element of c by the Kernel functions


c->Get_Element(i);
c->Get_ElementPart(i, offset, size);
The first function accesses the element and places a copy in a local system buffer and returns a pointer of type (ElementType *). The second function accesses part of an element at a given offset and size and make a copy in the buffer. In other collections, such as distributed arrays, matrices and grids, the operator (...) has been overloaded. For example, if c is a two dimension collection, then expressions like

x = c(i,j) + c(i+1,j)
work by calling the Get_Element function if a reference is not to a local element.


mohr@cs.uoregon.edu
Thu Feb 24 15:47:41 PST 1994