Actual source code: pcomm.c

 2:  #include petsc.h

  6: /*@C 
  7:    PetscSetCommWorld - Sets a communicator to be PETSc world communicator
  8:    (default is MPI_COMM_WORLD).  Must call BEFORE PetscInitialize().

 10:    Collective on MPI_Comm

 12:    Input Parameter:
 13: .  comm - the communicator

 15:    Note:
 16:    This routine is intended for users who need to initialize PETSc on a
 17:    subset of processors within a larger job.  Thus, most users need not
 18:    call this routine.

 20:    Level: advanced

 22:    Concepts: communicator^setting for PETSc
 23:    Concepts: MPI communicator^setting for PETSc
 24:    Concepts: PETSC_COMM_WORLD^setting

 26: @*/
 27: PetscErrorCode PetscSetCommWorld(MPI_Comm comm)
 28: {
 30:   if (PetscInitializeCalled) SETERRQ(PETSC_ERR_ARG_WRONGSTATE,"Must call before PetscInitialize()");
 31:   PETSC_COMM_WORLD = comm;
 32:   return(0);
 33: }