Actual source code: gcomm.c
1: /*$Id: gcomm.c,v 1.25 2001/03/23 23:20:38 balay Exp $*/
2: /*
3: Provides utility routines for manulating any type of PETSc object.
4: */
5: #include petsc.h
7: /*@C
8: PetscObjectGetComm - Gets the MPI communicator for any PetscObject,
9: regardless of the type.
11: Not Collective
13: Input Parameter:
14: . obj - any PETSc object, for example a Vec, Mat or KSP. Thus must be
15: cast with a (PetscObject), for example,
16: PetscObjectGetComm((PetscObject)mat,&comm);
18: Output Parameter:
19: . comm - the MPI communicator
21: Level: advanced
23: Concepts: communicator^getting from object
24: Concepts: MPI communicator^getting from object
26: @*/
27: int PetscObjectGetComm(PetscObject obj,MPI_Comm *comm)
28: {
32: if (!obj) SETERRQ(PETSC_ERR_ARG_CORRUPT,"Null object");
33: if (obj->bops->getcomm) {
34: obj->bops->getcomm(obj,comm);
35: } else {
36: *comm = obj->comm;
37: }
38: return(0);
39: }