VecScatterCreateToZero

Creates a scatter context that copies all vector values to a vector on the zeroth processor

Synopsis

PetscErrorCode VecScatterCreateToZero(Vec vin,VecScatter *ctx,Vec *vout)
Collective

Input Parameter

vin -input MPIVEC

Output Parameter

ctx - scatter context
vout - output MPIVEC that is large enough to scatter into on processor 0 and of length zero on all other processors

Usage

       VecScatterCreateToZero(vin,&ctx,&vout);

       // scatter as many times as you need 
       VecScatterBegin(vin,vout,INSERT_VALUES,SCATTER_FORWARD,ctx);
       VecScatterEnd(vin,vout,INSERT_VALUES,SCATTER_FORWARD,ctx);

       // destroy scatter context and local vector when no longer needed
       VecScatterDestroy(ctx);
       VecDestroy(vout);

Note: If you want to treat the vector on processor zero as a sequential vector call VecGetArray() on it and create a sequential vector with VecCreateSeqWithArray().

See Also

VecScatterCreate(), VecScatterCreateToAll(), VecScatterBegin(), VecScatterEnd()

Level:intermediate
Location:
src/vec/utils/vecmpitoseq.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages