1: #define PETSC_DLL 2: /* 3: Provides utility routines for manulating any type of PETSc object. 4: */ 5: #include petsc.h 9: /*@C 10: PetscObjectGetComm - Gets the MPI communicator for any PetscObject, 11: regardless of the type. 13: Not Collective 15: Input Parameter: 16: . obj - any PETSc object, for example a Vec, Mat or KSP. Thus must be 17: cast with a (PetscObject), for example, 18: PetscObjectGetComm((PetscObject)mat,&comm); 20: Output Parameter: 21: . comm - the MPI communicator 23: Level: advanced 25: Concepts: communicator^getting from object 26: Concepts: MPI communicator^getting from object 28: @*/ 29: PetscErrorCode PetscObjectGetComm(PetscObject obj,MPI_Comm *comm) 30: { 34: if (!obj) SETERRQ(PETSC_ERR_ARG_CORRUPT,"Null object"); 35: if (obj->bops->getcomm) { 36: obj->bops->getcomm(obj,comm); 37: } else { 38: *comm = obj->comm; 39: } 40: return(0); 41: }