Partitioning objects are provided to allow both user and programmable control. Load balancers would use the programmable control which represents a separate interface to the partitioning objects. Users would more directly use the more simple interface for the specification of the partitioning of an array object. A++ arrays provide member functions as the means of associated an array with a particular partitioning object. This interface allows for a simplified manipulation of many partitioning objects (and thus even more P++ array objects) within a single application.
For example, an adaptive mesh refinement (AMR) grid could contain many array objects associated with each rectangular grid (there would be many rectangular grids within an AMR application) and a single partitioning object for rectangular grid. Within an adaptive mesh refinement grid many grids and thus many partitioning objects would exist. The control of the adaptive mesh refinement grid and the array objects associated with the definition of the application can thus be abstracted through the control of the partitioning objects associated with the adaptive grid.
Partitioning_Type P; doubleArray A(100,100,P); // A uses the partition object P doubleArray B(100,100); // B has the default partition object B.partition(P); // repartitioning B consistent with P Range Middle_Processors (100,199); // specify a fictitious collection of processors Partitioning_Type Q(Middle_Processors); // build another partitioning object B.partition(Q); // B is repartitioned onto the middle 100 processors
The example above builds a partitioning object, P, which has the default partitioning (across all processors and partitioned along each axis). The array A is built to have a partitioning across the processors specified by P. The array, B, is build with the default partitioning and then repartitioned to be consistent with the partitioning specified by P (since P, in this case, represented the default partitioning the distribution of B is unchanged). The partitioning Q is build over the processor 100 through 199, and B is repartitioned onto that smaller collection of processors.