VecScatterCreateToZero#

Creates an output vector and a scatter context used to copy all vector values into the output vector on the zeroth processor

Synopsis#

#include "petscsf.h" 
PetscErrorCode VecScatterCreateToZero(Vec vin, VecScatter *ctx, Vec *vout)

Collective

Input Parameter#

  • vin - Vec of type MPIVEC

Output Parameters#

  • ctx - scatter context

  • vout - output SEQVEC 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(ctx,vin,vout,INSERT_VALUES,SCATTER_FORWARD);
        VecScatterEnd(ctx,vin,vout,INSERT_VALUES,SCATTER_FORWARD);

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

Notes#

vout may be NULL [PETSC_NULL_VEC from fortran] if you do not need to have it created

Do NOT create a vector and then pass it in as the final argument vout! vout is created by this routine automatically (unless you pass NULL in for that argument if you do not need it).

See Also#

Low-level Vector Communication, VecScatter, VecScatterCreate(), VecScatterCreateToAll(), VecScatterBegin(), VecScatterEnd()

Level#

intermediate

Location#

src/vec/is/sf/interface/vscat.c

Examples#

src/tao/constrained/tutorials/ex1.c


Edit on GitLab

Index of all PetscSF routines
Table of Contents for all manual pages
Index of all manual pages