Gather the values from each process in the non-root group into an array of values at the root process. On the root process, the pth element of the result will be equal to the value parameter of the process with rank p in the other group when this routine returns. Use this variant of the routine when you want to pre-allocate storage for the outValues array.

Namespace:  MPI
Assembly:  MPI (in MPI.dll)
Version: (


public void Gather<T>(
	T inValue,
	int root,
	ref T[] outValues
Visual Basic (Declaration)
Public Sub Gather(Of T) ( _
	inValue As T, _
	root As Integer, _
	ByRef outValues As T() _
Visual C++
generic<typename T>
void Gather(
	T inValue, 
	int root, 
	array<T>^% outValues


Type: T
The value contributed by this process. Only significant at processes in the leaf (non-root) group.
Type: System..::.Int32
Used to indicate the process gathering the data. At the root, should be Root. At leaf group processes should be the rank of the root process in the root group. At non-root processes in the root group, should be Null.
Type: array< T >[]()[] %
An array that will store the values contributed by each process. This value is only significant at the root, and can be omitted by non-root processes. Supply this argument when you have pre-allocated space for the resulting array.

Type Parameters

Any serializable type.

See Also